typedef struct Mp3AudioContext {
AVClass *class;
lame_global_flags *gfp;
- int stereo;
uint8_t buffer[BUFFER_SIZE];
int buffer_index;
int reservoir;
if (avctx->channels > 2)
return -1;
- s->stereo = avctx->channels > 1 ? 1 : 0;
-
if ((s->gfp = lame_init()) == NULL)
goto err;
lame_set_in_samplerate(s->gfp, avctx->sample_rate);
} else {
lame_set_quality(s->gfp, avctx->compression_level);
}
- lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO);
+ lame_set_mode(s->gfp, avctx->channels > 1 ? JOINT_STEREO : MONO);
lame_set_brate(s->gfp, avctx->bit_rate / 1000);
if (avctx->flags & CODEC_FLAG_QSCALE) {
lame_set_brate(s->gfp, 0);
/* lame 3.91 dies on '1-channel interleaved' data */
if (data) {
- if (s->stereo) {
+ if (avctx->channels > 1) {
lame_result = lame_encode_buffer_interleaved(s->gfp, data,
avctx->frame_size,
s->buffer + s->buffer_index,