[vlc-devel] [PATCH 4/4] demux: image: add WebP probing
Tristan Matthews
tmatth at videolan.org
Tue Mar 6 07:40:58 CET 2018
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
More information about the vlc-devel
mailing list