~ubuntu-branches/ubuntu/lucid/vlc/lucid

« back to all changes in this revision

Viewing changes to extras/contrib/src/Patches/libass_mplayer_updates.patch

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-11-12 15:29:11 UTC
  • mfrom: (3.5.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091112152911-skpz5ubpg18zjedp
Tags: 1.0.3-1ubuntu1
* Merge from Debian unstable (LP: #435524), remaining changes:
  - build against xulrunner-dev instead of iceape-dev
  - build against libx264-dev and install libx264 plugin
  - add Xb-Npp header to vlc package
  - recommend vlc-plugin-pulse for vlc
  - backport patch "402_increase_pulseaudio_score.diff"

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -ruN libass-0.9.6-orig/libass/ass.c libass-0.9.6/libass/ass.c
2
 
--- libass-0.9.6-orig/libass/ass.c      2009-03-13 18:37:09.000000000 +0100
3
 
+++ libass-0.9.6/libass/ass.c   2009-06-28 02:48:51.000000000 +0200
4
 
@@ -56,7 +56,7 @@
5
 
 
6
 
 void ass_free_track(ass_track_t* track) {
7
 
        int i;
8
 
-       
9
 
+
10
 
        if (track->parser_priv) {
11
 
                if (track->parser_priv->fontname)
12
 
                        free(track->parser_priv->fontname);
13
 
@@ -85,14 +85,14 @@
14
 
 /// \return style id
15
 
 int ass_alloc_style(ass_track_t* track) {
16
 
        int sid;
17
 
-       
18
 
+
19
 
        assert(track->n_styles <= track->max_styles);
20
 
 
21
 
        if (track->n_styles == track->max_styles) {
22
 
                track->max_styles += ASS_STYLES_ALLOC;
23
 
                track->styles = (ass_style_t*)realloc(track->styles, sizeof(ass_style_t)*track->max_styles);
24
 
        }
25
 
-       
26
 
+
27
 
        sid = track->n_styles++;
28
 
        memset(track->styles + sid, 0, sizeof(ass_style_t));
29
 
        return sid;
30
 
@@ -103,14 +103,14 @@
31
 
 /// \return event id
32
 
 int ass_alloc_event(ass_track_t* track) {
33
 
        int eid;
34
 
-       
35
 
+
36
 
        assert(track->n_events <= track->max_events);
37
 
 
38
 
        if (track->n_events == track->max_events) {
39
 
                track->max_events += ASS_EVENTS_ALLOC;
40
 
                track->events = (ass_event_t*)realloc(track->events, sizeof(ass_event_t)*track->max_events);
41
 
        }
42
 
-       
43
 
+
44
 
        eid = track->n_events++;
45
 
        memset(track->events + eid, 0, sizeof(ass_event_t));
46
 
        return eid;
47
 
@@ -217,7 +217,7 @@
48
 
                if (target->name != NULL) free(target->name); \
49
 
                target->name = strdup(token); \
50
 
                mp_msg(MSGT_ASS, MSGL_DBG2, "%s = %s\n", #name, token);
51
 
-               
52
 
+
53
 
 #define COLORVAL(name) ANYVAL(name,string2color)
54
 
 #define INTVAL(name) ANYVAL(name,atoi)
55
 
 #define FPVAL(name) ANYVAL(name,atof)
56
 
@@ -261,7 +261,7 @@
57
 
  * \param event parsed data goes here
58
 
  * \param str string to parse, zero-terminated
59
 
  * \param n_ignored number of format options to skip at the beginning
60
 
-*/ 
61
 
+*/
62
 
 static int process_event_tail(ass_track_t* track, ass_event_t* event, char* str, int n_ignored)
63
 
 {
64
 
        char* token;
65
 
@@ -329,9 +329,9 @@
66
 
        ass_style_t* target;
67
 
        int sid;
68
 
        char** list = track->library->style_overrides;
69
 
-       
70
 
+
71
 
        if (!list) return;
72
 
-       
73
 
+
74
 
        for (fs = list; *fs; ++fs) {
75
 
                eq = strrchr(*fs, '=');
76
 
                if (!eq)
77
 
@@ -398,7 +398,7 @@
78
 
  * \param track track
79
 
  * \param str string to parse, zero-terminated
80
 
  * Allocates a new style struct.
81
 
-*/ 
82
 
+*/
83
 
 static int process_style(ass_track_t* track, char *str)
84
 
 {
85
 
 
86
 
@@ -426,9 +426,9 @@
87
 
        }
88
 
 
89
 
        q = format = strdup(track->style_format);
90
 
-       
91
 
+
92
 
        mp_msg(MSGT_ASS, MSGL_V, "[%p] Style: %s\n", track, str);
93
 
-       
94
 
+
95
 
        sid = ass_alloc_style(track);
96
 
 
97
 
        style = track->styles + sid;
98
 
@@ -436,13 +436,13 @@
99
 
 // fill style with some default values
100
 
        style->ScaleX = 100.;
101
 
        style->ScaleY = 100.;
102
 
-       
103
 
+
104
 
        while (1) {
105
 
                NEXT(q, tname);
106
 
                NEXT(p, token);
107
 
-               
108
 
+
109
 
 //             ALIAS(TertiaryColour,OutlineColour) // ignore TertiaryColour; it appears only in SSA, and is overridden by BackColour
110
 
-                       
111
 
+
112
 
                if (0) { // cool ;)
113
 
                        STRVAL(Name)
114
 
                                if ((strcmp(target->Name, "Default")==0) || (strcmp(target->Name, "*Default")==0))
115
 
@@ -494,7 +494,7 @@
116
 
        }
117
 
        free(format);
118
 
        return 0;
119
 
-       
120
 
+
121
 
 }
122
 
 
123
 
 static int process_styles_line(ass_track_t* track, char *str)
124
 
@@ -541,7 +541,7 @@
125
 
                // called directly from demuxer
126
 
                int eid;
127
 
                ass_event_t* event;
128
 
-               
129
 
+
130
 
                str += 9;
131
 
                skip_spaces(&str);
132
 
 
133
 
@@ -600,7 +600,7 @@
134
 
        }
135
 
        dsize = q - buf;
136
 
        assert(dsize <= size / 4 * 3 + 2);
137
 
-       
138
 
+
139
 
        if (track->library->extract_fonts) {
140
 
                ass_add_font(track->library, track->parser_priv->fontname, (char*)buf, dsize);
141
 
                buf = 0;
142
 
@@ -631,7 +631,7 @@
143
 
                mp_msg(MSGT_ASS, MSGL_V, "fontname: %s\n", track->parser_priv->fontname);
144
 
                return 0;
145
 
        }
146
 
-       
147
 
+
148
 
        if (!track->parser_priv->fontname) {
149
 
                mp_msg(MSGT_ASS, MSGL_V, "Not understood: %s  \n", str);
150
 
                return 0;
151
 
@@ -648,7 +648,7 @@
152
 
        }
153
 
        memcpy(track->parser_priv->fontdata + track->parser_priv->fontdata_used, str, len);
154
 
        track->parser_priv->fontdata_used += len;
155
 
-       
156
 
+
157
 
        return 0;
158
 
 }
159
 
 
160
 
@@ -656,7 +656,7 @@
161
 
  * \brief Parse a header line
162
 
  * \param track track
163
 
  * \param str string to parse, zero-terminated
164
 
-*/ 
165
 
+*/
166
 
 static int process_line(ass_track_t* track, char *str)
167
 
 {
168
 
        if (!strncasecmp(str, "[Script Info]", 13)) {
169
 
@@ -778,7 +778,7 @@
170
 
  * \param size length of data
171
 
  * \param timecode starting time of the event (milliseconds)
172
 
  * \param duration duration of the event (milliseconds)
173
 
-*/ 
174
 
+*/
175
 
 void ass_process_chunk(ass_track_t* track, char *data, int size, long long timecode, long long duration)
176
 
 {
177
 
        char* str;
178
 
@@ -791,7 +791,7 @@
179
 
                mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_EventFormatHeaderMissing);
180
 
                return;
181
 
        }
182
 
-       
183
 
+
184
 
        str = malloc(size + 1);
185
 
        memcpy(str, data, size);
186
 
        str[size] = '\0';
187
 
@@ -801,8 +801,8 @@
188
 
        event = track->events + eid;
189
 
 
190
 
        p = str;
191
 
-       
192
 
-       do { 
193
 
+
194
 
+       do {
195
 
                NEXT(p, token);
196
 
                event->ReadOrder = atoi(token);
197
 
                if (check_duplicate_event(track, event->ReadOrder))
198
 
@@ -815,7 +815,7 @@
199
 
 
200
 
                event->Start = timecode;
201
 
                event->Duration = duration;
202
 
-               
203
 
+
204
 
                free(str);
205
 
                return;
206
 
 //             dump_events(tid);
207
 
@@ -863,11 +863,11 @@
208
 
                char* op;
209
 
                size_t rc;
210
 
                int clear = 0;
211
 
-               
212
 
+
213
 
                outbuf = malloc(osize);
214
 
                ip = data;
215
 
                op = outbuf;
216
 
-               
217
 
+
218
 
                while (1) {
219
 
                        if (ileft)
220
 
                                rc = iconv(icdsc, &ip, &ileft, &op, &oleft);
221
 
@@ -898,7 +898,7 @@
222
 
                icdsc = (iconv_t)(-1);
223
 
                mp_msg(MSGT_ASS,MSGL_V,"LIBSUB: closed iconv descriptor.\n");
224
 
        }
225
 
-       
226
 
+
227
 
        return outbuf;
228
 
 }
229
 
 #endif // ICONV
230
 
@@ -927,7 +927,7 @@
231
 
                fclose(fp);
232
 
                return 0;
233
 
        }
234
 
-       
235
 
+
236
 
        sz = ftell(fp);
237
 
        rewind(fp);
238
 
 
239
 
@@ -936,9 +936,9 @@
240
 
                fclose(fp);
241
 
                return 0;
242
 
        }
243
 
-       
244
 
+
245
 
        mp_msg(MSGT_ASS, MSGL_V, "file size: %ld\n", sz);
246
 
-       
247
 
+
248
 
        buf = malloc(sz + 1);
249
 
        assert(buf);
250
 
        bytes_read = 0;
251
 
@@ -954,7 +954,7 @@
252
 
        } while (sz - bytes_read > 0);
253
 
        buf[sz] = '\0';
254
 
        fclose(fp);
255
 
-       
256
 
+
257
 
        if (bufsize)
258
 
                *bufsize = sz;
259
 
        return buf;
260
 
@@ -967,9 +967,9 @@
261
 
 {
262
 
        ass_track_t* track;
263
 
        int i;
264
 
-       
265
 
+
266
 
        track = ass_new_track(library);
267
 
-       
268
 
+
269
 
        // process header
270
 
        process_text(track, buf);
271
 
 
272
 
@@ -998,15 +998,15 @@
273
 
  * \param bufsize size of buffer
274
 
  * \param codepage recode buffer contents from given codepage
275
 
  * \return newly allocated track
276
 
-*/ 
277
 
+*/
278
 
 ass_track_t* ass_read_memory(ass_library_t* library, char* buf, size_t bufsize, char* codepage)
279
 
 {
280
 
        ass_track_t* track;
281
 
        int need_free = 0;
282
 
-       
283
 
+
284
 
        if (!buf)
285
 
                return 0;
286
 
-       
287
 
+
288
 
 #ifdef CONFIG_ICONV
289
 
        if (codepage)
290
 
                buf = sub_recode(buf, bufsize, codepage);
291
 
@@ -1029,7 +1029,7 @@
292
 
 {
293
 
        char* buf;
294
 
        size_t bufsize;
295
 
-       
296
 
+
297
 
        buf = read_file(fname, &bufsize);
298
 
        if (!buf)
299
 
                return 0;
300
 
@@ -1052,7 +1052,7 @@
301
 
  * \param fname file name
302
 
  * \param codepage recode buffer contents from given codepage
303
 
  * \return newly allocated track
304
 
-*/ 
305
 
+*/
306
 
 ass_track_t* ass_read_file(ass_library_t* library, char* fname, char* codepage)
307
 
 {
308
 
        char* buf;
309
 
@@ -1066,11 +1066,11 @@
310
 
        free(buf);
311
 
        if (!track)
312
 
                return 0;
313
 
-       
314
 
+
315
 
        track->name = strdup(fname);
316
 
 
317
 
        mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_AddedSubtitleFileFname, fname, track->n_styles, track->n_events);
318
 
-       
319
 
+
320
 
 //     dump_events(forced_tid);
321
 
        return track;
322
 
 }
323
 
@@ -1111,12 +1111,12 @@
324
 
 
325
 
        if (movement == 0) return 0;
326
 
        if (track->n_events == 0) return 0;
327
 
-       
328
 
+
329
 
        if (movement < 0)
330
 
                for (i = 0; (i < track->n_events) && ((long long)(track->events[i].Start + track->events[i].Duration) <= now); ++i) {}
331
 
        else
332
 
                for (i = track->n_events - 1; (i >= 0) && ((long long)(track->events[i].Start) > now); --i) {}
333
 
-       
334
 
+
335
 
        // -1 and n_events are ok
336
 
        assert(i >= -1); assert(i <= track->n_events);
337
 
        i += movement;
338
 
diff -ruN libass-0.9.6-orig/libass/ass.h libass-0.9.6/libass/ass.h
339
 
--- libass-0.9.6-orig/libass/ass.h      2009-03-13 18:37:09.000000000 +0100
340
 
+++ libass-0.9.6/libass/ass.h   2009-06-28 02:48:51.000000000 +0200
341
 
@@ -195,7 +195,7 @@
342
 
  * \param bufsize size of buffer
343
 
  * \param codepage recode buffer contents from given codepage
344
 
  * \return newly allocated track
345
 
-*/ 
346
 
+*/
347
 
 ass_track_t* ass_read_memory(ass_library_t* library, char* buf, size_t bufsize, char* codepage);
348
 
 /**
349
 
  * \brief read styles from file into already initialized track
350
 
diff -ruN libass-0.9.6-orig/libass/ass_bitmap.c libass-0.9.6/libass/ass_bitmap.c
351
 
--- libass-0.9.6-orig/libass/ass_bitmap.c       2009-03-13 18:37:09.000000000 +0100
352
 
+++ libass-0.9.6/libass/ass_bitmap.c    2009-06-28 02:48:51.000000000 +0200
353
 
@@ -237,7 +237,7 @@
354
 
        unsigned char* g = bm_g->buffer + (t - bm_g->top) * bm_g->w + (l - bm_g->left);
355
 
        unsigned char* o = bm_o->buffer + (t - bm_o->top) * bm_o->w + (l - bm_o->left);
356
 
        unsigned char* s = bm_s->buffer + (t - bm_s->top) * bm_s->w + (l - bm_s->left);
357
 
-       
358
 
+
359
 
        for (y = 0; y < b - t; ++y) {
360
 
                for (x = 0; x < r - l; ++x) {
361
 
                        unsigned char c_g, c_o;
362
 
@@ -309,7 +309,7 @@
363
 
        if (*bm_o)
364
 
                resize_tmp(priv_blur, (*bm_o)->w, (*bm_o)->h);
365
 
        resize_tmp(priv_blur, (*bm_g)->w, (*bm_g)->h);
366
 
-       
367
 
+
368
 
        if (be) {
369
 
                while (be--) {
370
 
                        if (*bm_o)
371
 
diff -ruN libass-0.9.6-orig/libass/ass_cache.c libass-0.9.6/libass/ass_cache.c
372
 
--- libass-0.9.6-orig/libass/ass_cache.c        2009-03-13 18:37:09.000000000 +0100
373
 
+++ libass-0.9.6/libass/ass_cache.c     2009-06-28 02:48:51.000000000 +0200
374
 
@@ -117,7 +117,7 @@
375
 
        if (map->count > 0 || map->hit_count + map->miss_count > 0)
376
 
                mp_msg(MSGT_ASS, MSGL_V, "cache statistics: \n  total accesses: %d\n  hits: %d\n  misses: %d\n  object count: %d\n",
377
 
                       map->hit_count + map->miss_count, map->hit_count, map->miss_count, map->count);
378
 
-       
379
 
+
380
 
        for (i = 0; i < map->nbuckets; ++i) {
381
 
                hashmap_item_t* item = map->root[i];
382
 
                while (item) {
383
 
@@ -254,7 +254,7 @@
384
 
  * \brief Get a bitmap from bitmap cache.
385
 
  * \param key hash key
386
 
  * \return requested hash val or 0 if not found
387
 
-*/ 
388
 
+*/
389
 
 bitmap_hash_val_t* cache_find_bitmap(bitmap_hash_key_t* key)
390
 
 {
391
 
        return hashmap_find(bitmap_cache, key);
392
 
@@ -302,7 +302,7 @@
393
 
  * \brief Get a glyph from glyph cache.
394
 
  * \param key hash key
395
 
  * \return requested hash val or 0 if not found
396
 
-*/ 
397
 
+*/
398
 
 glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key)
399
 
 {
400
 
        return hashmap_find(glyph_cache, key);
401
 
diff -ruN libass-0.9.6-orig/libass/ass_cache.h libass-0.9.6/libass/ass_cache.h
402
 
--- libass-0.9.6-orig/libass/ass_cache.h        2009-03-13 18:37:09.000000000 +0100
403
 
+++ libass-0.9.6/libass/ass_cache.h     2009-06-28 02:48:51.000000000 +0200
404
 
@@ -49,7 +49,7 @@
405
 
        int shift_x, shift_y; // shift vector that was added to glyph before applying rotation
406
 
                              // = 0, if frx = fry = frx = 0
407
 
                              // = (glyph base point) - (rotation origin), otherwise
408
 
-       
409
 
+
410
 
        FT_Vector advance; // subpixel shift vector
411
 
 } bitmap_hash_key_t;
412
 
 
413
 
@@ -110,7 +110,7 @@
414
 
 void ass_glyph_cache_reset(void);
415
 
 void ass_glyph_cache_done(void);
416
 
 
417
 
-typedef struct hashmap_s hashmap_t; 
418
 
+typedef struct hashmap_s hashmap_t;
419
 
 typedef void (*hashmap_item_dtor_t)(void* key, size_t key_size, void* value, size_t value_size);
420
 
 typedef int (*hashmap_key_compare_t)(void* key1, void* key2, size_t key_size);
421
 
 typedef unsigned (*hashmap_hash_t)(void* key, size_t key_size);
422
 
diff -ruN libass-0.9.6-orig/libass/ass_font.c libass-0.9.6/libass/ass_font.c
423
 
--- libass-0.9.6-orig/libass/ass_font.c 2009-03-13 18:37:09.000000000 +0100
424
 
+++ libass-0.9.6/libass/ass_font.c      2009-06-28 02:48:51.000000000 +0200
425
 
@@ -121,12 +121,14 @@
426
 
        FT_Face face;
427
 
        int error;
428
 
        int mem_idx;
429
 
-       
430
 
+
431
 
        if (font->n_faces == ASS_FONT_MAX_FACES)
432
 
                return -1;
433
 
-       
434
 
+
435
 
        path = fontconfig_select(fc_priv, font->desc.family, font->desc.treat_family_as_pattern, font->desc.bold,
436
 
                                              font->desc.italic, &index, ch);
437
 
+       if (!path)
438
 
+               return -1;
439
 
 
440
 
        mem_idx = find_font(font->library, path);
441
 
        if (mem_idx >= 0) {
442
 
@@ -145,7 +147,7 @@
443
 
        }
444
 
        charmap_magic(face);
445
 
        buggy_font_workaround(face);
446
 
-       
447
 
+
448
 
        font->faces[font->n_faces++] = face;
449
 
        update_transform(font);
450
 
        face_set_size(face, font->size);
451
 
@@ -164,7 +166,7 @@
452
 
        fontp = ass_font_cache_find(desc);
453
 
        if (fontp)
454
 
                return fontp;
455
 
-       
456
 
+
457
 
        font.library = library;
458
 
        font.ftlibrary = ftlibrary;
459
 
        font.n_faces = 0;
460
 
@@ -256,7 +258,7 @@
461
 
                        return;
462
 
                }
463
 
        }
464
 
-       
465
 
+
466
 
        *asc = *desc = 0;
467
 
 }
468
 
 
469
 
@@ -308,18 +310,18 @@
470
 
        case ASS_HINTING_NORMAL: flags = FT_LOAD_FORCE_AUTOHINT; break;
471
 
        case ASS_HINTING_NATIVE: flags = 0; break;
472
 
        }
473
 
-       
474
 
+
475
 
        error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP | flags);
476
 
        if (error) {
477
 
                mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph);
478
 
                return 0;
479
 
        }
480
 
-       
481
 
+
482
 
 #if (FREETYPE_MAJOR > 2) || \
483
 
     ((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR >= 2)) || \
484
 
     ((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR == 1) && (FREETYPE_PATCH >= 10))
485
 
 // FreeType >= 2.1.10 required
486
 
-       if (!(face->style_flags & FT_STYLE_FLAG_ITALIC) && 
487
 
+       if (!(face->style_flags & FT_STYLE_FLAG_ITALIC) &&
488
 
                        (font->desc.italic > 55)) {
489
 
                FT_GlyphSlot_Oblique(face->glyph);
490
 
        }
491
 
@@ -329,7 +331,7 @@
492
 
                mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph);
493
 
                return 0;
494
 
        }
495
 
-       
496
 
+
497
 
        return glyph;
498
 
 }
