Lines Matching defs:avctx

40     AVCodecContext *avctx;
63 static void opus_write_extradata(AVCodecContext *avctx)
65 uint8_t *bs = avctx->extradata;
69 bytestream_put_byte (&bs, avctx->ch_layout.nb_channels);
70 bytestream_put_le16 (&bs, avctx->initial_padding);
71 bytestream_put_le32 (&bs, avctx->sample_rate);
122 const int subframesize = s->avctx->frame_size;
161 const int subframesize = s->avctx->frame_size;
524 f->format = s->avctx->sample_fmt;
525 f->nb_samples = s->avctx->frame_size;
526 ret = av_channel_layout_copy(&f->ch_layout, &s->avctx->ch_layout);
542 static int opus_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
545 OpusEncContext *s = avctx->priv_data;
551 ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame));
554 if (!s->afq.remaining_samples || !avctx->frame_number)
566 int pad_empty = s->packet.frames*(frame_size/s->avctx->frame_size) - s->bufqueue.available + 1;
575 ff_bufqueue_add(avctx, &s->bufqueue, empty);
587 if ((ret = ff_alloc_packet(avctx, avpkt, alloc_size)) < 0)
610 static av_cold int opus_encode_end(AVCodecContext *avctx)
612 OpusEncContext *s = avctx->priv_data;
628 static av_cold int opus_encode_init(AVCodecContext *avctx)
631 OpusEncContext *s = avctx->priv_data;
633 s->avctx = avctx;
634 s->channels = avctx->ch_layout.nb_channels;
641 avctx->frame_size = 120;
643 avctx->initial_padding = 120;
645 if (!avctx->bit_rate) {
647 avctx->bit_rate = coupled*(96000) + (s->channels - coupled*2)*(48000);
648 } else if (avctx->bit_rate < 6000 || avctx->bit_rate > 255000 * s->channels) {
649 int64_t clipped_rate = av_clip(avctx->bit_rate, 6000, 255000 * s->channels);
650 av_log(avctx, AV_LOG_ERROR, "Unsupported bitrate %"PRId64" kbps, clipping to %"PRId64" kbps\n",
651 avctx->bit_rate/1000, clipped_rate/1000);
652 avctx->bit_rate = clipped_rate;
656 avctx->extradata_size = 19;
657 avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
658 if (!avctx->extradata)
660 opus_write_extradata(avctx);
662 ff_af_queue_init(avctx, &s->afq);
667 if (!(s->dsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT)))
680 ff_bufqueue_add(avctx, &s->bufqueue, spawn_empty_frame(s));
684 if ((ret = ff_opus_psy_init(&s->psyctx, s->avctx, &s->bufqueue, &s->options)))
698 s->frame[i].avctx = s->avctx;