From 2f6713bedeb77a7c058ce4954eb95ee7a2ca7119 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 11 Oct 2012 02:23:22 +0200 Subject: sub: enable sub-pos with libass The --sub-pos option and sub-pos property control the vertical position of a subtitle. Also change how sub-pos is handled in the old subtitle renderer (used with -no-ass). The new behavior doesn't render subtitles out of the screen if the subtitle is located near the top screen border and has too many lines. --- sub/ass_mp.c | 3 +++ sub/osd_libass.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sub/ass_mp.c b/sub/ass_mp.c index 202664578b..e2729df8ca 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -232,6 +232,9 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, ass_set_frame_size(priv, dim->w, dim->h); ass_set_margins(priv, dim->mt, dim->mb, dim->ml, dim->mr); ass_set_use_margins(priv, opts->ass_use_margins); +#if LIBASS_VERSION >= 0x01010000 + ass_set_line_position(priv, 100 - sub_pos); +#endif ass_set_font_scale(priv, opts->ass_font_scale); if (!unscaled && (opts->ass_hinting & 4)) hinting = 0; diff --git a/sub/osd_libass.c b/sub/osd_libass.c index e770215ce6..9b0bbb01ab 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -345,8 +345,10 @@ void vo_update_text_sub(struct osd_state *osd, mp_osd_obj_t* obj) ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style; - style->MarginV = obj->osd_track->PlayResY * ((100 - sub_pos)/110.0); update_font_scale(obj->osd_track, style, text_font_scale_factor); +#if LIBASS_VERSION >= 0x01010000 + ass_set_line_position(osd->osd_render, 100 - sub_pos); +#endif char *text = talloc_strdup(NULL, ""); -- cgit v1.2.3