summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-10 19:58:57 +0100
committerwm4 <wm4@nowhere>2013-12-10 20:07:39 +0100
commit7c7d214775f87e82312aa1441d59ddf7c0df9d2e (patch)
treea398eb6f7e1368c5f4c5ec2c4684f83c0f017e13 /sub
parentbf003033e376b34779373565595f2863fe3c4dd6 (diff)
downloadmpv-7c7d214775f87e82312aa1441d59ddf7c0df9d2e.tar.bz2
mpv-7c7d214775f87e82312aa1441d59ddf7c0df9d2e.tar.xz
osd: add option for "unscaled" OSD
Diffstat (limited to 'sub')
-rw-r--r--sub/ass_mp.c2
-rw-r--r--sub/ass_mp.h2
-rw-r--r--sub/osd_libass.c7
3 files changed, 8 insertions, 3 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 33cd1559fc..72c22d54e6 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -39,7 +39,7 @@
// res_y should be track->PlayResY
// It determines scaling of font sizes and more.
-void mp_ass_set_style(ASS_Style *style, int res_y,
+void mp_ass_set_style(ASS_Style *style, double res_y,
const struct osd_style_opts *opts)
{
if (opts->font) {
diff --git a/sub/ass_mp.h b/sub/ass_mp.h
index 27d09d8acd..987efdfe28 100644
--- a/sub/ass_mp.h
+++ b/sub/ass_mp.h
@@ -44,7 +44,7 @@ struct MPOpts;
struct mp_osd_res;
struct osd_style_opts;
-void mp_ass_set_style(ASS_Style *style, int res_y,
+void mp_ass_set_style(ASS_Style *style, double res_y,
const struct osd_style_opts *opts);
void mp_ass_add_default_styles(ASS_Track *track, struct MPOpts *opts);
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index 0564fbb4d3..71255256a9 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -163,8 +163,13 @@ static void update_osd(struct osd_state *osd, struct osd_object *obj)
struct osd_style_opts font = *opts->osd_style;
font.font_size *= opts->osd_scale;
+ double playresy = obj->osd_track->PlayResY;
+ // Compensate for libass and mp_ass_set_style scaling the font etc.
+ if (!opts->osd_scale_by_window)
+ playresy *= 720.0 / obj->vo_res.h;
+
ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style;
- mp_ass_set_style(style, obj->osd_track->PlayResY, &font);
+ mp_ass_set_style(style, playresy, &font);
char *text = mangle_ass(osd->osd_text);
add_osd_ass_event(obj->osd_track, text);