summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2021-05-27 00:56:41 -0500
committersfan5 <sfan5@live.de>2023-06-25 11:01:58 +0200
commitba7cc071068f4f57ae354e77f64552712fda6855 (patch)
treeeb264b91c1465e149d8d3aefdad7a9813d658b13 /player/loadfile.c
parent991a2f79ce381544437791430c91cd026e21d726 (diff)
downloadmpv-ba7cc071068f4f57ae354e77f64552712fda6855.tar.bz2
mpv-ba7cc071068f4f57ae354e77f64552712fda6855.tar.xz
sub: rewrite auto-forced-only support
- No longer has a fake "option" used only internally (which didn't always get propagated properly) - Always overrideable during playback
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index c2fbdd334b..1bd16ebe50 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -591,6 +591,7 @@ 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) {
@@ -639,9 +640,16 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
pick = NULL;
if (pick && !opts->autoload_files && pick->is_external)
pick = NULL;
- if (pick && type == STREAM_SUB && prefer_forced && !pick->forced_track &&
- opts->subs_rend->forced_subs_only == -1)
- opts->subs_rend->forced_subs_only_current = 1;
+ if (pick && type == STREAM_SUB && prefer_forced && !pick->forced_track) {
+ // If the codec is DVD or PGS, we can display it in forced-only mode.
+ // This isn't really meaningful for other codecs, so we'll just pick nothing.
+ if (pick->stream &&
+ !strcmp(pick->stream->codec->codec, "dvd_subtitle") ||
+ !strcmp(pick->stream->codec->codec, "hdmv_pgs_subtitle"))
+ pick->forced_only_def = 1;
+ else
+ pick = NULL;
+ }
cleanup:
talloc_free(langs);
return pick;
@@ -1639,8 +1647,6 @@ static void play_current_file(struct MPContext *mpctx)
if (reinit_complex_filters(mpctx, false) < 0)
goto terminate_playback;
- opts->subs_rend->forced_subs_only_current = (opts->subs_rend->forced_subs_only == 1) ? 1 : 0;
-
for (int t = 0; t < STREAM_TYPE_COUNT; t++) {
for (int i = 0; i < num_ptracks[t]; i++) {
struct track *sel = NULL;