[Ffmpeg-devel] [PATCH] C93 demuxer and decoder (GSoC qualification task)

Anssi Hannula anssi.hannula
Thu Apr 5 22:39:35 CEST 2007


Michael Niedermayer wrote:
> Hi

Hi!

> On Thu, Apr 05, 2007 at 10:36:15PM +0300, Anssi Hannula wrote:
>>>> +    ret = av_new_packet(pkt, datasize + 768 + 1);
>>>> +    if (ret < 0)
>>>> +        return ret;
>>>> +    pkt->data[0] = 0;
>>>> +
>>>> +    ret = get_buffer(pb, pkt->data + 768 + 1, datasize);
>>>> +    if (ret < datasize) {
>>>> +        av_free_packet(pkt);
>>>> +        return AVERROR_IO;
>>>> +    }
>>>> +
>>>> +    datasize = get_le16(pb); /* palette size */
>>>> +    if (datasize) {
>>>> +        if (datasize != 768) {
>>>> +            av_log(s, AV_LOG_ERROR, "invalid palette size %u\n", datasize);
>>>> +            av_free_packet(pkt);
>>>> +            return AVERROR_INVALIDDATA;
>>>> +        }
>>>> +        pkt->data[0] |= C93_HAS_PALETTE;
>>>> +        ret = get_buffer(pb, pkt->data + 1, datasize);
>>>> +        if (ret < datasize) {
>>>> +            av_free_packet(pkt);
>>>> +            return AVERROR_IO;
>>>> +        }
>>>> +    }
>>> if there is no palette pkt->size should be decreased by 768
>> Even when the 768 unused bytes are in the beginning of the pkt instead
>> of the end?
> 
> hmm, i missed that, i just thought if the packets get stored in some other
> container (like avi) it would be better to avoid the extra useless 768 bytes

I take it you don't think it is necessary to have the palette put in the
end instead? (we'd have to pass the video frame size in the beginning of
pkt and in c93_decode_frame() get the palette from buf+videoframesize)

Anyway, attached is the patch with your last suggestions applied.

-- 
Anssi Hannula

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-c93_3.diff
Type: text/x-patch
Size: 19545 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070405/9eacefd3/attachment.bin>



More information about the ffmpeg-devel mailing list