annotate libass/ass_types.h @ 36560:67e2b2a5ce42

tcp: fix socket/descriptor leak on error.
author reimar
date Sun, 19 Jan 2014 22:24:53 +0000
parents c3aaaf17c721
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
1 /*
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
3 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
4 * This file is part of libass.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
5 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
6 * Permission to use, copy, modify, and distribute this software for any
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
7 * purpose with or without fee is hereby granted, provided that the above
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
8 * copyright notice and this permission notice appear in all copies.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
9 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
17 */
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
18
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
19 #ifndef LIBASS_TYPES_H
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
20 #define LIBASS_TYPES_H
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
21
26138
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
22 #include <stdint.h>
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
23
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
24 #define VALIGN_SUB 0
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
25 #define VALIGN_CENTER 8
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
26 #define VALIGN_TOP 4
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
27 #define HALIGN_LEFT 1
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
28 #define HALIGN_CENTER 2
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
29 #define HALIGN_RIGHT 3
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
30
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
31 /* Opaque objects internally used by libass. Contents are private. */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
32 typedef struct ass_renderer ASS_Renderer;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
33 typedef struct render_priv ASS_RenderPriv;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
34 typedef struct parser_priv ASS_ParserPriv;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
35 typedef struct ass_library ASS_Library;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
36
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
37 /* ASS Style: line */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
38 typedef struct ass_style {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
39 char *Name;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
40 char *FontName;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
41 double FontSize;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
42 uint32_t PrimaryColour;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
43 uint32_t SecondaryColour;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
44 uint32_t OutlineColour;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
45 uint32_t BackColour;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
46 int Bold;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
47 int Italic;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
48 int Underline;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
49 int StrikeOut;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
50 double ScaleX;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
51 double ScaleY;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
52 double Spacing;
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
53 double Angle;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
54 int BorderStyle;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
55 double Outline;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
56 double Shadow;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
57 int Alignment;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
58 int MarginL;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
59 int MarginR;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
60 int MarginV;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
61 int Encoding;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
62 int treat_fontname_as_pattern;
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
63 double Blur;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
64 } ASS_Style;
19638
a3473d990fed Better collision detection algorithm. The idea is to keep a subtitle in place
eugeni
parents: 19492
diff changeset
65
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
66 /*
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
67 * ASS_Event corresponds to a single Dialogue line;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
68 * text is stored as-is, style overrides will be parsed later.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
69 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
70 typedef struct ass_event {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
71 long long Start; // ms
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
72 long long Duration; // ms
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
73
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
74 int ReadOrder;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
75 int Layer;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
76 int Style;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
77 char *Name;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
78 int MarginL;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
79 int MarginR;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
80 int MarginV;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
81 char *Effect;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
82 char *Text;
19638
a3473d990fed Better collision detection algorithm. The idea is to keep a subtitle in place
eugeni
parents: 19492
diff changeset
83
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
84 ASS_RenderPriv *render_priv;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
85 } ASS_Event;
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20008
diff changeset
86
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
87 /*
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
88 * ass track represent either an external script or a matroska subtitle stream
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
89 * (no real difference between them); it can be used in rendering after the
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
90 * headers are parsed (i.e. events format line read).
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
91 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
92 typedef struct ass_track {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
93 int n_styles; // amount used
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
94 int max_styles; // amount allocated
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
95 int n_events;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
96 int max_events;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
97 ASS_Style *styles; // array of styles, max_styles length, n_styles used
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
98 ASS_Event *events; // the same as styles
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
99
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
100 char *style_format; // style format line (everything after "Format: ")
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
101 char *event_format; // event format line
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28860
diff changeset
102
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
103 enum {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
104 TRACK_TYPE_UNKNOWN = 0,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
105 TRACK_TYPE_ASS,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
106 TRACK_TYPE_SSA
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
107 } track_type;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
108
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
109 // Script header fields
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
110 int PlayResX;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
111 int PlayResY;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
112 double Timer;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
113 int WrapStyle;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
114 int ScaledBorderAndShadow;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
115 int Kerning;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
116 char *Language;
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
117 enum {
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
118 YCBCR_DEFAULT = 0, // TV.601 on YCbCr video, None on RGB video
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
119 YCBCR_UNKNOWN,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
120 YCBCR_NONE, // untouched RGB values
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
121 YCBCR_BT601_TV,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
122 YCBCR_BT601_PC,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
123 YCBCR_BT709_TV,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
124 YCBCR_BT709_PC,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
125 YCBCR_SMPTE240M_TV,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
126 YCBCR_SMPTE240M_PC,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
127 YCBCR_FCC_TV,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
128 YCBCR_FCC_PC
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 34295
diff changeset
129 } YCbCrMatrix;
19492
c8daf3471201 SSA/ASS parser reworked, with 2 main results:
eugeni
parents: 18937
diff changeset
130
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
131 int default_style; // index of default style
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
132 char *name; // file name in case of external subs, 0 for streams
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
133
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
134 ASS_Library *library;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
135 ASS_ParserPriv *parser_priv;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
136 } ASS_Track;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
137
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
138 #endif /* LIBASS_TYPES_H */