Lines Matching defs:avctx
46 AVCodecContext *avctx;
66 ff_dlog(s->avctx, "resizing output buffer: %d -> %d\n", s->buffer_size,
77 static av_cold int mp3lame_encode_close(AVCodecContext *avctx)
79 LAMEContext *s = avctx->priv_data;
92 static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
94 LAMEContext *s = avctx->priv_data;
97 s->avctx = avctx;
104 lame_set_num_channels(s->gfp, avctx->ch_layout.nb_channels);
105 lame_set_mode(s->gfp, avctx->ch_layout.nb_channels > 1 ?
109 lame_set_in_samplerate (s->gfp, avctx->sample_rate);
110 lame_set_out_samplerate(s->gfp, avctx->sample_rate);
113 if (avctx->compression_level != FF_COMPRESSION_DEFAULT)
114 lame_set_quality(s->gfp, avctx->compression_level);
117 if (avctx->flags & AV_CODEC_FLAG_QSCALE) { // VBR
119 lame_set_VBR_quality(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA);
121 if (avctx->bit_rate) {
124 lame_set_VBR_mean_bitrate_kbps(s->gfp, avctx->bit_rate / 1000);
126 lame_set_brate(s->gfp, avctx->bit_rate / 1000);
131 if (avctx->cutoff)
132 lame_set_lowpassfreq(s->gfp, avctx->cutoff);
147 avctx->initial_padding = lame_get_encoder_delay(s->gfp) + 528 + 1;
148 ff_af_queue_init(avctx, &s->afq);
150 avctx->frame_size = lame_get_framesize(s->gfp);
153 if (avctx->sample_fmt == AV_SAMPLE_FMT_FLTP) {
155 for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
156 s->samples_flt[ch] = av_malloc_array(avctx->frame_size,
169 s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
178 mp3lame_encode_close(avctx);
190 static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
193 LAMEContext *s = avctx->priv_data;
200 switch (avctx->sample_fmt) {
209 av_log(avctx, AV_LOG_ERROR, "inadequate AVFrame plane padding\n");
212 for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
231 av_log(avctx, AV_LOG_ERROR,
240 av_log(avctx, AV_LOG_ERROR, "error reallocating output buffer\n");
259 av_log(avctx, AV_LOG_ERROR, "Invalid mp3 header at start of buffer\n");
262 av_log(avctx, AV_LOG_ERROR, "free format output not supported\n");
266 ff_dlog(avctx, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len,
269 if ((ret = ff_get_encode_buffer(avctx, avpkt, len, 0)) < 0)
276 ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
279 discard_padding = avctx->frame_size - avpkt->duration;
281 if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) {
282 av_log(avctx, AV_LOG_ERROR, "discard padding overflow\n");
286 if ((!s->delay_sent && avctx->initial_padding > 0) || discard_padding > 0) {
295 AV_WL32(side_data, avctx->initial_padding);