499
 
 
500
 
diff -ruN libass-0.9.6-orig/libass/ass_fontconfig.c libass-0.9.6/libass/ass_fontconfig.c
501
 
--- libass-0.9.6-orig/libass/ass_fontconfig.c   2009-03-13 18:37:09.000000000 +0100
502
 
+++ libass-0.9.6/libass/ass_fontconfig.c        2009-06-28 02:48:51.000000000 +0200
503
 
@@ -72,7 +72,7 @@
504
 
  * \param index out: font index inside a file
505
 
  * \param code: the character that should be present in the font, can be 0
506
 
  * \return font file path
507
 
-*/ 
508
 
+*/
509
 
 static char* _select_font(fc_instance_t* priv, const char* family, int treat_family_as_pattern,
510
 
                          unsigned bold, unsigned italic, int* index, uint32_t code)
511
 
 {
512
 
@@ -87,7 +87,7 @@
513
 
        int curf;
514
 
        char* retval = NULL;
515
 
        int family_cnt;
516
 
-       
517
 
+
518
 
        *index = 0;
519
 
 
520
 
        if (treat_family_as_pattern)
521
 
@@ -97,7 +97,7 @@
522
 
 
523
 
        if (!pat)
524
 
                goto error;
525
 
-       
526
 
+
527
 
        if (!treat_family_as_pattern) {
528
 
                FcPatternAddString(pat, FC_FAMILY, (const FcChar8*)family);
529
 
 
530
 
@@ -130,7 +130,7 @@
531
 
        FcPatternAddInteger(pat, FC_WEIGHT, bold);
532
 
 
533
 
        FcDefaultSubstitute(pat);
534
 
-       
535
 
+
536
 
        rc = FcConfigSubstitute(priv->config, pat, FcMatchPattern);
537
 
        if (!rc)
538
 
                goto error;
539
 
@@ -160,11 +160,13 @@
540
 
                goto error;
541
 
 
542
 
 #if (FC_VERSION >= 20297)
543
 
-       // Remove all extra family names from original pattern.
544
 
-       // After this, FcFontRenderPrepare will select the most relevant family
545
 
-       // name in case there are more than one of them.
546
 
-       for (; family_cnt > 1; --family_cnt)
547
 
-               FcPatternRemove(pat, FC_FAMILY, family_cnt - 1);
548
 
+       if (!treat_family_as_pattern) {
549
 
+               // Remove all extra family names from original pattern.
550
 
+               // After this, FcFontRenderPrepare will select the most relevant family
551
 
+               // name in case there are more than one of them.
552
 
+               for (; family_cnt > 1; --family_cnt)
553
 
+                       FcPatternRemove(pat, FC_FAMILY, family_cnt - 1);
554
 
+       }
555
 
 #endif
556
 
 
557
 
        rpat = FcFontRenderPrepare(priv->config, pat, fset->fonts[curf]);
558
 
@@ -233,7 +235,7 @@
559
 
  * \param index out: font index inside a file
560
 
  * \param code: the character that should be present in the font, can be 0
561
 
  * \return font file path
562
 
-*/ 
563
 
+*/
564
 
 char* fontconfig_select(fc_instance_t* priv, const char* family, int treat_family_as_pattern,
565
 
                        unsigned bold, unsigned italic, int* index, uint32_t code)
566
 
 {
567
 
@@ -247,23 +249,23 @@
568
 
        if (!res && priv->family_default) {
569
 
                res = _select_font(priv, priv->family_default, 0, bold, italic, index, code);
570
 
                if (res)
571
 
-                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFontFamily, 
572
 
+                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFontFamily,
573
 
                                        family, bold, italic, res, *index);
574
 
        }
575
 
        if (!res && priv->path_default) {
576
 
                res = priv->path_default;
577
 
                *index = priv->index_default;
578
 
-               mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFont, 
579
 
+               mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFont,
580
 
                       family, bold, italic, res, *index);
581
 
        }
582
 
        if (!res) {
583
 
                res = _select_font(priv, "Arial", 0, bold, italic, index, code);
584
 
                if (res)
585
 
-                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingArialFontFamily, 
586
 
+                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingArialFontFamily,
587
 
                                        family, bold, italic, res, *index);
588
 
        }
