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.
This commit is contained in:
wm4 2012-10-11 02:23:22 +02:00
parent fd56c168ae
commit 2f6713bede
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -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, "");