@rathann Even if you build libheif with only the AVIF codecs enabled, users can still install the libde265 and x265 plugins themselves later on.
Ok, I understand that you want to want the packager. How about this: the build script checks whether HEIC and AVIF codecs are installed (like in your change in 7b006410) and then outputs a build warning/error when it is not available during build.
The commit e4ace369 still seems to have the edge case that if neither HEIC nor AVIF codecs are installed during build time, it will turn these MIME-types off even though it may be fine for the user.
I think this is dangerous. If no libheif codecs are installed during the build, the MIME types list will not include the formats, even though the user has these codecs installed and they actually work perfectly. I'm not exactly sure where this MIME_TYPES list is used, but if it's used on the desktop to select the application to open for a file, this might be a problem.
Why not simply always include HEIC/AVIF in the supported formats when libheif is detected? There could be an error message telling the user that he has to install the codecs when he tries to use one that is not installed yet.
The meson.build
file is currently checking for available HEIF codecs at compile-time:
https://gitlab.gnome.org/GNOME/gimp/-/blob/4b6ff68094abd7bd3dd9a074d0ee1dacd3b9ff00/meson.build#L755-770
This check will not be accurate anymore with libheif >= 1.14.0 because codecs can be added as libheif plugins at runtime. This was added so that various codecs can be installed as separate packages instead of building everything into the libheif library as a big dependency blob.
Consequently, it is not possible anymore to tell at compile-time which codecs the user will have installed.
The variables builtin_????_encoder
are now always set to 'yes' (https://github.com/strukturag/libheif/issues/758).
Thus, your current check will still work, but may return more codecs than are actually available. When trying to use them, you will get a runtime error instead.
You can also check for available codecs with heif_have_encoder_for_format()
after library initialization (heif_init()
) to check the availability. For example in order to disable some codecs in the UI.