comparison src/aac/libfaad2/mp4.c @ 691:e6c5fdae6e88 trunk

[svn] - oh yes, commit mplayer patches as well
author nenolod
date Tue, 20 Feb 2007 06:38:03 -0800
parents 1d8b08df98c3
children f1b6f1b2cdb3
comparison
equal deleted inserted replaced
690:0305b3165a01 691:e6c5fdae6e88
1 /* 1 /*
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding 2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com 3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
4 ** 4 **
5 ** This program is free software; you can redistribute it and/or modify 5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by 6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or 7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version. 8 ** (at your option) any later version.
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 ** 18 **
19 ** Any non-GPL usage of this software or parts of this software is strictly 19 ** Any non-GPL usage of this software or parts of this software is strictly
20 ** forbidden. 20 ** forbidden.
21 ** 21 **
22 ** Software using this code must display the following message visibly in or 22 ** Commercial non-GPL licensing of this software is possible.
23 ** on each copy of the software: 23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
24 ** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Nero AG, www.nero.com"
25 ** in, for example, the about-box or help/startup screen.
26 ** 24 **
27 ** Commercial non-GPL licensing of this software is possible. 25 ** $Id: mp4.c,v 1.32 2004/09/04 14:56:28 menno Exp $
28 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
29 **
30 ** $Id: mp4.c,v 1.35 2006/08/06 18:57:15 menno Exp $
31 **/ 26 **/
32 27
33 #include "common.h" 28 #include "common.h"
34 #include "structs.h" 29 #include "structs.h"
35 30
61 #ifdef SBR_DEC 56 #ifdef SBR_DEC
62 1, /* 5 SBR */ 57 1, /* 5 SBR */
63 #else 58 #else
64 0, /* 5 SBR */ 59 0, /* 5 SBR */
65 #endif 60 #endif
61 #ifdef SCALABLE_DEC
62 1, /* 6 AAC Scalable */
63 #else
66 0, /* 6 AAC Scalable */ 64 0, /* 6 AAC Scalable */
65 #endif
67 0, /* 7 TwinVQ */ 66 0, /* 7 TwinVQ */
68 0, /* 8 CELP */ 67 0, /* 8 CELP */
69 0, /* 9 HVXC */ 68 0, /* 9 HVXC */
70 0, /* 10 Reserved */ 69 0, /* 10 Reserved */
71 0, /* 11 Reserved */ 70 0, /* 11 Reserved */
82 #ifdef LTP_DEC 81 #ifdef LTP_DEC
83 1, /* 19 ER AAC LTP */ 82 1, /* 19 ER AAC LTP */
84 #else 83 #else
85 0, /* 19 ER AAC LTP */ 84 0, /* 19 ER AAC LTP */
86 #endif 85 #endif
86 #ifdef SCALABLE_DEC
87 1, /* 20 ER AAC scalable */
88 #else
87 0, /* 20 ER AAC scalable */ 89 0, /* 20 ER AAC scalable */
90 #endif
88 0, /* 21 ER TwinVQ */ 91 0, /* 21 ER TwinVQ */
89 0, /* 22 ER BSAC */ 92 0, /* 22 ER BSAC */
90 #ifdef LD_DEC 93 #ifdef LD_DEC
91 1, /* 23 ER AAC LD */ 94 1, /* 23 ER AAC LD */
92 #else 95 #else
243 int16_t syncExtensionType = (int16_t)faad_getbits(&ld, 11 246 int16_t syncExtensionType = (int16_t)faad_getbits(&ld, 11
244 DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType")); 247 DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType"));
245 248
246 if (syncExtensionType == 0x2b7) 249 if (syncExtensionType == 0x2b7)
247 { 250 {
248 uint8_t tmp_OTi = (uint8_t)faad_getbits(&ld, 5 251 mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
249 DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType")); 252 DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType"));
250 253
251 if (mp4ASC->objectTypeIndex == 5) 254 if (mp4ASC->objectTypeIndex == 5)
252 { 255 {
253 mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(&ld 256 mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(&ld
254 DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag")); 257 DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag"));
255 258
256 if (mp4ASC->sbr_present_flag) 259 if (mp4ASC->sbr_present_flag)
257 { 260 {
258 uint8_t tmp; 261 uint8_t tmp;
259
260 /* Don't set OT to SBR until checked that it is actually there */
261 mp4ASC->objectTypeIndex = tmp_OTi;
262
263 tmp = (uint8_t)faad_getbits(&ld, 4 262 tmp = (uint8_t)faad_getbits(&ld, 4
264 DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); 263 DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
265 264
266 /* check for downsampled SBR */ 265 /* check for downsampled SBR */
267 if (tmp == mp4ASC->samplingFrequencyIndex) 266 if (tmp == mp4ASC->samplingFrequencyIndex)