1 diff -ruN libass-0.9.5/libass/ass.c libass-0.9.5-patched/libass/ass.c
2 --- libass/libass/ass.c 2008-05-22 20:01:18.000000000 +0200
3 +++ libass-0.9.5-patched/libass/ass.c 2008-08-08 23:59:21.000000000 +0200
10 - outbuf = malloc(size);
11 + outbuf = malloc(osize);
18 rc = iconv(icdsc, &ip, &ileft, &op, &oleft);
19 + else {// clear the conversion state and leave
21 + rc = iconv(icdsc, NULL, NULL, &op, &oleft);
23 if (rc == (size_t)(-1)) {
25 - int offset = op - outbuf;
26 + size_t offset = op - outbuf;
27 outbuf = (char*)realloc(outbuf, osize + size);
31 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorRecodingFile);
39 outbuf[osize - oleft - 1] = 0;
41 diff -ruN libass-0.9.5/libass/ass_bitmap.c libass-0.9.5-patched/libass/ass_bitmap.c
42 --- libass/libass/ass_bitmap.c 2008-05-22 20:01:18.000000000 +0200
43 +++ libass-0.9.5-patched/libass/ass_bitmap.c 2008-08-09 00:04:36.000000000 +0200
45 resize_tmp(priv, (*bm_g)->w, (*bm_g)->h);
48 - blur((*bm_g)->buffer, priv->tmp, (*bm_g)->w, (*bm_g)->h, (*bm_g)->w, (int*)priv->gt2, priv->g_r, priv->g_w);
50 blur((*bm_o)->buffer, priv->tmp, (*bm_o)->w, (*bm_o)->h, (*bm_o)->w, (int*)priv->gt2, priv->g_r, priv->g_w);
52 + blur((*bm_g)->buffer, priv->tmp, (*bm_g)->w, (*bm_g)->h, (*bm_g)->w, (int*)priv->gt2, priv->g_r, priv->g_w);
56 diff -ruN libass-0.9.5/libass/ass_fontconfig.c libass-0.9.5-patched/libass/ass_fontconfig.c
57 --- libass/libass/ass_fontconfig.c 2008-05-22 20:01:18.000000000 +0200
58 +++ libass-0.9.5-patched/libass/ass_fontconfig.c 2008-08-08 23:59:21.000000000 +0200
62 fset = FcFontSort(priv->config, pat, FcTrue, NULL, &result);
66 for (curf = 0; curf < fset->nfont; ++curf) {
67 FcPattern* curp = fset->fonts[curf];
72 + int face_index, num_faces = 1;
74 - rc = FT_New_Memory_Face(ftlibrary, (unsigned char*)data, data_size, 0, &face);
75 + for (face_index = 0; face_index < num_faces; ++face_index) {
76 + rc = FT_New_Memory_Face(ftlibrary, (unsigned char*)data, data_size, 0, &face);
78 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorOpeningMemoryFont, name);
81 + num_faces = face->num_faces;
83 pattern = FcFreeTypeQueryFace(face, (unsigned char*)name, 0, FcConfigGetBlanks(priv->config));
94 for (i = 0; i < library->num_fontdata; ++i)
95 process_fontdata(priv, library, ftlibrary, i);
97 - if (FcDirCacheValid((const FcChar8 *)dir) == FcFalse)
99 + if (FcDirCacheValid((const FcChar8 *)dir) == FcFalse)
101 mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_UpdatingFontCache);
102 if (FcGetVersion() >= 20390 && FcGetVersion() < 20400)
105 mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FcConfigAppFontAddDirFailed);
109 priv->family_default = family ? strdup(family) : 0;
110 priv->path_default = path ? strdup(path) : 0;
111 diff -ruN libass-0.9.5/libass/ass_render.c libass-0.9.5-patched/libass/ass_render.c
112 --- libass/libass/ass_render.c 2008-05-22 20:01:18.000000000 +0200
113 +++ libass-0.9.5-patched/libass/ass_render.c 2008-08-09 00:04:28.000000000 +0200
115 EVENT_HSCROLL, // "Banner" transition effect, text_width is unlimited
116 EVENT_VSCROLL // "Scroll up", "Scroll down" transition effects
118 - int pos_x, pos_y; // position
119 - int org_x, org_y; // origin
120 + double pos_x, pos_y; // position
121 + double org_x, org_y; // origin
122 char have_origin; // origin is explicitly defined; if 0, get_base_point() is used
123 double scale_x, scale_y;
124 double hspacing; // distance between letters, in pixels
126 uint32_t fade; // alpha from \fad
127 char be; // blur edges
129 + int drawing_mode; // not implemented; when != 0 text is discarded, except for style override tags
131 effect_t effect_type;
133 @@ -456,19 +457,19 @@
135 * \brief Mapping between script and screen coordinates
137 -static int x2scr(int x) {
138 +static int x2scr(double x) {
139 return x*frame_context.orig_width_nocrop / frame_context.track->PlayResX +
140 FFMAX(global_settings->left_margin, 0);
143 * \brief Mapping between script and screen coordinates
145 -static int y2scr(int y) {
146 +static int y2scr(double y) {
147 return y * frame_context.orig_height_nocrop / frame_context.track->PlayResY +
148 FFMAX(global_settings->top_margin, 0);
150 // the same for toptitles
151 -static int y2scr_top(int y) {
152 +static int y2scr_top(double y) {
153 if (global_settings->use_margins)
154 return y * frame_context.orig_height_nocrop / frame_context.track->PlayResY;
157 FFMAX(global_settings->top_margin, 0);
159 // the same for subtitles
160 -static int y2scr_sub(int y) {
161 +static int y2scr_sub(double y) {
162 if (global_settings->use_margins)
163 return y * frame_context.orig_height_nocrop / frame_context.track->PlayResY +
164 FFMAX(global_settings->top_margin, 0) +
165 @@ -679,11 +680,11 @@
166 * \param pwr multiplier for some tag effects (comes from \t tags)
168 static char* parse_tag(char* p, double pwr) {
169 -#define skip_all(x) if (*p == (x)) ++p; else { \
170 - while ((*p != (x)) && (*p != '}') && (*p != 0)) {++p;} }
171 +#define skip_to(x) while ((*p != (x)) && (*p != '}') && (*p != 0)) { ++p;}
172 #define skip(x) if (*p == (x)) ++p; else { return p; }
177 if ((*p == '}') || (*p == 0))
181 } else if (mystrcmp(&p, "move")) {
183 long long t1, t2, delta_t, t;
188 x1 = strtol(p, &p, 10);
190 } else if (mystrcmp(&p, "fn")) {
196 family = malloc(p - start + 1);
197 strncpy(family, start, p - start);
199 render_context.org_x = v1;
200 render_context.org_y = v2;
201 render_context.have_origin = 1;
202 + render_context.detect_collisions = 0;
203 } else if (mystrcmp(&p, "t")) {
209 p = parse_tag(p, k); // maybe k*pwr ? no, specs forbid nested \t's
210 - skip_all(')'); // FIXME: better skip(')'), but much more tags support required
211 + skip_to(')'); // in case there is some unknown tag or a comment
213 } else if (mystrcmp(&p, "clip")) {
216 @@ -1026,12 +1029,19 @@
217 render_context.shadow = val;
219 render_context.shadow = render_context.style->Shadow;
220 + } else if (mystrcmp(&p, "pbo")) {
221 + (void)strtol(p, &p, 10); // ignored
222 + } else if (mystrcmp(&p, "p")) {
224 + if (!mystrtoi(&p, 10, &val))
226 + render_context.drawing_mode = !!val;
237 @@ -1071,7 +1081,7 @@
241 - } else if (*(p+1) == 'n') {
242 + } else if ((*(p+1) == 'n') || (*(p+1) == 'h')) {
246 @@ -1201,6 +1211,7 @@
247 render_context.clip_y1 = frame_context.track->PlayResY;
248 render_context.detect_collisions = 1;
249 render_context.fade = 0;
250 + render_context.drawing_mode = 0;
251 render_context.effect_type = EF_NONE;
252 render_context.effect_timing = 0;
253 render_context.effect_skip_timing = 0;
254 @@ -1748,7 +1759,9 @@
256 // get next char, executing style override
257 // this affects render_context
258 - code = get_next_char(&p);
260 + code = get_next_char(&p);
261 + } while (code && render_context.drawing_mode); // skip everything in drawing mode
263 // face could have been changed in get_next_char
264 if (!render_context.font) {
265 @@ -1934,7 +1947,7 @@
266 if (render_context.evt_type == EVENT_POSITIONED) {
269 - mp_msg(MSGT_ASS, MSGL_DBG2, "positioned event at %d, %d\n", render_context.pos_x, render_context.pos_y);
270 + mp_msg(MSGT_ASS, MSGL_DBG2, "positioned event at %f, %f\n", render_context.pos_x, render_context.pos_y);
271 get_base_point(bbox, alignment, &base_x, &base_y);
272 device_x = x2scr(render_context.pos_x) - base_x;
273 device_y = y2scr(render_context.pos_y) - base_y;