[vlc-devel] [PATCH 4/4] demux: image: add WebP probing

Jean-Baptiste Kempf jb at videolan.org
Wed Mar 7 06:08:18 CET 2018


LGTM.

On Tue, 6 Mar 2018, at 07:40, Tristan Matthews wrote:
> Refs #19446
> ---
>  modules/demux/image.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/modules/demux/image.c b/modules/demux/image.c
> index 038cf5e43f..9c5aafc4af 100644
> --- a/modules/demux/image.c
> +++ b/modules/demux/image.c
> @@ -416,6 +416,19 @@ static bool IsJfif(stream_t *s)
>      return true;
>  }
>  
> +static bool IsWebP(stream_t *s)
> +{
> +    const uint8_t *header;
> +    if (vlc_stream_Peek(s, &header, 12) < 12) /* WebP header size */
> +        return false;
> +    if (memcmp(&header[0], "RIFF", 4))
> +        return false;
> +    /* skip size */
> +    if (memcmp(&header[8], "WEBP", 4))
> +        return false;
> +    return true;
> +}
> +
>  static bool IsSpiff(stream_t *s)
>  {
>      const uint8_t *header;
> @@ -616,6 +629,9 @@ static const image_format_t formats[] = {
>      { .codec = VLC_CODEC_JPEG,
>        .detect = IsExif,
>      },
> +    { .codec = VLC_CODEC_WEBP,
> +      .detect = IsWebP,
> +    },
>      { .codec = VLC_CODEC_BPG,
>        .marker_size = 4,
>        .marker = { 'B', 'P', 'G', 0xFB },
> -- 
> 2.16.2
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list