[FFmpeg-devel] [PATCH]Use flt as default input format for libaacplus
Carl Eugen Hoyos
cehoyos at ag.or.at
Fri Nov 25 00:21:06 CET 2011
Hi!
If I understand aacplusenc.c correctly, float is the native format for the
encoder:
switch (aacp->config.inputFormat){
case AACPLUS_INPUT_16BIT: {
int16_t *inbuff = (int16_t *) inputBuffer;
for (i=0; i<samplesInput; i++)
aacp->inBuf[...] = (float) inbuff[i];
break;
}
case AACPLUS_INPUT_FLOAT: {
float *inbuff = (float *) inputBuffer;
for (i=0; i<samplesInput; i++)
aacp->inBuf[...] = inbuff[i] * SHRT_MAX;
break;
}
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/libaacplus.c b/libavcodec/libaacplus.c
index a5ededb..5515934 100644
--- a/libavcodec/libaacplus.c
+++ b/libavcodec/libaacplus.c
@@ -64,7 +64,11 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
aacplus_cfg->bitRate = avctx->bit_rate;
aacplus_cfg->bandWidth = avctx->cutoff;
aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);
+ if (avctx->sample_fmt == SAMPLE_FMT_FLT) {
+ aacplus_cfg->inputFormat = AACPLUS_INPUT_FLOAT;
+ } else {
- aacplus_cfg->inputFormat = AACPLUS_INPUT_16BIT;
+ aacplus_cfg->inputFormat = AACPLUS_INPUT_16BIT;
+ }
if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {
av_log(avctx, AV_LOG_ERROR, "libaacplus doesn't support this output format!\n");
return -1;
@@ -129,6 +133,6 @@ AVCodec ff_libaacplus_encoder = {
aacPlus_encode_init,
aacPlus_encode_frame,
aacPlus_encode_close,
- .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+ .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_FLT,SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("libaacplus AAC+ (Advanced Audio Codec with SBR+PS)"),
};
More information about the ffmpeg-devel
mailing list