summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2024-01-14 15:25:56 +0100
committerDudemanguy <random342@airmail.cc>2024-01-20 17:26:45 +0000
commit5871ba8f3e7e728d2efcbfdbe1d67059f8feca4d (patch)
tree24295cdfbbee943d2b356c567feeb8c5422ba6bf /player/command.c
parent02c6165d2b3e8448f13a34a845113d94669b0050 (diff)
downloadmpv-5871ba8f3e7e728d2efcbfdbe1d67059f8feca4d.tar.bz2
mpv-5871ba8f3e7e728d2efcbfdbe1d67059f8feca4d.tar.xz
command: restore lang after track reload
If a track's language was guessed from its filename, the commands that reload the track, like sub-reload, remove it. Fix this by calling guess_lang_from_filename() again. Note that backing up t->lang and restoring it if nt->lang is NULL would work incorrectly when lang is in the stream and it is removed before reloading.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 3caaf897ce..caf134aa66 100644
--- a/player/command.c
+++ b/player/command.c
@@ -5769,6 +5769,10 @@ static void cmd_track_reload(void *p)
}
struct track *nt = mpctx->tracks[nt_num];
+
+ if (!nt->lang)
+ nt->lang = mp_guess_lang_from_filename(nt, nt->external_filename);
+
mp_switch_track(mpctx, nt->type, nt, 0);
print_track_list(mpctx, "Reloaded:");
}