Lines Matching defs:avctx
41 static av_cold int pcm_encode_init(AVCodecContext *avctx)
43 avctx->frame_size = 0;
45 switch (avctx->codec->id) {
61 avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
62 avctx->block_align = avctx->ch_layout.nb_channels * avctx->bits_per_coded_sample / 8;
63 avctx->bit_rate = avctx->block_align * 8LL * avctx->sample_rate;
86 n /= avctx->ch_layout.nb_channels; \
87 for (c = 0; c < avctx->ch_layout.nb_channels; c++) { \
96 static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
109 sample_size = av_get_bits_per_sample(avctx->codec->id) / 8;
110 n = frame->nb_samples * avctx->ch_layout.nb_channels;
113 if ((ret = ff_get_encode_buffer(avctx, avpkt, n * sample_size, 0)) < 0)
117 switch (avctx->codec->id) {
213 n /= avctx->ch_layout.nb_channels;
214 for (c = 0; c < avctx->ch_layout.nb_channels; c++) {
252 static av_cold int pcm_decode_init(AVCodecContext *avctx)
254 PCMDecode *s = avctx->priv_data;
258 if (avctx->ch_layout.nb_channels <= 0) {
259 av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
263 switch (avctx->codec_id) {
278 if (avctx->bits_per_coded_sample < 1 || avctx->bits_per_coded_sample > 24)
281 s->scale = 1. / (1 << (avctx->bits_per_coded_sample - 1));
292 avctx->sample_fmt = avctx->codec->sample_fmts[0];
294 if (avctx->sample_fmt == AV_SAMPLE_FMT_S32)
295 avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec_id);
319 for (c = 0; c < avctx->ch_layout.nb_channels; c++) { \
329 static int pcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
334 PCMDecode *s = avctx->priv_data;
335 int channels = avctx->ch_layout.nb_channels;
340 sample_size = av_get_bits_per_sample(avctx->codec_id) / 8;
344 if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) {
351 av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n");
356 av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
360 if (avctx->codec_id != avctx->codec->id) {
361 av_log(avctx, AV_LOG_ERROR, "codec ids mismatch\n");
369 av_log(avctx, AV_LOG_ERROR,
381 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
385 switch (avctx->codec_id) {
435 n /= avctx->ch_layout.nb_channels;
436 for (c = 0; c < avctx->ch_layout.nb_channels; c++) {
500 n /= avctx->ch_layout.nb_channels;
501 for (c = 0; c < avctx->ch_layout.nb_channels; c++) {
542 if (avctx->codec_id == AV_CODEC_ID_PCM_F16LE ||
543 avctx->codec_id == AV_CODEC_ID_PCM_F24LE) {
546 s->scale, FFALIGN(frame->nb_samples * avctx->ch_layout.nb_channels, 4));