diff options
author | wm4 <wm4@nowhere> | 2015-06-27 22:02:24 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-06-27 22:02:24 +0200 |
commit | 26f52c5730bbe66229e05f11be8a94a539786318 (patch) | |
tree | 0e16575b4310801e1e1a1f6dbc2d75b3abd4e5ee /player | |
parent | a8711001c5c14ba6b06fddcccb46a78d815d1edf (diff) | |
download | mpv-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')
-rw-r--r-- | player/command.c | 1 | ||||
-rw-r--r-- | player/core.h | 2 | ||||
-rw-r--r-- | player/loadfile.c | 11 |
3 files changed, 11 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c index 852f232446..cc6a41946c 100644 --- a/player/command.c +++ b/player/command.c @@ -1872,6 +1872,7 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) .unavailable = !track->lang}, {"albumart", SUB_PROP_FLAG(track->attached_picture)}, {"default", SUB_PROP_FLAG(track->default_track)}, + {"forced", SUB_PROP_FLAG(track->forced_track)}, {"external", SUB_PROP_FLAG(track->is_external)}, {"selected", SUB_PROP_FLAG(track->selected)}, {"external-filename", SUB_PROP_STR(track->external_filename), diff --git a/player/core.h b/player/core.h index 542105ba6e..81cf613abf 100644 --- a/player/core.h +++ b/player/core.h @@ -89,7 +89,7 @@ struct track { int ff_index; // same as stream->ff_index, or 0. char *title; - bool default_track; + bool default_track, forced_track; bool attached_picture; char *lang; 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; |