summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-22 23:57:39 +0200
committerwm4 <wm4@nowhere>2013-05-23 01:02:24 +0200
commit1139eae082b30e1230c1b882ddd472bfadd37e32 (patch)
tree6fba1c39d803c370bf7fda23756b4ca6741d1a00
parent89b8154aadd6982b5c6ddb1de5614daedb0850f1 (diff)
downloadmpv-1139eae082b30e1230c1b882ddd472bfadd37e32.tar.bz2
mpv-1139eae082b30e1230c1b882ddd472bfadd37e32.tar.xz
demux_mkv: use a single flag to indicate whether cues have been read
Before this commit, the demuxer would in theory accept multiple cues elements (and append its contents to the index in the order as encountered during reading). According to the Matroska specification, there can be only one cues element in the segment, so this seems like an overcomplication. Change it so that redundant elements are ignored, like with all other unique header elements. This makes implementing deferred reading of the cues element easier.
-rw-r--r--demux/demux_mkv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 10dee33c91..14300b2d96 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -174,6 +174,7 @@ typedef struct mkv_demuxer {
bool parsed_tags;
bool parsed_chapters;
bool parsed_attachments;
+ bool parsed_cues;
uint64_t skip_to_timecode;
int v_skip_to_keyframe, a_skip_to_keyframe;
@@ -1016,10 +1017,11 @@ static int read_header_element(struct demuxer *demuxer, uint32_t id,
return demux_mkv_read_tracks(demuxer);
case MATROSKA_ID_CUES:
- if (is_parsed_header(mkv_d, pos))
+ if (mkv_d->parsed_cues)
break;
if (at_filepos && !seek_pos_id(s, at_filepos, id))
return -1;
+ mkv_d->parsed_cues = true;
return demux_mkv_read_cues(demuxer);
case MATROSKA_ID_TAGS: