From: Andre Noll Date: Sat, 28 Aug 2021 19:15:35 +0000 (+0200) Subject: mp4: Check for missing metadata also for regular opens. X-Git-Tag: v0.7.1~7^2~3 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=b96d1f30be6fda4b3d93aef19e66273260503cac;hp=945502385e8261d6921c7e1748fa64f34b7b81fd;p=paraslash.git mp4: Check for missing metadata also for regular opens. 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. --- diff --git a/mp4.c b/mp4.c index 2121155c..7145a47a 100644 --- a/mp4.c +++ b/mp4.c @@ -609,6 +609,9 @@ static int open_file(const struct mp4_callback *cb, bool meta_only, struct mp4 * 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: @@ -732,11 +735,6 @@ int mp4_open_meta(const struct mp4_callback *cb, struct mp4 **result) 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; }