Revert "options: add --sub-visibility=<primary-only|secondary-only>"

This reverts commit 04f0b0abe4.

It's not a good idea to unify the names only for visibility, while
keeping secondary-* for everything else.

This needs a bit more thought before we allow secondary sub to be
visible on its own.
This commit is contained in:
Avi Halachmi (:avih) 2022-01-19 21:56:28 +02:00
parent 04f0b0abe4
commit 9cddd73f67
9 changed files with 22 additions and 23 deletions

View File

@ -39,8 +39,6 @@ Interface changes
- add `--tone-mapping-mode`, replacing `--tone-mapping-desaturate` and
`--tone-mapping-desaturate-exponent`.
- add `dolbyvision` sub-parameter to `format` video filter
- remove `--secondary-sub-visibility` and introduces
`--sub-visibility=primary-only` and `--sub-visibility=secondary-only`
--- mpv 0.34.0 ---
- deprecate selecting by card number with `--drm-connector`, add
`--drm-device` which can be used instead

View File

@ -2607,10 +2607,19 @@ Subtitles
This is a path list option. See `List Options`_ for details.
``--sub-visibility=<no|yes|primary-only|secondary-only>``, ``--no-sub-visibility``
``--sub-visibility``, ``--no-sub-visibility``
Can be used to disable display of subtitles, but still select and decode
them.
``--secondary-sub-visibility``, ``--no-secondary-sub-visibility``
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

View File

@ -121,6 +121,7 @@
#R add sub-pos +1 # move subtitles down
#t add sub-pos +1 # move subtitles down
#v cycle sub-visibility # hide or show the subtitles
#Alt+v cycle secondary-sub-visibility # hide or show the secondary subtitles
#V cycle sub-ass-vsfilter-aspect-compat # toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer
#u cycle-values sub-ass-override "force" "no" # toggle overriding SSA/ASS subtitle styles with the normal styles
#j cycle sub # switch subtitle track

View File

@ -240,9 +240,8 @@ const struct m_sub_options mp_subtitle_sub_opts = {
{"sub-delay", OPT_FLOAT(sub_delay)},
{"sub-fps", OPT_FLOAT(sub_fps)},
{"sub-speed", OPT_FLOAT(sub_speed)},
{"sub-visibility", OPT_CHOICE(sub_visibility,
{"no", 0}, {"yes", 1}, {"primary-only", 2}, {"secondary-only", 3})
},
{"sub-visibility", OPT_FLAG(sub_visibility)},
{"secondary-sub-visibility", OPT_FLAG(sec_sub_visibility)},
{"sub-forced-only", OPT_CHOICE(forced_subs_only,
{"auto", -1}, {"no", 0}, {"yes", 1})},
{"stretch-dvd-subs", OPT_FLAG(stretch_dvd_subs)},
@ -286,6 +285,7 @@ const struct m_sub_options mp_subtitle_sub_opts = {
.size = sizeof(OPT_BASE_STRUCT),
.defaults = &(OPT_BASE_STRUCT){
.sub_visibility = 1,
.sec_sub_visibility = 1,
.forced_subs_only = -1,
.sub_pos = 100,
.sub_speed = 1.0,
@ -880,8 +880,6 @@ static const m_option_t mp_opts[] = {
{"pphelp", OPT_REMOVED(NULL)},
{"rawaudio", OPT_REMOVED("use --demuxer-rawaudio-...")},
{"rawvideo", OPT_REMOVED("use --demuxer-rawvideo-...")},
{"secondary-sub-visibility", OPT_REMOVED(
"use --sub-visibility=primary-only/yes")},
{"spugauss", OPT_REPLACED("sub-gauss")},
{"srate", OPT_REPLACED("audio-samplerate")},
{"ss", OPT_REPLACED("start")},

View File

@ -73,6 +73,7 @@ typedef struct mp_vo_opts {
// Subtitle options needed by the subtitle decoders/renderers.
struct mp_subtitle_opts {
int sub_visibility;
int sec_sub_visibility;
int sub_pos;
float sub_delay;
float sub_fps;

View File

@ -4003,13 +4003,11 @@ static const struct property_osd_display {
{"sub-delay", "Sub delay"},
{"sub-speed", "Sub speed"},
{"sub-visibility",
.msg = "Subtitles ${?sub-visibility==no:hidden}"
"${?sub-visibility==yes:visible}"
"${?sub-visibility==primary-only:visible (primary only"
"${?sid==no: but no subtitles selected})}"
"${?sub-visibility==secondary-only:visible (secondary only"
"${?secondary-sid==no: but no subtitles selected})}"
},
.msg = "Subtitles ${!sub-visibility==yes:hidden}"
"${?sub-visibility==yes:visible${?sub==no: (but no subtitles selected)}}"},
{"secondary-sub-visibility",
.msg = "Secondary Subtitles ${!secondary-sub-visibility==yes:hidden}"
"${?secondary-sub-visibility==yes:visible${?secondary-sid==no: (but no secondary subtitles selected)}}"},
{"sub-forced-only", "Forced sub only"},
{"sub-scale", "Sub Scale"},
{"sub-ass-vsfilter-aspect-compat", "Subtitle VSFilter aspect compat"},

View File

@ -453,12 +453,7 @@ 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->sub_visibility == 1 || sub->opts->sub_visibility == 3;
return !!sub->opts->sec_sub_visibility;
}

View File

@ -51,7 +51,6 @@ 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);

View File

@ -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 && sub_is_primary_visible(obj->sub))
if (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))