diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2013-08-27 16:35:59 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2013-08-27 16:35:59 -0700 |
commit | 206a397c708738c08edc0229881018edcb8ea793 (patch) | |
tree | 3ee77e3e55aef9117d0bc6bc8ed4dd2370903e1c /libMpegTPDec/src | |
parent | 5016eb7f6582fbb2d72d79be782325a12df08864 (diff) | |
download | fdk-aac-206a397c708738c08edc0229881018edcb8ea793.tar.gz fdk-aac-206a397c708738c08edc0229881018edcb8ea793.tar.bz2 fdk-aac-206a397c708738c08edc0229881018edcb8ea793.zip |
Decoder parse ASC
* AAC-Decoder
- Add support for explicit backward compatible signaling via ASC extension.
Bug 9428126
Change-Id: I0cb8226da07e3684bbb7eb95d10b6040973aa0f6
Diffstat (limited to 'libMpegTPDec/src')
-rw-r--r-- | libMpegTPDec/src/tpdec_asc.cpp | 59 | ||||
-rw-r--r-- | libMpegTPDec/src/version | 2 |
2 files changed, 60 insertions, 1 deletions
diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp index 59ad58b..4d7cc02 100644 --- a/libMpegTPDec/src/tpdec_asc.cpp +++ b/libMpegTPDec/src/tpdec_asc.cpp @@ -834,6 +834,62 @@ bail: #endif /* TP_ELD_ENABLE */ +static +TRANSPORTDEC_ERROR AudioSpecificConfig_ExtensionParse(CSAudioSpecificConfig *self, HANDLE_FDK_BITSTREAM bs, CSTpCallBacks *cb) +{ + TP_ASC_EXTENSION_ID lastAscExt, ascExtId = ASCEXT_UNKOWN; + INT bitsAvailable = (INT)FDKgetValidBits(bs); + + while (bitsAvailable >= 11) + { + lastAscExt = ascExtId; + ascExtId = (TP_ASC_EXTENSION_ID)FDKreadBits(bs, 11); + bitsAvailable -= 11; + + switch (ascExtId) { + case ASCEXT_SBR: /* 0x2b7 */ + if ( (self->m_extensionAudioObjectType != AOT_SBR) && (bitsAvailable >= 5) ) { + self->m_extensionAudioObjectType = getAOT(bs); + + if ( (self->m_extensionAudioObjectType == AOT_SBR) + || (self->m_extensionAudioObjectType == AOT_ER_BSAC) ) + { /* Get SBR extension configuration */ + self->m_sbrPresentFlag = FDKreadBits(bs, 1); + bitsAvailable -= 1; + + if ( self->m_sbrPresentFlag == 1 ) { + self->m_extensionSamplingFrequency = getSampleRate(bs, &self->m_extensionSamplingFrequencyIndex, 4); + + if ((INT)self->m_extensionSamplingFrequency <= 0) { + return TRANSPORTDEC_PARSE_ERROR; + } + } + if ( self->m_extensionAudioObjectType == AOT_ER_BSAC ) { + self->m_extensionChannelConfiguration = FDKreadBits(bs, 4); + bitsAvailable -= 4; + } + } + /* Update counter because of variable length fields (AOT and sampling rate) */ + bitsAvailable = (INT)FDKgetValidBits(bs); + } + break; + case ASCEXT_PS: /* 0x548 */ + if ( (lastAscExt == ASCEXT_SBR) + && (self->m_extensionAudioObjectType == AOT_SBR) + && (bitsAvailable > 0) ) + { /* Get PS extension configuration */ + self->m_psPresentFlag = FDKreadBits(bs, 1); + bitsAvailable -= 1; + } + break; + default: + /* Just ignore anything. */ + return TRANSPORTDEC_OK; + } + } + + return TRANSPORTDEC_OK; +} /* * API Functions @@ -984,6 +1040,9 @@ TRANSPORTDEC_ERROR AudioSpecificConfig_Parse( break; } + if (fExplicitBackwardCompatible) { + ErrorStatus = AudioSpecificConfig_ExtensionParse(self, bs, cb); + } return (ErrorStatus); } diff --git a/libMpegTPDec/src/version b/libMpegTPDec/src/version index 91c4c67..2803347 100644 --- a/libMpegTPDec/src/version +++ b/libMpegTPDec/src/version @@ -2,7 +2,7 @@ /* library info */ #define TP_LIB_VL0 2 #define TP_LIB_VL1 3 -#define TP_LIB_VL2 2 +#define TP_LIB_VL2 3 #define TP_LIB_TITLE "MPEG Transport" #define TP_LIB_BUILD_DATE __DATE__ #define TP_LIB_BUILD_TIME __TIME__ |