]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - aac_afh.c
mp4: Eliminate duplication between the two open functions.
[paraslash.git] / aac_afh.c
index 42cba27a3670ddac4bde28f9d683c9c31a86e924..f3a06c4c213c80fad95158d8c33b18fafa43e33a 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -60,9 +60,8 @@ static int aac_afh_open(const void *map, size_t mapsize, void **afh_context)
        c->cb.seek = aac_afh_seek_cb;
        c->cb.user_data = c;
 
-       ret = -E_MP4_OPEN;
-       c->mp4 = mp4_open_read(&c->cb);
-       if (!c->mp4)
+       ret = mp4_open_read(&c->cb, &c->mp4);
+       if (ret < 0)
                goto free_ctx;
        *afh_context = c;
        return 0;
@@ -229,9 +228,9 @@ static int aac_afh_rewrite_tags(const char *map, size_t mapsize,
                return ret;
        lseek(fd, 0, SEEK_SET);
 
-       mp4 = mp4_open_meta(&cb);
-       if (!mp4)
-               return -E_MP4_OPEN;
+       ret = mp4_open_meta(&cb, &mp4);
+       if (ret < 0)
+               return ret;
        metadata = mp4_get_meta(mp4);
        PARA_NOTICE_LOG("%u metadata item(s) found\n", metadata->count);
        replace_or_add_tag("artist", tags->artist, metadata);