From aaacb7010fc247cfc9f16b2e3aee568f29089a22 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Sat, 1 Dec 2007 01:01:35 +0000 Subject: Remove the mallocs for the codecdata in the m4a parser and assume a maximum size of 64 bytes (see comments in source). Also clean up the alac_set_info() function a little and make it alignment-safe. We still need to remove the seektable related mallocs. Please report if any AAC or ALAC files stop playing in Rockbox after this commit - but it is not expected to cause problems. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15861 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libm4a/m4a.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'apps/codecs/libm4a/m4a.h') diff --git a/apps/codecs/libm4a/m4a.h b/apps/codecs/libm4a/m4a.h index 401cff3b7a..a4d4dc0f79 100644 --- a/apps/codecs/libm4a/m4a.h +++ b/apps/codecs/libm4a/m4a.h @@ -23,6 +23,19 @@ #include #include +/* AAC codecdata appears to always be less than 8 bytes - see + AudioSpecificConfig2 in libfaad/mp4.c + + ALAC codecdata appears to always be 44 bytes (see alac_set_info in + libalac/alac.c) but my test file contains 56 bytes. + + So we go safe and round up to 64 bytes - if we find more than this, + we give an error (even though we could possibly continue), so we + can increase this buffer. +*/ + +#define MAX_CODECDATA_SIZE 64 + typedef struct { struct codec_api* ci; int eof; @@ -57,7 +70,7 @@ typedef struct uint32_t num_sample_byte_sizes; uint32_t codecdata_len; - void *codecdata; + uint8_t codecdata[MAX_CODECDATA_SIZE]; int mdat_offset; uint32_t mdat_len; -- cgit v1.2.3