summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-01-19 11:23:52 -0600
committerDudemanguy <random342@airmail.cc>2022-01-22 16:22:25 +0000
commit024e0cd4c1405a41edd6a8b302ec6b747bc60ea3 (patch)
tree5df7dfe8d7d860e70ef57c5143d345b8c1da8cc3
parent9cddd73f67f11dba2f2921124e2c39c77af01651 (diff)
downloadmpv-024e0cd4c1405a41edd6a8b302ec6b747bc60ea3.tar.bz2
mpv-024e0cd4c1405a41edd6a8b302ec6b747bc60ea3.tar.xz
options: only apply sub-visibility to primary subs
Previously, the sub-visibility option changed the visibility of all subtitles including secondary ones. This meant that it was not possible to only display secondary subtitles while hiding the primary ones. This modifies the sub-visibility option so that it only affects primary subtitles which allows only secondary subtitles to be displayed.
-rw-r--r--DOCS/interface-changes.rst1
-rw-r--r--DOCS/man/options.rst5
-rw-r--r--sub/dec_sub.c9
-rw-r--r--sub/dec_sub.h1
-rw-r--r--sub/osd.c2
5 files changed, 9 insertions, 9 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 63a08071ec..c84aed05ca 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -39,6 +39,7 @@ Interface changes
- add `--tone-mapping-mode`, replacing `--tone-mapping-desaturate` and
`--tone-mapping-desaturate-exponent`.
- add `dolbyvision` sub-parameter to `format` video filter
+ - `--sub-visibility` no longer has any effect on secondary subtitles
--- mpv 0.34.0 ---
- deprecate selecting by card number with `--drm-connector`, add
`--drm-device` which can be used instead
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 7b51b585e8..f024712f7d 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -2615,11 +2615,6 @@ Subtitles
Can be used to disable display of secondary subtitles, but still select and
decode them.
- .. note::
-
- If ``--sub-visibility=no``, secondary subtitles are hidden regardless of
- ``--secondary-sub-visibility``.
-
``--sub-clear-on-seek``
(Obscure, rarely useful.) Can be used to play broken mkv files with
duplicate ReadOrder fields. ReadOrder is the first field in a
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index a283a5151d..5a49f6e4a3 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -334,8 +334,6 @@ struct sub_bitmaps *sub_get_bitmaps(struct dec_sub *sub, struct mp_osd_res dim,
{
pthread_mutex_lock(&sub->lock);
- struct mp_subtitle_opts *opts = sub->opts;
-
pts = pts_to_subtitle(sub, pts);
sub->last_vo_pts = pts;
@@ -344,7 +342,7 @@ struct sub_bitmaps *sub_get_bitmaps(struct dec_sub *sub, struct mp_osd_res dim,
struct sub_bitmaps *res = NULL;
if (!(sub->end != MP_NOPTS_VALUE && pts >= sub->end) &&
- opts->sub_visibility && sub->sd->driver->get_bitmaps)
+ sub->sd->driver->get_bitmaps)
res = sub->sd->driver->get_bitmaps(sub->sd, dim, format, pts);
pthread_mutex_unlock(&sub->lock);
@@ -453,6 +451,11 @@ void sub_set_play_dir(struct dec_sub *sub, int dir)
pthread_mutex_unlock(&sub->lock);
}
+bool sub_is_primary_visible(struct dec_sub *sub)
+{
+ return !!sub->opts->sub_visibility;
+}
+
bool sub_is_secondary_visible(struct dec_sub *sub)
{
return !!sub->opts->sec_sub_visibility;
diff --git a/sub/dec_sub.h b/sub/dec_sub.h
index 6257e74c65..dea5f7c5b8 100644
--- a/sub/dec_sub.h
+++ b/sub/dec_sub.h
@@ -51,6 +51,7 @@ void sub_reset(struct dec_sub *sub);
void sub_select(struct dec_sub *sub, bool selected);
void sub_set_recorder_sink(struct dec_sub *sub, struct mp_recorder_sink *sink);
void sub_set_play_dir(struct dec_sub *sub, int dir);
+bool sub_is_primary_visible(struct dec_sub *sub);
bool sub_is_secondary_visible(struct dec_sub *sub);
int sub_control(struct dec_sub *sub, enum sd_ctrl cmd, void *arg);
diff --git a/sub/osd.c b/sub/osd.c
index e422716ada..297ad88fe8 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -291,7 +291,7 @@ static struct sub_bitmaps *render_object(struct osd_state *osd,
check_obj_resize(osd, osdres, obj);
if (obj->type == OSDTYPE_SUB) {
- if (obj->sub)
+ if (obj->sub && sub_is_primary_visible(obj->sub))
res = sub_get_bitmaps(obj->sub, obj->vo_res, format, video_pts);
} else if (obj->type == OSDTYPE_SUB2) {
if (obj->sub && sub_is_secondary_visible(obj->sub))