mirror of https://github.com/mpv-player/mpv
player: move timeline specific handling to timeline loaders
In particular, gets rid of the Matroska specifics from the common code.
This commit is contained in:
parent
f8dc5db315
commit
59dc351772
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue