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;
100 if ((s->
gfp = lame_init()) == NULL)
113 lame_set_quality(s->
gfp, 5);
119 lame_set_VBR(s->
gfp, vbr_default);
127 lame_set_bWriteVbrTag(s->
gfp,0);
133 if (lame_init_params(s->
gfp) < 0) {
139 avctx->
delay = lame_get_encoder_delay(s->
gfp) + 528 + 1;
147 for (ch = 0; ch < avctx->
channels; ch++) {
169 #define ENCODE_BUFFER(func, buf_type, buf_name) do { \
170 lame_result = func(s->gfp, \
171 (const buf_type *)buf_name[0], \
172 (const buf_type *)buf_name[1], frame->nb_samples, \
173 s->buffer + s->buffer_index, \
174 s->buffer_size - s->buffer_index); \
198 for (ch = 0; ch < avctx->
channels; ch++) {
200 (
const float *)frame->
data[ch],
213 if (lame_result < 0) {
214 if (lame_result == -1) {
216 "lame: output buffer too small (buffer index: %d, free bytes: %d)\n",
243 len = hdr.frame_size;
246 if (len <= s->buffer_index) {
263 #define OFFSET(x) offsetof(LAMEContext, x)
264 #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
284 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000, 0
288 .
name =
"libmp3lame",