summaryrefslogtreecommitdiffstats
path: root/libAACenc/src/aacenc_lib.cpp
diff options
context:
space:
mode:
authorpiratfm <piratfm@gmail.com>2013-04-12 00:26:09 +0300
committerMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-14 17:42:30 +0100
commitddb94b9025f6893a6d9543254fedf0a70c0549b8 (patch)
treec53927550c4bba4c2b6e4dbec60d183f70982fcb /libAACenc/src/aacenc_lib.cpp
parent671667db206f8551c21c085158d2f949a93536e6 (diff)
downloadfdk-aac-dabplus-ddb94b9025f6893a6d9543254fedf0a70c0549b8.tar.gz
fdk-aac-dabplus-ddb94b9025f6893a6d9543254fedf0a70c0549b8.tar.bz2
fdk-aac-dabplus-ddb94b9025f6893a6d9543254fedf0a70c0549b8.zip
vlc works with bare aac
Conflicts: .cproject libAACenc/src/aacenc_lib.cpp libAACenc/src/qc_main.cpp libFDK/src/FDK_crc.cpp libSYS/include/FDK_audio.h
Diffstat (limited to 'libAACenc/src/aacenc_lib.cpp')
-rw-r--r--libAACenc/src/aacenc_lib.cpp54
1 files changed, 47 insertions, 7 deletions
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index 392a0a6..efde05f 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -87,7 +87,7 @@ amm-info@iis.fraunhofer.de
contents/description: FDK HE-AAC Encoder interface library functions
****************************************************************************/
-
+#include <stdio.h>
#include "aacenc_lib.h"
#include "FDK_audio.h"
#include "aacenc.h"
@@ -427,17 +427,17 @@ static void FDKaacEnc_MapConfig(
/* Map virtual aot to transport aot. */
switch (hAacConfig->audioObjectType) {
- case AOT_MP2_AAC_LC:
case AOT_DABPLUS_AAC_LC:
+ case AOT_MP2_AAC_LC:
transport_AOT = AOT_AAC_LC;
break;
- case AOT_MP2_SBR:
case AOT_DABPLUS_SBR:
+ case AOT_MP2_SBR:
transport_AOT = AOT_SBR;
cc->flags |= CC_SBR;
break;
- case AOT_MP2_PS:
case AOT_DABPLUS_PS:
+ case AOT_MP2_PS:
transport_AOT = AOT_PS;
cc->flags |= CC_SBR;
break;
@@ -484,9 +484,27 @@ static void FDKaacEnc_MapConfig(
cc->flags |= CC_IS_BASELAYER;
cc->channelMode = hAacConfig->channelMode;
- cc->nSubFrames = (hAacConfig->nSubFrames > 1 && extCfg->userTpNsubFrames == 1)
+ if(extCfg->userTpType == TT_DABPLUS && hAacConfig->nSubFrames==1) {
+ switch(hAacConfig->sampleRate) {
+ case 48000:
+ cc->nSubFrames=6;
+ break;
+ case 32000:
+ cc->nSubFrames=4;
+ break;
+ case 24000:
+ cc->nSubFrames=3;
+ break;
+ case 16000:
+ cc->nSubFrames=2;
+ break;
+ }
+ fprintf(stderr, "hAacConfig->nSubFrames=%d hAacConfig->sampleRate=%d\n", hAacConfig->nSubFrames, hAacConfig->sampleRate);
+ } else {
+ cc->nSubFrames = (hAacConfig->nSubFrames > 1 && extCfg->userTpNsubFrames == 1)
? hAacConfig->nSubFrames
: extCfg->userTpNsubFrames;
+ }
cc->flags |= (extCfg->userTpProtection) ? CC_PROTECTION : 0;
@@ -751,6 +769,7 @@ INT aacEncoder_LimitBitrate(
FDK_ASSERT(bitRate > 0);
+ fprintf(stderr, "aacEncoder_LimitBitrate(): bitRate=%d", bitRate);
return bitRate;
}
@@ -809,11 +828,14 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
case AOT_DABPLUS_PS:
hAacConfig->syntaxFlags |= ((config->userSbrEnabled) ? AC_SBR_PRESENT : 0);
case AOT_DABPLUS_AAC_LC:
- config->userTpType = (config->userTpType!=TT_UNKNOWN) ? config->userTpType : TT_MP4_RAW;
+ config->userTpType = (config->userTpType!=TT_UNKNOWN) ? config->userTpType : TT_DABPLUS;
hAacConfig->framelength = (config->userFramelength!=(UINT)-1) ? config->userFramelength : 960;
if (hAacConfig->framelength != 960) {
return AACENC_INVALID_CONFIG;
}
+ config->userTpSignaling=2;
+ if(config->userTpType == TT_DABPLUS)
+ hAacConfig->syntaxFlags |= AC_DAB;
break;
#if 0
case AOT_ER_AAC_LC:
@@ -857,6 +879,22 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
break;
}
+ /* We need the frame length to call aacEncoder_LimitBitrate() */
+ fprintf(stderr, "##### WARNING ##### REMOVE ME");
+ fprintf(stderr, "config->userBitrate=%d\n", config->userBitrate);
+ hAacConfig->bitRate = aacEncoder_LimitBitrate(
+ NULL,
+ hAacConfig->sampleRate,
+ hAacConfig->framelength,
+ hAacConfig->nChannels,
+ hAacConfig->channelMode,
+ config->userBitrate,
+ hAacConfig->nSubFrames,
+ isSbrActive(hAacConfig),
+ hAacConfig->audioObjectType
+ );
+ fprintf(stderr, "hAacConfig->bitRate=%d\n", hAacConfig->bitRate);
+
switch ( hAacConfig->audioObjectType ) {
case AOT_ER_AAC_LD:
case AOT_ER_AAC_ELD:
@@ -1014,6 +1052,7 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
hAacEncoder->metaDataAllowed = 0;
}
+ fprintf(stderr, "hAacEncoder->metaDataAllowed=%d", hAacEncoder->metaDataAllowed);
return err;
}
@@ -1970,6 +2009,7 @@ AACENC_ERROR aacEncoder_SetParam(
|| ((type==TT_MP4_LATM_MCP1) && ((flags&CAPF_LATM) && (flags&CAPF_RAWPACKETS)))
|| ((type==TT_MP4_LOAS) && (flags&CAPF_LOAS))
|| ((type==TT_MP4_RAW) && (flags&CAPF_RAWPACKETS))
+ || ((type==TT_DABPLUS) && ((flags&CAPF_DAB_AAC) && (flags&CAPF_RAWPACKETS)))
) )
{
err = AACENC_INVALID_CONFIG;
@@ -2007,7 +2047,7 @@ AACENC_ERROR aacEncoder_SetParam(
break;
case AACENC_TPSUBFRAMES:
if (settings->userTpNsubFrames != value) {
- if (! ( (value>=1) && (value<=4) ) ) {
+ if (! ( (value>=1) && (value<=6) ) ) {
err = AACENC_INVALID_CONFIG;
break;
}