]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mp4: Wire it in and make it compile cleanly.
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 21 Oct 2021 17:09:59 +0000 (19:09 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
This switches to our local copy of libmp4ff. The configure script
now turns on support for the aac audio format even if libmp4ff is
not installed.

Some changes to mp4.c were necessary to silence warnings, most of
which are trivial. The single notably non-trivial change is the missing
initialization of chunk_sample and chunk in mp4ff_chunk_of_sample().

aac_afh.c
configure.ac
mp4.c
mp4.h

index 5c1225b62b2e179026dadf7638d4f44f041345cb..d8ad48a1527a0b223c02a94ba9e65cf3b462d109 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
 #include <neaacdec.h>
 
 #include "para.h"
-
-/* To get the mp4ff_tag_t and mp4ff_metadata_t typedefs. */
-#define USE_TAGGING
-#include <mp4ff.h>
-
+#include "mp4.h"
 #include "error.h"
 #include "portable_io.h"
 #include "afh.h"
index b817979f39ec79c141cd67eaaef6f49f559b5d21..9056002acd7010349939e06c2b3ccc3f8cfc5b5b 100644 (file)
@@ -291,12 +291,10 @@ AC_DEFUN([NEED_FLAC_OBJECTS], [{
 }])
 ########################################################################### faad
 STASH_FLAGS
-LIB_ARG_WITH([faad], [-lfaad -lmp4ff])
+LIB_ARG_WITH([faad], [-lfaad])
 HAVE_FAAD=yes
 AC_CHECK_HEADER(neaacdec.h, [], HAVE_FAAD=no)
-AC_CHECK_HEADER(mp4ff.h, [], HAVE_FAAD=no)
 AC_CHECK_LIB([faad], [NeAACDecOpen], [], HAVE_FAAD=no)
-AC_CHECK_LIB([mp4ff], [mp4ff_meta_get_artist], [], HAVE_FAAD=no)
 LIB_SUBST_FLAGS(faad)
 UNSTASH_FLAGS
 ########################################################################### mad
@@ -434,7 +432,7 @@ if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes && test -n "$BISON" && \
        NEED_OPUS_OBJECTS() && server_errlist_objs="$server_errlist_objs opus_afh opus_common"
        NEED_FLAC_OBJECTS && server_errlist_objs="$server_errlist_objs flac_afh"
        if test $HAVE_FAAD = yes; then
-               server_errlist_objs="$server_errlist_objs aac_afh"
+               server_errlist_objs="$server_errlist_objs aac_afh mp4"
        fi
        server_objs="$server_errlist_objs"
        AC_SUBST(server_objs, add_dot_o($server_objs))
@@ -693,7 +691,7 @@ NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
 NEED_FLAC_OBJECTS && recv_errlist_objs="$recv_errlist_objs flac_afh"
 
 if test $HAVE_FAAD = yes; then
-       recv_errlist_objs="$recv_errlist_objs aac_afh"
+       recv_errlist_objs="$recv_errlist_objs aac_afh mp4"
 fi
 recv_objs="$recv_errlist_objs"
 AC_SUBST(recv_objs, add_dot_o($recv_objs))
@@ -728,7 +726,7 @@ NEED_FLAC_OBJECTS && {
        audio_format_handlers="$audio_format_handlers flac"
 }
 if test $HAVE_FAAD = yes; then
-       afh_errlist_objs="$afh_errlist_objs aac_afh"
+       afh_errlist_objs="$afh_errlist_objs aac_afh mp4"
        audio_format_handlers="$audio_format_handlers aac"
 fi
 
@@ -786,7 +784,7 @@ NEED_FLAC_OBJECTS && {
        play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh"
 }
 if test $HAVE_FAAD = yes; then
-       play_errlist_objs="$play_errlist_objs aac_afh aacdec_filter"
+       play_errlist_objs="$play_errlist_objs aac_afh aacdec_filter mp4"
 fi
 if test $HAVE_MAD = yes; then
        play_errlist_objs="$play_errlist_objs mp3dec_filter"
diff --git a/mp4.c b/mp4.c
index d04137a911cebf83f516a1b5abce3732b080c845..58838d55261ebb7e73a48ce77cf4e9b66abb07c4 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -14,7 +14,7 @@ int32_t mp4ff_total_tracks(const mp4ff_t * f)
        return f->total_tracks;
 }
 
