Lines Matching defs:avctx

250 static av_cold int dsp_init(AVCodecContext *avctx, vorbis_enc_context *venc)
254 venc->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
271 AVCodecContext *avctx)
279 venc->channels = avctx->ch_layout.nb_channels;
280 venc->sample_rate = avctx->sample_rate;
379 if (ff_vorbis_ready_floor1_list(avctx, fc->list, fc->values))
469 if ((ret = dsp_init(avctx, venc)) < 0)
1031 static AVFrame *spawn_empty_frame(AVCodecContext *avctx, int channels)
1039 f->format = avctx->sample_fmt;
1040 f->nb_samples = avctx->frame_size;
1091 static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
1094 vorbis_enc_context *venc = avctx->priv_data;
1108 ff_bufqueue_add(avctx, &venc->bufqueue, clone);
1113 need_more = venc->bufqueue.available * avctx->frame_size < frame_size;
1120 if (venc->bufqueue.available * avctx->frame_size < frame_size) {
1121 int frames_needed = (frame_size/avctx->frame_size) - venc->bufqueue.available;
1125 AVFrame *empty = spawn_empty_frame(avctx, venc->channels);
1129 ff_bufqueue_add(avctx, &venc->bufqueue, empty);
1134 move_audio(venc, avctx->frame_size);
1139 if ((ret = ff_alloc_packet(avctx, avpkt, 8192)) < 0)
1160 av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n");
1184 av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n");
1205 static av_cold int vorbis_encode_close(AVCodecContext *avctx)
1207 vorbis_enc_context *venc = avctx->priv_data;
1266 static av_cold int vorbis_encode_init(AVCodecContext *avctx)
1268 vorbis_enc_context *venc = avctx->priv_data;
1271 if (avctx->ch_layout.nb_channels != 2) {
1272 av_log(avctx, AV_LOG_ERROR, "Current FFmpeg Vorbis encoder only supports 2 channels.\n");
1276 if ((ret = create_vorbis_context(venc, avctx)) < 0)
1279 avctx->bit_rate = 0;
1280 if (avctx->flags & AV_CODEC_FLAG_QSCALE)
1281 venc->quality = avctx->global_quality / (float)FF_QP2LAMBDA;
1286 if ((ret = put_main_header(venc, (uint8_t**)&avctx->extradata)) < 0)
1288 avctx->extradata_size = ret;
1290 avctx->frame_size = 64;
1291 avctx->initial_padding = 1 << (venc->log2_blocksize[1] - 1);
1293 ff_af_queue_init(avctx, &venc->afq);