589
 
        if (res)
590
 
-               mp_msg(MSGT_ASS, MSGL_V, "fontconfig_select: (%s, %d, %d) -> %s, %d\n", 
591
 
+               mp_msg(MSGT_ASS, MSGL_V, "fontconfig_select: (%s, %d, %d) -> %s, %d\n",
592
 
                                family, bold, italic, res, *index);
593
 
        return res;
594
 
 }
595
 
@@ -314,7 +316,7 @@
596
 
  * \param idx index of the processed font in library->fontdata
597
 
  * With FontConfig >= 2.4.2, builds a font pattern in memory via FT_New_Memory_Face/FcFreeTypeQueryFace.
598
 
  * With older FontConfig versions, save the font to ~/.mplayer/fonts.
599
 
-*/ 
600
 
+*/
601
 
 static void process_fontdata(fc_instance_t* priv, ass_library_t* library, FT_Library ftlibrary, int idx)
602
 
 {
603
 
        int rc;
604
 
@@ -345,7 +347,7 @@
605
 
        } else if (!S_ISDIR(st.st_mode)) {
606
 
                mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_NotADirectory, fonts_dir);
607
 
        }
608
 
-       
609
 
+
610
 
        fname = validate_fname((char*)name);
611
 
 
612
 
        snprintf(buf, 1000, "%s/%s", fonts_dir, fname);
