]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mp4.c
mp4: Remove ->error of struct mp4.
[paraslash.git] / mp4.c
diff --git a/mp4.c b/mp4.c
index c40fbe0b6cce2e1e7a87436b941555d7d780176b..477b4307244731a0702599c8e49cf2a89862efa3 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -52,11 +52,8 @@ struct mp4 {
        uint8_t last_atom;
        uint64_t file_size;
 
-       uint32_t error;
-
        /* incremental track index while reading the file */
        int32_t total_tracks;
-
        /* track data */
        struct mp4_track *track[MAX_TRACKS];
 
@@ -445,18 +442,6 @@ static int32_t set_position(struct mp4 *f, int64_t position)
        return 0;
 }
 
-static void track_add(struct mp4 *f)
-{
-       f->total_tracks++;
-
-       if (f->total_tracks > MAX_TRACKS) {
-               f->total_tracks = 0;
-               f->error++;
-               return;
-       }
-       f->track[f->total_tracks - 1] = para_calloc(sizeof(struct mp4_track));
-}
-
 static int read_stsz(struct mp4 *f)
 {
        int ret;
@@ -904,11 +889,13 @@ static int parse_sub_atoms(struct mp4 *f, uint64_t total_size, int meta_only)
                if (size == 0)
                        return -1;
                counted_size += size;
-               /* we're starting to read a new track, update index,
-                * so that all data and tables get written in the right place
-                */
-               if (atom_type == ATOM_TRAK)
-                       track_add(f);
+               if (atom_type == ATOM_TRAK) {
+                       if (f->total_tracks >= MAX_TRACKS)
+                               return -1;
+                       f->total_tracks++;
+                       f->track[f->total_tracks - 1] = para_calloc(
+                               sizeof(struct mp4_track));
+               }
                /* parse subatoms */
                if (meta_only && !need_parse_when_meta_only(atom_type)) {
                        set_position(f, get_position(f) + size - header_size);
@@ -966,7 +953,7 @@ struct mp4 *mp4_open_read(const struct mp4_callback *cb)
 
        f->cb = cb;
        ret = parse_atoms(f, 0);
-       if (ret < 0 || f->error) {
+       if (ret < 0) {
                free(f);
                return NULL;
        }
@@ -1168,7 +1155,7 @@ struct mp4 *mp4_open_meta(const struct mp4_callback *cb)
 
        f->cb = cb;
        ret = parse_atoms(f, 1);
-       if (ret < 0 || f->error) {
+       if (ret < 0) {
                free(f);
                return NULL;
        }