Mercurial > libavformat.hg
comparison mov.c @ 1005:d5b8ab2409f7 libavformat
some mov files have invalid pts so we need to consider these pts too in calculating the timabase
author | michael |
---|---|
date | Sat, 11 Mar 2006 11:30:07 +0000 |
parents | 76287fba65ff |
children | 22538d21681f |
comparison
equal
deleted
inserted
replaced
1004:409b399440a3 | 1005:d5b8ab2409f7 |
---|---|
1256 return 0; | 1256 return 0; |
1257 } | 1257 } |
1258 | 1258 |
1259 static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 1259 static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
1260 { | 1260 { |
1261 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | |
1262 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | |
1261 unsigned int i, entries; | 1263 unsigned int i, entries; |
1262 | 1264 |
1263 get_byte(pb); /* version */ | 1265 get_byte(pb); /* version */ |
1264 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ | 1266 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ |
1265 entries = get_be32(pb); | 1267 entries = get_be32(pb); |
1266 if(entries >= UINT_MAX / sizeof(Time2Sample)) | 1268 if(entries >= UINT_MAX / sizeof(Time2Sample)) |
1267 return -1; | 1269 return -1; |
1268 | 1270 |
1269 c->streams[c->fc->nb_streams-1]->ctts_count = entries; | 1271 sc->ctts_count = entries; |
1270 c->streams[c->fc->nb_streams-1]->ctts_data = av_malloc(entries * sizeof(Time2Sample)); | 1272 sc->ctts_data = av_malloc(entries * sizeof(Time2Sample)); |
1271 | 1273 |
1272 dprintf("track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); | 1274 dprintf("track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); |
1273 | 1275 |
1274 for(i=0; i<entries; i++) { | 1276 for(i=0; i<entries; i++) { |
1275 c->streams[c->fc->nb_streams - 1]->ctts_data[i].count= get_be32(pb); | 1277 int count =get_be32(pb); |
1276 c->streams[c->fc->nb_streams - 1]->ctts_data[i].duration= get_be32(pb); | 1278 int duration =get_be32(pb); |
1279 | |
1280 sc->ctts_data[i].count = count; | |
1281 sc->ctts_data[i].duration= duration; | |
1282 | |
1283 sc->time_rate= ff_gcd(sc->time_rate, duration); | |
1277 } | 1284 } |
1278 return 0; | 1285 return 0; |
1279 } | 1286 } |
1280 | 1287 |
1281 static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 1288 static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |