diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2017-03-29 18:21:29 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:41 -0300 |
commit | c5022f51f55feab06ba86610d237a2207f078e2f (patch) | |
tree | 22573a5564dc67b164347d770fa4718b44b9fafe /libavcodec | |
parent | a7a672c88edf51425e587f377c568b06f786d776 (diff) | |
download | ffmpeg-c5022f51f55feab06ba86610d237a2207f078e2f.tar.gz |
dpcm: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dpcm.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index d9ea23adb3..95052282ae 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -132,7 +132,7 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx) DPCMContext *s = avctx->priv_data; int i; - if (avctx->channels < 1 || avctx->channels > 2) { + if (avctx->ch_layout.nb_channels < 1 || avctx->ch_layout.nb_channels > 2) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n"); return AVERROR(EINVAL); } @@ -215,7 +215,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, int out = 0, ret; int predictor[2]; int ch = 0; - int stereo = avctx->channels - 1; + int stereo = avctx->ch_layout.nb_channels - 1; int16_t *output_samples, *samples_end; GetByteContext gb; @@ -229,10 +229,10 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, out = buf_size - 8; break; case AV_CODEC_ID_INTERPLAY_DPCM: - out = buf_size - 6 - avctx->channels; + out = buf_size - 6 - avctx->ch_layout.nb_channels; break; case AV_CODEC_ID_XAN_DPCM: - out = buf_size - 2 * avctx->channels; + out = buf_size - 2 * avctx->ch_layout.nb_channels; break; case AV_CODEC_ID_SOL_DPCM: if (avctx->codec_tag != 3) @@ -250,12 +250,12 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "packet is too small\n"); return AVERROR(EINVAL); } - if (out % avctx->channels) { + if (out % avctx->ch_layout.nb_channels) { av_log(avctx, AV_LOG_WARNING, "channels have differing number of samples\n"); } /* get output buffer */ - frame->nb_samples = (out + avctx->channels - 1) / avctx->channels; + frame->nb_samples = (out + avctx->ch_layout.nb_channels - 1) / avctx->ch_layout.nb_channels; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; output_samples = (int16_t *)frame->data[0]; @@ -287,7 +287,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, case AV_CODEC_ID_INTERPLAY_DPCM: bytestream2_skipu(&gb, 6); /* skip over the stream mask and stream length */ - for (ch = 0; ch < avctx->channels; ch++) { + for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { predictor[ch] = sign_extend(bytestream2_get_le16u(&gb), 16); *output_samples++ = predictor[ch]; } @@ -307,7 +307,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, { int shift[2] = { 4, 4 }; - for (ch = 0; ch < avctx->channels; ch++) + for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) predictor[ch] = sign_extend(bytestream2_get_le16u(&gb), 16); ch = 0; |