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

Sebastian Vater cdgs.basty
Thu May 6 19:26:13 CEST 2010


Alex Converse a ?crit :
> and the only time you actually use PUT_* is after if(ex)
>
> +    if (!st->codec->extradata) {
> +        st->codec->extradata_size = IFF_EXTRA_CONTEXT_SIZE;
> +        st->codec->extradata = av_malloc(IFF_EXTRA_CONTEXT_SIZE +
> FF_INPUT_BUFFER_PADDING_SIZE);
> +        if (!st->codec->extradata)
> +            return AVERROR(ENOMEM);
> +    }
> +    ex = GET_EXTRA_CONTEXT(st->codec);
> +    if (ex) {
> +        memset(ex, 0, IFF_EXTRA_CONTEXT_SIZE);
> +        PUT_EXCTX_INT8 (ex, EXTRA_CONTEXT_COMPRESSION,  compression);
> +        PUT_EXCTX_INT8 (ex, EXTRA_CONTEXT_HAM,          (screenmode &
> CAMG_HAM) != 0);
> +        PUT_EXCTX_INT8 (ex, EXTRA_CONTEXT_EHB,          (screenmode &
> CAMG_EHB) != 0);
> +        PUT_EXCTX_INT8 (ex, EXTRA_CONTEXT_MASKING,      masking);
> +        PUT_EXCTX_INT16(ex, EXTRA_CONTEXT_TRANSPARENCY, transparency);
> +    }
>
> Also in that same block you've just malloced your extradata so there
> is no need to check it's size, and you return ENOMEM if that malloc
> fails so you don't even need that NULL check.
>
> [...]
> PUT will not be called if ex is null
>   

Oh damn, you're right...I did just a new patch with removes the PUT
stuff completely, the if (!ex) stuff isn't even necessary anymore,
because if that would happen a return ENOMEM occurs before.

I also updated the new patch attached here to use bytestream.h API
instead to put the values as suggested by Ronald.

-- 

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

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



More information about the ffmpeg-devel mailing list