aacdec: Allow selecting float output at runtime.
This commit is contained in:
parent
4c7ad768e1
commit
26d5a4b6b4
@ -557,12 +557,8 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ffdshow custom code */
|
avctx->sample_fmt = avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
|
||||||
#if CONFIG_AUDIO_FLOAT
|
AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
|
||||||
#else
|
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AAC_INIT_VLC_STATIC( 0, 304);
|
AAC_INIT_VLC_STATIC( 0, 304);
|
||||||
AAC_INIT_VLC_STATIC( 1, 270);
|
AAC_INIT_VLC_STATIC( 1, 270);
|
||||||
@ -2179,12 +2175,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
|||||||
avctx->frame_size = samples;
|
avctx->frame_size = samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ffdshow custom code */
|
data_size_tmp = samples * avctx->channels;
|
||||||
#if CONFIG_AUDIO_FLOAT
|
data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(float) : sizeof(int16_t);
|
||||||
data_size_tmp = samples * avctx->channels * sizeof(float);
|
|
||||||
#else
|
|
||||||
data_size_tmp = samples * avctx->channels * sizeof(int16_t);
|
|
||||||
#endif
|
|
||||||
if (*data_size < data_size_tmp) {
|
if (*data_size < data_size_tmp) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
|
"Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
|
||||||
@ -2194,12 +2186,10 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
|||||||
*data_size = data_size_tmp;
|
*data_size = data_size_tmp;
|
||||||
|
|
||||||
if (samples) {
|
if (samples) {
|
||||||
/* ffdshow custom code */
|
if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||||
#if CONFIG_AUDIO_FLOAT
|
float_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
|
||||||
float_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
|
} else
|
||||||
#else
|
ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
|
||||||
ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ac->output_configured)
|
if (ac->output_configured)
|
||||||
@ -2518,11 +2508,7 @@ AVCodec ff_aac_decoder = {
|
|||||||
aac_decode_frame,
|
aac_decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||||
#if CONFIG_AUDIO_FLOAT
|
AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
|
||||||
AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
|
|
||||||
#else
|
|
||||||
AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE
|
|
||||||
#endif
|
|
||||||
},
|
},
|
||||||
.channel_layouts = aac_channel_layout,
|
.channel_layouts = aac_channel_layout,
|
||||||
};
|
};
|
||||||
@ -2542,11 +2528,7 @@ AVCodec ff_aac_latm_decoder = {
|
|||||||
.decode = latm_decode_frame,
|
.decode = latm_decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
|
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||||
#if CONFIG_AUDIO_FLOAT
|
AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
|
||||||
AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
|
|
||||||
#else
|
|
||||||
AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE
|
|
||||||
#endif
|
|
||||||
},
|
},
|
||||||
.channel_layouts = aac_channel_layout,
|
.channel_layouts = aac_channel_layout,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user