Fix #590: Do you have plan to support webp format
[geeqie.git] / src / image-load.c
index 24e5845..11045c4 100644 (file)
@@ -29,6 +29,7 @@
 #include "image_load_heif.h"
 #include "image_load_ffmpegthumbnailer.h"
 #include "image_load_collection.h"
+#include "image_load_webp.h"
 
 #include "exif.h"
 #include "filedata.h"
@@ -637,6 +638,16 @@ static void image_loader_setup_loader(ImageLoader *il)
                }
        else
 #endif
+#ifdef HAVE_WEBP
+       if (il->bytes_total >= 12 &&
+               (memcmp(il->mapped_file, "RIFF", 4) == 0) &&
+               (memcmp(il->mapped_file + 8, "WEBP", 4) == 0))
+               {
+               DEBUG_1("Using custom webp loader");
+               image_loader_backend_set_webp(&il->backend);
+               }
+       else
+#endif
 #ifdef HAVE_JPEG
        if (il->bytes_total >= 2 && il->mapped_file[0] == 0xff && il->mapped_file[1] == 0xd8)
                {