613
 
@@ -405,14 +407,14 @@
614
 
  * \param family default font family
615
 
  * \param path default font path
616
 
  * \return pointer to fontconfig private data
617
 
-*/ 
618
 
+*/
619
 
 fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, const char* family, const char* path, int fc)
620
 
 {
621
 
        int rc;
622
 
        fc_instance_t* priv = calloc(1, sizeof(fc_instance_t));
623
 
        const char* dir = library->fonts_dir;
624
 
        int i;
625
 
-       
626
 
+
627
 
        if (!fc) {
628
 
                mp_msg(MSGT_ASS, MSGL_WARN,
629
 
                       MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
630
 
@@ -495,9 +497,9 @@
631
 
        fc_instance_t* priv;
632
 
 
633
 
        mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
634
 
-       
635
 
+
636
 
        priv = calloc(1, sizeof(fc_instance_t));
637
 
-       
638
 
+
639
 
        priv->path_default = strdup(path);
640
 
        priv->index_default = 0;
641
 
        return priv;
642
 
diff -ruN libass-0.9.6-orig/libass/ass_library.c libass-0.9.6/libass/ass_library.c
643
 
--- libass-0.9.6-orig/libass/ass_library.c      2009-03-13 18:37:09.000000000 +0100
644
 
+++ libass-0.9.6/libass/ass_library.c   2009-06-28 02:48:51.000000000 +0200
645
 
@@ -62,13 +62,13 @@
646
 
        char** p;
647
 
        char** q;
648
 
        int cnt;
649
 
-       
650
 
+
651
 
        if (priv->style_overrides) {
652
 
                for (p = priv->style_overrides; *p; ++p)
653
 
                        free(*p);
654
 
                free(priv->style_overrides);
655
 
        }
656
 
-       
657
 
+
658
 
        if (!list) return;
659
 
 
660
 
        for (p = list, cnt = 0; *p; ++p, ++cnt) {}
661
 
@@ -91,14 +91,14 @@
662
 
        if (!name || !data || !size)
663
 
                return;
664
 
        grow_array((void**)&priv->fontdata, priv->num_fontdata, sizeof(*priv->fontdata));
665
 
-       
666
 
+
667
 
        priv->fontdata[idx].name = strdup(name);
668
 
-       
669
 
+
670
 
        priv->fontdata[idx].data = malloc(size);
671
 
        memcpy(priv->fontdata[idx].data, data, size);
672
 
-       
673
 
+
674
 
        priv->fontdata[idx].size = size;
675
 
-       
676
 
+
677
 
        priv->num_fontdata ++;
678
 
 }
679
 
 
680
 
diff -ruN libass-0.9.6-orig/libass/ass_render.c libass-0.9.6/libass/ass_render.c
681
 
--- libass-0.9.6-orig/libass/ass_render.c       2009-03-13 18:37:09.000000000 +0100
682
 
+++ libass-0.9.6/libass/ass_render.c    2009-06-28 02:51:52.000000000 +0200
683
 
@@ -119,7 +119,7 @@
684
 
        double blur; // gaussian blur
685
 
        double shadow;
686
 
        double frx, fry, frz; // rotation
687
 
-       
688
 
+
689
 
        bitmap_hash_key_t hash_key;
690
 
 } glyph_info_t;
691
 
 
692
 
@@ -141,11 +141,11 @@
693
 
 typedef struct render_context_s {
694
 
        ass_event_t* event;
695
 
        ass_style_t* style;
696
 
-       
697
 
+
698
 
        ass_font_t* font;
699
 
        char* font_path;
700
 
        double font_size;
701
 
-       
702
 
+
703
 
        FT_Stroker stroker;
704
 
        int alignment; // alignment overrides go here; if zero, style value will be used
705
 
        double frx, fry, frz;
706
 
@@ -185,7 +185,7 @@
707
 
        unsigned bold;
708
 
        unsigned italic;
709
 
        int treat_family_as_pattern;
710
 
-       
711
 
+
712
 
 } render_context_t;
713
 
 
714
 
 // frame-global data
715
 
@@ -248,13 +248,13 @@
716
 
        FT_Library ft;
717
 
        ass_renderer_t* priv = 0;
718
 
        int vmajor, vminor, vpatch;
719
 
-       
720
 
+
721
 
        memset(&render_context, 0, sizeof(render_context));
722
 
        memset(&frame_context, 0, sizeof(frame_context));
723
 
        memset(&text_info, 0, sizeof(text_info));
724
 
 
725
 
        error = FT_Init_FreeType( &ft );
726
 
-       if ( error ) { 
727
 
+       if ( error ) {
728
 
                mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FT_Init_FreeTypeFailed);
729
 
                goto ass_init_exit;
730
 
        }
731
 
@@ -276,14 +276,14 @@
732
 
        priv->library = library;
733
 
        priv->ftlibrary = ft;
734
 
        // images_root and related stuff is zero-filled in calloc
735
 
-       
736
 
+
737
 
        ass_font_cache_init();
738
 
        ass_bitmap_cache_init();
739
 
        ass_composite_cache_init();
740
 
        ass_glyph_cache_init();
741
 
 
742
 
        text_info.glyphs = calloc(MAX_GLYPHS, sizeof(glyph_info_t));
743
 
-       
744
 
+
745
 
 ass_init_exit:
746
 
        if (priv) mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_Init);
