]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mp4.c
mp4: Check for missing metadata also for regular opens.
[paraslash.git] / mp4.c
diff --git a/mp4.c b/mp4.c
index 381c9a21d8d24a709d7b474f90ad5e97bb87374d..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:
@@ -617,7 +620,7 @@ fail:
        return ret;
 }
 
-int mp4_open_read(const struct mp4_callback *cb, struct mp4 **result)
+int mp4_open(const struct mp4_callback *cb, struct mp4 **result)
 {
        struct mp4 *f;
        int ret;
@@ -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;
 }
@@ -869,7 +867,7 @@ static int write_data(struct mp4 *f, void *data, size_t size)
        return 1;
 }
 
-int mp4_meta_update(struct mp4 *f)
+int mp4_update_meta(struct mp4 *f)
 {
        void *new_moov_data;
        uint32_t new_moov_size;