Lines Matching defs:avctx
82 static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
84 AMRWBContext *s = avctx->priv_data;
86 if (avctx->sample_rate != 16000 && avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
87 av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n");
91 if (avctx->ch_layout.nb_channels != 1) {
92 av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
96 s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx);
97 s->last_bitrate = avctx->bit_rate;
99 avctx->frame_size = 320;
100 avctx->initial_padding = 80;
107 static int amr_wb_encode_close(AVCodecContext *avctx)
109 AMRWBContext *s = avctx->priv_data;
115 static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
118 AMRWBContext *s = avctx->priv_data;
122 if ((ret = ff_alloc_packet(avctx, avpkt, MAX_PACKET_SIZE)) < 0)
125 if (s->last_bitrate != avctx->bit_rate) {
126 s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx);
127 s->last_bitrate = avctx->bit_rate;
131 av_log(avctx, AV_LOG_ERROR, "Error encoding frame\n");
136 avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);