annotate libass/ass_types.h @ 26612:87d096a58965

Check ASF packet size before calling demux_asf_read_packet. Fixes segfault with damaged ASF files.
author eugeni
date Fri, 02 May 2008 13:33:14 +0000
parents 74055622161d
children 0f892cd714b2
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 // -*- c-basic-offset: 8; indent-tabs-mode: t -*-
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
2 // vim:ts=8:sw=8:noet:ai:
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
3 /*
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
4 Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
5
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
6 This program is free software; you can redistribute it and/or modify
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
7 it under the terms of the GNU General Public License as published by
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
8 the Free Software Foundation; either version 2 of the License, or
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
9 (at your option) any later version.
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
10
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
11 This program is distributed in the hope that it will be useful,
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
14 GNU General Public License for more details.
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
15
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
16 You should have received a copy of the GNU General Public License
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
17 along with this program; if not, write to the Free Software
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
19 */
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19638
diff changeset
20
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
21 #ifndef LIBASS_TYPES_H
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
22 #define LIBASS_TYPES_H
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
23
26138
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
24 #include <stdint.h>
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
25
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
26 #define VALIGN_SUB 0
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
27 #define VALIGN_CENTER 8
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
28 #define VALIGN_TOP 4
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
29 #define HALIGN_LEFT 1
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
30 #define HALIGN_CENTER 2
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
31 #define HALIGN_RIGHT 3
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
32
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
33 /// ass Style: line
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
34 typedef struct ass_style_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
35 char* Name;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
36 char* FontName;
23300
04dbd42b3962 Support fractional font sizes.
eugeni
parents: 22259
diff changeset
37 double FontSize;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
38 uint32_t PrimaryColour;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
39 uint32_t SecondaryColour;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
40 uint32_t OutlineColour;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
41 uint32_t BackColour;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
42 int Bold;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
43 int Italic;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
44 int Underline;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
45 int StrikeOut;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
46 double ScaleX;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
47 double ScaleY;
22259
cb409839a110 Correct implementation of text spacing.
eugeni
parents: 20477
diff changeset
48 double Spacing;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
49 int Angle;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
50 int BorderStyle;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
51 double Outline;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
52 double Shadow;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
53 int Alignment;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
54 int MarginL;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
55 int MarginR;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
56 int MarginV;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
57 // int AlphaLevel;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
58 int Encoding;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
59 } ass_style_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
60
19638
a3473d990fed Better collision detection algorithm. The idea is to keep a subtitle in place
eugeni
parents: 19492
diff changeset
61 typedef struct render_priv_s render_priv_t;
a3473d990fed Better collision detection algorithm. The idea is to keep a subtitle in place
eugeni
parents: 19492
diff changeset
62
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
63 /// ass_event_t corresponds to a single Dialogue line
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
64 /// Text is stored as-is, style overrides will be parsed later
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
65 typedef struct ass_event_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
66 long long Start; // ms
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
67 long long Duration; // ms
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
68
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
69 int ReadOrder;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
70 int Layer;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
71 int Style;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
72 char* Name;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
73 int MarginL;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
74 int MarginR;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
75 int MarginV;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
76 char* Effect;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
77 char* Text;
19638
a3473d990fed Better collision detection algorithm. The idea is to keep a subtitle in place
eugeni
parents: 19492
diff changeset
78
a3473d990fed Better collision detection algorithm. The idea is to keep a subtitle in place
eugeni
parents: 19492
diff changeset
79 render_priv_t* render_priv;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
80 } ass_event_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
81
19492
c8daf3471201 SSA/ASS parser reworked, with 2 main results:
eugeni
parents: 18937
diff changeset
82 typedef struct parser_priv_s parser_priv_t;
c8daf3471201 SSA/ASS parser reworked, with 2 main results:
eugeni
parents: 18937
diff changeset
83
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20008
diff changeset
84 typedef struct ass_library_s ass_library_t;
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20008
diff changeset
85
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
86 /// ass track represent either an external script or a matroska subtitle stream (no real difference between them)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
87 /// it can be used in rendering after the headers are parsed (i.e. events format line read)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
88 typedef struct ass_track_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
89 int n_styles; // amount used
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
90 int max_styles; // amount allocated
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
91 int n_events;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
92 int max_events;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
93 ass_style_t* styles; // array of styles, max_styles length, n_styles used
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
94 ass_event_t* events; // the same as styles
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
95
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
96 char* style_format; // style format line (everything after "Format: ")
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
97 char* event_format; // event format line
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
98
19492
c8daf3471201 SSA/ASS parser reworked, with 2 main results:
eugeni
parents: 18937
diff changeset
99 enum {TRACK_TYPE_UNKNOWN = 0, TRACK_TYPE_ASS, TRACK_TYPE_SSA} track_type;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
100
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
101 // script header fields
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
102 int PlayResX;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
103 int PlayResY;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
104 double Timer;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
105 int WrapStyle;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
106
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
107
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
108 int default_style; // index of default style
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
109 char* name; // file name in case of external subs, 0 for streams
19492
c8daf3471201 SSA/ASS parser reworked, with 2 main results:
eugeni
parents: 18937
diff changeset
110
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20008
diff changeset
111 ass_library_t* library;
19492
c8daf3471201 SSA/ASS parser reworked, with 2 main results:
eugeni
parents: 18937
diff changeset
112 parser_priv_t* parser_priv;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
113 } ass_track_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
114
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
115 #endif /* LIBASS_TYPES_H */