demux_mkv: disable ordered chapters if ChapterTimeEnd is missing

If the EditionFlagOrdered is set, chapters without ChapterTimeEnd make
no sense. Ordered chapters will play the chapters in the order they
appear, but will play the ranges the chapters cover. So if the end time
is missing, the range is incomplete and it's not clear what should be
played. If you assume the start of the next chapter as end time, the
ordered flag will have no observable effect, so that's not a useful
assumption.

This fixes playback of a file which (apparently) had the
EditionFlagOrdered set accidentally, with normal chapters.
This commit is contained in:
wm4 2015-06-28 18:32:58 +02:00
parent 745cc7a8cd
commit fccce81d42
1 changed files with 11 additions and 2 deletions

View File

@ -846,11 +846,20 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
struct matroska_chapter chapter = {0};
char *name = "(unnamed)";
if (!ca->n_chapter_time_start)
MP_MSG(demuxer, warn_level, "Chapter lacks start time\n");
chapter.start = ca->chapter_time_start;
chapter.end = ca->chapter_time_end;
if (!ca->n_chapter_time_start)
MP_MSG(demuxer, warn_level, "Chapter lacks start time\n");
if (!ca->n_chapter_time_start || !ca->n_chapter_time_end) {
if (demuxer->matroska_data.ordered_chapters) {
MP_MSG(demuxer, warn_level, "Chapter lacks start or end "
"time, disabling ordered chapters.\n");
demuxer->matroska_data.ordered_chapters = NULL;
demuxer->matroska_data.num_ordered_chapters = 0;
}
}
if (ca->n_chapter_display) {
if (ca->n_chapter_display > 1)
MP_MSG(demuxer, warn_level, "Multiple chapter "