]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - aac_afh.c
mp4: Use read/write functions from portable_io.h.
[paraslash.git] / aac_afh.c
index 5c1225b62b2e179026dadf7638d4f44f041345cb..c2daf5b533ca881990963618fbd2c488468f58ce 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"
@@ -112,20 +108,6 @@ static void aac_afh_close(void *afh_context)
        free(c);
 }
 
-/**
- * Libmp4ff function to reposition the file to the given sample.
- *
- * \param f The opaque handle returned by mp4ff_open_read().
- * \param track The number of the (audio) track.
- * \param sample Destination.
- *
- * We need this function to obtain the offset of the sample within the audio
- * file. Unfortunately, it is not exposed in the mp4ff header.
- *
- * \return This function always returns 0.
- */
-int32_t mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample);
-
 static int aac_afh_get_chunk(uint32_t chunk_num, void *afh_context,
                const char **buf, uint32_t *len)
 {
@@ -134,10 +116,9 @@ static int aac_afh_get_chunk(uint32_t chunk_num, void *afh_context,
        size_t offset;
 
        assert(chunk_num <= INT_MAX);
-       /* this function always returns zero */
        mp4ff_set_sample_position(c->mp4ff, c->track, chunk_num);
        offset = c->fpos;
-       ss = mp4ff_read_sample_getsize(c->mp4ff, c->track, chunk_num);
+       ss = mp4ff_get_sample_size(c->mp4ff, c->track, chunk_num);
        if (ss <= 0)
                return -E_MP4FF_BAD_SAMPLE;
        assert(ss + offset <= c->mapsize);