Lines Matching refs:avctx
87 static int adx_encode_header(AVCodecContext *avctx, uint8_t *buf, int bufsize)
89 ADXContext *c = avctx->priv_data;
96 bytestream_put_byte(&buf, avctx->channels); /* channels */
97 bytestream_put_be32(&buf, avctx->sample_rate); /* sample rate */
110 static av_cold int adx_encode_init(AVCodecContext *avctx)
112 ADXContext *c = avctx->priv_data;
114 if (avctx->channels > 2) {
115 av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
118 avctx->frame_size = BLOCK_SAMPLES;
122 ff_adx_calculate_coeffs(c->cutoff, avctx->sample_rate, COEFF_BITS, c->coeff);
127 static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
130 ADXContext *c = avctx->priv_data;
135 out_size = BLOCK_SIZE * avctx->channels + !c->header_parsed * HEADER_SIZE;
136 if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0)
142 if ((hdrsize = adx_encode_header(avctx, dst, avpkt->size)) < 0) {
143 av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n");
150 for (ch = 0; ch < avctx->channels; ch++) {
151 adx_encode(c, dst, samples + ch, &c->prev[ch], avctx->channels);