Lines Matching defs:avctx

72 static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
74 VmdAudioContext *s = avctx->priv_data;
75 int channels = avctx->ch_layout.nb_channels;
78 av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
81 if (avctx->block_align < 1 || avctx->block_align % channels ||
82 avctx->block_align > INT_MAX - channels) {
83 av_log(avctx, AV_LOG_ERROR, "invalid block align\n");
87 av_channel_layout_uninit(&avctx->ch_layout);
88 av_channel_layout_default(&avctx->ch_layout, channels);
90 if (avctx->bits_per_coded_sample == 16)
91 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
93 avctx->sample_fmt = AV_SAMPLE_FMT_U8;
94 s->out_bps = av_get_bytes_per_sample(avctx->sample_fmt);
96 s->chunk_size = avctx->block_align + channels * (s->out_bps == 2);
98 av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, "
100 channels, avctx->bits_per_coded_sample, avctx->block_align,
101 avctx->sample_rate);
135 static int vmdaudio_decode_frame(AVCodecContext *avctx, AVFrame *frame,
141 VmdAudioContext *s = avctx->priv_data;
146 int channels = avctx->ch_layout.nb_channels;
149 av_log(avctx, AV_LOG_WARNING, "skipping small junk packet\n");
156 av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type);
167 av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
185 if (silent_chunks + audio_chunks >= INT_MAX / avctx->block_align)
189 frame->nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) /
190 avctx->ch_layout.nb_channels;
191 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
198 int silent_size = avctx->block_align * silent_chunks;
199 av_assert0(avctx->block_align * silent_chunks <= frame->nb_samples * avctx->ch_layout.nb_channels);
213 av_assert0((buf_size & (avctx->ch_layout.nb_channels > 1)) == 0);
217 output_samples_s16 += avctx->block_align;
220 output_samples_u8 += avctx->block_align;