return 1;
}
+void mp4_close(struct mp4 *f)
+{
+ free(f->track.stsz_table);
+ free(f->track.stts_sample_count);
+ free(f->track.stsc_first_chunk);
+ free(f->track.stsc_samples_per_chunk);
+ free(f->track.stco_chunk_offset);
+ for (uint32_t n = 0; n < f->meta.count; n++) {
+ free(f->meta.tags[n].item);
+ free(f->meta.tags[n].value);
+ }
+ free(f->meta.tags);
+ free(f);
+}
+
static int open_file(const struct mp4_callback *cb, bool meta_only, struct mp4 **result)
{
int ret;
return 1;
fail:
*result = NULL;
- free(f);
+ mp4_close(f);
return ret;
}
return ret;
}
-void mp4_close(struct mp4 *f)
-{
- free(f->track.stsz_table);
- free(f->track.stts_sample_count);
- free(f->track.stsc_first_chunk);
- free(f->track.stsc_samples_per_chunk);
- free(f->track.stco_chunk_offset);
- for (uint32_t n = 0; n < f->meta.count; n++) {
- free(f->meta.tags[n].item);
- free(f->meta.tags[n].value);
- }
- free(f->meta.tags);
- free(f);
-}
-
static int32_t chunk_of_sample(const struct mp4 *f, int32_t sample,
int32_t *chunk)
{