diff options
-rw-r--r-- | DOCS/interface-changes.rst | 2 | ||||
-rw-r--r-- | DOCS/man/input.rst | 4 | ||||
-rw-r--r-- | DOCS/man/options.rst | 11 | ||||
-rw-r--r-- | options/options.c | 4 | ||||
-rw-r--r-- | options/options.h | 2 | ||||
-rw-r--r-- | player/command.c | 5 | ||||
-rw-r--r-- | player/core.h | 1 | ||||
-rw-r--r-- | player/loadfile.c | 12 | ||||
-rw-r--r-- | sub/dec_sub.c | 4 | ||||
-rw-r--r-- | sub/sd.h | 2 | ||||
-rw-r--r-- | sub/sd_ass.c | 2 | ||||
-rw-r--r-- | sub/sd_lavc.c | 3 |
12 files changed, 13 insertions, 39 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index aa2149ba4d..0fa85796a7 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -47,6 +47,8 @@ Interface changes - remove special handling of the `auto` value from `--alang/slang/vlang` options - add `--subs-match-os-language` as a replacement for `--slang=auto` - add `always` option to `--subs-fallback-forced` + - remove `auto` choice from `--sub-forced-only` + - remove `auto-forced-only` property --- mpv 0.36.0 --- - add `--target-contrast` - Target luminance value is now also applied when ICC profile is used. diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 2faffef656..07beb67717 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -2886,10 +2886,6 @@ Property list ``yes``/true if the track has the forced flag set in the file, ``no``/false or unavailable otherwise. - ``track-list/N/auto-forced-only`` - ``yes``/true if the track was autoselected in forced-only mode, - ``no``/false or unavailable otherwise. - ``track-list/N/codec`` The codec name used by this track, for example ``h264``. Unavailable in some rare cases. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index cf0dcdc5ee..de9e92a778 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -2621,12 +2621,11 @@ Subtitles subtitles (if the difference is smaller than 210 ms, the gap or overlap is removed). -``--sub-forced-only=<auto|yes|no>`` - Display only forced subtitles for the DVD subtitle stream selected by e.g. - ``--slang`` (default: ``auto``). When set to ``auto``, enabled when the - ``--subs-with-matching-audio`` option is on and a non-forced stream is selected. - Enabling this will hide all subtitles in streams that don't make a distinction - between forced and unforced events within a stream. +``--sub-forced-only=<yes|no>`` + Enabling this displays only forced events within subtitle streams. Only + some bitmap subtitle formats (such as DVD or PGS) are capable of having a + mixture of forced and unforced events within the stream. Enabling this on + text subtitles will cause no subtitles to be displayed (default: ``no``). ``--sub-fps=<rate>`` Specify the framerate of the subtitle file (default: video fps). Affects diff --git a/options/options.c b/options/options.c index ae51a010ac..4f0f4be631 100644 --- a/options/options.c +++ b/options/options.c @@ -262,8 +262,7 @@ const struct m_sub_options mp_subtitle_sub_opts = { {"sub-speed", OPT_FLOAT(sub_speed)}, {"sub-visibility", OPT_BOOL(sub_visibility)}, {"secondary-sub-visibility", OPT_BOOL(sec_sub_visibility)}, - {"sub-forced-only", OPT_CHOICE(forced_subs_only, - {"auto", -1}, {"no", 0}, {"yes", 1})}, + {"sub-forced-only", OPT_BOOL(forced_subs_only)}, {"stretch-dvd-subs", OPT_BOOL(stretch_dvd_subs)}, {"stretch-image-subs-to-screen", OPT_BOOL(stretch_image_subs)}, {"image-subs-video-resolution", OPT_BOOL(image_subs_video_res)}, @@ -306,7 +305,6 @@ const struct m_sub_options mp_subtitle_sub_opts = { .defaults = &(OPT_BASE_STRUCT){ .sub_visibility = true, .sec_sub_visibility = true, - .forced_subs_only = -1, .sub_pos = 100, .sub_speed = 1.0, .ass_enabled = true, diff --git a/options/options.h b/options/options.h index a2fca90432..1f47732d65 100644 --- a/options/options.h +++ b/options/options.h @@ -83,7 +83,7 @@ struct mp_subtitle_opts { float sub_delay; float sub_fps; float sub_speed; - int forced_subs_only; + bool forced_subs_only; bool stretch_dvd_subs; bool stretch_image_subs; bool image_subs_video_res; diff --git a/player/command.c b/player/command.c index 71363e832d..b9cbdec200 100644 --- a/player/command.c +++ b/player/command.c @@ -1975,7 +1975,6 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) {"albumart", SUB_PROP_BOOL(track->attached_picture)}, {"default", SUB_PROP_BOOL(track->default_track)}, {"forced", SUB_PROP_BOOL(track->forced_track)}, - {"auto-forced-only", SUB_PROP_BOOL(track->forced_only_def)}, {"dependent", SUB_PROP_BOOL(track->dependent_track)}, {"visual-impaired", SUB_PROP_BOOL(track->visual_impaired_track)}, {"hearing-impaired", SUB_PROP_BOOL(track->hearing_impaired_track)}, @@ -3015,10 +3014,6 @@ static int mp_property_sub_forced_only_cur(void *ctx, struct m_property *prop, { MPContext *mpctx = ctx; int ret = mpctx->opts->subs_rend->forced_subs_only; - if (ret == -1) { - struct track *track = mpctx->current_track[0][STREAM_SUB]; - ret = track && track->forced_only_def; - } return m_property_bool_ro(action, arg, ret); } diff --git a/player/core.h b/player/core.h index 9b60add51d..0f63f13474 100644 --- a/player/core.h +++ b/player/core.h @@ -137,7 +137,6 @@ struct track { // Current subtitle state (or cached state if selected==false). struct dec_sub *d_sub; - bool forced_only_def; // Current decoding state (NULL if selected==false) struct mp_decoder_wrapper *dec; diff --git a/player/loadfile.c b/player/loadfile.c index cd528624f0..535d486ee0 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -260,8 +260,8 @@ static void print_stream(struct MPContext *mpctx, struct track *t) char b[2048] = {0}; bool forced_only = false; if (t->type == STREAM_SUB) { - int forced_opt = mpctx->opts->subs_rend->forced_subs_only; - if (forced_opt == 1 || (forced_opt && t->forced_only_def)) + bool forced_opt = mpctx->opts->subs_rend->forced_subs_only; + if (forced_opt) forced_only = t->selected; } APPEND(b, " %3s %-5s", t->selected ? (forced_only ? "(*)" : "(+)") : "", tname); @@ -630,7 +630,6 @@ struct track *select_default_track(struct MPContext *mpctx, int order, struct track *forced_pick = NULL; for (int n = 0; n < mpctx->num_tracks; n++) { struct track *track = mpctx->tracks[n]; - track->forced_only_def = false; if (track->type != type) continue; if (track->user_tid == tid) { @@ -672,13 +671,6 @@ struct track *select_default_track(struct MPContext *mpctx, int order, pick = NULL; if (pick && !opts->autoload_files && pick->is_external) pick = NULL; - if (pick && sub && !pick->forced_track) { - // If the codec is DVD or PGS, we can display it in forced-only mode. - if (pick->stream && - (!strcmp(pick->stream->codec->codec, "dvd_subtitle") || - !strcmp(pick->stream->codec->codec, "hdmv_pgs_subtitle"))) - pick->forced_only_def = true; - } cleanup: talloc_free(langs); return pick; diff --git a/sub/dec_sub.c b/sub/dec_sub.c index a476c20396..dc26aa027e 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -69,8 +69,6 @@ struct dec_sub { struct sd *sd; struct demux_packet *new_segment; - - bool forced_only_def; }; static void update_subtitle_speed(struct dec_sub *sub) @@ -144,7 +142,6 @@ static struct sd *init_decoder(struct dec_sub *sub) .attachments = sub->attachments, .codec = sub->codec, .preload_ok = true, - .forced_only_def = sub->forced_only_def, }; if (sd->driver->init(sd) >= 0) @@ -182,7 +179,6 @@ struct dec_sub *sub_create(struct mpv_global *global, struct track *track, .last_vo_pts = MP_NOPTS_VALUE, .start = MP_NOPTS_VALUE, .end = MP_NOPTS_VALUE, - .forced_only_def = track->forced_only_def, }; sub->opts = sub->opts_cache->opts; mpthread_mutex_init_recursive(&sub->lock); @@ -24,8 +24,6 @@ struct sd { // Set to false as soon as the decoder discards old subtitle events. // (only needed if sd_functions.accept_packets_in_advance == false) bool preload_ok; - - bool forced_only_def; }; struct sd_functions { diff --git a/sub/sd_ass.c b/sub/sd_ass.c index a4df24e0ae..1ce77384c8 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -577,7 +577,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res dim, // Currently no supported text sub formats support a distinction between forced // and unforced lines, so we just assume everything's unforced and discard everything. // If we ever see a format that makes this distinction, we can add support here. - if (opts->forced_subs_only == 1 || (opts->forced_subs_only && sd->forced_only_def)) + if (opts->forced_subs_only) goto done; double scale = dim.display_par; diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index eb71bdd0c2..5586a4c287 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -195,8 +195,7 @@ static void read_sub_bitmaps(struct sd *sd, struct sub *sub) MP_ERR(sd, "unsupported subtitle type from libavcodec\n"); continue; } - if (!(r->flags & AV_SUBTITLE_FLAG_FORCED) && (opts->forced_subs_only == 1 || - (opts->forced_subs_only && sd->forced_only_def))) + if (!(r->flags & AV_SUBTITLE_FLAG_FORCED) && opts->forced_subs_only) continue; if (r->w <= 0 || r->h <= 0) continue; |