747
 
        else mp_msg(MSGT_ASS, MSGL_ERR, MSGTR_LIBASS_InitFailed);
748
 
@@ -316,7 +316,7 @@
749
 
 static ass_image_t* my_draw_bitmap(unsigned char* bitmap, int bitmap_w, int bitmap_h, int stride, int dst_x, int dst_y, uint32_t color)
750
 
 {
751
 
        ass_image_t* img = calloc(1, sizeof(ass_image_t));
752
 
-       
753
 
+
754
 
        img->w = bitmap_w;
755
 
        img->h = bitmap_h;
756
 
        img->stride = stride;
757
 
@@ -353,7 +353,7 @@
758
 
        dst_x += bm->left;
759
 
        dst_y += bm->top;
760
 
        brk -= bm->left;
761
 
-       
762
 
+
763
 
        // clipping
764
 
        clip_x0 = render_context.clip_x0;
765
 
        clip_y0 = render_context.clip_y0;
766
 
@@ -363,7 +363,7 @@
767
 
        b_y0 = 0;
768
 
        b_x1 = bm->w;
769
 
        b_y1 = bm->h;
770
 
-       
771
 
+
772
 
        tmp = dst_x - clip_x0;
773
 
        if (tmp < 0) {
774
 
                mp_msg(MSGT_ASS, MSGL_DBG2, "clip left\n");
775
 
@@ -384,13 +384,13 @@
776
 
                mp_msg(MSGT_ASS, MSGL_DBG2, "clip bottom\n");
777
 
                b_y1 = bm->h + tmp;
778
 
        }
779
 
-       
780
 
+
781
 
        if ((b_y0 >= b_y1) || (b_x0 >= b_x1))
782
 
                return tail;
783
 
 
784
 
        if (brk > b_x0) { // draw left part
785
 
                if (brk > b_x1) brk = b_x1;
786
 
-               img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + b_x0, 
787
 
+               img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + b_x0,
788
 
                        brk - b_x0, b_y1 - b_y0, bm->w,
789
 
                        dst_x + b_x0, dst_y + b_y0, color);
790
 
                *tail = img;
791
 
@@ -398,7 +398,7 @@
792
 
        }
