return sample_count;
}
PARA_WARNING_LOG("stsz not found, buflen: %d\n", buflen);
- return -E_STCO;
+ return -E_STSZ;
}
static int read_chunk_table(unsigned skip)
*/
static int aac_reposition_stream(long unsigned request)
{
- return -E_AAC_REPOS;
+ return 1;
+// return -E_AAC_REPOS;
}
static __must_check int para_fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
return -E_FREAD;
}
-char *aac_read_chunk(long unsigned current_chunk, ssize_t *len)
+static char *aac_read_chunk(long unsigned current_chunk, ssize_t *len)
{
int ret;
size_t pos;
#include "aac.h"
#include "error.h"
+/**
+ * get a new libfaad decoder handle
+ *
+ */
NeAACDecHandle aac_open(void)
{
NeAACDecHandle h = NeAACDecOpen();
return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3];
}
+/**
+ * search for the first entry in the stco table
+ *
+ * \param buf buffer to seach
+ * \param buflen length of \a buf
+ * \param skip Upon succesful return, this contains the number
+ * of bytes to skip from the input buffer.
+ *
+ * \return the position of the first entry in the table on success,
+ * -E_STCO on errors.
+ */
int aac_find_entry_point(unsigned char *buf, unsigned buflen, int *skip)
{
#define AAC_AFH_ERRORS \
PARA_ERROR(AAC_REPOS, "aac repositioning error"), \
PARA_ERROR(AAC_READ, "aac read error"), \
+ PARA_ERROR(STSZ, "did not find stcz atom"), \
#define AAC_COMMON_ERRORS \
- PARA_ERROR(AAC_OPEN, "NeAACDecOpen() failed"), \
PARA_ERROR(AAC_BUF, "invalid buffer"), \
+ PARA_ERROR(ESDS, "did not find esds atom"), \
+ PARA_ERROR(STCO, "did not find stco atom"), \
+
#define OGG_ERRORS \
PARA_ERROR(OGG_READ, "ogg read error"), \
#define AACDEC_ERRORS \
PARA_ERROR(AACDEC_INIT, "failed to init aac decoder"), \
- PARA_ERROR(ESDS, "did not find esds atom"), \
- PARA_ERROR(STSZ, "did not find stsz atom"), \
- PARA_ERROR(STCO, "did not find stco atom"), \
PARA_ERROR(AAC_DECODE, "aac decode error"), \
/* these do not need error handling (yet) */