fix heifload with libheif 1.6
heif_avif wasn't added until libheif 1.7
This commit is contained in:
parent
8d4852f217
commit
888b5654a0
15
configure.ac
15
configure.ac
@ -888,16 +888,13 @@ if test x"$with_heif" = x"yes"; then
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
# heif_main_brand added in 1.4.0
|
||||
# heif_main_brand added in 1.4.0, but heif_avif appeared in 1.7 ... just check
|
||||
# the libheif version number since testing for enums is annoying
|
||||
if test x"$with_heif" = x"yes"; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $HEIF_LIBS"
|
||||
AC_CHECK_FUNCS(heif_main_brand,[
|
||||
AC_DEFINE(HAVE_HEIF_MAIN_BRAND,1,
|
||||
[define if you have heif_main_brand.])
|
||||
],[]
|
||||
)
|
||||
LIBS="$save_LIBS"
|
||||
PKG_CHECK_MODULES(HEIF_AVIF, libheif >= 1.7.0, [
|
||||
AC_DEFINE(HAVE_HEIF_AVIF,1,[define if you have heif_avif.])
|
||||
], [
|
||||
])
|
||||
fi
|
||||
|
||||
# heif_decoding_options.convert_hdr_to_8bit added in 1.7.0
|
||||
|
@ -567,20 +567,24 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
||||
vips_image_set_int( out,
|
||||
VIPS_META_PAGE_HEIGHT, heif->page_height );
|
||||
|
||||
/* Determine compression from HEIF "brand"
|
||||
* Requires libheif 1.4.0+, prior versions were HEVC only
|
||||
/* Determine compression from HEIF "brand". heif_avif and heif_avis
|
||||
* were added in v1.7.
|
||||
*/
|
||||
compression = VIPS_FOREIGN_HEIF_COMPRESSION_HEVC;
|
||||
|
||||
#ifdef HAVE_HEIF_MAIN_BRAND
|
||||
#ifdef HAVE_HEIF_AVIF
|
||||
{
|
||||
const unsigned char *brand_data;
|
||||
if ( brand_data = vips_source_sniff( heif->source, 12 ) ) {
|
||||
|
||||
if( (brand_data = vips_source_sniff( heif->source, 12 )) ) {
|
||||
enum heif_brand brand;
|
||||
brand = heif_main_brand( brand_data, 12 );
|
||||
if( brand == heif_avif || brand == heif_avis )
|
||||
if( brand == heif_avif ||
|
||||
brand == heif_avis )
|
||||
compression = VIPS_FOREIGN_HEIF_COMPRESSION_AV1;
|
||||
}
|
||||
#endif /*HAVE_HEIF_MAIN_BRAND*/
|
||||
}
|
||||
#endif /*HAVE_HEIF_AVIF*/
|
||||
|
||||
vips_image_set_string( out, "heif-compression",
|
||||
vips_enum_nick( VIPS_TYPE_FOREIGN_HEIF_COMPRESSION,
|
||||
|
Loading…
Reference in New Issue
Block a user