Since we allow to update the metadata of a file handle returned by
mp4_open(), we should check for both types of opens that the file
actually contains the udta, meta and ilst atoms.
ret = -E_MP4_BAD_SAMPLERATE;
if (f->track.sample_rate == 0)
goto fail;
+ ret = -E_MP4_MISSING_ATOM;
+ if (f->udta_size == 0 || f->meta_size == 0 || f->ilst_size == 0)
+ goto fail;
*result = f;
return 1;
fail:
if (ret < 0)
return ret;
- if (f->udta_size == 0 || f->meta_size == 0 || f->ilst_size == 0) {
- mp4_close(f);
- *result = NULL;
- return -E_MP4_MISSING_ATOM;
- }
*result = f;
return 1;
}