]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mp4: Return proper types for sample rate and count.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 27 Aug 2021 17:10:51 +0000 (19:10 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 27 Jun 2022 14:45:56 +0000 (16:45 +0200)
The sample rate and the number of samples are stored as 16-bit/32-bit
unsigned integers in the mp4 file, so let mp4_get_sample_rate()
and mp4_num_samples() return these types.

mp4.c
mp4.h

diff --git a/mp4.c b/mp4.c
index b12cbbf48c121c83c8b1bf40c92196fa5d051841..1c33a176e2fafd1d174017cea25edcfba536a5fb 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -710,7 +710,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 +720,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];
diff --git a/mp4.h b/mp4.h
index 5a07fadc0278719c422eb15b46e59c5eeb05fb36..00de8d64609d1bdf079e6010fe21817012240263 100644 (file)
--- a/mp4.h
+++ b/mp4.h
@@ -23,9 +23,9 @@ int mp4_set_sample_position(struct mp4 *f, uint32_t sample);
 int mp4_open_read(const struct mp4_callback *cb, struct mp4 **result);
 void mp4_close(struct mp4 *f);
 int mp4_get_sample_size(const struct mp4 *f, uint32_t sample, uint32_t *result);
-uint32_t mp4_get_sample_rate(const struct mp4 *f);
+uint16_t mp4_get_sample_rate(const struct mp4 *f);
 uint16_t mp4_get_channel_count(const struct mp4 *f);
-int32_t mp4_num_samples(const struct mp4 *f);
+uint32_t mp4_num_samples(const struct mp4 *f);
 uint64_t mp4_get_duration(const struct mp4 *f);
 int mp4_open_meta(const struct mp4_callback *cb, struct mp4 **result);
 struct mp4_metadata *mp4_get_meta(struct mp4 *f);