Lines Matching refs:avctx
44 static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
46 Mp3AudioContext *s = avctx->priv_data;
48 if (avctx->channels > 2)
51 s->stereo = avctx->channels > 1 ? 1 : 0;
55 lame_set_in_samplerate(s->gfp, avctx->sample_rate);
56 lame_set_out_samplerate(s->gfp, avctx->sample_rate);
57 lame_set_num_channels(s->gfp, avctx->channels);
58 if (avctx->compression_level == FF_COMPRESSION_DEFAULT) {
61 lame_set_quality(s->gfp, avctx->compression_level);
64 lame_set_brate(s->gfp, avctx->bit_rate / 1000);
65 if (avctx->flags & CODEC_FLAG_QSCALE) {
68 lame_set_VBR_quality(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA);
72 s->reservoir = avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR;
78 avctx->frame_size = lame_get_framesize(s->gfp);
79 avctx->coded_frame = avcodec_alloc_frame();
80 avctx->coded_frame->key_frame = 1;
149 static int MP3lame_encode_frame(AVCodecContext *avctx, unsigned char *frame,
152 Mp3AudioContext *s = avctx->priv_data;
161 avctx->frame_size,
166 avctx->frame_size, s->buffer +
178 av_log(avctx, AV_LOG_ERROR,
191 //av_log(avctx, AV_LOG_DEBUG, "in:%d packet-len:%d index:%d\n",
192 // avctx->frame_size, len, s->buffer_index);
200 av_log(avctx, AV_LOG_DEBUG, "%2X ", frame[i]);
207 static av_cold int MP3lame_encode_close(AVCodecContext *avctx)
209 Mp3AudioContext *s = avctx->priv_data;
211 av_freep(&avctx->coded_frame);