aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-18 20:10:30 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-03 19:49:55 +0100
commit2bbda9872fabf4038acbc98ceecfc1218a3370a8 (patch)
tree93cd1eaefa33a0b8b1f65b5351ffa0ab8b0fb487
parent9dd420ede168a95bf2896c9eaf17cccb6491487a (diff)
downloadffmpeg-2bbda9872fabf4038acbc98ceecfc1218a3370a8.tar.gz
adxdec: Do not require extradata.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit bdd62a615a74ba7d29b528263462937da132c62c) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/adxdec.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index f049def626..20f2606a90 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -38,16 +38,15 @@ static av_cold int adx_decode_init(AVCodecContext *avctx)
ADXContext *c = avctx->priv_data;
int ret, header_size;
- if (avctx->extradata_size < 24)
- return AVERROR_INVALIDDATA;
-
- if ((ret = avpriv_adx_decode_header(avctx, avctx->extradata,
- avctx->extradata_size, &header_size,
- c->coeff)) < 0) {
- av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
- return AVERROR_INVALIDDATA;
+ if (avctx->extradata_size >= 24) {
+ if ((ret = avpriv_adx_decode_header(avctx, avctx->extradata,
+ avctx->extradata_size, &header_size,
+ c->coeff)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
+ return AVERROR_INVALIDDATA;
+ }
+ c->channels = avctx->channels;
}
- c->channels = avctx->channels;
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
@@ -107,6 +106,21 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
return buf_size;
}
+ if(AV_RB16(buf) == 0x8000){
+ int header_size;
+ if ((ret = avpriv_adx_decode_header(avctx, buf,
+ buf_size, &header_size,
+ c->coeff)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
+ return AVERROR_INVALIDDATA;
+ }
+ c->channels = avctx->channels;
+ if(buf_size < header_size)
+ return AVERROR_INVALIDDATA;
+ buf += header_size;
+ buf_size -= header_size;
+ }
+
/* calculate number of blocks in the packet */
num_blocks = buf_size / (BLOCK_SIZE * c->channels);