annotate libass/ass.h @ 36530:9b0dae1bf6ea

rawdv: various small code improvements.
author reimar
date Sun, 19 Jan 2014 11:13:03 +0000
parents c3aaaf17c721
children
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 /*
26723
0f892cd714b2 Use standard license header.
diego
parents: 26582
diff changeset
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
0f892cd714b2 Use standard license header.
diego
parents: 26582
diff changeset
3 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
4 * This file is part of libass.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26582
diff changeset
5 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
6 * Permission to use, copy, modify, and distribute this software for any
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
7 * purpose with or without fee is hereby granted, provided that the above
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
8 * copyright notice and this permission notice appear in all copies.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26582
diff changeset
9 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31875
diff changeset
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26582
diff changeset
17 */
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19652
diff changeset
18
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25613
diff changeset
19 #ifndef LIBASS_ASS_H
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25613
diff changeset
20 #define LIBASS_ASS_H
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
21
26138
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
22 #include <stdio.h>
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
23 #include <stdarg.h>
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
24 #include "ass_types.h"
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
25
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
26 #define LIBASS_VERSION 0x01020000
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
27
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
28 /*
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
29 * A linked list of images produced by an ass renderer.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
30 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
31 * These images have to be rendered in-order for the correct screen
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
32 * composition. The libass renderer clips these bitmaps to the frame size.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
33 * w/h can be zero, in this case the bitmap should not be rendered at all.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
34 * The last bitmap row is not guaranteed to be padded up to stride size,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
35 * e.g. in the worst case a bitmap has the size stride * (h - 1) + w.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
36 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
37 typedef struct ass_image {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
38 int w, h; // Bitmap width/height
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
39 int stride; // Bitmap stride
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
40 unsigned char *bitmap; // 1bpp stride*h alpha buffer
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
41 // Note: the last row may not be padded to
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
42 // bitmap stride!
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
43 uint32_t color; // Bitmap color and alpha, RGBA
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
44 int dst_x, dst_y; // Bitmap placement inside the video frame
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
45
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
46 struct ass_image *next; // Next image, or NULL
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
47
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
48 enum {
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
49 IMAGE_TYPE_CHARACTER,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
50 IMAGE_TYPE_OUTLINE,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
51 IMAGE_TYPE_SHADOW
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
52 } type;
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
53
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
54 } ASS_Image;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
55
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
56 /*
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
57 * Hinting type. (see ass_set_hinting below)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
58 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
59 * FreeType's native hinter is still buggy sometimes and it is recommended
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
60 * to use the light autohinter, ASS_HINTING_LIGHT, instead. For best
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
61 * compatibility with problematic fonts, disable hinting.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
62 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
63 typedef enum {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
64 ASS_HINTING_NONE = 0,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
65 ASS_HINTING_LIGHT,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
66 ASS_HINTING_NORMAL,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
67 ASS_HINTING_NATIVE
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
68 } ASS_Hinting;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
69
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
70 /**
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
71 * \brief Text shaping levels.
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
72 *
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
73 * SIMPLE is a fast, font-agnostic shaper that can do only substitutions.
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
74 * COMPLEX is a slower shaper using OpenType for substitutions and positioning.
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
75 *
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
76 * libass uses the best shaper available by default.
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
77 */
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
78 typedef enum {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
79 ASS_SHAPING_SIMPLE = 0,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
80 ASS_SHAPING_COMPLEX
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
81 } ASS_ShapingLevel;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
82
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
83 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
84 * \brief Initialize the library.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
85 * \return library handle or NULL if failed
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
86 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
87 ASS_Library *ass_library_init(void);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
88
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
89 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
90 * \brief Finalize the library
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
91 * \param priv library handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
92 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
93 void ass_library_done(ASS_Library *priv);
23134
1de2a46a0987 Add -ass-hinting option for setting font hinting method.
eugeni
parents: 21506
diff changeset
94
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
95 /**
31853
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
96 * \brief Set additional fonts directory.
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
97 * Optional directory that will be scanned for fonts recursively. The fonts
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
98 * found are used for font lookup.
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
99 * NOTE: A valid font directory is not needed to support embedded fonts.
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
100 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
101 * \param priv library handle
31853
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
102 * \param fonts_dir directory with additional fonts
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
103 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
104 void ass_set_fonts_dir(ASS_Library *priv, const char *fonts_dir);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
105
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
106 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
107 * \brief Whether fonts should be extracted from track data.
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
108 * \param priv library handle
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
109 * \param extract whether to extract fonts
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
110 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
111 void ass_set_extract_fonts(ASS_Library *priv, int extract);
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
112
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
113 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
114 * \brief Register style overrides with a library instance.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
115 * The overrides should have the form [Style.]Param=Value, e.g.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
116 * SomeStyle.Font=Arial
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
117 * ScaledBorderAndShadow=yes
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
118 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
119 * \param priv library handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
120 * \param list NULL-terminated list of strings
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
121 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
122 void ass_set_style_overrides(ASS_Library *priv, char **list);
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
123
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
124 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
125 * \brief Explicitly process style overrides for a track.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
126 * \param track track handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
127 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
128 void ass_process_force_style(ASS_Track *track);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
129
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
130 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
131 * \brief Register a callback for debug/info messages.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
132 * If a callback is registered, it is called for every message emitted by
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
133 * libass. The callback receives a format string and a list of arguments,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
134 * to be used for the printf family of functions. Additionally, a log level
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
135 * from 0 (FATAL errors) to 7 (verbose DEBUG) is passed. Usually, level 5
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
136 * should be used by applications.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
137 * If no callback is set, all messages level < 5 are printed to stderr,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
138 * prefixed with [ass].
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
139 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
140 * \param priv library handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
141 * \param msg_cb pointer to callback function
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
142 * \param data additional data, will be passed to callback
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
143 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
144 void ass_set_message_cb(ASS_Library *priv, void (*msg_cb)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
145 (int level, const char *fmt, va_list args, void *data),
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
146 void *data);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
147
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
148 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
149 * \brief Initialize the renderer.
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
150 * \param priv library handle
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
151 * \return renderer handle or NULL if failed
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
152 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
153 ASS_Renderer *ass_renderer_init(ASS_Library *);
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
154
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
155 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
156 * \brief Finalize the renderer.
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
157 * \param priv renderer handle
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
158 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
159 void ass_renderer_done(ASS_Renderer *priv);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
160
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
161 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
162 * \brief Set the frame size in pixels, including margins.
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
163 * The renderer will never return images that are outside of the frame area.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
164 * The value set with this function can influence the pixel aspect ratio used
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
165 * for rendering. If the frame size doesn't equal to the video size, you may
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
166 * have to use ass_set_pixel_aspect().
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
167 * @see ass_set_pixel_aspect()
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
168 * @see ass_set_margins()
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
169 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
170 * \param w width
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
171 * \param h height
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
172 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
173 void ass_set_frame_size(ASS_Renderer *priv, int w, int h);
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
174
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
175 /**
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
176 * \brief Set the source image size in pixels.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
177 * This is used to calculate the source aspect ratio and the blur scale.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
178 * The source image size can be reset to default by setting w and h to 0.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
179 * The value set with this function can influence the pixel aspect ratio used
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
180 * for rendering.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
181 * @see ass_set_pixel_aspect()
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
182 * \param priv renderer handle
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
183 * \param w width
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
184 * \param h height
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
185 */
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
186 void ass_set_storage_size(ASS_Renderer *priv, int w, int h);
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
187
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
188 /**
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
189 * \brief Set shaping level. This is merely a hint, the renderer will use
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
190 * whatever is available if the request cannot be fulfilled.
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
191 * \param level shaping level
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
192 */
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
193 void ass_set_shaper(ASS_Renderer *priv, ASS_ShapingLevel level);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
194
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
195 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
196 * \brief Set frame margins. These values may be negative if pan-and-scan
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
197 * is used. The margins are in pixels. Each value specifies the distance from
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
198 * the video rectangle to the renderer frame. If a given margin value is
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
199 * positive, there will be free space between renderer frame and video area.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
200 * If a given margin value is negative, the frame is inside the video, i.e.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
201 * the video has been cropped.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
202 *
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
203 * The renderer will try to keep subtitles inside the frame area. If possible,
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
204 * text is layout so that it is inside the cropped area. Subtitle events
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
205 * that can't be moved are cropped against the frame area.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
206 *
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
207 * ass_set_use_margins() can be used to allow libass to render subtitles into
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
208 * the empty areas if margins are positive, i.e. the video area is smaller than
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
209 * the frame. (Traditionally, this has been used to show subtitles in
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
210 * the bottom "black bar" between video bottom screen border when playing 16:9
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
211 * video on a 4:3 screen.)
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
212 *
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
213 * When using this function, it is recommended to calculate and set your own
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
214 * aspect ratio with ass_set_pixel_aspect(), as the defaults won't make any
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
215 * sense.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
216 * @see ass_set_pixel_aspect()
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
217 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
218 * \param t top margin
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
219 * \param b bottom margin
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
220 * \param l left margin
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
221 * \param r right margin
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
222 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
223 void ass_set_margins(ASS_Renderer *priv, int t, int b, int l, int r);
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
224
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
225 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
226 * \brief Whether margins should be used for placing regular events.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
227 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
228 * \param use whether to use the margins
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
229 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
230 void ass_set_use_margins(ASS_Renderer *priv, int use);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
231
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
232 /**
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
233 * \brief Set pixel aspect ratio correction.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
234 * This is the ratio of pixel width to pixel height.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
235 *
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
236 * Generally, this is (s_w / s_h) / (d_w / d_h), where s_w and s_h is the
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
237 * video storage size, and d_w and d_h is the video display size. (Display
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
238 * and storage size can be different for anamorphic video, such as DVDs.)
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
239 *
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
240 * If the pixel aspect ratio is 0, or if the aspect ratio has never been set
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
241 * by calling this function, libass will calculate a default pixel aspect ratio
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
242 * out of values set with ass_set_frame_size() and ass_set_storage_size(). Note
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
243 * that this is useful only if the frame size corresponds to the video display
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
244 * size. Keep in mind that the margins set with ass_set_margins() are ignored
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
245 * for aspect ratio calculations as well.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
246 * If the storage size has not been set, a pixel aspect ratio of 1 is assumed.
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
247 * \param priv renderer handle
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
248 * \param par pixel aspect ratio (1.0 means square pixels, 0 means default)
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
249 */
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
250 void ass_set_pixel_aspect(ASS_Renderer *priv, double par);
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
251
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
252 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
253 * \brief Set aspect ratio parameters.
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
254 * This calls ass_set_pixel_aspect(priv, dar / sar).
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
255 * @deprecated New code should use ass_set_pixel_aspect().
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
256 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
257 * \param dar display aspect ratio (DAR), prescaled for output PAR
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
258 * \param sar storage aspect ratio (SAR)
20477
de4a66d99f41 Libass interface reworked:
eugeni
parents: 20446
diff changeset
259 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
260 void ass_set_aspect_ratio(ASS_Renderer *priv, double dar, double sar);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
261
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
262 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
263 * \brief Set a fixed font scaling factor.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
264 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
265 * \param font_scale scaling factor, default is 1.0
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
266 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
267 void ass_set_font_scale(ASS_Renderer *priv, double font_scale);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
268
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
269 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
270 * \brief Set font hinting method.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
271 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
272 * \param ht hinting method
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
273 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
274 void ass_set_hinting(ASS_Renderer *priv, ASS_Hinting ht);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
275
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
276 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
277 * \brief Set line spacing. Will not be scaled with frame size.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
278 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
279 * \param line_spacing line spacing in pixels
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
280 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
281 void ass_set_line_spacing(ASS_Renderer *priv, double line_spacing);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
282
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
283 /**
35262
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
284 * \brief Set vertical line position.
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
285 * \param priv renderer handle
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
286 * \param line_position vertical line position of subtitles in percent
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
287 * (0-100: 0 = on the bottom (default), 100 = on top)
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
288 */
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
289 void ass_set_line_position(ASS_Renderer *priv, double line_position);
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
290
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
291 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
292 * \brief Set font lookup defaults.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
293 * \param default_font path to default font to use. Must be supplied if
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
294 * fontconfig is disabled or unavailable.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
295 * \param default_family fallback font family for fontconfig, or NULL
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
296 * \param fc whether to use fontconfig
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
297 * \param config path to fontconfig configuration file, or NULL. Only relevant
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
298 * if fontconfig is used.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
299 * \param update whether fontconfig cache should be built/updated now. Only
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
300 * relevant if fontconfig is used.
31853
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
301 *
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
302 * NOTE: font lookup must be configured before an ASS_Renderer can be used.
26582
62ac4f8062ee Remove libass dependency on global font_fontconfig variable.
eugeni
parents: 26138
diff changeset
303 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
304 void ass_set_fonts(ASS_Renderer *priv, const char *default_font,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
305 const char *default_family, int fc, const char *config,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
306 int update);
26582
62ac4f8062ee Remove libass dependency on global font_fontconfig variable.
eugeni
parents: 26138
diff changeset
307
62ac4f8062ee Remove libass dependency on global font_fontconfig variable.
eugeni
parents: 26138
diff changeset
308 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
309 * \brief Update/build font cache. This needs to be called if it was
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
310 * disabled when ass_set_fonts was set.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
311 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
312 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
313 * \return success
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
314 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
315 int ass_fonts_update(ASS_Renderer *priv);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
316
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
317 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
318 * \brief Set hard cache limits. Do not set, or set to zero, for reasonable
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
319 * defaults.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
320 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
321 * \param priv renderer handle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
322 * \param glyph_max maximum number of cached glyphs
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
323 * \param bitmap_max_size maximum bitmap cache size (in MB)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
324 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
325 void ass_set_cache_limits(ASS_Renderer *priv, int glyph_max,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
326 int bitmap_max_size);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
327
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
328 /**
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
329 * \brief Render a frame, producing a list of ASS_Image.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
330 * \param priv renderer handle
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
331 * \param track subtitle track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
332 * \param now video timestamp in milliseconds
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
333 * \param detect_change will be set to 1 if a change occured compared
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
334 * to the last invocation
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
335 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
336 ASS_Image *ass_render_frame(ASS_Renderer *priv, ASS_Track *track,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
337 long long now, int *detect_change);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
338
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
339
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
340 /*
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
341 * The following functions operate on track objects and do not need
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
342 * an ass_renderer
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
343 */
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
344
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
345 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
346 * \brief Allocate a new empty track object.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
347 * \param library handle
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
348 * \return pointer to empty track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
349 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
350 ASS_Track *ass_new_track(ASS_Library *);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
351
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
352 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
353 * \brief Deallocate track and all its child objects (styles and events).
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
354 * \param track track to deallocate
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
355 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
356 void ass_free_track(ASS_Track *track);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
357
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
358 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
359 * \brief Allocate new style.
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
360 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
361 * \return newly allocated style id
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
362 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
363 int ass_alloc_style(ASS_Track *track);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
364
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
365 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
366 * \brief Allocate new event.
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
367 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
368 * \return newly allocated event id
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
369 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
370 int ass_alloc_event(ASS_Track *track);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
371
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
372 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
373 * \brief Delete a style.
19474
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
374 * \param track track
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
375 * \param sid style id
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
376 * Deallocates style data. Does not modify track->n_styles.
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
377 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
378 void ass_free_style(ASS_Track *track, int sid);
19474
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
379
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
380 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
381 * \brief Delete an event.
19474
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
382 * \param track track
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
383 * \param eid event id
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
384 * Deallocates event data. Does not modify track->n_events.
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
385 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
386 void ass_free_event(ASS_Track *track, int eid);
19474
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
387
07209f48e527 Add public functions for removal of styles and events.
eugeni
parents: 18937
diff changeset
388 /**
27498
d895515b366d libass: add a new ass_process_data() to process demuxed subtitle packets
aurel
parents: 26738
diff changeset
389 * \brief Parse a chunk of subtitle stream data.
d895515b366d libass: add a new ass_process_data() to process demuxed subtitle packets
aurel
parents: 26738
diff changeset
390 * \param track track
d895515b366d libass: add a new ass_process_data() to process demuxed subtitle packets
aurel
parents: 26738
diff changeset
391 * \param data string to parse
d895515b366d libass: add a new ass_process_data() to process demuxed subtitle packets
aurel
parents: 26738
diff changeset
392 * \param size length of data
d895515b366d libass: add a new ass_process_data() to process demuxed subtitle packets
aurel
parents: 26738
diff changeset
393 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
394 void ass_process_data(ASS_Track *track, char *data, int size);
27498
d895515b366d libass: add a new ass_process_data() to process demuxed subtitle packets
aurel
parents: 26738
diff changeset
395
d895515b366d libass: add a new ass_process_data() to process demuxed subtitle packets
aurel
parents: 26738
diff changeset
396 /**
31853
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
397 * \brief Parse Codec Private section of the subtitle stream, in Matroska
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
398 * format. See the Matroska specification for details.
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
399 * \param track target track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
400 * \param data string to parse
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
401 * \param size length of data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
402 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
403 void ass_process_codec_private(ASS_Track *track, char *data, int size);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
404
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
405 /**
31853
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
406 * \brief Parse a chunk of subtitle stream data. A chunk contains exactly one
e64df5862cea Import libass 0.9.10
greg
parents: 31242
diff changeset
407 * event in Matroska format. See the Matroska specification for details.
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
408 * \param track track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
409 * \param data string to parse
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
410 * \param size length of data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
411 * \param timecode starting time of the event (milliseconds)
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
412 * \param duration duration of the event (milliseconds)
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
413 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
414 void ass_process_chunk(ASS_Track *track, char *data, int size,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
415 long long timecode, long long duration);
23424
7286d245bf33 Move code for reading a file and recoding it to utf-8 to a separate function.
eugeni
parents: 23134
diff changeset
416
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
417 /**
31227
ee7beb1a3a6e backport ass_flush_events() from upstream libass and make use of it
aurel
parents: 30200
diff changeset
418 * \brief Flush buffered events.
ee7beb1a3a6e backport ass_flush_events() from upstream libass and make use of it
aurel
parents: 30200
diff changeset
419 * \param track track
ee7beb1a3a6e backport ass_flush_events() from upstream libass and make use of it
aurel
parents: 30200
diff changeset
420 */
ee7beb1a3a6e backport ass_flush_events() from upstream libass and make use of it
aurel
parents: 30200
diff changeset
421 void ass_flush_events(ASS_Track *track);
ee7beb1a3a6e backport ass_flush_events() from upstream libass and make use of it
aurel
parents: 30200
diff changeset
422
ee7beb1a3a6e backport ass_flush_events() from upstream libass and make use of it
aurel
parents: 30200
diff changeset
423 /**
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
424 * \brief Read subtitles from file.
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
425 * \param library library handle
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
426 * \param fname file name
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
427 * \param codepage encoding (iconv format)
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
428 * \return newly allocated track
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
429 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
430 ASS_Track *ass_read_file(ASS_Library *library, char *fname,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
431 char *codepage);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
432
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
433 /**
20603
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
434 * \brief Read subtitles from memory.
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
435 * \param library library handle
20603
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
436 * \param buf pointer to subtitles text
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
437 * \param bufsize size of buffer
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
438 * \param codepage encoding (iconv format)
20603
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
439 * \return newly allocated track
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27499
diff changeset
440 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
441 ASS_Track *ass_read_memory(ASS_Library *library, char *buf,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
442 size_t bufsize, char *codepage);
20603
b0814eba65ec Implement loading subtitles from memory.
eugeni
parents: 20477
diff changeset
443 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
444 * \brief Read styles from file into already initialized track.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
445 * \param fname file name
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
446 * \param codepage encoding (iconv format)
19652
2c016957360a Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents: 19638
diff changeset
447 * \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
448 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
449 int ass_read_styles(ASS_Track *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
450
2c016957360a Add -ass-styles option. It allows to load styles from a file and use them
eugeni
parents: 19638
diff changeset
451 /**
21455
dd49d3712e6f Rename: ass_process_font -> ass_add_font.
eugeni
parents: 20603
diff changeset
452 * \brief Add a memory font.
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
453 * \param library library handle
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
454 * \param name attachment name
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
455 * \param data binary font data
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
456 * \param data_size data size
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
457 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
458 void ass_add_font(ASS_Library *library, char *name, char *data,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
459 int data_size);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
460
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
461 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
462 * \brief Remove all fonts stored in an ass_library object.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
463 * \param library library handle
25613
f00333e3facf Copy font data to ass_library instead of referencing demuxer-owned memory.
eugeni
parents: 25535
diff changeset
464 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
465 void ass_clear_fonts(ASS_Library *library);
25613
f00333e3facf Copy font data to ass_library instead of referencing demuxer-owned memory.
eugeni
parents: 25535
diff changeset
466
f00333e3facf Copy font data to ass_library instead of referencing demuxer-owned memory.
eugeni
parents: 25535
diff changeset
467 /**
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
468 * \brief Calculates timeshift from now to the start of some other subtitle
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
469 * event, depending on movement parameter.
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
470 * \param track subtitle track
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
471 * \param now current time in milliseconds
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
472 * \param movement how many events to skip from the one currently displayed
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
473 * +2 means "the one after the next", -1 means "previous"
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
474 * \return timeshift in milliseconds
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
475 */
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 30066
diff changeset
476 long long ass_step_sub(ASS_Track *track, long long now, int movement);
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
477
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25613
diff changeset
478 #endif /* LIBASS_ASS_H */