[FFmpeg-devel] [PATCH] avformat/mov: compute dts_shift with trun cts
Alexandre Sicard
alexandre.sicard at smartjog.com
Fri May 31 17:19:16 CEST 2013
Some movies have negative composition time offsets in their trun, causing pts <
dts errors. This patch makes use of dts_shift to handle them.
Signed-off-by: Alexandre Sicard <alexandre.sicard at smartjog.com>
---
libavformat/mov.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1c03b15..c43e6e3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2562,6 +2562,9 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->ctts_data[sc->ctts_count].count = 1;
sc->ctts_data[sc->ctts_count].duration = (flags & MOV_TRUN_SAMPLE_CTS) ?
avio_rb32(pb) : 0;
+ if (sc->ctts_data[sc->ctts_count].duration < 0) {
+ sc->dts_shift = FFMAX(sc->dts_shift, -sc->ctts_data[sc->ctts_count].duration);
+ }
sc->ctts_count++;
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
keyframe = 1;
--
1.8.3
More information about the ffmpeg-devel
mailing list