summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/input.rst7
-rw-r--r--DOCS/man/options.rst28
-rw-r--r--DOCS/man/vf.rst4
-rw-r--r--options/options.c11
-rw-r--r--options/options.h2
-rw-r--r--player/command.c3
-rw-r--r--player/configfiles.c3
-rw-r--r--sub/ass_mp.c35
-rw-r--r--sub/ass_mp.h2
-rw-r--r--sub/sd_ass.c2
10 files changed, 70 insertions, 27 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 36486bedac..80b4b253e9 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1381,8 +1381,11 @@ Property list
``sub-scale`` (RW)
Subtitle font size multiplier.
-``ass-use-margins`` (RW)
- See ``--ass-use-margins``.
+``ass-force-margins`` (RW)
+ See ``--ass-force-margins``.
+
+``sub-use-margins`` (RW)
+ See ``--sub-use-margins``.
``ass-vsfilter-aspect-compat`` (RW)
See ``--ass-vsfilter-aspect-compat``.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index a50bd09e27..7ba22949cd 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -438,7 +438,8 @@ Program Behavior
Enable the youtube-dl hook-script. It will look at the input URL, and will
play the video located on the website. This works with many streaming sites,
not just the one that the script is named after. This requires a recent
- version of youtube-dl to be installed on the system. (Enabled by default.)
+ version of youtube-dl to be installed on the system. (Enabled by default,
+ except when the client API / libmpv is used.)
If the script can't do anything with an URL, it will do nothing.
@@ -1155,13 +1156,22 @@ Subtitles
doesn't covert the window fully, e.g. because screen aspect and window
aspect mismatch (and the player adds black bars).
+ Default: yes.
+
This option is misnamed. The difference to the confusingly similar sounding
option ``--sub-scale-by-window`` is that ``--sub-scale-with-window`` still
scales with the approximate window size, while the other option disables
this scaling.
+ Affects plain text subtitles only (or ASS if ``--ass-style-override`` is
+ set high enough).
+
+``--ass-scale-with-window=<yes|no>``
+ Like ``--sub-scale-with-window``, but affects subtitles in ASS format only.
Like ``--sub-scale``, this can break ASS subtitles.
+ Default: no.
+
``--embeddedfonts``, ``--no-embeddedfonts``
Use fonts embedded in Matroska container files and ASS scripts (default:
enabled). These fonts can be used for SSA/ASS subtitle rendering.
@@ -1245,9 +1255,21 @@ Subtitles
options. Requires a modified libass, can break rendering easily.
Probably more reliable than ``force``.
-``--ass-use-margins``
+``--ass-force-margins``
+ Enables placing toptitles and subtitles in black borders when they are
+ available, if the subtitles are in the ASS format.
+
+ Default: no.
+
+``--sub-use-margins``
Enables placing toptitles and subtitles in black borders when they are
- available.
+ available, if the subtitles are in a plain text format (or ASS if
+ ``--ass-style-override`` is set high enough).
+
+ Default: yes.
+
+ Renamed from ``--ass-use-margins``. To place ASS subtitles in the borders
+ too (like the old option did), also add ``--ass-force-margins``.
``--ass-vsfilter-aspect-compat=<yes|no>``
Stretch SSA/ASS subtitles when playing anamorphic videos for compatibility
diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst
index bfc6e5d53d..7c31e4d6d5 100644
--- a/DOCS/man/vf.rst
+++ b/DOCS/man/vf.rst
@@ -445,9 +445,9 @@ Available filters are:
``<bottom-margin>``
Adds a black band at the bottom of the frame. The SSA/ASS renderer can
- place subtitles there (with ``--ass-use-margins``).
+ place subtitles there (with ``--sub-use-margins``).
``<top-margin>``
- Black band on the top for toptitles (with ``--ass-use-margins``).
+ Black band on the top for toptitles (with ``--sub-use-margins``).
.. admonition:: Examples
diff --git a/options/options.c b/options/options.c
index 48c46e4462..5276a6f6bf 100644
--- a/options/options.c
+++ b/options/options.c
@@ -337,7 +337,8 @@ const m_option_t mp_opts[] = {
OPT_FLAG("sub-ass", ass_enabled, 0),
OPT_FLOATRANGE("sub-scale", sub_scale, 0, 0, 100),
OPT_FLOATRANGE("ass-line-spacing", ass_line_spacing, 0, -1000, 1000),
- OPT_FLAG("ass-use-margins", ass_use_margins, 0),
+ OPT_FLAG("sub-use-margins", sub_use_margins, 0),
+ OPT_FLAG("ass-force-margins", ass_use_margins, 0),
OPT_FLAG("ass-vsfilter-aspect-compat", ass_vsfilter_aspect_compat, 0),
OPT_CHOICE("ass-vsfilter-color-compat", ass_vsfilter_color_compat, 0,
({"no", 0}, {"basic", 1}, {"full", 2}, {"force-601", 3})),
@@ -353,6 +354,7 @@ const m_option_t mp_opts[] = {
({"no", 0}, {"yes", 1}, {"force", 3}, {"signfs", 4})),
OPT_FLAG("sub-scale-by-window", sub_scale_by_window, 0),
OPT_FLAG("sub-scale-with-window", sub_scale_with_window, 0),
+ OPT_FLAG("ass-scale-with-window", ass_scale_with_window, 0),
OPT_FLAG("osd-bar", osd_bar_visible, 0),
OPT_FLOATRANGE("osd-bar-align-x", osd_bar_align_x, 0, -1.0, +1.0),
OPT_FLOATRANGE("osd-bar-align-y", osd_bar_align_y, 0, -1.0, +1.0),
@@ -473,8 +475,6 @@ const m_option_t mp_opts[] = {
OPT_FLAG("keepaspect", vo.keepaspect, 0),
OPT_FLAG("keepaspect-window", vo.keepaspect_window, 0),
-//---------------------- mplayer-only options ------------------------
-
OPT_FLAG("use-filedir-conf", use_filedir_conf, 0),
OPT_CHOICE("osd-level", osd_level, 0,
({"0", 0}, {"1", 1}, {"2", 2}, {"3", 3})),
@@ -658,6 +658,7 @@ const m_option_t mp_opts[] = {
OPT_REMOVED("fixed-vo", "--fixed-vo=yes is now the default"),
OPT_REPLACED("mkv-subtitle-preroll", "demuxer-mkv-subtitle-preroll"),
OPT_REPLACED("dtshd", "ad-spdif-dtshd"),
+ OPT_REPLACED("ass-use-margins", "sub-use-margins"),
{0}
};
@@ -706,6 +707,10 @@ const struct MPOpts mp_default_opts = {
.osd_scale = 1,
.osd_scale_by_window = 1,
.sub_scale_by_window = 1,
+ .ass_use_margins = 0,
+ .sub_use_margins = 1,
+ .ass_scale_with_window = 0,
+ .sub_scale_with_window = 1,
.use_text_osd = 1,
#if HAVE_LUA
.lua_load_osc = 1,
diff --git a/options/options.h b/options/options.h
index c558176940..52bf0fa221 100644
--- a/options/options.h
+++ b/options/options.h
@@ -241,6 +241,7 @@ typedef struct MPOpts {
int osd_scale_by_window;
int sub_scale_by_window;
int sub_scale_with_window;
+ int ass_scale_with_window;
struct osd_style_opts *osd_style;
struct osd_style_opts *sub_text_style;
float sub_scale;
@@ -249,6 +250,7 @@ typedef struct MPOpts {
int ass_enabled;
float ass_line_spacing;
int ass_use_margins;
+ int sub_use_margins;
int ass_vsfilter_aspect_compat;
int ass_vsfilter_color_compat;
int ass_vsfilter_blur_compat;
diff --git a/player/command.c b/player/command.c
index 9378f53df0..43da75e156 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3448,7 +3448,8 @@ static const struct m_property mp_properties[] = {
{"sub-visibility", property_osd_helper},
{"sub-forced-only", property_osd_helper},
{"sub-scale", property_osd_helper},
- {"ass-use-margins", property_osd_helper},
+ {"sub-use-margins", property_osd_helper},
+ {"ass-force-margins", property_osd_helper},
{"ass-vsfilter-aspect-compat", property_osd_helper},
{"ass-style-override", property_osd_helper},
diff --git a/player/configfiles.c b/player/configfiles.c
index bc89439e3a..621c2f96e1 100644
--- a/player/configfiles.c
+++ b/player/configfiles.c
@@ -243,7 +243,8 @@ static const char *const backup_properties[] = {
"options/sub-pos",
"options/sub-visibility",
"options/sub-scale",
- "options/ass-use-margins",
+ "options/sub-use-margins",
+ "options/ass-force-margins",
"options/ass-vsfilter-aspect-compat",
"options/ass-style-override",
"options/ab-loop-a",
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index c71efe191f..973b78d6cb 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -126,34 +126,43 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts)
return track;
}
-void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
+void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, bool is_ass,
struct mp_osd_res *dim)
{
ass_set_frame_size(priv, dim->w, dim->h);
ass_set_margins(priv, dim->mt, dim->mb, dim->ml, dim->mr);
- int set_use_margins = 0;
+ bool set_use_margins = false;
int set_sub_pos = 0;
float set_line_spacing = 0;
float set_font_scale = 1;
int set_hinting = 0;
- if (opts->ass_style_override) {
+ bool set_scale_with_window = false;
+ bool set_scale_by_window = true;
+ // With forced overrides, apply the --sub-* specific options
+ if (!is_ass || opts->ass_style_override == 3) {
+ set_scale_with_window = opts->sub_scale_with_window;
+ set_use_margins = opts->sub_use_margins;
+ set_scale_by_window = opts->sub_scale_by_window;
+ } else {
+ set_scale_with_window = opts->ass_scale_with_window;
set_use_margins = opts->ass_use_margins;
+ }
+ if (!is_ass || opts->ass_style_override) {
set_sub_pos = 100 - opts->sub_pos;
set_line_spacing = opts->ass_line_spacing;
set_hinting = opts->ass_hinting;
set_font_scale = opts->sub_scale;
- if (opts->sub_scale_with_window) {
- int vidh = dim->h - (dim->mt + dim->mb);
- set_font_scale *= dim->h / (float)MPMAX(vidh, 1);
- }
- if (!opts->sub_scale_by_window) {
- double factor = dim->h / 720.0;
- if (factor != 0.0)
- set_font_scale /= factor;
- }
}
-
+ if (set_scale_with_window) {
+ int vidh = dim->h - (dim->mt + dim->mb);
+ set_font_scale *= dim->h / (float)MPMAX(vidh, 1);
+ }
+ if (!set_scale_by_window) {
+ double factor = dim->h / 720.0;
+ if (factor != 0.0)
+ set_font_scale /= factor;
+ }
ass_set_use_margins(priv, set_use_margins);
#if LIBASS_VERSION >= 0x01010000
ass_set_line_position(priv, set_sub_pos);
diff --git a/sub/ass_mp.h b/sub/ass_mp.h
index 86c5c7ff0a..4e5cc88554 100644
--- a/sub/ass_mp.h
+++ b/sub/ass_mp.h
@@ -53,7 +53,7 @@ void mp_ass_add_default_styles(ASS_Track *track, struct MPOpts *opts);
ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts);
struct MPOpts;
-void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
+void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, bool is_ass,
struct mp_osd_res *dim);
void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts,
struct mpv_global *global, struct mp_log *log);
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 9e08c2c3b6..73b836c98a 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -145,7 +145,7 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res dim, double pts,
if (isnormal(par))
scale = par;
}
- mp_ass_configure(renderer, opts, &dim);
+ mp_ass_configure(renderer, opts, !ctx->is_converted, &dim);
ass_set_aspect_ratio(renderer, scale, 1);
#if LIBASS_VERSION >= 0x01020000
if (!ctx->is_converted && (!opts->ass_style_override ||