mirror of https://git.ffmpeg.org/ffmpeg.git
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
This commit is contained in:
parent
d82da3a880
commit
70a61ed4e4
|
@ -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)
|
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;
|
unsigned int i, entries;
|
||||||
|
|
||||||
get_byte(pb); /* version */
|
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))
|
if(entries >= UINT_MAX / sizeof(Time2Sample))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
c->streams[c->fc->nb_streams-1]->ctts_count = entries;
|
sc->ctts_count = entries;
|
||||||
c->streams[c->fc->nb_streams-1]->ctts_data = av_malloc(entries * sizeof(Time2Sample));
|
sc->ctts_data = av_malloc(entries * sizeof(Time2Sample));
|
||||||
|
|
||||||
dprintf("track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
|
dprintf("track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
|
||||||
|
|
||||||
for(i=0; i<entries; i++) {
|
for(i=0; i<entries; i++) {
|
||||||
c->streams[c->fc->nb_streams - 1]->ctts_data[i].count= get_be32(pb);
|
int count =get_be32(pb);
|
||||||
c->streams[c->fc->nb_streams - 1]->ctts_data[i].duration= 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue