Fix #901: add ftypavif magic for AVIF files
authorUwe Ohse  <>
Fri, 4 Jun 2021 13:29:57 +0000 (14:29 +0100)
committerColin Clark <colin.clark@cclark.uk>
Fri, 4 Jun 2021 13:29:57 +0000 (14:29 +0100)
https://github.com/BestImageViewer/geeqie/issues/901

AVIF loading depends on the magic numbers, and the current list of known magics in src/image-load.c
is: ftypheic, ftypmsf1, ftypmif1. This is okay for HEIF, but AVIF is a different beast with a different codec and a different magic ftypavif (which is generated by gimp and darktable), and a different file extension (.avif)

src/image-load.c

index e6913ff..1250318 100644 (file)
@@ -712,7 +712,8 @@ static void image_loader_setup_loader(ImageLoader *il)
        if (il->bytes_total >= 12 &&
                ((memcmp(il->mapped_file + 4, "ftypheic", 8) == 0) ||
                (memcmp(il->mapped_file + 4, "ftypmsf1", 8) == 0) ||
-               (memcmp(il->mapped_file + 4, "ftypmif1", 8) == 0)))
+               (memcmp(il->mapped_file + 4, "ftypmif1", 8) == 0) ||
+               (memcmp(il->mapped_file + 4, "ftypavif", 8) == 0)))
                {
                DEBUG_1("Using custom heif loader");
                image_loader_backend_set_heif(&il->backend);