summaryrefslogtreecommitdiffstats
path: root/sub/osd_libass.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub/osd_libass.c')
-rw-r--r--sub/osd_libass.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index d157f7925c..cbf9466780 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -89,7 +89,7 @@ static void create_osd_ass_track(struct osd_state *osd, struct osd_object *obj)
ASS_Style *style = track->styles + sid;
style->Alignment = 5; // top-title, left
style->Name = strdup("OSD");
- mp_ass_set_style(style, osd->opts->osd_style);
+ mp_ass_set_style(style, MP_ASS_FONT_PLAYRESY, osd->opts->osd_style);
// Set to neutral base direction, as opposed to VSFilter LTR default
style->Encoding = -1;
}
@@ -158,7 +158,7 @@ static void update_osd(struct osd_state *osd, struct osd_object *obj)
font.font_size *= opts->osd_scale;
ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style;
- mp_ass_set_style(style, &font);
+ mp_ass_set_style(style, obj->osd_track->PlayResY, &font);
char *text = mangle_ass(osd->osd_text);
add_osd_ass_event(obj->osd_track, text);
@@ -354,7 +354,7 @@ static void update_sub(struct osd_state *osd, struct osd_object *obj)
clear_obj(obj);
- if (!(vo_sub && opts->sub_visibility))
+ if (!osd->sub_text || !osd->sub_text[0])
return;
if (!obj->osd_track)
@@ -364,21 +364,15 @@ static void update_sub(struct osd_state *osd, struct osd_object *obj)
font.font_size *= opts->sub_scale;
ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style;
- mp_ass_set_style(style, &font);
+ mp_ass_set_style(style, obj->osd_track->PlayResY, &font);
#if LIBASS_VERSION >= 0x01010000
- ass_set_line_position(osd->osd_render, 100 - sub_pos);
+ ass_set_line_position(osd->osd_render, 100 - opts->sub_pos);
#endif
- char *text = talloc_strdup(NULL, "");
-
- for (int n = 0; n < vo_sub->lines; n++)
- text = talloc_asprintf_append_buffer(text, "%s\n", vo_sub->text[n]);
-
- char *escaped_text = mangle_ass(text);
+ char *escaped_text = mangle_ass(osd->sub_text);
add_osd_ass_event(obj->osd_track, escaped_text);
talloc_free(escaped_text);
- talloc_free(text);
}
static void update_object(struct osd_state *osd, struct osd_object *obj)
@@ -387,7 +381,7 @@ static void update_object(struct osd_state *osd, struct osd_object *obj)
case OSDTYPE_OSD:
update_osd(osd, obj);
break;
- case OSDTYPE_SUBTITLE:
+ case OSDTYPE_SUBTEXT:
update_sub(osd, obj);
break;
case OSDTYPE_PROGBAR: