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;
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);