27 #include <lame/lame.h>
41 #define BUFFER_SIZE (7200 + 2 * MPA_FRAME_SIZE + MPA_FRAME_SIZE / 4+1000) // FIXME: Buffer size to small? Adding 1000 to make up for it.
46 lame_global_flags *
gfp;
81 #if FF_API_OLD_ENCODE_AUDIO
102 if ((s->
gfp = lame_init()) ==
NULL)
115 lame_set_quality(s->
gfp, 5);
121 lame_set_VBR(s->
gfp, vbr_default);
129 lame_set_bWriteVbrTag(s->
gfp,0);
135 if (lame_init_params(s->
gfp) < 0) {
141 avctx->
delay = lame_get_encoder_delay(s->
gfp) + 528 + 1;
146 #if FF_API_OLD_ENCODE_AUDIO
157 for (ch = 0; ch < avctx->
channels; ch++) {
179 #define ENCODE_BUFFER(func, buf_type, buf_name) do { \
180 lame_result = func(s->gfp, \
181 (const buf_type *)buf_name[0], \
182 (const buf_type *)buf_name[1], frame->nb_samples, \
183 s->buffer + s->buffer_index, \
184 s->buffer_size - s->buffer_index); \
208 for (ch = 0; ch < avctx->
channels; ch++) {
210 (
const float *)frame->
data[ch],
223 if (lame_result < 0) {
224 if (lame_result == -1) {
226 "lame: output buffer too small (buffer index: %d, free bytes: %d)\n",
253 len = hdr.frame_size;
256 if (len <= s->buffer_index) {
273 #define OFFSET(x) offsetof(LAMEContext, x)
274 #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
293 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000, 0
297 .
name =
"libmp3lame",