3 #include "AudioTools/AudioCodecs/AudioCodecsBase.h"
4 #include "AACDecoderFDK.h"
5 #include "AACEncoderFDK.h"
11 AudioInfoSupport *audioChangeFDK =
nullptr;
24 AACDecoderFDK(
int output_buffer_size = FDK_OUT_BUFFER_DEFAULT_SIZE){
26 dec =
new aac_fdk::AACDecoderFDK(output_buffer_size);
31 dec =
new aac_fdk::AACDecoderFDK(out_stream, output_buffer_size);
40 dec->setOutput(out_stream);
44 return dec->begin(TT_MP4_ADTS, 1);
48 bool begin(TRANSPORT_TYPE transportType, UINT nrOfLayers){
49 return dec->begin(transportType, nrOfLayers);
59 AAC_DECODER_ERROR
configure(uint8_t *conf,
const uint32_t &length) {
60 return dec->configure(conf, length);
64 virtual size_t write(
const uint8_t *data,
size_t len) {
65 return dec->write(data, len);
69 CStreamInfo audioInfoEx(){
70 return dec->audioInfo();
76 CStreamInfo i = audioInfoEx();
89 virtual operator bool() {
93 aac_fdk::AACDecoderFDK *driver() {
97 static void audioChangeCallback(CStreamInfo &info){
98 if (audioChangeFDK!=
nullptr){
100 base.channels = info.numChannels;
101 base.sample_rate = info.sampleRate;
102 base.bits_per_sample = 16;
109 audioChangeFDK = &bi;
111 dec->setInfoCallback(audioChangeCallback);
115 aac_fdk::AACDecoderFDK *dec=
nullptr;
132 enc =
new aac_fdk::AACEncoderFDK();
136 enc =
new aac_fdk::AACEncoderFDK();
137 enc->setOutput(out_stream);
146 enc->setOutput(out_stream);
155 enc->setBitrate(bitrate);
180 enc->setAudioObjectType(aot);
195 enc->setAfterburner(afterburner);
205 enc->setSpectralBandReplication(eld_sbr);
227 enc->setVariableBitrateMode(vbr);
236 enc->setOutputBufferSize(outbuf_size);
243 aac_fdk::AudioInfo info;
247 enc->setAudioInfo(info);
269 virtual bool begin(
int input_channels=2,
int input_sample_rate=44100,
int input_bits_per_sample=16) {
271 return enc->begin(input_channels,input_sample_rate, input_bits_per_sample);
281 size_t write(
const uint8_t *data,
size_t len){
282 LOGD(
"write %d bytes", (
int)len);
283 return enc->write((uint8_t*)data, len);
292 UINT getParameter(
const AACENC_PARAM param) {
293 return enc->getParameter(param);
296 int setParameter(AACENC_PARAM param, uint32_t value){
297 return enc->setParameter(param, value);
300 aac_fdk::AACEncoderFDK *driver() {
314 aac_fdk::AACEncoderFDK *enc=
nullptr;