[FFmpeg-devel] [PATCH] MJPEG/AVI1 to JPEG/JFIF byte stream format filter

Michael Niedermayer michaelni
Thu Nov 4 01:32:07 CET 2010


On Wed, Nov 03, 2010 at 11:52:31PM +0100, Nicolas George wrote:
[...]
> +static int mjpeg2jpeg_filter(AVBitStreamFilterContext *bsfc,
> +                             AVCodecContext *avctx, const char *args,
> +                             uint8_t **poutbuf, int *poutbuf_size,
> +                             const uint8_t *buf, int buf_size,
> +                             int keyframe)
> +{
> +    int input_skip, output_size;
> +    uint8_t *output, *out;
> +
> +    if (buf_size < 12) {
> +        av_log(avctx, AV_LOG_ERROR, "input is truncated\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +    if (memcmp("AVI1", buf + 6, 4)) {
> +        av_log(avctx, AV_LOG_ERROR, "input is not MJPEG/AVI1\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +    input_skip = (buf[4] << 8) + buf[5] + 4;
> +    if (buf_size < input_skip) {
> +        av_log(avctx, AV_LOG_ERROR, "input is truncated\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +    output_size = buf_size - input_skip +
> +                  sizeof(jpeg_header) + dht_segment_size;

does ISO C gurantee that sizeof() is what we want it to be ?

besides this this patch looks ok to me
also if you want write access and agree to our development policy then contact
diego

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101104/4c663290/attachment.pgp>



More information about the ffmpeg-devel mailing list