diff options
author | Daniel Dawson <ddawson@icehouse.net> | 2009-12-01 03:59:38 -0800 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-12-04 07:15:22 +0200 |
commit | 9b81b7827ce4ce887c6f22332e31b058f68cf3ac (patch) | |
tree | f70779d648044f0d3e7dc50b3906e7eb8452a7ed /libmpdemux | |
parent | 55f94a1a91bf9bf28b5b33f698c28a86c08e0e75 (diff) | |
download | mpv-9b81b7827ce4ce887c6f22332e31b058f68cf3ac.tar.bz2 mpv-9b81b7827ce4ce887c6f22332e31b058f68cf3ac.tar.xz |
demux_mkv: Detect and warn about virtual timeline nesting
Detect use of ChapterSegmentEditionUID element in a Matroska chapter
definition, indicating inclusion of an external virtual timeline,
which is not yet supported. Leave the chapter is the chapter list but
set segment_uid to zero. This way timeline parsing will skip the
chapter and avoid nonsensical output but will still print information
about missing content.
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_mkv.c | 16 | ||||
-rw-r--r-- | libmpdemux/ebml.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c index dcf2a71721..3874298172 100644 --- a/libmpdemux/demux_mkv.c +++ b/libmpdemux/demux_mkv.c @@ -1093,6 +1093,7 @@ static uint64_t read_one_chapter(struct demuxer *demuxer, stream_t *s) char *name = 0; int i; uint32_t id; + bool badchapter = false; len = ebml_read_length(s, &i); uint64_t bytes_read = len + i; @@ -1147,6 +1148,15 @@ static uint64_t read_one_chapter(struct demuxer *demuxer, stream_t *s) } break; + case MATROSKA_ID_CHAPTERSEGMENTEDITIONUID: + mp_tmsg(MSGT_DEMUX, MSGL_WARN, + "[mkv] Warning: unsupported edition recursion in chapter; " + "will skip on playback!\n"); + ebml_read_skip(s, &l); + len -= l; + badchapter = true; + break; + default: ebml_read_skip(s, &l); len -= l; @@ -1169,6 +1179,11 @@ static uint64_t read_one_chapter(struct demuxer *demuxer, stream_t *s) m->ordered_chapters[m->num_ordered_chapters] = chapter; m->num_ordered_chapters++; + if (badchapter) { + memset(&chapter.segment_uid, 0, sizeof(chapter.segment_uid)); + goto cleanup; + } + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Chapter %u from %02d:%02d:%02d." "%03d to %02d:%02d:%02d.%03d, %s\n", cid, @@ -1181,6 +1196,7 @@ static uint64_t read_one_chapter(struct demuxer *demuxer, stream_t *s) (int) ((end / 1000) % 60), (int) (end % 1000), name); +cleanup: free(name); return bytes_read; } diff --git a/libmpdemux/ebml.h b/libmpdemux/ebml.h index 4faf2495f1..a224bcd8e0 100644 --- a/libmpdemux/ebml.h +++ b/libmpdemux/ebml.h @@ -152,6 +152,8 @@ #define MATROSKA_ID_CHAPTERDISPLAY 0x80 #define MATROSKA_ID_CHAPSTRING 0x85 #define MATROSKA_ID_CHAPTERSEGMENTUID 0x6E67 +#define MATROSKA_ID_CHAPTERSEGMENTEDITIONUID\ + 0x6EBC /* IDs in the cluster master */ #define MATROSKA_ID_CLUSTERTIMECODE 0xE7 |