diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-02-26 01:06:57 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-21 01:52:51 +0100 |
commit | 4005a71def6f9608b01f81e2ca28248cf451f50b (patch) | |
tree | 5e97968c350c30ddc03e55305fd033d1c1819d8d | |
parent | 429347afa7484773378191ab5846a199545e6b47 (diff) | |
download | ffmpeg-4005a71def6f9608b01f81e2ca28248cf451f50b.tar.gz |
avformat/adxdec: set avctx->channels in adx_read_header
It is used in adx_read_packet, which currently depends on the decoder/parser setting this value between reading the file header and demuxing the first packet.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 64ea4a0598e7ca61b95cf6c93fd409151a448001)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/adxdec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index ddaa201179..e57d0516dc 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -83,8 +83,14 @@ static int adx_read_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Invalid extradata size.\n"); return AVERROR_INVALIDDATA; } + avctx->channels = AV_RB8(avctx->extradata + 7); avctx->sample_rate = AV_RB32(avctx->extradata + 8); + if (avctx->channels <= 0) { + av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", avctx->channels); + return AVERROR_INVALIDDATA; + } + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = s->iformat->raw_codec_id; |