Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-04-16 20:49:30 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2017-08-04 20:18:07 +0300
commit1831d4ff70d5e9c38c6096e76c40dfb6182a0fb0 (patch)
tree067cd8e6136ffa22cf966f4c53c88a8868d81474
parent7dbc8adf2d239b96555090d355c9ba08dea7a05d (diff)
matroskadec_haali: support multiple CueTrackPositions in one CuePoint
-rw-r--r--libavformat/MatroskaParser.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libavformat/MatroskaParser.c b/libavformat/MatroskaParser.c
index 375ef33245..094fc4f282 100644
--- a/libavformat/MatroskaParser.c
+++ b/libavformat/MatroskaParser.c
@@ -1649,7 +1649,7 @@ static void parseCues(MatroskaFile *mf,ulonglong toplen) {
jmp_buf jb;
ulonglong v;
struct Cue cc;
- unsigned i,j,k;
+ unsigned i,j,k,startCue;
mf->seen.Cues = 1;
mf->nCues = 0;
@@ -1669,6 +1669,7 @@ static void parseCues(MatroskaFile *mf,ulonglong toplen) {
FOREACH(mf,toplen)
case 0xbb: // CuePoint
+ startCue = mf->nCues;
FOREACH(mf,len)
case 0xb3: // CueTime
cc.Time = readUInt(mf,(unsigned)len);
@@ -1721,13 +1722,21 @@ static void parseCues(MatroskaFile *mf,ulonglong toplen) {
ENDFOR(mf);
break;
ENDFOR(mf);
+
+ if (mf->nCues == 0 && mf->pCluster - mf->pSegment != cc.Position) {
+ addCue(mf,mf->pCluster - mf->pSegment,mf->firstTimecode);
+ startCue = 1;
+ }
+
+ memcpy(AGET(mf,Cues),&cc,sizeof(cc));
break;
ENDFOR(mf);
- if (mf->nCues == 0 && mf->pCluster - mf->pSegment != cc.Position)
- addCue(mf,mf->pCluster - mf->pSegment,mf->firstTimecode);
+ // Update time after parsing all CueTrackPositions
+ // The time may not have been available before
+ for (i = startCue; i < mf->nCues; i++)
+ mf->Cues[i].Time = cc.Time;
- memcpy(AGET(mf,Cues),&cc,sizeof(cc));
break;
ENDFOR(mf);