Skip to content

Commit

Permalink
avformat/adxdec: set avctx->channels in adx_read_header
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Anton Khirnov <[email protected]>
  • Loading branch information
Andreas Cadhalpun authored and elenril committed Mar 5, 2015
1 parent bb4eddd commit c73c3c3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libavformat/adxdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c73c3c3

Please sign in to comment.