summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/ae_faac.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs/ae_faac.c')
-rw-r--r--libmpcodecs/ae_faac.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/libmpcodecs/ae_faac.c b/libmpcodecs/ae_faac.c
index 86ada0ebfb..3ed02d3f05 100644
--- a/libmpcodecs/ae_faac.c
+++ b/libmpcodecs/ae_faac.c
@@ -18,7 +18,7 @@
static faacEncHandle faac;
static faacEncConfigurationPtr config = NULL;
-static int
+static int
param_bitrate = 128,
param_quality = 0,
param_object_type = 1,
@@ -58,11 +58,11 @@ static int bind_faac(audio_encoder_t *encoder, muxer_stream_t *mux_a)
mux_a->h.dwScale=encoder->params.samples_per_frame;
mux_a->wf->nSamplesPerSec=mux_a->h.dwRate;
mux_a->wf->nAvgBytesPerSec = encoder->params.bitrate / 8;
-
+
mux_a->wf->nBlockAlign = mux_a->h.dwScale;
mux_a->h.dwSuggestedBufferSize = (encoder->params.audio_preload*mux_a->wf->nAvgBytesPerSec)/1000;
mux_a->h.dwSuggestedBufferSize -= mux_a->h.dwSuggestedBufferSize % mux_a->wf->nBlockAlign;
-
+
mux_a->wf->cbSize = decoder_specific_len;
mux_a->wf->wBitsPerSample = 0; /* does not apply */
((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->wID = 1;
@@ -70,23 +70,23 @@ static int bind_faac(audio_encoder_t *encoder, muxer_stream_t *mux_a)
((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nBlockSize = mux_a->wf->nBlockAlign;
((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nFramesPerBlock = 1;
((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0;
-
- // Fix allocation
+
+ // Fix allocation
mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize);
-
+
if(config->inputFormat == FAAC_INPUT_FLOAT)
encoder->input_format = AF_FORMAT_FLOAT_NE;
else if(config->inputFormat == FAAC_INPUT_32BIT)
encoder->input_format = AF_FORMAT_S32_NE;
else
encoder->input_format = AF_FORMAT_S16_NE;
-
+
encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize;
encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2;
if(decoder_specific_buffer && decoder_specific_len)
memcpy(mux_a->wf + 1, decoder_specific_buffer, decoder_specific_len);
-
+
return 1;
}
@@ -107,7 +107,7 @@ static int encode_faac(audio_encoder_t *encoder, uint8_t *dest, void *src, int l
// len is divided by the number of bytes per sample
enc_frame_size = faacEncEncode(faac, (int32_t*) src, len / divisor, dest, max_size);
-
+
return enc_frame_size;
}
@@ -117,13 +117,13 @@ int close_faac(audio_encoder_t *encoder)
}
int mpae_init_faac(audio_encoder_t *encoder)
-{
+{
if(encoder->params.channels < 1 || encoder->params.channels > 6 || (param_mpeg != 2 && param_mpeg != 4))
{
mp_msg(MSGT_MENCODER, MSGL_FATAL, "AE_FAAC, unsupported number of channels: %d, or mpeg version: %d, exit\n", encoder->params.channels, param_mpeg);
return 0;
}
-
+
faac = faacEncOpen(encoder->params.sample_rate, encoder->params.channels, &samples_input, &max_bytes_output);
if(!faac)
{
@@ -143,7 +143,7 @@ int mpae_init_faac(audio_encoder_t *encoder)
config->quantqual = param_quality;
else
config->bitRate = param_bitrate / encoder->params.channels;
-
+
if(param_format==33)
{
config->inputFormat = FAAC_INPUT_FLOAT;
@@ -172,26 +172,26 @@ int mpae_init_faac(audio_encoder_t *encoder)
config->bandWidth = param_cutoff;
if(encoder->params.channels == 6)
config->useLfe = 1;
-
- if(!faacEncSetConfiguration(faac, config))
+
+ if(!faacEncSetConfiguration(faac, config))
{
mp_msg(MSGT_MENCODER, MSGL_FATAL, "AE_FAAC, counldn't set specified parameters, exiting\n");
return 0;
}
-
+
if(param_raw)
- faacEncGetDecoderSpecificInfo(faac, &decoder_specific_buffer, &decoder_specific_len);
+ faacEncGetDecoderSpecificInfo(faac, &decoder_specific_buffer, &decoder_specific_len);
else
decoder_specific_len = 0;
-
+
encoder->params.bitrate = param_bitrate;
encoder->params.samples_per_frame = 1024;
encoder->decode_buffer_size = divisor * samples_input; //samples * 16 bits_per_sample
-
+
encoder->bind = bind_faac;
encoder->get_frame_size = get_frame_size;
encoder->encode = encode_faac;
encoder->close = close_faac;
-
+
return 1;
}