Lines Matching refs:avctx
45 static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
47 ROQDPCMContext *context = avctx->priv_data;
54 static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
56 ROQDPCMContext *context = avctx->priv_data;
59 if (avctx->channels > 2) {
60 av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n");
63 if (avctx->sample_rate != 22050) {
64 av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n");
68 avctx->frame_size = ROQ_FRAME_SIZE;
69 avctx->bit_rate = (ROQ_HEADER_SIZE + ROQ_FRAME_SIZE * avctx->channels) *
72 context->frame_buffer = av_malloc(8 * ROQ_FRAME_SIZE * avctx->channels *
83 roq_dpcm_encode_close(avctx);
127 static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
133 ROQDPCMContext *context = avctx->priv_data;
135 stereo = (avctx->channels == 2);
141 memcpy(&context->frame_buffer[context->buffered_samples * avctx->channels],
142 in, avctx->frame_size * avctx->channels * sizeof(*in));
143 context->buffered_samples += avctx->frame_size;
161 data_size = avctx->channels * context->buffered_samples;
163 data_size = avctx->channels * avctx->frame_size;
165 if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size)) < 0)
184 avpkt->duration = data_size / avctx->channels;