On 12/19/2011 09:14 AM, Måns Rullgård wrote:

> Justin Ruggles <[email protected]> writes:
> 
>> From: Michael Niedermayer <[email protected]>
>>
>> Signed-off-by: Michael Niedermayer <[email protected]>
>> Signed-off-by: Justin Ruggles <[email protected]>
>> ---
>>  libavcodec/adxdec.c |   35 ++++++++++++++++++++++++++---------
>>  1 files changed, 26 insertions(+), 9 deletions(-)
>>
>> diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
>> index e910413..ea11db7 100644
>> --- a/libavcodec/adxdec.c
>> +++ b/libavcodec/adxdec.c
>> @@ -38,16 +38,16 @@ 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->header_parsed = 1;
>>      }
> 
> Does this format come in two variants, with extradata and with header
> in-band?  A little more background on why this is changed now would be
> welcome.  What have demuxers done in the past?


Yes, it comes in 2 variants. SFD is an MPEG container variant that has
the ADX header in the packet data. ADX files have the header at the
start of the file, followed by 18-byte packets.

In the past, we didn't have an ADX demuxer, and the ADX decoder handled
the in-packet header from the SFD demuxer.  I fairly recently added an
ADX parser which extracted the header and put it in extradata, but it
ended up leading to infinite loops in some cases.

Handling it either way allows the parser to be simplified to just detect
the header and include it with the first packet. The ADX demuxer still
puts it in extradata to be processed at init().

-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to