]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mp4: Check for missing metadata also for regular opens.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 28 Aug 2021 19:15:35 +0000 (21:15 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 27 Jun 2022 14:45:56 +0000 (16:45 +0200)
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.

mp4.c

diff --git a/mp4.c b/mp4.c
index 2121155ccebeed885c78221e994e81acca3de846..7145a47a829695e2cf82a46f58b18aa743c30246 100644 (file)
--- 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;
 }