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;
98 if (!(s->
gfp = lame_init()))
115 lame_set_VBR(s->
gfp, vbr_default);
120 lame_set_VBR(s->
gfp, vbr_abr);
121 lame_set_VBR_mean_bitrate_kbps(s->
gfp, avctx->
bit_rate / 1000);
128 lame_set_bWriteVbrTag(s->
gfp,0);
134 if (lame_init_params(s->
gfp) < 0) {
148 for (ch = 0; ch < avctx->
channels; ch++) {
175 #define ENCODE_BUFFER(func, buf_type, buf_name) do { \
176 lame_result = func(s->gfp, \
177 (const buf_type *)buf_name[0], \
178 (const buf_type *)buf_name[1], frame->nb_samples, \
179 s->buffer + s->buffer_index, \
180 s->buffer_size - s->buffer_index); \
205 for (ch = 0; ch < avctx->
channels; ch++) {
207 (
const float *)frame->
data[ch],
222 if (lame_result < 0) {
223 if (lame_result == -1) {
225 "lame: output buffer too small (buffer index: %d, free bytes: %d)\n",
257 len = hdr.frame_size;
260 if (len <= s->buffer_index) {
277 #define OFFSET(x) offsetof(LAMEContext, x)
278 #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
299 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000, 0
303 .
name =
"libmp3lame",