Merge pull request #1657 from lovell/improve-avif-detection

Improve compile-time libheif and runtime AVIF detection
This commit is contained in:
John Cupitt 2020-05-18 22:38:11 +01:00 committed by GitHub
commit b4a9636e51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -855,14 +855,16 @@ if test x"$with_heif" != x"no"; then
PKG_CHECK_MODULES(HEIF, libheif, PKG_CHECK_MODULES(HEIF, libheif,
[with_heif=yes [with_heif=yes
have_h265_decoder=`$PKG_CONFIG libheif --variable builtin_h265_decoder` have_h265_decoder=`$PKG_CONFIG libheif --variable builtin_h265_decoder`
have_avif_decoder=`$PKG_CONFIG libheif --variable builtin_avif_decoder`
# test for !=no so that we work for older libheif which does not have # test for !=no so that we work for older libheif which does not have
# this variable # this variable
if test x"$have_h265_decoder" != x"no"; then if test x"$have_h265_decoder" != x"no" -o x"$have_avif_decoder" = x"yes"; then
AC_DEFINE(HAVE_HEIF_DECODER,1, AC_DEFINE(HAVE_HEIF_DECODER,1,
[define if your libheif has decode support.]) [define if your libheif has decode support.])
fi fi
have_h265_encoder=`$PKG_CONFIG libheif --variable builtin_h265_encoder` have_h265_encoder=`$PKG_CONFIG libheif --variable builtin_h265_encoder`
if test x"$have_h265_encoder" != x"no"; then have_avif_encoder=`$PKG_CONFIG libheif --variable builtin_avif_encoder`
if test x"$have_h265_encoder" != x"no" -o x"$have_avif_encoder" = x"yes"; then
AC_DEFINE(HAVE_HEIF_ENCODER,1, AC_DEFINE(HAVE_HEIF_ENCODER,1,
[define if your libheif has encode support.]) [define if your libheif has encode support.])
fi fi
@ -872,6 +874,8 @@ if test x"$with_heif" != x"no"; then
with_heif=no with_heif=no
have_h265_decoder= have_h265_decoder=
have_h265_encoder= have_h265_encoder=
have_avif_decoder=
have_avif_encoder=
] ]
) )
fi fi

View File

@ -237,7 +237,8 @@ static const char *heif_magic[] = {
"ftyphevm", /* Multiview sequence */ "ftyphevm", /* Multiview sequence */
"ftyphevs", /* Scaleable sequence */ "ftyphevs", /* Scaleable sequence */
"ftypmif1", /* Nokia alpha_ image */ "ftypmif1", /* Nokia alpha_ image */
"ftypmsf1" /* Nokia animation image */ "ftypmsf1", /* Nokia animation image */
"ftypavif" /* AV1 image format */
}; };
/* THe API has: /* THe API has: