Mercurial > mplayer.hg
annotate libass/ass.h @ 20361:87c1bd5096de
remove outdated reference to "tvout-voodoo"; fixes compilation
author | kraymer |
---|---|
date | Sun, 22 Oct 2006 15:48:38 +0000 |
parents | fa122b7c71c6 |
children | e8adc3778348 |
rev | line source |
---|---|
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19652
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:
19652
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:
19652
diff
changeset
|
3 /* |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19652
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:
19652
diff
changeset
|
5 |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19652
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:
19652
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:
19652
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:
19652
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:
19652
diff
changeset
|
10 |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19652
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:
19652
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:
19652
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:
19652
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:
19652
diff
changeset
|
15 |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19652
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:
19652
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:
19652
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:
19652
diff
changeset
|
19 */ |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19652
diff
changeset
|
20 |
18937 | 21 #ifndef __ASS_H__ |
22 #define __ASS_H__ | |
23 | |
24 #include "ass_types.h" | |
25 | |
26 /// Libass "library object". Contents are private. | |
27 typedef struct ass_instance_s ass_instance_t; | |
28 | |
29 /// used in ass_configure | |
30 typedef struct ass_settings_s { | |
31 int frame_width; | |
32 int frame_height; | |
33 double font_size_coeff; // font size multiplier | |
34 double line_spacing; // additional line spacing (in frame pixels) | |
35 int top_margin; // height of top margin. Everything except toptitles is shifted down by top_margin. | |
36 int bottom_margin; // height of bottom margin. (frame_height - top_margin - bottom_margin) is original video height. | |
19538 | 37 int left_margin; |
38 int right_margin; | |
39 int use_margins; // 0 - place all subtitles inside original frame | |
40 // 1 - use margins for placing toptitles and subtitles | |
18937 | 41 double aspect; // frame aspect ratio, d_width / d_height. |
42 } ass_settings_t; | |
43 | |
44 /// a linked list of images produced by ass renderer | |
45 typedef struct ass_image_s { | |
46 int w, h; // bitmap width/height | |
47 int stride; // bitmap stride | |
48 unsigned char* bitmap; // 1bpp stride*h alpha buffer | |
49 uint32_t color; // RGBA | |
50 int dst_x, dst_y; // bitmap placement inside the video frame | |
51 | |
52 struct ass_image_s* next; // linked list | |
53 } ass_image_t; | |
54 | |
55 /** | |
56 * \brief initialize the library | |
57 * \return library handle or NULL if failed | |
58 */ | |
59 ass_instance_t* ass_init(void); | |
60 | |
61 /** | |
62 * \brief finalize the library | |
63 * \param priv library handle | |
64 */ | |
65 void ass_done(ass_instance_t* priv); | |
66 | |
67 /** | |
68 * \brief configure the library | |
69 * \param priv library handle | |
70 * \param config struct with configuration parameters. Caller is free to reuse it after this function returns. | |
71 */ | |
72 void ass_configure(ass_instance_t* priv, const ass_settings_t* config); | |
73 | |
74 /** | |
75 * \brief render a frame, producing a list of ass_image_t | |
76 * \param priv library | |
77 * \param track subtitle track | |
78 * \param now video timestamp in milliseconds | |
79 */ | |
80 ass_image_t* ass_render_frame(ass_instance_t *priv, ass_track_t* track, long long now); | |
81 | |
82 | |
83 // The following functions operate on track objects and do not need an ass_instance // | |
84 | |
85 /** | |
86 * \brief allocate a new empty track object | |
87 * \return pointer to empty track | |
88 */ | |
89 ass_track_t* ass_new_track(void); | |
90 | |
91 /** | |
92 * \brief deallocate track and all its child objects (styles and events) | |
93 * \param track track to deallocate | |
94 */ | |
95 void ass_free_track(ass_track_t* track); | |
96 | |
97 /** | |
98 * \brief allocate new style | |
99 * \param track track | |
100 * \return newly allocated style id | |
101 */ | |
102 int ass_alloc_style(ass_track_t* track); | |
103 | |
104 /** | |
105 * \brief allocate new event | |
106 * \param track track | |
107 * \return newly allocated event id | |
108 */ | |
109 int ass_alloc_event(ass_track_t* track); | |
110 | |
111 /** | |
19474
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
112 * \brief delete a style |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
113 * \param track track |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
114 * \param sid style id |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
115 * Deallocates style data. Does not modify track->n_styles. |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
116 */ |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
117 void ass_free_style(ass_track_t* track, int sid); |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
118 |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
119 /** |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
120 * \brief delete an event |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
121 * \param track track |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
122 * \param eid event id |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
123 * Deallocates event data. Does not modify track->n_events. |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
124 */ |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
125 void ass_free_event(ass_track_t* track, int eid); |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
126 |
07209f48e527
Add public functions for removal of styles and events.
eugeni
parents:
18937
diff
changeset
|
127 /** |
18937 | 128 * \brief Process Codec Private section of subtitle stream |
129 * \param track target track | |
130 * \param data string to parse | |
131 * \param size length of data | |
132 */ | |
19492 | 133 void ass_process_codec_private(ass_track_t* track, char *data, int size); |
18937 | 134 |
135 /** | |
136 * \brief Process a chunk of subtitle stream data. In matroska, this containes exactly 1 event (or a commentary) | |
137 * \param track track | |
138 * \param data string to parse | |
139 * \param size length of data | |
140 * \param timecode starting time of the event (milliseconds) | |
141 * \param duration duration of the event (milliseconds) | |
142 */ | |
19492 | 143 void ass_process_chunk(ass_track_t* track, char *data, int size, long long timecode, long long duration); |
18937 | 144 |
145 /** | |
146 * \brief Read subtitles from file. | |
147 * \param fname file name | |
148 * \return newly allocated track | |
149 */ | |
150 ass_track_t* ass_read_file(char* fname); | |
151 | |
152 /** | |
19652
2c016957360a
Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents:
19638
diff
changeset
|
153 * \brief read styles from file into already initialized track |
2c016957360a
Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents:
19638
diff
changeset
|
154 * \return 0 on success |
2c016957360a
Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents:
19638
diff
changeset
|
155 */ |
2c016957360a
Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents:
19638
diff
changeset
|
156 int ass_read_styles(ass_track_t* track, char* fname); |
2c016957360a
Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents:
19638
diff
changeset
|
157 |
2c016957360a
Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents:
19638
diff
changeset
|
158 /** |
18937 | 159 * \brief Process embedded matroska font. Saves it to ~/.mplayer/fonts. |
160 * \param name attachment name | |
161 * \param data binary font data | |
162 * \param data_size data size | |
163 */ | |
164 void ass_process_font(const char* name, char* data, int data_size); | |
165 | |
166 /** | |
167 * \brief Calculates timeshift from now to the start of some other subtitle event, depending on movement parameter | |
168 * \param track subtitle track | |
169 * \param now current time, ms | |
170 * \param movement how many events to skip from the one currently displayed | |
171 * +2 means "the one after the next", -1 means "previous" | |
172 * \return timeshift, ms | |
173 */ | |
174 long long ass_step_sub(ass_track_t* track, long long now, int movement); | |
175 | |
176 #endif | |
177 |