1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

on2avc: convert to new channel layout API

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Anton Khirnov 2019-05-29 09:36:27 +02:00 committed by James Almer
parent 8777ea2b01
commit 045d6b9abf

View File

@ -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