mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 09:57:34 +00:00
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.
This commit is contained in:
parent
4c283d5f8d
commit
14a24f35bf
@ -2540,6 +2540,17 @@ OSD
|
||||
|
||||
Default: 22.
|
||||
|
||||
``--osd-align-x=<left|center|right>``, ``--sub-text-align-x=...``
|
||||
Control to which corner of the screen OSD or text subtitles should be
|
||||
aligned to (default: ``center`` for subs, ``left`` for OSD).
|
||||
|
||||
Never applied to ASS subtitles, except in ``--no-sub-ass`` mode. Likewise,
|
||||
this does not apply to image subtitles.
|
||||
|
||||
``--osd-align-y=<top|center|bottom>`` ``--sub-text-align-y=...``
|
||||
Vertical position (default: ``bottom`` for subs, ``top`` for OSD).
|
||||
Details see ``--osd-align-x``.
|
||||
|
||||
``--osd-scale=<factor>``
|
||||
OSD font size multiplier, multiplied with ``--osd-font-size`` value.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user