]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mp4: Make struct mp4ff opaque, hide struct mp4ff_track.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 9 Aug 2021 22:06:48 +0000 (00:06 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
For the former, code outside of mp4.c only needs a pointer while the
latter does not need to be exposed at all.

Fix the indentation of the two declarations while at it.

mp4.c
mp4.h

diff --git a/mp4.c b/mp4.c
index b6fbabcd39e45c5fb2a5df9d4dcb45e0db8fe205..32871727b345ab61ff3b0498a69de772c387cabd 100644 (file)
--- a/mp4.c
+++ b/mp4.c
 #include "string.h"
 #include "mp4.h"
 
+struct mp4ff_track {
+       int32_t type;
+       int32_t channelCount;
+       int32_t sampleSize;
+       uint16_t sampleRate;
+       int32_t audioType;
+
+       /* stsd */
+       int32_t stsd_entry_count;
+
+       /* stsz */
+       int32_t stsz_sample_size;
+       int32_t stsz_sample_count;
+       int32_t *stsz_table;
+
+       /* stts */
+       int32_t stts_entry_count;
+       int32_t *stts_sample_count;
+       int32_t *stts_sample_delta;
+
+       /* stsc */
+       int32_t stsc_entry_count;
+       int32_t *stsc_first_chunk;
+       int32_t *stsc_samples_per_chunk;
+       int32_t *stsc_sample_desc_index;
+
+       /* stsc */
+       int32_t stco_entry_count;
+       int32_t *stco_chunk_offset;
+
+       /* ctts */
+       int32_t ctts_entry_count;
+       int32_t *ctts_sample_count;
+       int32_t *ctts_sample_offset;
+
+       /* esde */
+       uint8_t *decoderConfig;
+       int32_t decoderConfigLen;
+
+       uint32_t maxBitrate;
+       uint32_t avgBitrate;
+
+       uint32_t timeScale;
+       uint64_t duration;
+};
+
+#define MAX_TRACKS 1024
+
+struct mp4ff {
+       /* stream to read from */
+       struct mp4ff_callback *stream;
+       int64_t current_position;
+
+       uint64_t moov_offset;
+       uint64_t moov_size;
+       uint8_t last_atom;
+       uint64_t file_size;
+       uint32_t error;
+
+       /* mvhd */
+       int32_t time_scale;
+       int32_t duration;
+
+       /* incremental track index while reading the file */
+       int32_t total_tracks;
+
+       /* track data */
+       struct mp4ff_track *track[MAX_TRACKS];
+
+       /* metadata */
+       struct mp4ff_metadata tags;
+};
+
 int32_t mp4ff_total_tracks(const struct mp4ff *f)
 {
        return f->total_tracks;
diff --git a/mp4.h b/mp4.h
index 216a6c041f5139367701b177ec6578a8187f0a1d..e9b18871f97da0a1633a433285b8e1f8579dfc65 100644 (file)
--- a/mp4.h
+++ b/mp4.h
@@ -7,55 +7,6 @@ struct mp4ff_callback {
     uint32_t read_error;
 };
 
-struct mp4ff_track {
-    int32_t type;
-    int32_t channelCount;
-    int32_t sampleSize;
-    uint16_t sampleRate;
-    int32_t audioType;
-
-    /* stsd */
-    int32_t stsd_entry_count;
-
-    /* stsz */
-    int32_t stsz_sample_size;
-    int32_t stsz_sample_count;
-    int32_t *stsz_table;
-
-    /* stts */
-    int32_t stts_entry_count;
-    int32_t *stts_sample_count;
-    int32_t *stts_sample_delta;
-
-    /* stsc */
-    int32_t stsc_entry_count;
-    int32_t *stsc_first_chunk;
-    int32_t *stsc_samples_per_chunk;
-    int32_t *stsc_sample_desc_index;
-
-    /* stsc */
-    int32_t stco_entry_count;
-    int32_t *stco_chunk_offset;
-
-    /* ctts */
-    int32_t ctts_entry_count;
-    int32_t *ctts_sample_count;
-    int32_t *ctts_sample_offset;
-
-    /* esde */
-    uint8_t *decoderConfig;
-    int32_t decoderConfigLen;
-
-    uint32_t maxBitrate;
-    uint32_t avgBitrate;
-
-    uint32_t timeScale;
-    uint64_t duration;
-
-};
-
-#define MAX_TRACKS 1024
-
 struct mp4ff_tag {
     char *item;
     char *value;
@@ -67,31 +18,7 @@ struct mp4ff_metadata {
     uint32_t count;
 };
 
-/* mp4 main file structure */
-struct mp4ff {
-    /* stream to read from */
-    struct mp4ff_callback *stream;
-    int64_t current_position;
-
-    uint64_t moov_offset;
-    uint64_t moov_size;
-    uint8_t last_atom;
-    uint64_t file_size;
-    uint32_t error;
-
-    /* mvhd */
-    int32_t time_scale;
-    int32_t duration;
-
-    /* incremental track index while reading the file */
-    int32_t total_tracks;
-
-    /* track data */
-    struct mp4ff_track *track[MAX_TRACKS];
-
-    /* metadata */
-    struct mp4ff_metadata tags;
-};
+struct mp4ff; /* opaque */
 
 void mp4ff_set_sample_position(struct mp4ff *f, const int32_t track, const int32_t sample);
 int32_t mp4ff_total_tracks(const struct mp4ff *f);