Lines Matching defs:avctx

312 static av_cold int g726_encode_init(AVCodecContext *avctx)
314 G726Context* c = avctx->priv_data;
316 c->little_endian = !strcmp(avctx->codec->name, "g726le");
318 if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL &&
319 avctx->sample_rate != 8000) {
320 av_log(avctx, AV_LOG_ERROR, "Sample rates other than 8kHz are not "
325 if (avctx->sample_rate <= 0) {
326 av_log(avctx, AV_LOG_ERROR, "Invalid sample rate %d\n",
327 avctx->sample_rate);
331 if (avctx->ch_layout.nb_channels != 1) {
332 av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
336 if (avctx->bit_rate)
337 c->code_size = (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate;
340 avctx->bit_rate = c->code_size * avctx->sample_rate;
341 avctx->bits_per_coded_sample = c->code_size;
347 avctx->frame_size = ((int[]){ 4096, 2736, 2048, 1640 })[c->code_size - 2];
352 static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
355 G726Context *c = avctx->priv_data;
361 if ((ret = ff_get_encode_buffer(avctx, avpkt, out_size, 0)) < 0)
439 static av_cold int g726_decode_init(AVCodecContext *avctx)
441 G726Context* c = avctx->priv_data;
443 if (avctx->ch_layout.nb_channels > 1){
444 avpriv_request_sample(avctx, "Decoding more than one channel");
447 av_channel_layout_uninit(&avctx->ch_layout);
448 avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
450 c->little_endian = !strcmp(avctx->codec->name, "g726le");
452 c->code_size = avctx->bits_per_coded_sample;
454 av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size);
459 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
464 static int g726_decode_frame(AVCodecContext *avctx, AVFrame *frame,
469 G726Context *c = avctx->priv_data;
478 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
490 av_log(avctx, AV_LOG_ERROR, "Frame invalidly split, missing parser?\n");
497 static void g726_decode_flush(AVCodecContext *avctx)
499 G726Context *c = avctx->priv_data;