[FFmpeg-devel] [PATCH] HAM6/HAM8 support for IFF demuxer/decoder

Sebastian Vater cdgs.basty
Wed May 5 16:48:31 CEST 2010


Martin Storsj? a ?crit :
> On Tue, 4 May 2010, Sebastian Vater wrote:
>
>   
>> --- a/libavformat/iff.c
>> +++ b/libavformat/iff.c
>> @@ -152,12 +155,18 @@ static int iff_read_header(AVFormatContext *s,
>>          case ID_CMAP:
>> -            st->codec->extradata_size = data_size;
>> -            st->codec->extradata      = av_malloc(data_size);
>> +            st->codec->extradata_size = data_size + sizeof(IffExtraContext);
>> +            st->codec->extradata      = av_malloc(data_size + sizeof(IffExtraContext));
>>              if (!st->codec->extradata)
>>                  return AVERROR(ENOMEM);
>> @@ -195,6 +204,17 @@ static int iff_read_header(AVFormatContext *s,
>>  
>>      url_fseek(pb, iff->body_pos, SEEK_SET);
>>  
>> +    if (!st->codec->extradata) {
>> +        st->codec->extradata_size = sizeof(IffExtraContext);
>> +        st->codec->extradata = av_malloc(sizeof(IffExtraContext));
>> +        if (!st->codec->extradata)
>> +            return AVERROR(ENOMEM);
>> +    }
>>     
>
> If being nitpicky, you should pad extradata with 
> FF_INPUT_BUFFER_PADDING_SIZE, set to zero, see the documentation of the 
> extradata field in avcodec.h. I guess the current decoder doesn't care 
> about this, but it's part of the public libavcodec API, that libavformat 
> should follow.
>   

Fixed.

Because of backward compatibility I have changed it to append the
extradata struct after the palette (because in the original version, the
palette data was always at 0).

The demuxer now fills in fields for EHB/Masking/Transparency, but the
decoder will jump out with an error now, if either EHB / Masking or
transparency is detected.

Also please note I changed the way (this is required by HAM) palette
under- and overflows are handled. A palette can contain less entries can
specified planes (remaining colors are simply set to black then).

I hope the new patch sastifies you are more bit.

-- 

Best regards,
                   :-) Basty/CDGS (-:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: iff-ham-support.patch
Type: text/x-patch
Size: 14961 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100505/082af58f/attachment.bin>



More information about the ffmpeg-devel mailing list