]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mp4.c
mp4: Remove ->len member of struct mp4_tag.
[paraslash.git] / mp4.c
diff --git a/mp4.c b/mp4.c
index b12cbbf48c121c83c8b1bf40c92196fa5d051841..e98a24e26615f07a22e83d1343d75b56aca85253 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -394,7 +394,6 @@ static int parse_tag(struct mp4 *f, uint8_t parent, int32_t size)
        tag = f->meta.tags + f->meta.count;
        tag->item = para_strdup(get_metadata_name(parent));
        tag->value = value;
-       tag->len = len;
        f->meta.count++;
        return 1;
 fail:
@@ -567,6 +566,21 @@ static int parse_sub_atoms(struct mp4 *f, uint64_t total_size, bool meta_only)
        return 1;
 }
 
+void mp4_close(struct mp4 *f)
+{
+       free(f->track.stsz_table);
+       free(f->track.stts_sample_count);
+       free(f->track.stsc_first_chunk);
+       free(f->track.stsc_samples_per_chunk);
+       free(f->track.stco_chunk_offset);
+       for (uint32_t n = 0; n < f->meta.count; n++) {
+               free(f->meta.tags[n].item);
+               free(f->meta.tags[n].value);
+       }
+       free(f->meta.tags);
+       free(f);
+}
+
 static int open_file(const struct mp4_callback *cb, bool meta_only, struct mp4 **result)
 {
        int ret;
@@ -599,7 +613,7 @@ static int open_file(const struct mp4_callback *cb, bool meta_only, struct mp4 *
        return 1;
 fail:
        *result = NULL;
-       free(f);
+       mp4_close(f);
        return ret;
 }
 
@@ -622,21 +636,6 @@ fail:
        return ret;
 }
 
-void mp4_close(struct mp4 *f)
-{
-       free(f->track.stsz_table);
-       free(f->track.stts_sample_count);
-       free(f->track.stsc_first_chunk);
-       free(f->track.stsc_samples_per_chunk);
-       free(f->track.stco_chunk_offset);
-       for (uint32_t n = 0; n < f->meta.count; n++) {
-               free(f->meta.tags[n].item);
-               free(f->meta.tags[n].value);
-       }
-       free(f->meta.tags);
-       free(f);
-}
-
 static int32_t chunk_of_sample(const struct mp4 *f, int32_t sample,
                int32_t *chunk)
 {
@@ -710,7 +709,7 @@ int mp4_get_sample_size(const struct mp4 *f, uint32_t sample, uint32_t *result)
        return 1;
 }
 
-uint32_t mp4_get_sample_rate(const struct mp4 *f)
+uint16_t mp4_get_sample_rate(const struct mp4 *f)
 {
        return f->track.sample_rate;
 }
@@ -720,10 +719,10 @@ uint16_t mp4_get_channel_count(const struct mp4 *f)
        return f->track.channel_count;
 }
 
-int32_t mp4_num_samples(const struct mp4 *f)
+uint32_t mp4_num_samples(const struct mp4 *f)
 {
        const struct mp4_track *t = &f->track;
-       int32_t total = 0;
+       uint32_t total = 0;
 
        for (uint32_t n = 0; n < t->stts_entry_count; n++)
                total += t->stts_sample_count[n];