-int32_t mp4ff_read_data(mp4ff_t * f, int8_t * data, uint32_t size)
+int32_t mp4ff_read_data(mp4ff_t * f, void *data, uint32_t size)
 {
        int32_t result = 1;
 
@@ -724,7 +724,6 @@ static int32_t mp4ff_read_esds(mp4ff_t * f)
 }
 static int32_t mp4ff_read_mp4a(mp4ff_t * f)
 {
-       uint64_t size;
        int32_t i;
        uint8_t atom_type = 0;
        uint8_t header_size = 0;
@@ -750,7 +749,7 @@ static int32_t mp4ff_read_mp4a(mp4ff_t * f)
 
        mp4ff_read_int16(f);
 
-       size = mp4ff_atom_read_header(f, &atom_type, &header_size);
+       mp4ff_atom_read_header(f, &atom_type, &header_size);
        if (atom_type == ATOM_ESDS) {
                mp4ff_read_esds(f);
        }
@@ -828,7 +827,7 @@ static int32_t mp4ff_read_mvhd(mp4ff_t * f)
 }
 
 static int32_t mp4ff_tag_add_field(mp4ff_metadata_t * tags, const char *item,
-                char *value, int32_t len)
+               const char *value, int32_t len)
 {
        void *backup = (void *) tags->tags;
 
@@ -924,8 +923,7 @@ char *mp4ff_read_string(mp4ff_t * f, uint32_t length)
        return str;
 }
 
-static int32_t mp4ff_set_metadata_name(mp4ff_t * f, const uint8_t atom_type,
-               char **name)
+static int32_t mp4ff_set_metadata_name(const uint8_t atom_type, char **name)
 {
        static char *tag_names[] = {
                "unknown", "title", "artist", "writer", "album",
@@ -1132,8 +1130,7 @@ static int32_t mp4ff_parse_tag(mp4ff_t * f, const uint8_t parent_atom_type,
        if (data) {
                if (!done) {
                        if (name == NULL)
-                               mp4ff_set_metadata_name(f, parent_atom_type,
-                                                       &name);
+                               mp4ff_set_metadata_name(parent_atom_type, &name);
                        if (name)
                                mp4ff_tag_add_field(&(f->tags), name, data, len);
                }
@@ -1331,13 +1328,13 @@ int32_t parse_atoms(mp4ff_t * f, int meta_only)
        return 0;
 }
 
-int32_t mp4ff_get_decoder_config(const mp4ff_t * f, const int track,
+void mp4ff_get_decoder_config(const mp4ff_t * f, const int track,
                                 unsigned char **ppBuf, unsigned int *pBufSize)
 {
        if (track >= f->total_tracks) {
                *ppBuf = NULL;
                *pBufSize = 0;
-               return 1;
+               return;
        }
 
        if (f->track[track]->decoderConfig == NULL
@@ -1348,7 +1345,7 @@ int32_t mp4ff_get_decoder_config(const mp4ff_t * f, const int track,
                *ppBuf = malloc(f->track[track]->decoderConfigLen);
                if (*ppBuf == NULL) {
                        *pBufSize = 0;
-                       return 1;
+                       return;
                }
                memcpy(*ppBuf, f->track[track]->decoderConfig,
                        f->track[track]->decoderConfigLen);
@@ -1443,6 +1440,8 @@ static int32_t mp4ff_chunk_of_sample(const mp4ff_t * f, const int32_t track,
        int32_t chunk2entry;
        int32_t chunk1, chunk2, chunk1samples, range_samples, total = 0;
 
+       *chunk_sample = 0;
+       *chunk = 1;
        if (f->track[track] == NULL) {
                return -1;
        }
@@ -1695,7 +1694,7 @@ typedef struct {
 
 #define stricmp strcasecmp
 
-membuffer *membuffer_create()
+membuffer *membuffer_create(void)
 {
        const unsigned initial_size = 256;
 
@@ -2239,7 +2238,7 @@ static uint32_t modify_moov(mp4ff_t * f, const mp4ff_metadata_t * data,
        return 1;
 }
 
-int32_t mp4ff_write_data(mp4ff_t * f, int8_t * data, uint32_t size)
+int32_t mp4ff_write_data(mp4ff_t * f, void *data, uint32_t size)
 {
        int32_t result = 1;
 
diff --git a/mp4.h b/mp4.h
index cf8519daed15b0739252080968bfbcae55fa2fc7..92c995c14b0671bd59f0f5a0f73f6ad2de626580 100644 (file)
--- a/mp4.h
+++ b/mp4.h
@@ -100,7 +100,7 @@ typedef struct
 } mp4ff_t;
 
 int32_t mp4ff_total_tracks(const mp4ff_t *f);
-int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int track,
+void mp4ff_get_decoder_config(const mp4ff_t *f, const int track,
                unsigned char** ppBuf, unsigned int* pBufSize);
 mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
 void mp4ff_close(mp4ff_t *f);