summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2024-04-17 18:18:31 +0200
committerKacper Michajłow <kasper93@gmail.com>2024-05-09 17:12:55 +0200
commitb7216d5d037146bdf6b9d2291bcb3d7344054f52 (patch)
treeb0ebc7a92e496b68939a64291e99967953334bee /player/loadfile.c
parentbf6d49cbd44871fec6795c4eb334e7ed4035f171 (diff)
downloadmpv-b7216d5d037146bdf6b9d2291bcb3d7344054f52.tar.bz2
mpv-b7216d5d037146bdf6b9d2291bcb3d7344054f52.tar.xz
Revert "loadfile: compute audio lang for sub selection when using lavfi-complex"
This reverts commit 9e6c6c08975c03b771adc1d2b524d91a985ed2b9.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 077ac20017..cfdc445c98 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -579,35 +579,6 @@ static char **process_langs(char **in)
return out;
}
-static const char *get_audio_lang(struct MPContext *mpctx)
-{
- // If we have a single current audio track, this is simple.
- if (mpctx->current_track[0][STREAM_AUDIO])
- return mpctx->current_track[0][STREAM_AUDIO]->lang;
-
- const char *ret = NULL;
-
- // Otherwise, we may be using a filter with multiple inputs.
- // Iterate over the tracks and find the ones in use.
- for (int i = 0; i < mpctx->num_tracks; i++) {
- const struct track *t = mpctx->tracks[i];
- if (t->type != STREAM_AUDIO || !t->selected)
- continue;
-
- // If we have input in multiple audio languages, bail out;
- // we don't have a meaningful single language.
- // Partial matches (e.g. en-US vs en-GB) are acceptable here.
- if (ret && t->lang && !mp_match_lang_single(t->lang, ret))
- return NULL;
-
- // We'll return the first non-null tag we see
- if (!ret)
- ret = t->lang;
- }
-
- return ret;
-}
-
struct track *select_default_track(struct MPContext *mpctx, int order,
enum stream_type type)
{
@@ -625,7 +596,9 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
langs = add_os_langs();
os_langs = true;
}
- const char *audio_lang = get_audio_lang(mpctx);
+ const char *audio_lang = mpctx->current_track[0][STREAM_AUDIO] ?
+ mpctx->current_track[0][STREAM_AUDIO]->lang :
+ NULL;
bool sub = type == STREAM_SUB;
struct track *pick = NULL;
for (int n = 0; n < mpctx->num_tracks; n++) {