Mercurial > mplayer.hg
comparison libass/ass.h @ 20477:de4a66d99f41
Libass interface reworked:
- ass_instance_t renamed to ass_renderer_t
- ass_library_t introduced
- use of mplayer-specific global variables limited to ass_mp.c
author | eugeni |
---|---|
date | Sat, 28 Oct 2006 15:07:18 +0000 |
parents | e8adc3778348 |
children | b0814eba65ec |
comparison
equal
deleted
inserted
replaced
20476:1fd76553550d | 20477:de4a66d99f41 |
---|---|
21 #ifndef __ASS_H__ | 21 #ifndef __ASS_H__ |
22 #define __ASS_H__ | 22 #define __ASS_H__ |
23 | 23 |
24 #include "ass_types.h" | 24 #include "ass_types.h" |
25 | 25 |
26 /// Libass "library object". Contents are private. | 26 /// Libass renderer object. Contents are private. |
27 typedef struct ass_instance_s ass_instance_t; | 27 typedef struct ass_renderer_s ass_renderer_t; |
28 | 28 |
29 /// a linked list of images produced by ass renderer | 29 /// a linked list of images produced by ass renderer |
30 typedef struct ass_image_s { | 30 typedef struct ass_image_s { |
31 int w, h; // bitmap width/height | 31 int w, h; // bitmap width/height |
32 int stride; // bitmap stride | 32 int stride; // bitmap stride |
39 | 39 |
40 /** | 40 /** |
41 * \brief initialize the library | 41 * \brief initialize the library |
42 * \return library handle or NULL if failed | 42 * \return library handle or NULL if failed |
43 */ | 43 */ |
44 ass_instance_t* ass_init(void); | 44 ass_library_t* ass_library_init(void); |
45 | 45 |
46 /** | 46 /** |
47 * \brief finalize the library | 47 * \brief finalize the library |
48 * \param priv library handle | 48 * \param priv library handle |
49 */ | 49 */ |
50 void ass_done(ass_instance_t* priv); | 50 void ass_library_done(ass_library_t*); |
51 | 51 |
52 void ass_set_frame_size(ass_instance_t* priv, int w, int h); | 52 /** |
53 void ass_set_margins(ass_instance_t* priv, int t, int b, int l, int r); | 53 * \brief set private font directory |
54 void ass_set_use_margins(ass_instance_t* priv, int use); | 54 * It is used for saving embedded fonts and also in font lookup. |
55 void ass_set_aspect_ratio(ass_instance_t* priv, double ar); | 55 */ |
56 void ass_set_font_scale(ass_instance_t* priv, double font_scale); | 56 void ass_set_fonts_dir(ass_library_t* priv, const char* fonts_dir); |
57 int ass_set_fonts(ass_instance_t* priv, const char* fonts_dir, const char* default_font, const char* default_family); | 57 |
58 void ass_set_extract_fonts(ass_library_t* priv, int extract); | |
59 | |
60 void ass_set_style_overrides(ass_library_t* priv, char** list); | |
61 | |
62 /** | |
63 * \brief initialize the renderer | |
64 * \param priv library handle | |
65 * \return renderer handle or NULL if failed | |
66 */ | |
67 ass_renderer_t* ass_renderer_init(ass_library_t*); | |
68 | |
69 /** | |
70 * \brief finalize the renderer | |
71 * \param priv renderer handle | |
72 */ | |
73 void ass_renderer_done(ass_renderer_t* priv); | |
74 | |
75 void ass_set_frame_size(ass_renderer_t* priv, int w, int h); | |
76 void ass_set_margins(ass_renderer_t* priv, int t, int b, int l, int r); | |
77 void ass_set_use_margins(ass_renderer_t* priv, int use); | |
78 void ass_set_aspect_ratio(ass_renderer_t* priv, double ar); | |
79 void ass_set_font_scale(ass_renderer_t* priv, double font_scale); | |
80 | |
81 /** | |
82 * \brief set font lookup defaults | |
83 */ | |
84 int ass_set_fonts(ass_renderer_t* priv, const char* default_font, const char* default_family); | |
58 | 85 |
59 /** | 86 /** |
60 * \brief render a frame, producing a list of ass_image_t | 87 * \brief render a frame, producing a list of ass_image_t |
61 * \param priv library | 88 * \param priv library |
62 * \param track subtitle track | 89 * \param track subtitle track |
63 * \param now video timestamp in milliseconds | 90 * \param now video timestamp in milliseconds |
64 */ | 91 */ |
65 ass_image_t* ass_render_frame(ass_instance_t *priv, ass_track_t* track, long long now); | 92 ass_image_t* ass_render_frame(ass_renderer_t *priv, ass_track_t* track, long long now); |
66 | 93 |
67 | 94 |
68 // The following functions operate on track objects and do not need an ass_instance // | 95 // The following functions operate on track objects and do not need an ass_renderer // |
69 | 96 |
70 /** | 97 /** |
71 * \brief allocate a new empty track object | 98 * \brief allocate a new empty track object |
72 * \return pointer to empty track | 99 * \return pointer to empty track |
73 */ | 100 */ |
74 ass_track_t* ass_new_track(void); | 101 ass_track_t* ass_new_track(ass_library_t*); |
75 | 102 |
76 /** | 103 /** |
77 * \brief deallocate track and all its child objects (styles and events) | 104 * \brief deallocate track and all its child objects (styles and events) |
78 * \param track track to deallocate | 105 * \param track track to deallocate |
79 */ | 106 */ |
130 /** | 157 /** |
131 * \brief Read subtitles from file. | 158 * \brief Read subtitles from file. |
132 * \param fname file name | 159 * \param fname file name |
133 * \return newly allocated track | 160 * \return newly allocated track |
134 */ | 161 */ |
135 ass_track_t* ass_read_file(char* fname); | 162 ass_track_t* ass_read_file(ass_library_t* library, char* fname, char* codepage); |
136 | 163 |
137 /** | 164 /** |
138 * \brief read styles from file into already initialized track | 165 * \brief read styles from file into already initialized track |
139 * \return 0 on success | 166 * \return 0 on success |
140 */ | 167 */ |
141 int ass_read_styles(ass_track_t* track, char* fname); | 168 int ass_read_styles(ass_track_t* track, char* fname, char* codepage); |
142 | 169 |
143 /** | 170 /** |
144 * \brief Process embedded matroska font. Saves it to ~/.mplayer/fonts. | 171 * \brief Process embedded matroska font. Saves it to ~/.mplayer/fonts. |
145 * \param name attachment name | 172 * \param name attachment name |
146 * \param data binary font data | 173 * \param data binary font data |
147 * \param data_size data size | 174 * \param data_size data size |
148 */ | 175 */ |
149 void ass_process_font(const char* name, char* data, int data_size); | 176 void ass_process_font(ass_library_t* library, const char* name, char* data, int data_size); |
150 | 177 |
151 /** | 178 /** |
152 * \brief Calculates timeshift from now to the start of some other subtitle event, depending on movement parameter | 179 * \brief Calculates timeshift from now to the start of some other subtitle event, depending on movement parameter |
153 * \param track subtitle track | 180 * \param track subtitle track |
154 * \param now current time, ms | 181 * \param now current time, ms |