From 59dc351772e95742600979886591401923aceb25 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 4 Feb 2015 21:20:41 +0100 Subject: player: move timeline specific handling to timeline loaders In particular, gets rid of the Matroska specifics from the common code. --- player/loadfile.c | 16 ++-------------- player/timeline/tl_cue.c | 1 + player/timeline/tl_matroska.c | 10 ++++++++++ player/timeline/tl_mpv_edl.c | 1 + 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/player/loadfile.c b/player/loadfile.c index 4f8b512e86..5b67618611 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1067,6 +1067,8 @@ goto_reopen_demuxer: ; goto terminate_playback; } + mpctx->track_layout = mpctx->demuxer; + if (mpctx->demuxer->matroska_data.ordered_chapters) build_ordered_chapter_timeline(mpctx); @@ -1078,20 +1080,6 @@ goto_reopen_demuxer: ; print_timeline(mpctx); load_chapters(mpctx); - - mpctx->track_layout = mpctx->demuxer; - if (mpctx->timeline) { - // With Matroska, the "master" file usually dictates track layout etc. - // On the contrary, the EDL and CUE demuxers are empty wrappers, as - // well as Matroska ordered chapter playlist-like files. - mpctx->track_layout = mpctx->timeline[0].source; - for (int n = 0; n < mpctx->num_timeline_parts; n++) { - if (mpctx->timeline[n].source == mpctx->demuxer) { - mpctx->track_layout = mpctx->demuxer; - break; - } - } - } add_demuxer_tracks(mpctx, mpctx->track_layout); mpctx->timeline_part = 0; diff --git a/player/timeline/tl_cue.c b/player/timeline/tl_cue.c index 8b8afeae17..d9541c5691 100644 --- a/player/timeline/tl_cue.c +++ b/player/timeline/tl_cue.c @@ -408,6 +408,7 @@ void build_cue_timeline(struct MPContext *mpctx) mpctx->num_timeline_parts = track_count + 1 - 1; mpctx->chapters = chapters; mpctx->num_chapters = track_count; + mpctx->track_layout = mpctx->timeline[0].source; out: talloc_free(ctx); diff --git a/player/timeline/tl_matroska.c b/player/timeline/tl_matroska.c index e2c721a003..8ced0ca7ac 100644 --- a/player/timeline/tl_matroska.c +++ b/player/timeline/tl_matroska.c @@ -569,4 +569,14 @@ void build_ordered_chapter_timeline(struct MPContext *mpctx) mpctx->num_timeline_parts = part_count - 1; mpctx->num_chapters = m->num_ordered_chapters; mpctx->chapters = chapters; + + // With Matroska, the "master" file usually dictates track layout etc., + // except maybe with playlist-like files. + mpctx->track_layout = mpctx->timeline[0].source; + for (int n = 0; n < mpctx->num_timeline_parts; n++) { + if (mpctx->timeline[n].source == mpctx->demuxer) { + mpctx->track_layout = mpctx->demuxer; + break; + } + } } diff --git a/player/timeline/tl_mpv_edl.c b/player/timeline/tl_mpv_edl.c index 4cd62fc497..ce90537bed 100644 --- a/player/timeline/tl_mpv_edl.c +++ b/player/timeline/tl_mpv_edl.c @@ -267,6 +267,7 @@ static void build_timeline(struct MPContext *mpctx, struct tl_parts *parts) mpctx->num_timeline_parts = parts->num_parts; mpctx->chapters = chapters; mpctx->num_chapters = num_chapters; + mpctx->track_layout = mpctx->timeline[0].source; return; error: -- cgit v1.2.3