793
 
        if (brk < b_x1) { // draw right part
794
 
                if (brk < b_x0) brk = b_x0;
795
 
-               img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + brk, 
796
 
+               img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + brk,
797
 
                        b_x1 - brk, b_y1 - b_y0, bm->w,
798
 
                        dst_x + brk, dst_y + b_y0, color2);
799
 
                *tail = img;
800
 
@@ -420,7 +420,7 @@
801
 
        char m;
802
 
        composite_hash_key_t hk;
803
 
        composite_hash_val_t *hv;
804
 
-       composite_hash_key_t *nhk;
805
 
+       composite_hash_val_t chv;
806
 
        int ax = (*last_tail)->dst_x;
807
 
        int ay = (*last_tail)->dst_y;
808
 
        int aw = (*last_tail)->w;
809
 
@@ -455,6 +455,7 @@
810
 
        cur_top = top-by;
811
 
 
812
 
        // Query cache
813
 
+       memset(&hk, 0, sizeof(hk));
814
 
        memcpy(&hk.a, last_hash, sizeof(*last_hash));
815
 
        memcpy(&hk.b, hash, sizeof(*hash));
816
 
        hk.aw = aw;
817
 
@@ -491,12 +492,9 @@
818
 
                }
819
 
 
820
 
        // Insert bitmaps into the cache
821
 
-       nhk = calloc(1, sizeof(*nhk));
822
 
-       memcpy(nhk, &hk, sizeof(*nhk));
823
 
-       hv = calloc(1, sizeof(*hv));
824
 
-       hv->a = (*last_tail)->bitmap;
825
 
-       hv->b = (*tail)->bitmap;
826
 
-       cache_add_composite(nhk, hv);
827
 
+       chv.a = (*last_tail)->bitmap;
828
 
+       chv.b = (*tail)->bitmap;
829
 
+       cache_add_composite( &hk, &chv);
830
 
 }
831
 
 
832
 
 /**
833
 
@@ -540,7 +538,7 @@
834
 
                pen_x = dst_x + info->pos.x;
835
 
                pen_y = dst_y + info->pos.y;
836
 
                bm = info->bm_o;
837
 
-               
838
 
+
839
 
                if ((info->effect_type == EF_KARAOKE_KO) && (info->effect_timing <= info->bbox.xMax)) {
840
 
                        // do nothing
841
 
                } else {
842
 
@@ -621,7 +619,7 @@
843
 
 static void compute_string_bbox( text_info_t* info, FT_BBox *abbox ) {
844
 
        FT_BBox bbox;
845
 
        int i;
846
 
-       
847
 
+
848
 
        if (text_info.length > 0) {
849
 
                bbox.xMin = 32000;
850
 
                bbox.xMax = -32000;
851
 
@@ -692,7 +690,7 @@
852
 
 
853
 
        render_context.font = ass_font_new(priv->library, priv->ftlibrary, priv->fontconfig_priv, &desc);
854
 
        free(desc.family);
855
 
-       
856
 
+
857
 
        if (render_context.font)
858
 
                change_font_size(render_context.font_size);
859
 
 }
860
 
@@ -778,7 +776,7 @@
861
 
  * \brief Calculate alpha value by piecewise linear function
862
 
  * Used for \fad, \fade implementation.
863
 
  */
864
 
