Lines Matching defs:avctx
38 static av_cold int gsm_init(AVCodecContext *avctx)
40 av_channel_layout_uninit(&avctx->ch_layout);
41 avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
42 if (!avctx->sample_rate)
43 avctx->sample_rate = 8000;
44 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
46 switch (avctx->codec_id) {
48 avctx->frame_size = GSM_FRAME_SIZE;
49 avctx->block_align = GSM_BLOCK_SIZE;
52 avctx->frame_size = 2 * GSM_FRAME_SIZE;
53 if (!avctx->block_align)
54 avctx->block_align = GSM_MS_BLOCK_SIZE;
56 if (avctx->block_align < MSN_MIN_BLOCK_SIZE ||
57 avctx->block_align > GSM_MS_BLOCK_SIZE ||
58 (avctx->block_align - MSN_MIN_BLOCK_SIZE) % 3) {
59 av_log(avctx, AV_LOG_ERROR, "Invalid block alignment %d\n",
60 avctx->block_align);
68 static int gsm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
77 if (buf_size < avctx->block_align) {
78 av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
83 frame->nb_samples = avctx->frame_size;
84 if ((res = ff_get_buffer(avctx, frame, 0)) < 0)
88 switch (avctx->codec_id) {
92 av_log(avctx, AV_LOG_WARNING, "Missing GSM magic!\n");
93 res = gsm_decode_block(avctx, samples, &gb, GSM_13000);
98 res = ff_msgsm_decode_block(avctx, samples, buf,
99 (GSM_MS_BLOCK_SIZE - avctx->block_align) / 3);
106 return avctx->block_align;
109 static void gsm_flush(AVCodecContext *avctx)
111 GSMContext *s = avctx->priv_data;