struct mp4_track {
bool is_audio;
int32_t channelCount;
- int32_t sampleSize;
uint16_t sampleRate;
- /* stsd */
- int32_t stsd_entry_count;
-
/* stsz */
int32_t stsz_sample_size;
int32_t stsz_sample_count;
int32_t stco_entry_count;
int32_t *stco_chunk_offset;
- uint32_t maxBitrate;
- uint32_t avgBitrate;
-
uint32_t timeScale;
uint64_t duration;
};
read_int32(f); /* reserved */
t->channelCount = read_int16(f);
- t->sampleSize = read_int16(f);
+ read_int16(f);
read_int16(f);
read_int16(f);
static int32_t read_stsd(struct mp4 *f)
{
- int32_t i;
+ int32_t i, entry_count;
uint8_t header_size = 0;
struct mp4_track *t;
read_char(f); /* version */
read_int24(f); /* flags */
- t->stsd_entry_count = read_int32(f);
+ entry_count = read_int32(f);
/* CVE-2017-9253 */
- for (i = 0; i < t->stsd_entry_count && !f->stream->read_error; i++) {
+ for (i = 0; i < entry_count && !f->stream->read_error; i++) {
uint64_t skip = get_position(f);
uint64_t size;
uint8_t atom_type = 0;
return write_data(f, temp, sizeof(temp));
}
-static int32_t truncate_stream(struct mp4 *f)
-{
- return f->stream->truncate(f->stream->user_data);
-}
-
int32_t mp4_meta_update(struct mp4_callback *f, const struct mp4_metadata *data)
{
void *new_moov_data;
write_data(ff, "moov", 4);
write_data(ff, new_moov_data, new_moov_size);
}
-
- truncate_stream(ff);
-
+ f->truncate(f->user_data);
mp4_close(ff);
return 1;
}