[vlc-devel] [PATCH 2/3] demux: image: add WebP probing
Tristan Matthews
tmatth at videolan.org
Wed Mar 7 09:27:44 CET 2018
Refs #19446
---
modules/demux/image.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/modules/demux/image.c b/modules/demux/image.c
index 038cf5e43f..7b7604156f 100644
--- a/modules/demux/image.c
+++ b/modules/demux/image.c
@@ -416,6 +416,21 @@ static bool IsJfif(stream_t *s)
return true;
}
+static bool IsWebP(stream_t *s)
+{
+ const uint8_t *header;
+ if (vlc_stream_Peek(s, &header, 20) < 20) /* WebP header size */
+ return false;
+ if (memcmp(&header[0], "RIFF", 4))
+ return false;
+ /* TODO: support other chunk types */
+ if (memcmp(&header[8], "WEBPVP8 ", 8))
+ return false;
+ /* skip headers */
+ vlc_stream_Seek(s, 20);
+ return true;
+}
+
static bool IsSpiff(stream_t *s)
{
const uint8_t *header;
@@ -616,6 +631,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
More information about the vlc-devel
mailing list