aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-05-29 09:36:27 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:44 -0300
commit045d6b9abfd8f44e4cedab65ec794267b186eba9 (patch)
tree68a4ce76e93cd0c67356fcb7e3a8182e378123a7 /libavcodec
parent8777ea2b017e73f53f2c3d53650903e37db6f6ef (diff)
downloadffmpeg-045d6b9abfd8f44e4cedab65ec794267b186eba9.tar.gz
on2avc: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/on2avc.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c
index fa3eb4b219..1d5a9487b3 100644
--- a/libavcodec/on2avc.c
+++ b/libavcodec/on2avc.c
@@ -691,7 +691,7 @@ static int on2avc_reconstruct_channel_ext(On2AVCContext *c, AVFrame *dst, int of
{
int ch, i;
- for (ch = 0; ch < c->avctx->channels; ch++) {
+ for (ch = 0; ch < c->avctx->ch_layout.nb_channels; ch++) {
float *out = (float*)dst->extended_data[ch] + offset;
float *in = c->coeffs[ch];
float *saved = c->delay[ch];
@@ -823,13 +823,13 @@ static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf,
c->grouping[i] = !get_bits1(&gb);
on2avc_read_ms_info(c, &gb);
- for (i = 0; i < c->avctx->channels; i++)
+ for (i = 0; i < c->avctx->ch_layout.nb_channels; i++)
if ((ret = on2avc_read_channel_data(c, &gb, i)) < 0)
return AVERROR_INVALIDDATA;
- if (c->avctx->channels == 2 && c->ms_present)
+ if (c->avctx->ch_layout.nb_channels == 2 && c->ms_present)
on2avc_apply_ms(c);
if (c->window_type < WINDOW_TYPE_EXT4) {
- for (i = 0; i < c->avctx->channels; i++)
+ for (i = 0; i < c->avctx->ch_layout.nb_channels; i++)
on2avc_reconstruct_channel(c, i, dst, offset);
} else {
on2avc_reconstruct_channel_ext(c, dst, offset);
@@ -910,21 +910,23 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
On2AVCContext *c = avctx->priv_data;
const uint8_t *lens = ff_on2avc_cb_lens;
const uint16_t *syms = ff_on2avc_cb_syms;
+ int channels = avctx->ch_layout.nb_channels;
int i, ret;
- if (avctx->channels > 2U) {
+ if (channels > 2U) {
avpriv_request_sample(avctx, "Decoding more than 2 channels");
return AVERROR_PATCHWELCOME;
}
c->avctx = avctx;
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
- avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO
- : AV_CH_LAYOUT_MONO;
+ av_channel_layout_uninit(&avctx->ch_layout);
+ avctx->ch_layout = (channels == 2) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO :
+ (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
c->is_av500 = (avctx->codec_tag == 0x500);
- if (avctx->channels == 2)
+ if (channels == 2)
av_log(avctx, AV_LOG_WARNING,
"Stereo mode support is not good, patch is welcome\n");
@@ -936,7 +938,7 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
for (; i < 128; i++)
c->scale_tab[i] = ceil(ff_exp10(i * 0.1) * 0.5 - 0.01);
- if (avctx->sample_rate < 32000 || avctx->channels == 1)
+ if (avctx->sample_rate < 32000 || channels == 1)
memcpy(c->long_win, ff_on2avc_window_long_24000,
1024 * sizeof(*c->long_win));
else