1
mirror of https://github.com/mpv-player/mpv synced 2025-01-20 21:07:29 +01:00

mplayer: take tracks from first segment if main file is empty

With Matroska ordered chapters, the main file (i.e. the file you're
playing) can be empty, while all video/audio data is in linked files.
Some files don't even contain the track list, only chapter information.
mpv refused to play these, because normally, the main file dictates the
track layout.

Fix this by using the first segment for track data if no part of the
timeline is sourced from the main file.
This commit is contained in:
wm4 2013-04-14 02:35:48 +02:00
parent 8133aa4d8a
commit 5d562c5ef2

View File

@ -3993,10 +3993,16 @@ goto_enable_cache: ;
mpctx->demuxer);
}
if (mpctx->timeline && !mpctx->demuxer->matroska_data.ordered_chapters) {
// With Matroska, the "master" file dictates track layout etc.
// On the contrary, the EDL and CUE demuxers are empty wrappers.
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.
for (int n = 0; n < mpctx->num_timeline_parts; n++) {
if (mpctx->timeline[n].source == mpctx->demuxer)
goto main_is_ok;
}
mpctx->demuxer = mpctx->timeline[0].source;
main_is_ok: ;
}
add_dvd_tracks(mpctx);
add_demuxer_tracks(mpctx, mpctx->demuxer);