diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-26 21:30:51 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-26 21:30:51 +0000 |
commit | dcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc (patch) | |
tree | 70c20a923be952aaaade669db89b1e180a9c95f6 /apps/codecs/libfaad/decoder.c | |
parent | 05c329060829f34d1e898a8761fe1e9114693a4f (diff) | |
download | rockbox-dcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc.tar.gz rockbox-dcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc.zip |
Submit FS#12081. Check validity of channel configuration, comment unneeded code that is too inflexible to work with MAX_CHANNELS = 2. Fixes compiler warnings with GCC 4.6.0.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29784 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libfaad/decoder.c')
-rw-r--r-- | apps/codecs/libfaad/decoder.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/apps/codecs/libfaad/decoder.c b/apps/codecs/libfaad/decoder.c index c374ad3284..05d788597e 100644 --- a/apps/codecs/libfaad/decoder.c +++ b/apps/codecs/libfaad/decoder.c | |||
@@ -77,8 +77,9 @@ static int16_t s_lt_pred_stat[MAX_CHANNELS][4*FRAME_LEN] MEM_ALIGN_ATTR; | |||
77 | /* static function declarations */ | 77 | /* static function declarations */ |
78 | static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, | 78 | static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, |
79 | uint8_t *buffer, uint32_t buffer_size); | 79 | uint8_t *buffer, uint32_t buffer_size); |
80 | /* not used by rockbox | ||
80 | static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo); | 81 | static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo); |
81 | 82 | */ | |
82 | 83 | ||
83 | char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode) | 84 | char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode) |
84 | { | 85 | { |
@@ -305,6 +306,12 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer, | |||
305 | } | 306 | } |
306 | #endif | 307 | #endif |
307 | 308 | ||
309 | /* A maximum of MAX_CHANNELS channels is supported. */ | ||
310 | if (*channels > MAX_CHANNELS) | ||
311 | { | ||
312 | return -1; | ||
313 | } | ||
314 | |||
308 | #ifdef SBR_DEC | 315 | #ifdef SBR_DEC |
309 | /* implicit signalling */ | 316 | /* implicit signalling */ |
310 | if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) | 317 | if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) |
@@ -399,6 +406,13 @@ int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer, | |||
399 | *channels = 2; | 406 | *channels = 2; |
400 | } | 407 | } |
401 | #endif | 408 | #endif |
409 | |||
410 | /* A maximum of MAX_CHANNELS channels is supported. */ | ||
411 | if (*channels > MAX_CHANNELS) | ||
412 | { | ||
413 | return -1; | ||
414 | } | ||
415 | |||
402 | hDecoder->sf_index = mp4ASC.samplingFrequencyIndex; | 416 | hDecoder->sf_index = mp4ASC.samplingFrequencyIndex; |
403 | hDecoder->object_type = mp4ASC.objectTypeIndex; | 417 | hDecoder->object_type = mp4ASC.objectTypeIndex; |
404 | #ifdef ERROR_RESILIENCE | 418 | #ifdef ERROR_RESILIENCE |
@@ -520,6 +534,8 @@ void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame) | |||
520 | } | 534 | } |
521 | } | 535 | } |
522 | 536 | ||
537 | /* not used by rockbox */ | ||
538 | #if 0 | ||
523 | static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo) | 539 | static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo) |
524 | { | 540 | { |
525 | hInfo->num_front_channels = 0; | 541 | hInfo->num_front_channels = 0; |
@@ -724,6 +740,7 @@ static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hI | |||
724 | } | 740 | } |
725 | } | 741 | } |
726 | } | 742 | } |
743 | #endif | ||
727 | 744 | ||
728 | void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, | 745 | void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, |
729 | NeAACDecFrameInfo *hInfo, | 746 | NeAACDecFrameInfo *hInfo, |
@@ -882,7 +899,9 @@ static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, | |||
882 | #endif | 899 | #endif |
883 | 900 | ||
884 | /* Make a channel configuration based on either a PCE or a channelConfiguration */ | 901 | /* Make a channel configuration based on either a PCE or a channelConfiguration */ |
902 | /* not used by rockbox | ||
885 | create_channel_config(hDecoder, hInfo); | 903 | create_channel_config(hDecoder, hInfo); |
904 | */ | ||
886 | 905 | ||
887 | /* number of samples in this frame */ | 906 | /* number of samples in this frame */ |
888 | hInfo->samples = frame_len*output_channels; | 907 | hInfo->samples = frame_len*output_channels; |