[FFmpeg-devel] [PATCH] Google WebP support

Ronald S. Bultje rsbultje
Sun Oct 17 17:31:29 CEST 2010


Hi,

On Sun, Oct 17, 2010 at 11:29 AM, Peter Ross <pross at xvid.org> wrote:
> On Sun, Oct 17, 2010 at 07:03:59AM -0700, Pascal Massimino wrote:
> +static int probe(AVProbeData *p)
> +{
> + ? ?if (!memcmp(p->buf, "RIFF", 4) && !memcmp(p->buf + 8, "WEBP", 4))
> + ? ? ? ?return AVPROBE_SCORE_MAX;
> +
> + ? ?return 0;
> +}
> +
> +static int read_header(AVFormatContext *s, AVFormatParameters *ap)
> +{
> + ? ?AVStream *st;
> + ? ?uint32_t riff_size;
> +
> + ? ?if (get_le32(s->pb) != AV_RL32("RIFF"))
> + ? ? ? ?return AVERROR(EINVAL);
> + ? ?riff_size = get_le32(s->pb);
> + ? ?if (get_le32(s->pb) != AV_RL32("WEBP"))
> + ? ? ? ?return AVERROR(EINVAL);
>
> There is no need to check the RIFF/WEBP magic numbers twice.

Applications might not use the probing.

Ronald



More information about the ffmpeg-devel mailing list