From: Vittorio Giovara <vittorio.giov...@gmail.com> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com> Signed-off-by: Anton Khirnov <an...@khirnov.net> --- libavformat/adxdec.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index 1038a0d67e..5bbd6a901f 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -53,12 +53,12 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt) AVCodecParameters *par = s->streams[0]->codecpar; int ret, size; - if (par->channels <= 0) { - av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->channels); + if (par->ch_layout.nb_channels <= 0) { + av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->ch_layout.nb_channels); return AVERROR_INVALIDDATA; } - size = BLOCK_SIZE * par->channels; + size = BLOCK_SIZE * par->ch_layout.nb_channels; pkt->pos = avio_tell(s->pb); pkt->stream_index = 0; @@ -83,6 +83,7 @@ static int adx_read_header(AVFormatContext *s) { ADXDemuxerContext *c = s->priv_data; AVCodecParameters *par; + int channels; AVStream *st = avformat_new_stream(s, NULL); if (!st) @@ -101,11 +102,13 @@ static int adx_read_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Invalid extradata size.\n"); return AVERROR_INVALIDDATA; } - par->channels = AV_RB8 (par->extradata + 7); + channels = AV_RB8 (par->extradata + 7); + par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + par->ch_layout.nb_channels = channels; par->sample_rate = AV_RB32(par->extradata + 8); - if (par->channels <= 0) { - av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->channels); + if (channels <= 0) { + av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", channels); return AVERROR_INVALIDDATA; } @@ -116,7 +119,7 @@ static int adx_read_header(AVFormatContext *s) par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id = s->iformat->raw_codec_id; - par->bit_rate = (int64_t)par->sample_rate * par->channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; + par->bit_rate = (int64_t)par->sample_rate * par->ch_layout.nb_channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, par->sample_rate); -- 2.24.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".