Lines Matching defs:avctx
36 static int get_mode(AVCodecContext *avctx)
38 if (avctx->block_align == 38)
40 else if (avctx->block_align == 50)
42 else if (avctx->bit_rate > 0)
43 return avctx->bit_rate <= 14000 ? 30 : 20;
70 static av_cold int ilbc_decode_init(AVCodecContext *avctx)
72 ILBCDecContext *s = avctx->priv_data;
75 if ((mode = get_mode(avctx)) < 0) {
76 av_log(avctx, AV_LOG_ERROR, "iLBC frame mode not indicated\n");
82 av_channel_layout_uninit(&avctx->ch_layout);
83 avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
84 avctx->sample_rate = 8000;
85 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
90 static int ilbc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
95 ILBCDecContext *s = avctx->priv_data;
100 av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be %u)\n",
102 av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be "
110 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
154 static av_cold int ilbc_encode_init(AVCodecContext *avctx)
156 ILBCEncContext *s = avctx->priv_data;
159 if (avctx->sample_rate != 8000) {
160 av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
164 if (avctx->ch_layout.nb_channels != 1) {
165 av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
169 if ((mode = get_mode(avctx)) > 0)
175 avctx->block_align = s->encoder.no_of_bytes;
176 avctx->frame_size = s->encoder.blockl;
181 static int ilbc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
184 ILBCEncContext *s = avctx->priv_data;
187 if ((ret = ff_alloc_packet(avctx, avpkt, 50)) < 0)