Commit 68417974 authored by hartman's avatar hartman

libass: upgrade libass contrib with the latest enhancements from Mplayer.

\h patch was removed because it's now include in the mplayer version.
parent e713ca1d
......@@ -2442,10 +2442,10 @@ DISTCLEAN_PKG += schroedinger-$(SCHROED_VERSION).tar.gz
libass-$(ASS_VERSION).tar.bz2:
$(WGET) $(ASS_URL)
# mplayer patches up to August 8, 2008 are included
libass: libass-$(ASS_VERSION).tar.bz2
$(EXTRACT_BZ2)
patch -p0 < Patches/libass_mplayer_updates.patch
cd $@; patch -p0 < ../Patches/libass-h-char-fix.patch
ifneq ($(HOST),$(BUILD))
patch -p0 < Patches/libass-cross.patch
cd $@; autoconf
......
Index: libass/ass_render.c
===================================================================
--- libass/ass_render.c (revision 15)
+++ libass/ass_render.c (working copy)
@@ -1071,7 +1071,7 @@
p += 2;
*str = p;
return '\n';
- } else if (*(p+1) == 'n') {
+ } else if ((*(p+1) == 'n') || (*(p+1) == 'h')) {
p += 2;
*str = p;
return ' ';
diff -ruN libass/libass/ass.c libass.update/libass/ass.c
diff -ruN libass-0.9.5/libass/ass.c libass-0.9.5-patched/libass/ass.c
--- libass/libass/ass.c 2008-05-22 20:01:18.000000000 +0200
+++ libass.update/libass/ass.c 2008-08-04 04:10:14.000000000 +0200
+++ libass-0.9.5-patched/libass/ass.c 2008-08-08 23:59:21.000000000 +0200
@@ -846,16 +846,22 @@
char* ip;
char* op;
......@@ -38,9 +38,24 @@ diff -ruN libass/libass/ass.c libass.update/libass/ass.c
}
outbuf[osize - oleft - 1] = 0;
}
diff -ruN libass/libass/ass_fontconfig.c libass.update/libass/ass_fontconfig.c
diff -ruN libass-0.9.5/libass/ass_bitmap.c libass-0.9.5-patched/libass/ass_bitmap.c
--- libass/libass/ass_bitmap.c 2008-05-22 20:01:18.000000000 +0200
+++ libass-0.9.5-patched/libass/ass_bitmap.c 2008-08-09 00:04:36.000000000 +0200
@@ -274,9 +274,10 @@
resize_tmp(priv, (*bm_g)->w, (*bm_g)->h);
if (be) {
- blur((*bm_g)->buffer, priv->tmp, (*bm_g)->w, (*bm_g)->h, (*bm_g)->w, (int*)priv->gt2, priv->g_r, priv->g_w);
if (*bm_o)
blur((*bm_o)->buffer, priv->tmp, (*bm_o)->w, (*bm_o)->h, (*bm_o)->w, (int*)priv->gt2, priv->g_r, priv->g_w);
+ else
+ blur((*bm_g)->buffer, priv->tmp, (*bm_g)->w, (*bm_g)->h, (*bm_g)->w, (int*)priv->gt2, priv->g_r, priv->g_w);
}
if (*bm_o)
diff -ruN libass-0.9.5/libass/ass_fontconfig.c libass-0.9.5-patched/libass/ass_fontconfig.c
--- libass/libass/ass_fontconfig.c 2008-05-22 20:01:18.000000000 +0200
+++ libass.update/libass/ass_fontconfig.c 2008-08-04 04:14:45.000000000 +0200
+++ libass-0.9.5-patched/libass/ass_fontconfig.c 2008-08-08 23:59:21.000000000 +0200
@@ -129,6 +129,8 @@
goto error;
......@@ -93,10 +108,61 @@ diff -ruN libass/libass/ass_fontconfig.c libass.update/libass/ass_fontconfig.c
priv->family_default = family ? strdup(family) : 0;
priv->path_default = path ? strdup(path) : 0;
diff -ruN libass/libass/ass_render.c libass.update/libass/ass_render.c
diff -ruN libass-0.9.5/libass/ass_render.c libass-0.9.5-patched/libass/ass_render.c
--- libass/libass/ass_render.c 2008-05-22 20:01:18.000000000 +0200
+++ libass.update/libass/ass_render.c 2008-08-04 04:16:01.000000000 +0200
@@ -679,11 +679,11 @@
+++ libass-0.9.5-patched/libass/ass_render.c 2008-08-09 00:04:28.000000000 +0200
@@ -149,8 +149,8 @@
EVENT_HSCROLL, // "Banner" transition effect, text_width is unlimited
EVENT_VSCROLL // "Scroll up", "Scroll down" transition effects
} evt_type;
- int pos_x, pos_y; // position
- int org_x, org_y; // origin
+ double pos_x, pos_y; // position
+ double org_x, org_y; // origin
char have_origin; // origin is explicitly defined; if 0, get_base_point() is used
double scale_x, scale_y;
double hspacing; // distance between letters, in pixels
@@ -161,6 +161,7 @@
uint32_t fade; // alpha from \fad
char be; // blur edges
int shadow;
+ int drawing_mode; // not implemented; when != 0 text is discarded, except for style override tags
effect_t effect_type;
int effect_timing;
@@ -456,19 +457,19 @@
/**
* \brief Mapping between script and screen coordinates
*/
-static int x2scr(int x) {
+static int x2scr(double x) {
return x*frame_context.orig_width_nocrop / frame_context.track->PlayResX +
FFMAX(global_settings->left_margin, 0);
}
/**
* \brief Mapping between script and screen coordinates
*/
-static int y2scr(int y) {
+static int y2scr(double y) {
return y * frame_context.orig_height_nocrop / frame_context.track->PlayResY +
FFMAX(global_settings->top_margin, 0);
}
// the same for toptitles
-static int y2scr_top(int y) {
+static int y2scr_top(double y) {
if (global_settings->use_margins)
return y * frame_context.orig_height_nocrop / frame_context.track->PlayResY;
else
@@ -476,7 +477,7 @@
FFMAX(global_settings->top_margin, 0);
}
// the same for subtitles
-static int y2scr_sub(int y) {
+static int y2scr_sub(double y) {
if (global_settings->use_margins)
return y * frame_context.orig_height_nocrop / frame_context.track->PlayResY +
FFMAX(global_settings->top_margin, 0) +
@@ -679,11 +680,11 @@
* \param pwr multiplier for some tag effects (comes from \t tags)
*/
static char* parse_tag(char* p, double pwr) {
......@@ -111,7 +177,16 @@ diff -ruN libass/libass/ass_render.c libass.update/libass/ass_render.c
if ((*p == '}') || (*p == 0))
return p;
@@ -787,7 +787,7 @@
@@ -727,7 +728,7 @@
} else if (mystrcmp(&p, "move")) {
int x1, x2, y1, y2;
long long t1, t2, delta_t, t;
- int x, y;
+ double x, y;
double k;
skip('(');
x1 = strtol(p, &p, 10);
@@ -787,7 +788,7 @@
} else if (mystrcmp(&p, "fn")) {
char* start = p;
char* family;
......@@ -120,7 +195,15 @@ diff -ruN libass/libass/ass_render.c libass.update/libass/ass_render.c
if (p > start) {
family = malloc(p - start + 1);
strncpy(family, start, p - start);
@@ -928,7 +928,8 @@
@@ -888,6 +889,7 @@
render_context.org_x = v1;
render_context.org_y = v2;
render_context.have_origin = 1;
+ render_context.detect_collisions = 0;
} else if (mystrcmp(&p, "t")) {
double v[3];
int v1, v2;
@@ -928,7 +930,8 @@
}
while (*p == '\\')
p = parse_tag(p, k); // maybe k*pwr ? no, specs forbid nested \t's
......@@ -130,7 +213,19 @@ diff -ruN libass/libass/ass_render.c libass.update/libass/ass_render.c
} else if (mystrcmp(&p, "clip")) {
int x0, y0, x1, y1;
int res = 1;
@@ -1031,7 +1032,7 @@
@@ -1026,12 +1029,19 @@
render_context.shadow = val;
else
render_context.shadow = render_context.style->Shadow;
+ } else if (mystrcmp(&p, "pbo")) {
+ (void)strtol(p, &p, 10); // ignored
+ } else if (mystrcmp(&p, "p")) {
+ int val;
+ if (!mystrtoi(&p, 10, &val))
+ val = 0;
+ render_context.drawing_mode = !!val;
}
return p;
#undef skip
......@@ -139,3 +234,40 @@ diff -ruN libass/libass/ass_render.c libass.update/libass/ass_render.c
}
/**
@@ -1071,7 +1081,7 @@
p += 2;
*str = p;
return '\n';
- } else if (*(p+1) == 'n') {
+ } else if ((*(p+1) == 'n') || (*(p+1) == 'h')) {
p += 2;
*str = p;
return ' ';
@@ -1201,6 +1211,7 @@
render_context.clip_y1 = frame_context.track->PlayResY;
render_context.detect_collisions = 1;
render_context.fade = 0;
+ render_context.drawing_mode = 0;
render_context.effect_type = EF_NONE;
render_context.effect_timing = 0;
render_context.effect_skip_timing = 0;
@@ -1748,7 +1759,9 @@
while (1) {
// get next char, executing style override
// this affects render_context
- code = get_next_char(&p);
+ do {
+ code = get_next_char(&p);
+ } while (code && render_context.drawing_mode); // skip everything in drawing mode
// face could have been changed in get_next_char
if (!render_context.font) {
@@ -1934,7 +1947,7 @@
if (render_context.evt_type == EVENT_POSITIONED) {
int base_x = 0;
int base_y = 0;
- mp_msg(MSGT_ASS, MSGL_DBG2, "positioned event at %d, %d\n", render_context.pos_x, render_context.pos_y);
+ mp_msg(MSGT_ASS, MSGL_DBG2, "positioned event at %f, %f\n", render_context.pos_x, render_context.pos_y);
get_base_point(bbox, alignment, &base_x, &base_y);
device_x = x2scr(render_context.pos_x) - base_x;
device_y = y2scr(render_context.pos_y) - base_y;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment