summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 58a60faaca..747793b645 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -495,12 +495,23 @@ static bool compare_track(struct track *t1, struct track *t2, char **langs,
}
return t1->user_tid <= t2->user_tid;
}
+
+static bool duplicate_track(struct MPContext *mpctx, int order,
+ enum stream_type type, struct track *track)
+{
+ for (int i = 0; i < order; i++) {
+ if (mpctx->current_track[i][type] == track)
+ return true;
+ }
+ return false;
+}
+
struct track *select_default_track(struct MPContext *mpctx, int order,
enum stream_type type)
{
struct MPOpts *opts = mpctx->opts;
int tid = opts->stream_id[order][type];
- char **langs = order == 0 ? opts->stream_lang[type] : NULL;
+ char **langs = opts->stream_lang[type];
if (tid == -2)
return NULL;
bool select_fallback = type == STREAM_VIDEO || type == STREAM_AUDIO;
@@ -513,6 +524,8 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
return track;
if (track->no_auto_select)
continue;
+ if (duplicate_track(mpctx, order, type, track))
+ continue;
if (!pick || compare_track(track, pick, langs, mpctx->opts))
pick = track;
}