Fix TextInfo reallocation
[libass.git] / libass / ass_types.h
blob63bc36c4026ab53b4198b0ce0456f45a435d04b1
1 /*
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
4 * This file is part of libass.
6 * libass is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * libass is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with libass; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef LIBASS_TYPES_H
22 #define LIBASS_TYPES_H
24 #include <stdint.h>
26 #define VALIGN_SUB 0
27 #define VALIGN_CENTER 8
28 #define VALIGN_TOP 4
29 #define HALIGN_LEFT 1
30 #define HALIGN_CENTER 2
31 #define HALIGN_RIGHT 3
33 /* Opaque objects internally used by libass. Contents are private. */
34 typedef struct ass_renderer ASS_Renderer;
35 typedef struct render_priv ASS_RenderPriv;
36 typedef struct parser_priv ASS_ParserPriv;
37 typedef struct ass_library ASS_Library;
39 /* ASS Style: line */
40 typedef struct ass_style {
41 char *Name;
42 char *FontName;
43 double FontSize;
44 uint32_t PrimaryColour;
45 uint32_t SecondaryColour;
46 uint32_t OutlineColour;
47 uint32_t BackColour;
48 int Bold;
49 int Italic;
50 int Underline;
51 int StrikeOut;
52 double ScaleX;
53 double ScaleY;
54 double Spacing;
55 int Angle;
56 int BorderStyle;
57 double Outline;
58 double Shadow;
59 int Alignment;
60 int MarginL;
61 int MarginR;
62 int MarginV;
63 int Encoding;
64 int treat_fontname_as_pattern;
65 } ASS_Style;
68 * ASS_Event corresponds to a single Dialogue line;
69 * text is stored as-is, style overrides will be parsed later.
71 typedef struct ass_event {
72 long long Start; // ms
73 long long Duration; // ms
75 int ReadOrder;
76 int Layer;
77 int Style;
78 char *Name;
79 int MarginL;
80 int MarginR;
81 int MarginV;
82 char *Effect;
83 char *Text;
85 ASS_RenderPriv *render_priv;
86 } ASS_Event;
89 * ass track represent either an external script or a matroska subtitle stream
90 * (no real difference between them); it can be used in rendering after the
91 * headers are parsed (i.e. events format line read).
93 typedef struct ass_track {
94 int n_styles; // amount used
95 int max_styles; // amount allocated
96 int n_events;
97 int max_events;
98 ASS_Style *styles; // array of styles, max_styles length, n_styles used
99 ASS_Event *events; // the same as styles
101 char *style_format; // style format line (everything after "Format: ")
102 char *event_format; // event format line
104 enum {
105 TRACK_TYPE_UNKNOWN = 0,
106 TRACK_TYPE_ASS,
107 TRACK_TYPE_SSA
108 } track_type;
110 // Script header fields
111 int PlayResX;
112 int PlayResY;
113 double Timer;
114 int WrapStyle;
115 int ScaledBorderAndShadow;
116 int Kerning;
118 int default_style; // index of default style
119 char *name; // file name in case of external subs, 0 for streams
121 ASS_Library *library;
122 ASS_ParserPriv *parser_priv;
123 } ASS_Track;
125 #endif /* LIBASS_TYPES_H */