diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-03-11 11:30:07 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-03-11 11:30:07 +0000 |
commit | 70a61ed4e41b2437fa412552c14a674c3ad22d53 (patch) | |
tree | 3739bc26f291a7affd339cec2ec9edb541a8a0b5 /libavformat/mov.c | |
parent | d82da3a880f4521b5fdc333b3e238e2415b86a8d (diff) | |
download | ffmpeg-70a61ed4e41b2437fa412552c14a674c3ad22d53.tar.gz |
some mov files have invalid pts so we need to consider these pts too in calculating the timabase
Originally committed as revision 5149 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 7e5473d1ac..a40910572d 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1258,6 +1258,8 @@ av_log(NULL, AV_LOG_DEBUG, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { + AVStream *st = c->fc->streams[c->fc->nb_streams-1]; + MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; unsigned int i, entries; get_byte(pb); /* version */ @@ -1266,14 +1268,19 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) if(entries >= UINT_MAX / sizeof(Time2Sample)) return -1; - c->streams[c->fc->nb_streams-1]->ctts_count = entries; - c->streams[c->fc->nb_streams-1]->ctts_data = av_malloc(entries * sizeof(Time2Sample)); + sc->ctts_count = entries; + sc->ctts_data = av_malloc(entries * sizeof(Time2Sample)); dprintf("track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); for(i=0; i<entries; i++) { - c->streams[c->fc->nb_streams - 1]->ctts_data[i].count= get_be32(pb); - c->streams[c->fc->nb_streams - 1]->ctts_data[i].duration= get_be32(pb); + int count =get_be32(pb); + int duration =get_be32(pb); + + sc->ctts_data[i].count = count; + sc->ctts_data[i].duration= duration; + + sc->time_rate= ff_gcd(sc->time_rate, duration); } return 0; } |