summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-27 22:02:24 +0200
committerwm4 <wm4@nowhere>2015-06-27 22:02:24 +0200
commit26f52c5730bbe66229e05f11be8a94a539786318 (patch)
tree0e16575b4310801e1e1a1f6dbc2d75b3abd4e5ee /player/loadfile.c
parenta8711001c5c14ba6b06fddcccb46a78d815d1edf (diff)
downloadmpv-26f52c5730bbe66229e05f11be8a94a539786318.tar.bz2
mpv-26f52c5730bbe66229e05f11be8a94a539786318.tar.xz
demux: export forced flag
At least Matroska files have a "forced" flag (in addition to the "default" flag). Export this flag. Treat it almost like the default flag, but with slightly higher priority.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index cef35cc485..3f753d1dfd 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -132,6 +132,8 @@ static void print_stream(struct MPContext *mpctx, struct track *t)
APPEND(b, " --%s=%s", langopt, t->lang);
if (t->default_track)
APPEND(b, " (*)");
+ if (t->forced_track)
+ APPEND(b, " (f)");
if (t->attached_picture)
APPEND(b, " [P]");
if (t->title)
@@ -383,6 +385,7 @@ static struct track *add_stream_track(struct MPContext *mpctx,
.ff_index = stream->ff_index,
.title = stream->title,
.default_track = stream->default_track,
+ .forced_track = stream->forced_track,
.attached_picture = stream->attached_picture != NULL,
.lang = stream->lang,
.under_timeline = under_timeline,
@@ -424,7 +427,8 @@ static int match_lang(char **langs, char *lang)
* 1) track is external (no_default cancels this)
* 1b) track was passed explicitly (is not an auto-loaded subtitle)
* 2) earlier match in lang list
- * 3) track is marked default
+ * 3a) track is marked forced
+ * 3b) track is marked default
* 4) attached picture, HLS bitrate
* 5) lower track number
* If select_fallback is not set, 5) is only used to determine whether a
@@ -444,6 +448,8 @@ static bool compare_track(struct track *t1, struct track *t2, char **langs,
int l1 = match_lang(langs, t1->lang), l2 = match_lang(langs, t2->lang);
if (l1 != l2)
return l1 > l2;
+ if (t1->forced_track != t2->forced_track)
+ return t1->forced_track;
if (t1->default_track != t2->default_track)
return t1->default_track;
if (t1->attached_picture != t2->attached_picture)
@@ -480,7 +486,8 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
pick = track;
}
if (pick && !select_fallback && !(pick->is_external && !pick->no_default)
- && !match_lang(langs, pick->lang) && !pick->default_track)
+ && !match_lang(langs, pick->lang) && !pick->default_track
+ && !pick->forced_track)
pick = NULL;
if (pick && pick->attached_picture && !mpctx->opts->audio_display)
pick = NULL;