37 #define FAAC_DELAY_SAMPLES 1024
67 faacEncConfigurationPtr faac_cfg;
68 unsigned long samples_input, max_bytes_output;
80 &samples_input, &max_bytes_output);
88 faac_cfg = faacEncGetCurrentConfiguration(s->
faac_handle);
89 if (faac_cfg->version != FAAC_CFG_VERSION) {
90 av_log(avctx,
AV_LOG_ERROR,
"wrong libfaac version (compiled for: %d, using %d)\n", FAAC_CFG_VERSION, faac_cfg->version);
98 faac_cfg->aacObjectType =
MAIN;
102 faac_cfg->aacObjectType = LOW;
105 faac_cfg->aacObjectType = SSR;
108 faac_cfg->aacObjectType = LTP;
115 faac_cfg->mpegVersion = MPEG4;
116 faac_cfg->useTns = 0;
117 faac_cfg->allowMidside = 1;
119 faac_cfg->bandWidth = avctx->
cutoff;
121 faac_cfg->bitRate = 0;
124 faac_cfg->outputFormat = 1;
125 faac_cfg->inputFormat = FAAC_INPUT_16BIT;
136 unsigned char *
buffer = NULL;
137 unsigned long decoder_specific_info_size;
139 if (!faacEncGetDecoderSpecificInfo(s->
faac_handle, &buffer,
140 &decoder_specific_info_size)) {
148 faac_cfg->outputFormat = 0;
153 if (!faacEncSetConfiguration(s->
faac_handle, faac_cfg)) {
155 for (i = avctx->
bit_rate/1000; i ; i--) {
156 faac_cfg->bitRate = 1000*i / avctx->
channels;
157 if (faacEncSetConfiguration(s->
faac_handle, faac_cfg))
166 av_log(avctx,
AV_LOG_WARNING,
"libfaac doesn't support the specified bitrate, using %dkbit/s instead\n", i);
183 int bytes_written,
ret;
184 int num_samples = frame ? frame->
nb_samples : 0;
185 void *samples = frame ? frame->
data[0] : NULL;
190 bytes_written = faacEncEncode(s->
faac_handle, samples,
193 if (bytes_written < 0) {
195 return bytes_written;
211 avpkt->
size = bytes_written;