diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-02-26 01:06:57 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-03-08 19:34:38 +0000 |
commit | a73b2c288e3dace6e054a5b48640978be1d5df84 (patch) | |
tree | fefd1ceff37df660f785bd6d34c49c9b36ff7ec4 | |
parent | 2ef2f60b4f0308d1c871091c9c1a9641d14ec585 (diff) | |
download | ffmpeg-a73b2c288e3dace6e054a5b48640978be1d5df84.tar.gz |
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: Anton Khirnov <anton@khirnov.net>
-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 fc83ff263b..9d3ebe398b 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -89,8 +89,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; |