|
|
@ -1935,7 +1935,7 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
|
|
|
|
|
|
|
|
entries = avio_rb32(pb); |
|
|
|
entries = avio_rb32(pb); |
|
|
|
|
|
|
|
|
|
|
|
av_log(c->fc, AV_LOG_TRACE, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "track[%u].stsc.entries = %u\n", c->fc->nb_streams - 1, entries); |
|
|
|
|
|
|
|
|
|
|
|
if (!entries) |
|
|
|
if (!entries) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -2032,7 +2032,7 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
|
|
|
|
|
|
|
|
entries = avio_rb32(pb); |
|
|
|
entries = avio_rb32(pb); |
|
|
|
|
|
|
|
|
|
|
|
av_log(c->fc, AV_LOG_TRACE, "keyframe_count = %d\n", entries); |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "keyframe_count = %u\n", entries); |
|
|
|
|
|
|
|
|
|
|
|
if (!entries) |
|
|
|
if (!entries) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -2087,14 +2087,14 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
} |
|
|
|
} |
|
|
|
entries = avio_rb32(pb); |
|
|
|
entries = avio_rb32(pb); |
|
|
|
|
|
|
|
|
|
|
|
av_log(c->fc, AV_LOG_TRACE, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "sample_size = %u sample_count = %u\n", sc->sample_size, entries); |
|
|
|
|
|
|
|
|
|
|
|
sc->sample_count = entries; |
|
|
|
sc->sample_count = entries; |
|
|
|
if (sample_size) |
|
|
|
if (sample_size) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) { |
|
|
|
if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) { |
|
|
|
av_log(c->fc, AV_LOG_ERROR, "Invalid sample field size %d\n", field_size); |
|
|
|
av_log(c->fc, AV_LOG_ERROR, "Invalid sample field size %u\n", field_size); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2155,7 +2155,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
avio_rb24(pb); /* flags */ |
|
|
|
avio_rb24(pb); /* flags */ |
|
|
|
entries = avio_rb32(pb); |
|
|
|
entries = avio_rb32(pb); |
|
|
|
|
|
|
|
|
|
|
|
av_log(c->fc, AV_LOG_TRACE, "track[%i].stts.entries = %i\n", |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "track[%u].stts.entries = %u\n", |
|
|
|
c->fc->nb_streams-1, entries); |
|
|
|
c->fc->nb_streams-1, entries); |
|
|
|
|
|
|
|
|
|
|
|
if (!entries) |
|
|
|
if (!entries) |
|
|
@ -2215,7 +2215,7 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
avio_rb24(pb); /* flags */ |
|
|
|
avio_rb24(pb); /* flags */ |
|
|
|
entries = avio_rb32(pb); |
|
|
|
entries = avio_rb32(pb); |
|
|
|
|
|
|
|
|
|
|
|
av_log(c->fc, AV_LOG_TRACE, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "track[%u].ctts.entries = %u\n", c->fc->nb_streams - 1, entries); |
|
|
|
|
|
|
|
|
|
|
|
av_freep(&sc->ctts_data); |
|
|
|
av_freep(&sc->ctts_data); |
|
|
|
|
|
|
|
|
|
|
@ -2372,9 +2372,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st) |
|
|
|
e->size = sample_size; |
|
|
|
e->size = sample_size; |
|
|
|
e->min_distance = distance; |
|
|
|
e->min_distance = distance; |
|
|
|
e->flags = keyframe ? AVINDEX_KEYFRAME : 0; |
|
|
|
e->flags = keyframe ? AVINDEX_KEYFRAME : 0; |
|
|
|
av_log(mov->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " |
|
|
|
av_log(mov->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %u, offset %"PRIx64", dts %"PRId64", " |
|
|
|
"size %d, distance %d, keyframe %d\n", st->index, current_sample, |
|
|
|
"size %u, distance %u, keyframe %d\n", st->index, current_sample, |
|
|
|
current_offset, current_dts, sample_size, distance, keyframe); |
|
|
|
current_offset, current_dts, sample_size, distance, keyframe); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
current_offset += sample_size; |
|
|
|
current_offset += sample_size; |
|
|
@ -2421,7 +2421,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) |
|
|
|
total += chunk_count * count; |
|
|
|
total += chunk_count * count; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
av_log(mov->fc, AV_LOG_TRACE, "chunk count %d\n", total); |
|
|
|
av_log(mov->fc, AV_LOG_TRACE, "chunk count %u\n", total); |
|
|
|
if (total >= UINT_MAX / sizeof(*st->index_entries) - st->nb_index_entries) |
|
|
|
if (total >= UINT_MAX / sizeof(*st->index_entries) - st->nb_index_entries) |
|
|
|
return; |
|
|
|
return; |
|
|
|
if (av_reallocp_array(&st->index_entries, |
|
|
|
if (av_reallocp_array(&st->index_entries, |
|
|
@ -2466,7 +2466,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (st->nb_index_entries >= total) { |
|
|
|
if (st->nb_index_entries >= total) { |
|
|
|
av_log(mov->fc, AV_LOG_ERROR, "wrong chunk count %d\n", total); |
|
|
|
av_log(mov->fc, AV_LOG_ERROR, "wrong chunk count %u\n", total); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
e = &st->index_entries[st->nb_index_entries++]; |
|
|
|
e = &st->index_entries[st->nb_index_entries++]; |
|
|
@ -2475,9 +2475,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st) |
|
|
|
e->size = size; |
|
|
|
e->size = size; |
|
|
|
e->min_distance = 0; |
|
|
|
e->min_distance = 0; |
|
|
|
e->flags = AVINDEX_KEYFRAME; |
|
|
|
e->flags = AVINDEX_KEYFRAME; |
|
|
|
av_log(mov->fc, AV_LOG_TRACE, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", " |
|
|
|
av_log(mov->fc, AV_LOG_TRACE, "AVIndex stream %d, chunk %u, offset %"PRIx64", dts %"PRId64", " |
|
|
|
"size %d, duration %d\n", st->index, i, current_offset, current_dts, |
|
|
|
"size %u, duration %u\n", st->index, i, current_offset, current_dts, |
|
|
|
size, samples); |
|
|
|
size, samples); |
|
|
|
|
|
|
|
|
|
|
|
current_offset += size; |
|
|
|
current_offset += size; |
|
|
|
current_dts += samples; |
|
|
|
current_dts += samples; |
|
|
@ -2920,7 +2920,7 @@ static int mov_read_tfdt(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!st) { |
|
|
|
if (!st) { |
|
|
|
av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", frag->track_id); |
|
|
|
av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %u\n", frag->track_id); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
sc = st->priv_data; |
|
|
|
sc = st->priv_data; |
|
|
@ -2955,7 +2955,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!st) { |
|
|
|
if (!st) { |
|
|
|
av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", frag->track_id); |
|
|
|
av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %u\n", frag->track_id); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
sc = st->priv_data; |
|
|
|
sc = st->priv_data; |
|
|
@ -2964,7 +2964,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
avio_r8(pb); /* version */ |
|
|
|
avio_r8(pb); /* version */ |
|
|
|
flags = avio_rb24(pb); |
|
|
|
flags = avio_rb24(pb); |
|
|
|
entries = avio_rb32(pb); |
|
|
|
entries = avio_rb32(pb); |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "flags 0x%x entries %d\n", flags, entries); |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "flags 0x%x entries %u\n", flags, entries); |
|
|
|
|
|
|
|
|
|
|
|
/* Always assume the presence of composition time offsets.
|
|
|
|
/* Always assume the presence of composition time offsets.
|
|
|
|
* Without this assumption, for instance, we cannot deal with a track in fragmented movies that meet the following. |
|
|
|
* Without this assumption, for instance, we cannot deal with a track in fragmented movies that meet the following. |
|
|
@ -3018,9 +3018,9 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
distance = 0; |
|
|
|
distance = 0; |
|
|
|
av_add_index_entry(st, offset, dts, sample_size, distance, |
|
|
|
av_add_index_entry(st, offset, dts, sample_size, distance, |
|
|
|
keyframe ? AVINDEX_KEYFRAME : 0); |
|
|
|
keyframe ? AVINDEX_KEYFRAME : 0); |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %u, offset %"PRIx64", dts %"PRId64", " |
|
|
|
"size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i, |
|
|
|
"size %u, distance %d, keyframe %d\n", st->index, sc->sample_count+i, |
|
|
|
offset, dts, sample_size, distance, keyframe); |
|
|
|
offset, dts, sample_size, distance, keyframe); |
|
|
|
distance++; |
|
|
|
distance++; |
|
|
|
dts += sample_duration; |
|
|
|
dts += sample_duration; |
|
|
|
offset += sample_size; |
|
|
|
offset += sample_size; |
|
|
@ -3146,7 +3146,7 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
av_log(c->fc, AV_LOG_WARNING, "multiple edit list entries, " |
|
|
|
av_log(c->fc, AV_LOG_WARNING, "multiple edit list entries, " |
|
|
|
"a/v desync might occur, patch welcome\n"); |
|
|
|
"a/v desync might occur, patch welcome\n"); |
|
|
|
|
|
|
|
|
|
|
|
av_log(c->fc, AV_LOG_TRACE, "track[%i].edit_count = %i\n", c->fc->nb_streams-1, edit_count); |
|
|
|
av_log(c->fc, AV_LOG_TRACE, "track[%u].edit_count = %i\n", c->fc->nb_streams - 1, edit_count); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|