summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-28 18:32:58 +0200
committerwm4 <wm4@nowhere>2015-06-28 18:32:58 +0200
commitfccce81d4232b2cd2f5da4659eb83718c4971085 (patch)
tree4f79f8cf64e2724a5ec6e526df002d006cbf75d6
parent745cc7a8cd1b7dd92bb4d4256a8ef7330b627a1d (diff)
downloadmpv-fccce81d4232b2cd2f5da4659eb83718c4971085.tar.bz2
mpv-fccce81d4232b2cd2f5da4659eb83718c4971085.tar.xz
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.
-rw-r--r--demux/demux_mkv.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 0b2bd719ee..747ed4d125 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -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 "