annotate libass/ass.h @ 19193:28d25943b7cf

Remove silly test/include path cleanup.
author diego
date Thu, 27 Jul 2006 10:52:40 +0000
parents 9e95ac641e77
children 07209f48e527
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
1 #ifndef __ASS_H__
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
2 #define __ASS_H__
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
3
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
4 #include "ass_types.h"
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
5
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
6 /// Libass "library object". Contents are private.
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
7 typedef struct ass_instance_s ass_instance_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
8
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
9 /// used in ass_configure
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
10 typedef struct ass_settings_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
11 int frame_width;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
12 int frame_height;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
13 double font_size_coeff; // font size multiplier
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
14 double line_spacing; // additional line spacing (in frame pixels)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
15 int top_margin; // height of top margin. Everything except toptitles is shifted down by top_margin.
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
16 int bottom_margin; // height of bottom margin. (frame_height - top_margin - bottom_margin) is original video height.
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
17 double aspect; // frame aspect ratio, d_width / d_height.
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
18 } ass_settings_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
19
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
20 /// a linked list of images produced by ass renderer
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
21 typedef struct ass_image_s {
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
22 int w, h; // bitmap width/height
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
23 int stride; // bitmap stride
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
24 unsigned char* bitmap; // 1bpp stride*h alpha buffer
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
25 uint32_t color; // RGBA
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
26 int dst_x, dst_y; // bitmap placement inside the video frame
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
27
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
28 struct ass_image_s* next; // linked list
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
29 } ass_image_t;
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
30
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
31 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
32 * \brief initialize the library
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
33 * \return library handle or NULL if failed
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
34 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
35 ass_instance_t* ass_init(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
36
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
37 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
38 * \brief finalize the library
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
39 * \param priv library handle
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
40 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
41 void ass_done(ass_instance_t* priv);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
42
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
43 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
44 * \brief configure the library
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
45 * \param priv library handle
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
46 * \param config struct with configuration parameters. Caller is free to reuse it after this function returns.
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
47 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
48 void ass_configure(ass_instance_t* priv, const ass_settings_t* config);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
49
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
50 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
51 * \brief start rendering a frame
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
52 * \param priv library
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
53 * \param track subtitle track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
54 * \param now video timestamp in milliseconds
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
55 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
56 int ass_start_frame(ass_instance_t *priv, ass_track_t* track, long long now);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
57
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
58 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
59 * \brief render a single event
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
60 * uses library, track and timestamp from the previous call to ass_start_frame
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
61 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
62 int ass_render_event(ass_event_t* event);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
63
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
64 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
65 * \brief done rendering frame, give out the results
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
66 * \return a list of images for blending
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
67 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
68 ass_image_t* ass_end_frame(void); // returns linked list of images to render
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
69
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
70 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
71 * \brief render a frame, producing a list of ass_image_t
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
72 * \param priv library
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
73 * \param track subtitle track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
74 * \param now video timestamp in milliseconds
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
75 * This function is equivalent to
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
76 * ass_start_frame()
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
77 * for events: start <= now < end:
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
78 * ass_render_event()
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
79 * ass_end_frame()
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
80 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
81 ass_image_t* ass_render_frame(ass_instance_t *priv, ass_track_t* track, long long now);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
82
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
83
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
84 // The following functions operate on track objects and do not need an ass_instance //
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
85
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
86 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
87 * \brief allocate a new empty track object
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
88 * \return pointer to empty track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
89 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
90 ass_track_t* ass_new_track(void);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
91
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
92 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
93 * \brief deallocate track and all its child objects (styles and events)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
94 * \param track track to deallocate
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
95 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
96 void ass_free_track(ass_track_t* track);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
97
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
98 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
99 * \brief allocate new style
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
100 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
101 * \return newly allocated style id
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
102 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
103 int ass_alloc_style(ass_track_t* track);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
104
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
105 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
106 * \brief allocate new event
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
107 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
108 * \return newly allocated event id
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
109 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
110 int ass_alloc_event(ass_track_t* track);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
111
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
112 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
113 * \brief Process Codec Private section of subtitle stream
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
114 * \param track target track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
115 * \param data string to parse
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
116 * \param size length of data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
117 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
118 void ass_process_chunk(ass_track_t* track, char *data, int size);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
119
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
120 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
121 * \brief Process a chunk of subtitle stream data. In matroska, this containes exactly 1 event (or a commentary)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
122 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
123 * \param data string to parse
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
124 * \param size length of data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
125 * \param timecode starting time of the event (milliseconds)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
126 * \param duration duration of the event (milliseconds)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
127 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
128 void ass_process_line(ass_track_t* track, char *data, int size, long long timecode, long long duration);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
129
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
130 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
131 * \brief Read subtitles from file.
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
132 * \param fname file name
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
133 * \return newly allocated track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
134 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
135 ass_track_t* ass_read_file(char* fname);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
136
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
137 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
138 * \brief Process embedded matroska font. Saves it to ~/.mplayer/fonts.
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
139 * \param name attachment name
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
140 * \param data binary font data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
141 * \param data_size data size
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
142 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
143 void ass_process_font(const char* name, char* data, int data_size);
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
144
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
145 /**
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
146 * \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
147 * \param track subtitle track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
148 * \param now current time, ms
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
149 * \param movement how many events to skip from the one currently displayed
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
150 * +2 means "the one after the next", -1 means "previous"
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
151 * \return timeshift, ms
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
152 */
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
153 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
154
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
155 #endif
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
156