summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-16 20:04:02 +0100
committerwm4 <wm4@nowhere>2015-02-16 20:04:02 +0100
commit14a24f35bfc78121591b14e9ad8e137791582212 (patch)
tree6f38c56d3bb67bffa16ea79e6148bb115dc5eb7c /sub
parent4c283d5f8dbfdd220015c9c4d661ec9b5a2ba6f7 (diff)
downloadmpv-14a24f35bfc78121591b14e9ad8e137791582212.tar.bz2
mpv-14a24f35bfc78121591b14e9ad8e137791582212.tar.xz
osd: customizable subtitle and OSD position
You can set in which "corner" the OSD and subtitles are shown. I'd prefer it a bit more general (so you could set the alignment using a factor), but the libass API does not provide this.
Diffstat (limited to 'sub')
-rw-r--r--sub/ass_mp.c1
-rw-r--r--sub/osd.c8
-rw-r--r--sub/osd.h2
3 files changed, 11 insertions, 0 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 991a94a089..c71efe191f 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -83,6 +83,7 @@ void mp_ass_set_style(ASS_Style *style, double res_y,
style->MarginV = opts->margin_y * scale;
style->ScaleX = 1.;
style->ScaleY = 1.;
+ style->Alignment = 1 + (opts->align_x + 1) + (opts->align_y + 2) % 3 * 4;
#if LIBASS_VERSION >= 0x01020000
style->Blur = opts->blur;
#endif
diff --git a/sub/osd.c b/sub/osd.c
index 02fbfadbfc..3e1260d3f8 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -54,6 +54,10 @@ static const m_option_t style_opts[] = {
OPT_FLOATRANGE("spacing", spacing, 0, -10, 10),
OPT_INTRANGE("margin-x", margin_x, 0, 0, 300),
OPT_INTRANGE("margin-y", margin_y, 0, 0, 600),
+ OPT_CHOICE("align-x", align_x, 0,
+ ({"left", -1}, {"center", 0}, {"right", +1})),
+ OPT_CHOICE("align-y", align_y, 0,
+ ({"top", -1}, {"center", 0}, {"bottom", +1})),
OPT_FLOATRANGE("blur", blur, 0, 0, 20),
{0}
};
@@ -71,6 +75,8 @@ const struct m_sub_options osd_style_conf = {
.shadow_offset = 0,
.margin_x = 25,
.margin_y = 22,
+ .align_x = -1,
+ .align_y = -1,
},
};
@@ -87,6 +93,8 @@ const struct m_sub_options sub_style_conf = {
.shadow_offset = 0,
.margin_x = 25,
.margin_y = 22,
+ .align_x = 0,
+ .align_y = 1,
},
};
diff --git a/sub/osd.h b/sub/osd.h
index 6b7e284f33..a96fc63663 100644
--- a/sub/osd.h
+++ b/sub/osd.h
@@ -133,6 +133,8 @@ struct osd_style_opts {
float spacing;
int margin_x;
int margin_y;
+ int align_x;
+ int align_y;
float blur;
};