annotate libass/ass.h @ 26439:52d96fa64e5c

add canopus codecs, patch by Gianluigi Tiesi
author compn
date Sat, 19 Apr 2008 21:56:31 +0000
parents 74055622161d
children 62ac4f8062ee
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: 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
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25613
diff changeset
21 #ifndef LIBASS_ASS_H
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25613
diff changeset
22 #define LIBASS_ASS_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 <stdio.h>
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
25 #include "ass_types.h"
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
26
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
27 /// Libass renderer object. Contents are private.
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
28 typedef struct ass_renderer_s ass_renderer_t;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
29
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
30 /// a linked list of images produced by ass renderer
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
31 typedef struct ass_image_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
32 int w, h; // bitmap width/height
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
33 int stride; // bitmap stride
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
34 unsigned char* bitmap; // 1bpp stride*h alpha buffer
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
35 uint32_t color; // RGBA
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
36 int dst_x, dst_y; // bitmap placement inside the video frame
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
37
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
38 struct ass_image_s* next; // linked list
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
39 } ass_image_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
40
23134
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
41 /// Hinting type
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
42 typedef enum {ASS_HINTING_NONE = 0,
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
43 ASS_HINTING_LIGHT,
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
44 ASS_HINTING_NORMAL,
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
45 ASS_HINTING_NATIVE
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
46 } ass_hinting_t;
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
47
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
48 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
49 * \brief initialize the library
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
50 * \return library handle or NULL if failed
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
51 */
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
52 ass_library_t* ass_library_init(void);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
53
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
54 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
55 * \brief finalize the library
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
56 * \param priv library handle
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
57 */
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
58 void ass_library_done(ass_library_t*);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
59
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
60 /**
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
61 * \brief set private font directory
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
62 * It is used for saving embedded fonts and also in font lookup.
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
63 */
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
64 void ass_set_fonts_dir(ass_library_t* priv, const char* fonts_dir);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
65
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
66 void ass_set_extract_fonts(ass_library_t* priv, int extract);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
67
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
68 void ass_set_style_overrides(ass_library_t* priv, char** list);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
69
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
70 /**
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
71 * \brief initialize the renderer
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
72 * \param priv library handle
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
73 * \return renderer handle or NULL if failed
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
74 */
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
75 ass_renderer_t* ass_renderer_init(ass_library_t*);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
76
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
77 /**
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
78 * \brief finalize the renderer
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
79 * \param priv renderer handle
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
80 */
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
81 void ass_renderer_done(ass_renderer_t* priv);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
82
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
83 void ass_set_frame_size(ass_renderer_t* priv, int w, int h);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
84 void ass_set_margins(ass_renderer_t* priv, int t, int b, int l, int r);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
85 void ass_set_use_margins(ass_renderer_t* priv, int use);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
86 void ass_set_aspect_ratio(ass_renderer_t* priv, double ar);
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
87 void ass_set_font_scale(ass_renderer_t* priv, double font_scale);
23134
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
88 void ass_set_hinting(ass_renderer_t* priv, ass_hinting_t ht);
24554
ffc2c7164bc0 Enable ass_line_spacing option.
eugeni
parents: 23689
diff changeset
89 void ass_set_line_spacing(ass_renderer_t* priv, double line_spacing);
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
90
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
91 /**
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
92 * \brief set font lookup defaults
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
93 */
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
94 int ass_set_fonts(ass_renderer_t* priv, const char* default_font, const char* default_family);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
95
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
96 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
97 * \brief render a frame, producing a list of ass_image_t
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
98 * \param priv library
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
99 * \param track subtitle track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
100 * \param now video timestamp in milliseconds
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
101 */
21506
8174acbf0633 Speed up ASS subtitles display by detecting changes between two consecutive
eugeni
parents: 21458
diff changeset
102 ass_image_t* ass_render_frame(ass_renderer_t *priv, ass_track_t* track, long long now, int* detect_change);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
103
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
104
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
105 // The following functions operate on track objects and do not need an ass_renderer //
18937
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 * \brief allocate a new empty track object
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
109 * \return pointer to empty track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
110 */
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
111 ass_track_t* ass_new_track(ass_library_t*);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
112
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
113 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
114 * \brief deallocate track and all its child objects (styles and events)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
115 * \param track track to deallocate
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
116 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
117 void ass_free_track(ass_track_t* track);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
118
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
119 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
120 * \brief allocate new style
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
121 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
122 * \return newly allocated style id
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
123 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
124 int ass_alloc_style(ass_track_t* track);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
125
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
126 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
127 * \brief allocate new event
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
128 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
129 * \return newly allocated event id
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
130 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
131 int ass_alloc_event(ass_track_t* track);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
132
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
133 /**
19474
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
134 * \brief delete a style
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
135 * \param track track
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
136 * \param sid style id
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
137 * Deallocates style data. Does not modify track->n_styles.
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
138 */
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
139 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
140
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
141 /**
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
142 * \brief delete an event
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
143 * \param track track
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
144 * \param eid event id
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
145 * Deallocates event data. Does not modify track->n_events.
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
146 */
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
147 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
148
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
149 /**
25514
8b945798b8f7 Improve comments for ass_process_* functions.
eugeni
parents: 24554
diff changeset
150 * \brief Parse Codec Private section of subtitle stream
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
151 * \param track target track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
152 * \param data string to parse
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
153 * \param size length of data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
154 */
19492
c8daf3471201 SSA/ASS parser reworked, with 2 main results:
eugeni
parents: 19474
diff changeset
155 void ass_process_codec_private(ass_track_t* track, char *data, int size);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
156
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
157 /**
25515
diego
parents: 25514
diff changeset
158 * \brief Parse a chunk of subtitle stream data. In Matroska, this contains exactly 1 event (or a commentary).
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
159 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
160 * \param data string to parse
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
161 * \param size length of data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
162 * \param timecode starting time of the event (milliseconds)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
163 * \param duration duration of the event (milliseconds)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
164 */
19492
c8daf3471201 SSA/ASS parser reworked, with 2 main results:
eugeni
parents: 19474
diff changeset
165 void ass_process_chunk(ass_track_t* track, char *data, int size, long long timecode, long long duration);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
166
23424
7286d245bf33 Move code for reading a file and recoding it to utf-8 to a separate function.
eugeni
parents: 23134
diff changeset
167 char* read_file_recode(char* fname, char* codepage, int* size);
7286d245bf33 Move code for reading a file and recoding it to utf-8 to a separate function.
eugeni
parents: 23134
diff changeset
168
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
169 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
170 * \brief Read subtitles from file.
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
171 * \param fname file name
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
172 * \return newly allocated track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
173 */
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
174 ass_track_t* ass_read_file(ass_library_t* library, char* fname, char* codepage);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
175
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
176 /**
20603
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
177 * \brief Read subtitles from memory.
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
178 * \param library libass library object
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
179 * \param buf pointer to subtitles text
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
180 * \param bufsize size of buffer
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
181 * \param codepage recode buffer contents from given codepage
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
182 * \return newly allocated track
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
183 */
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
184 ass_track_t* ass_read_memory(ass_library_t* library, char* buf, size_t bufsize, char* codepage);
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
185 /**
19652
2c016957360a Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents: 19638
diff changeset
186 * \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
187 * \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
188 */
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
189 int ass_read_styles(ass_track_t* track, char* fname, char* codepage);
19652
2c016957360a Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents: 19638
diff changeset
190
2c016957360a Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents: 19638
diff changeset
191 /**
21455
dd49d3712e6f Rename: ass_process_font -> ass_add_font.
eugeni
parents: 20603
diff changeset
192 * \brief Add a memory font.
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
193 * \param name attachment name
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
194 * \param data binary font data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
195 * \param data_size data size
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
196 */
21458
7af6c25a0cfc Keep embedded fonts in ass_library_t and perform actual disk write
eugeni
parents: 21455
diff changeset
197 void ass_add_font(ass_library_t* library, char* name, char* data, int data_size);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
198
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
199 /**
25613
f00333e3facf Copy font data to ass_library instead of referencing demuxer-owned memory.
eugeni
parents: 25535
diff changeset
200 * \brief Remove all fonts stored in ass_library object
f00333e3facf Copy font data to ass_library instead of referencing demuxer-owned memory.
eugeni
parents: 25535
diff changeset
201 */
f00333e3facf Copy font data to ass_library instead of referencing demuxer-owned memory.
eugeni
parents: 25535
diff changeset
202 void ass_clear_fonts(ass_library_t* library);
f00333e3facf Copy font data to ass_library instead of referencing demuxer-owned memory.
eugeni
parents: 25535
diff changeset
203
f00333e3facf Copy font data to ass_library instead of referencing demuxer-owned memory.
eugeni
parents: 25535
diff changeset
204 /**
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
205 * \brief Calculates timeshift from now to the start of some other subtitle event, depending on movement parameter
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
206 * \param track subtitle track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
207 * \param now current time, ms
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
208 * \param movement how many events to skip from the one currently displayed
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
209 * +2 means "the one after the next", -1 means "previous"
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
210 * \return timeshift, ms
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
211 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
212 long long ass_step_sub(ass_track_t* track, long long now, int movement);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
213
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25613
diff changeset
214 #endif /* LIBASS_ASS_H */