summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorRipose <ripose@protonmail.com>2021-11-13 15:55:53 -0800
committerDudemanguy <random342@airmail.cc>2022-01-19 14:27:04 +0000
commit04f0b0abe48d664aaa1400d1dddb02b434999b85 (patch)
treecc784261e29a6834d7e81ff763fc060867672748 /sub
parent1ab3f56df0d7be3b4152bd9e0cc50c1938ff6d70 (diff)
downloadmpv-04f0b0abe48d664aaa1400d1dddb02b434999b85.tar.bz2
mpv-04f0b0abe48d664aaa1400d1dddb02b434999b85.tar.xz
options: add --sub-visibility=<primary-only|secondary-only>
Adds --sub-visibility choices 'primary-only' for only displaying the primary subtitle track, and 'secondary-only' for only displaying secondary subtitle track. Removes --secondary-sub-visibility and displays a message telling the user to use --sub-visibility=yes/primary-only instead. These changes make it so that the default 'sub-visibility' bind 'v' cycles through all the 'sub-visibility' choices, 'no', 'yes', 'primary-only', and 'secondary-only'.
Diffstat (limited to 'sub')
-rw-r--r--sub/dec_sub.c7
-rw-r--r--sub/dec_sub.h1
-rw-r--r--sub/osd.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index a283a5151d..6525c41653 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -453,7 +453,12 @@ 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 == 1 || sub->opts->sub_visibility == 2;
+}
+
bool sub_is_secondary_visible(struct dec_sub *sub)
{
- return !!sub->opts->sec_sub_visibility;
+ return sub->opts->sub_visibility == 1 || sub->opts->sub_visibility == 3;
}
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))