diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-11-05 07:30:53 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-11-05 07:30:53 +0000 |
commit | e74527219668b720aefb7ecb79a44a8137aafa60 (patch) | |
tree | dfd381e42a8cb17cd424eaf887c0da408a207f42 /libavformat/mov.c | |
parent | fedb1eca0723d217832ab8ecdad6c608fce981ca (diff) | |
download | ffmpeg-e74527219668b720aefb7ecb79a44a8137aafa60.tar.gz |
compute dts shift with ctts value, cslg atom might be missing, fix #419
Originally committed as revision 20458 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index dc0135d8bd..194d139387 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1362,29 +1362,6 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_cslg(MOVContext *c, ByteIOContext *pb, MOVAtom atom) -{ - AVStream *st; - MOVStreamContext *sc; - - if (c->fc->nb_streams < 1) - return 0; - st = c->fc->streams[c->fc->nb_streams-1]; - sc = st->priv_data; - - get_be32(pb); // version + flags - - sc->dts_shift = get_be32(pb); - dprintf(c->fc, "dts shift %d\n", sc->dts_shift); - - get_be32(pb); // least dts to pts delta - get_be32(pb); // greatest dts to pts delta - get_be32(pb); // pts start - get_be32(pb); // pts end - - return 0; -} - static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st; @@ -1415,7 +1392,12 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) sc->ctts_data[i].count = count; sc->ctts_data[i].duration= duration; + if (duration < 0) + sc->dts_shift = FFMAX(sc->dts_shift, -duration); } + + dprintf(c->fc, "dts shift %d\n", sc->shift); + return 0; } @@ -1978,7 +1960,6 @@ static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('a','v','s','s'), mov_read_extradata }, { MKTAG('c','o','6','4'), mov_read_stco }, -{ MKTAG('c','s','l','g'), mov_read_cslg }, { MKTAG('c','t','t','s'), mov_read_ctts }, /* composition time to sample */ { MKTAG('d','i','n','f'), mov_read_default }, { MKTAG('d','r','e','f'), mov_read_dref }, |