-static unsigned interpolate_alpha(long long now, 
865
 
+static unsigned interpolate_alpha(long long now,
866
 
                long long t1, long long t2, long long t3, long long t4,
867
 
                unsigned a1, unsigned a2, unsigned a3)
868
 
 {
869
 
@@ -811,7 +809,7 @@
870
 
 static char* parse_tag(char* p, double pwr) {
871
 
 #define skip_to(x) while ((*p != (x)) && (*p != '}') && (*p != 0)) { ++p;}
872
 
 #define skip(x) if (*p == (x)) ++p; else { return p; }
873
 
-       
874
 
+
875
 
        skip_to('\\');
876
 
        skip('\\');
877
 
        if ((*p == '}') || (*p == 0))
878
 
@@ -919,7 +917,7 @@
879
 
                        mystrtoll(&p, &t1);
880
 
                        skip(',');
881
 
                        mystrtoll(&p, &t2);
882
 
-                       mp_msg(MSGT_ASS, MSGL_DBG2, "movement6: (%f, %f) -> (%f, %f), (%" PRId64 " .. %" PRId64 ")\n", 
883
 
+                       mp_msg(MSGT_ASS, MSGL_DBG2, "movement6: (%f, %f) -> (%f, %f), (%" PRId64 " .. %" PRId64 ")\n",
884
 
                                x1, y1, x2, y2, (int64_t)t1, (int64_t)t2);
885
 
                } else {
886
 
                        t1 = 0;
887
 
@@ -1111,7 +1109,7 @@
888
 
                        k = pow(((double)(t - t1)) / delta_t, v3);
889
 
                }
890
 
                while (*p == '\\')
891
 
-                       p = parse_tag(p, k); // maybe k*pwr ? no, specs forbid nested \t's 
892
 
+                       p = parse_tag(p, k); // maybe k*pwr ? no, specs forbid nested \t's
893
 
                skip_to(')'); // in case there is some unknown tag or a comment
894
 
                skip(')');
895
 
        } else if (mystrcmp(&p, "clip")) {
896
 
@@ -1293,7 +1291,7 @@
897
 
        while (cnt < 4 && (p = strchr(p, ';'))) {
898
 
                v[cnt++] = atoi(++p);
899
 
        }
900
 
-       
901
 
+
902
 
        if (strncmp(event->Effect, "Banner;", 7) == 0) {
903
 
                int delay;
904
 
                if (cnt < 1) {
905
 
@@ -1406,7 +1404,7 @@
906
 
        render_context.effect_type = EF_NONE;
907
 
        render_context.effect_timing = 0;
908
 
        render_context.effect_skip_timing = 0;
909
 
-       
910
 
+
911
 
        apply_transition_effects(event);
912
 
 }
913
 
 
914
 
@@ -1429,6 +1427,7 @@
915
 
        int error;
916
 
        glyph_hash_val_t* val;
917
 
        glyph_hash_key_t key;
918
 
+       memset(&key, 0, sizeof(key));
919
 
        key.font = render_context.font;
920
 
        key.size = render_context.font_size;
921
 
        key.ch = symbol;
922
 
@@ -1490,10 +1489,10 @@
923
 
 {
924
 
        bitmap_hash_val_t* val;
925
 
        bitmap_hash_key_t* key = &info->hash_key;
926
 
-       
927
 
+
928
 
        val = cache_find_bitmap(key);
929
 
 /*     val = 0; */
930
 
-       
931
 
+
932
 
        if (val) {
933
 
                info->bm = val->bm;
934
 
                info->bm_o = val->bm_o;
935
 
@@ -1600,8 +1599,8 @@
936
 
                        break_at = i;
937
 
                        mp_msg(MSGT_ASS, MSGL_DBG2, "forced line break at %d\n", break_at);
938
 
                }
939
 
-               
940
 
-               if (len >= max_text_width) {
941
 
+
942
 
+               if ((len >= max_text_width) && (frame_context.track->WrapStyle != 2)) {
943
 
                        break_type = 1;
944
 
                        break_at = last_space;
945
 
                        if (break_at == -1)
946
 
@@ -1617,7 +1616,7 @@
947
 
                        // marking break_at+1 as start of a new line
948
 
                        int lead = break_at + 1; // the first symbol of the new line
949
 
                        if (text_info.n_lines >= MAX_LINES) {
950
 
-                               // to many lines ! 
951
 
+                               // to many lines !
952
 
                                // no more linebreaks
953
 
                                for (j = lead; j < text_info.length; ++j)
954
 
                                        text_info.glyphs[j].linebreak = 0;
955
 
@@ -1630,7 +1629,7 @@
956
 
                        s_offset = s1->bbox.xMin + s1->pos.x;
957
 
                        text_info.n_lines ++;
958
 
                }
959
 
-               
960
 
+
961
 
                if (cur->symbol == ' ')
962
 
                        last_space = i;
963
 
 
964
 
@@ -1676,11 +1675,11 @@
965
 
                        if (i == text_info.length)
966
 
                                break;
967
 
                }
968
 
-               
969
 
+
970
 
        }
971
 
        assert(text_info.n_lines >= 1);
972
 
 #undef DIFF
973
 
-       
974
 
+
975
 
        measure_text();
976
 
 
977
 
        pen_shift_x = 0;
978
 
@@ -1704,7 +1703,7 @@
979
 
  * \brief determine karaoke effects
980
 
  * Karaoke effects cannot be calculated during parse stage (get_next_char()),
981
 
  * so they are done in a separate step.
982
 
- * Parse stage: when karaoke style override is found, its parameters are stored in the next glyph's 
983
 
+ * Parse stage: when karaoke style override is found, its parameters are stored in the next glyph's
984
 
  * (the first glyph of the karaoke word)'s effect_type and effect_timing.
985
 
  * This function:
986
 
  * 1. sets effect_type for all glyphs in the word (_karaoke_ word)
987
 
@@ -1873,12 +1872,13 @@
988
 
 /**
989
 
  * \brief Main ass rendering function, glues everything together
990
 
  * \param event event to render
991
 
+ * \param event_images struct containing resulting images, will also be initialized
992
 
  * Process event, appending resulting ass_image_t's to images_root.
993
 
  */
994
 
 static int ass_render_event(ass_event_t* event, event_images_t* event_images)
995
 
 {
996
 
        char* p;
997
 
-       FT_UInt previous; 
998
 
+       FT_UInt previous;
999
 
        FT_UInt num_glyphs;
1000
 
        FT_Vector pen;
1001
 
        unsigned code;
1002
 
@@ -1914,7 +1914,7 @@
1003
 
                do {
1004
 
                        code = get_next_char(&p);
1005
 
                } while (code && render_context.drawing_mode); // skip everything in drawing mode
1006
 
-               
1007
 
+
1008
 
                // face could have been changed in get_next_char
1009
 
                if (!render_context.font) {
1010
 
                        free_render_context();
1011
 
@@ -1925,7 +1925,7 @@
1012
 
                        break;
1013
 
 
1014
 
                if (text_info.length >= MAX_GLYPHS) {
1015
 
-                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_MAX_GLYPHS_Reached, 
1016
 
+                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_MAX_GLYPHS_Reached,
1017
 
                                        (int)(event - frame_context.track->events), event->Start, event->Duration, event->Text);
1018
 
                        break;
1019
 
                }
1020
 
@@ -1951,14 +1951,14 @@
1021
 
                                       &shift );
1022
 
 
1023
 
                get_outline_glyph(code, text_info.glyphs + text_info.length, &shift);
1024
 
-               
1025
 
+
1026
 
                text_info.glyphs[text_info.length].pos.x = pen.x >> 6;
1027
 
                text_info.glyphs[text_info.length].pos.y = pen.y >> 6;
1028
 
-               
1029
 
+
1030
 
                pen.x += text_info.glyphs[text_info.length].advance.x;
1031
 
                pen.x += double_to_d6(render_context.hspacing);
1032
 
                pen.y += text_info.glyphs[text_info.length].advance.y;
1033
 
-               
1034
 
+
1035
 
                previous = code;
1036
 
 
1037
 
                text_info.glyphs[text_info.length].symbol = code;
1038
 
@@ -2005,23 +2005,23 @@
1039
 
                render_context.effect_timing = 0;
1040
 
                render_context.effect_skip_timing = 0;
1041
 
        }
1042
 
-       
1043
 
+
1044
 
        if (text_info.length == 0) {
1045
 
                // no valid symbols in the event; this can be smth like {comment}
1046
 
                free_render_context();
1047
 
                return 1;
1048
 
        }
1049
 
-       
1050
 
+
1051
 
        // depends on glyph x coordinates being monotonous, so it should be done before line wrap
1052
 
        process_karaoke_effects();
1053
 
-       
1054
 
+
1055
 
        // alignments
1056
 
        alignment = render_context.alignment;
1057
 
        halign = alignment & 3;
1058
 
        valign = alignment & 12;
1059
 
 
1060
 
-       MarginL = (event->MarginL) ? event->MarginL : render_context.style->MarginL; 
1061
 
-       MarginR = (event->MarginR) ? event->MarginR : render_context.style->MarginR; 
1062
 
+       MarginL = (event->MarginL) ? event->MarginL : render_context.style->MarginL;
1063
 
+       MarginR = (event->MarginR) ? event->MarginR : render_context.style->MarginR;
1064
 
        MarginV = (event->MarginV) ? event->MarginV : render_context.style->MarginV;
1065
 
 
1066
 
        if (render_context.evt_type != EVENT_HSCROLL) {
1067
 
@@ -2061,12 +2061,12 @@
1068
 
        } else { // render_context.evt_type == EVENT_HSCROLL
1069
 
                measure_text();
1070
 
        }
1071
 
-       
1072
 
+
1073
 
        // determing text bounding box
1074
 
        compute_string_bbox(&text_info, &bbox);
1075
 
-       
1076
 
+
1077
 
        // determine device coordinates for text
1078
 
-       
1079
 
+
1080
 
        // x coordinate for everything except positioned events
1081
 
        if (render_context.evt_type == EVENT_NORMAL ||
1082
 
            render_context.evt_type == EVENT_VSCROLL) {
1083
 
@@ -2111,7 +2111,7 @@
1084
 
                device_x = x2scr_pos(render_context.pos_x) - base_x;
1085
 
                device_y = y2scr_pos(render_context.pos_y) - base_y;
1086
 
        }
1087
 
-       
1088
 
+
1089
 
        // fix clip coordinates (they depend on alignment)
1090
 
        if (render_context.evt_type == EVENT_NORMAL ||
1091
 
            render_context.evt_type == EVENT_HSCROLL ||
1092
 
@@ -2138,7 +2138,7 @@
1093
 
        // calculate rotation parameters
1094
 
        {
1095
 
                FT_Vector center;
1096
 
-               
1097
 
+
1098
 
                if (render_context.have_origin) {
1099
 
                        center.x = x2scr(render_context.org_x);
1100
 
                        center.y = y2scr(render_context.org_y);
1101
 
@@ -2166,6 +2166,7 @@
1102
 
        for (i = 0; i < text_info.length; ++i)
1103
 
                get_bitmap_glyph(text_info.glyphs + i);
1104
 
 
1105
 
+       memset(event_images, 0, sizeof(*event_images));
1106
 
        event_images->top = device_y - d6_to_int(text_info.lines[0].asc);
1107
 
        event_images->height = d6_to_int(text_info.height);
1108
 
        event_images->detect_collisions = render_context.detect_collisions;
1109
 
@@ -2174,7 +2175,7 @@
1110
 
        event_images->imgs = render_text(&text_info, device_x, device_y);
1111
 
 
1112
 
        free_render_context();
1113
 
-       
1114
 
+
1115
 
        return 0;
1116
 
 }
1117
 
 
1118
 
@@ -2300,7 +2301,7 @@
1119
 
 
1120
 
        if (track->n_events == 0)
1121
 
                return 1; // nothing to do
1122
 
-       
1123
 
+
1124
 
        frame_context.ass_priv = priv;
1125
 
        frame_context.width = global_settings->frame_width;
1126
 
        frame_context.height = global_settings->frame_height;
1127
 
@@ -2316,7 +2317,7 @@
1128
 
        frame_context.time = now;
1129
 
 
1130
 
        ass_lazy_track_init();
1131
 
-       
1132
 
+
1133
 
        frame_context.font_scale = global_settings->font_size_coeff *
1134
 
                                   frame_context.orig_height / frame_context.track->PlayResY;
1135
 
        if (frame_context.track->ScaledBorderAndShadow)
1136
 
@@ -2426,7 +2427,7 @@
1137
 
        fixed[*cnt].b = s->b + shift;
1138
 
        (*cnt)++;
1139
 
        qsort(fixed, *cnt, sizeof(segment_t), cmp_segment);
1140
 
-       
1141
 
+
1142
 
        return shift;
1143
 
 }
1144
 
 
1145
 
@@ -2481,7 +2482,7 @@
1146
 
                        priv->top = imgs[i].top;
1147
 
                        priv->height = imgs[i].height;
1148
 
                }
1149
 
-               
1150
 
+
1151
 
        }
1152
 
 }
1153
 
 
1154
 
@@ -2554,7 +2555,7 @@
1155
 
        int i, cnt, rc;
1156
 
        event_images_t* last;
1157
 
        ass_image_t** tail;
1158
 
-       
1159
 
+
1160
 
        // init frame
1161
 
        rc = ass_start_frame(priv, track, now);
1162
 
        if (rc != 0)
1163
 
@@ -2600,7 +2601,7 @@
1164
 
 
1165
 
        if (detect_change)
1166
 
                *detect_change = ass_detect_change(priv);
1167
 
-       
1168
 
+
1169
 
        // free the previous image list
1170
 
        ass_free_images(priv->prev_images_root);
1171
 
        priv->prev_images_root = 0;
1172
 
diff -ruN libass-0.9.6-orig/libass/ass_types.h libass-0.9.6/libass/ass_types.h
1173
 
--- libass-0.9.6-orig/libass/ass_types.h        2009-03-13 18:37:09.000000000 +0100
1174
 
+++ libass-0.9.6/libass/ass_types.h     2009-06-28 02:48:51.000000000 +0200
1175
 
@@ -100,7 +100,7 @@
1176
 
        char* event_format; // event format line
1177
 
 
1178
 
        enum {TRACK_TYPE_UNKNOWN = 0, TRACK_TYPE_ASS, TRACK_TYPE_SSA} track_type;
1179
 
-       
1180
 
+
1181
 
        // script header fields
1182
 
        int PlayResX;
1183
 
        int PlayResY;
1184
 
@@ -108,7 +108,7 @@
1185
 
        int WrapStyle;
1186
 
        char ScaledBorderAndShadow;
1187
 
 
1188
 
-       
1189
 
+
1190
 
        int default_style; // index of default style
1191
 
        char* name; // file name in case of external subs, 0 for streams
1192
 
 
1193
 
diff -ruN libass-0.9.6-orig/libass/ass_utils.c libass-0.9.6/libass/ass_utils.c
1194
 
--- libass-0.9.6-orig/libass/ass_utils.c        2009-03-13 18:37:09.000000000 +0100
1195
 
+++ libass-0.9.6/libass/ass_utils.c     2009-06-28 02:48:51.000000000 +0200
1196
 
@@ -72,17 +72,17 @@
1197
 
        uint32_t color = 0;
1198
 
        int result;
1199
 
        char* p = *q;
1200
 
-       
1201
 
-       if (*p == '&') ++p; 
1202
 
+
1203
 
+       if (*p == '&') ++p;
1204
 
        else mp_msg(MSGT_ASS, MSGL_DBG2, "suspicious color format: \"%s\"\n", p);
1205
 
-       
1206
 
-       if (*p == 'H' || *p == 'h') { 
1207
 
+
1208
 
+       if (*p == 'H' || *p == 'h') {
1209
 
                ++p;
1210
 
                result = mystrtou32(&p, 16, &color);
1211
 
        } else {
1212
 
                result = mystrtou32(&p, 0, &color);
1213
 
        }
1214
 
-       
1215
 
+
1216
 
        {
1217
 
                unsigned char* tmp = (unsigned char*)(&color);
1218
 
                unsigned char b;