From f2fa810c4bac275b4dc3ea9cd8b48d77e204618d Mon Sep 17 00:00:00 2001 From: Andre Date: Sat, 13 May 2006 07:09:52 +0200 Subject: [PATCH] aac: error cleanup put each aac-related error message to its proper subsystem --- aac_afh.c | 7 ++++--- aac_common.c | 15 +++++++++++++++ error.h | 8 ++++---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/aac_afh.c b/aac_afh.c index ac73fb19..93d3bec8 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -70,7 +70,7 @@ static int aac_find_stsz(unsigned char *buf, unsigned buflen, unsigned *skip) 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) @@ -192,7 +192,8 @@ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames, */ 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) @@ -205,7 +206,7 @@ static __must_check int para_fread(void *ptr, size_t size, size_t nmemb, FILE *s 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; diff --git a/aac_common.c b/aac_common.c index b3463b25..43e56000 100644 --- a/aac_common.c +++ b/aac_common.c @@ -26,6 +26,10 @@ #include "aac.h" #include "error.h" +/** + * get a new libfaad decoder handle + * + */ NeAACDecHandle aac_open(void) { NeAACDecHandle h = NeAACDecOpen(); @@ -97,6 +101,17 @@ unsigned aac_read_int32(unsigned char *buf) 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) { diff --git a/error.h b/error.h index eda69627..b70f7b47 100644 --- a/error.h +++ b/error.h @@ -193,11 +193,14 @@ extern const char **para_errlist[]; #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"), \ @@ -349,9 +352,6 @@ extern const char **para_errlist[]; #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) */ -- 2.39.5