jxlsave: avoid using deprecated functions (#2989)
* jxlsave: avoid using deprecated functions The upcoming libjxl 0.7 has deprecated a number of functions. * Prefer to use `ifdef` instead
This commit is contained in:
parent
34427d83a0
commit
f36196db1b
@ -847,6 +847,13 @@ if test x"$with_libjxl" != x"no"; then
|
||||
with_libjxl=yes
|
||||
AS_IF([test x"$with_libjxl_module" = x"no"],
|
||||
[PACKAGES_USED="$PACKAGES_USED libjxl"])
|
||||
|
||||
PKG_CHECK_MODULES(LIBJXL_0_7, libjxl >= 0.7,
|
||||
[AC_DEFINE(HAVE_LIBJXL_0_7,1,[define if you have libjxl >= 0.7])
|
||||
],
|
||||
[:
|
||||
]
|
||||
)
|
||||
],
|
||||
[AS_IF([test x"$with_libjxl" = x"test"],
|
||||
AC_MSG_WARN([libjxl not found; disabling libjxl support]),
|
||||
|
@ -229,7 +229,11 @@ vips_foreign_save_jxl_build( VipsObject *object )
|
||||
VipsForeignSaveJxl *jxl = (VipsForeignSaveJxl *) object;
|
||||
VipsImage **t = (VipsImage **) vips_object_local_array( object, 5 );
|
||||
|
||||
JxlEncoderOptions *options;
|
||||
#ifdef HAVE_LIBJXL_0_7
|
||||
JxlEncoderFrameSettings *frame_settings;
|
||||
#else
|
||||
JxlEncoderOptions *frame_settings;
|
||||
#endif
|
||||
JxlEncoderStatus status;
|
||||
VipsImage *in;
|
||||
VipsBandFormat format;
|
||||
@ -415,23 +419,33 @@ vips_foreign_save_jxl_build( VipsObject *object )
|
||||
if( vips_image_wio_input( in ) )
|
||||
return( -1 );
|
||||
|
||||
options = JxlEncoderOptionsCreate( jxl->encoder, NULL );
|
||||
JxlEncoderOptionsSetDecodingSpeed( options, jxl->tier );
|
||||
JxlEncoderOptionsSetDistance( options, jxl->distance );
|
||||
JxlEncoderOptionsSetEffort( options, jxl->effort );
|
||||
JxlEncoderOptionsSetLossless( options, jxl->lossless );
|
||||
#ifdef HAVE_LIBJXL_0_7
|
||||
frame_settings = JxlEncoderFrameSettingsCreate( jxl->encoder, NULL );
|
||||
JxlEncoderFrameSettingsSetOption( frame_settings,
|
||||
JXL_ENC_FRAME_SETTING_DECODING_SPEED, jxl->tier );
|
||||
JxlEncoderSetFrameDistance( frame_settings, jxl->distance );
|
||||
JxlEncoderFrameSettingsSetOption( frame_settings,
|
||||
JXL_ENC_FRAME_SETTING_EFFORT, jxl->effort );
|
||||
JxlEncoderSetFrameLossless( frame_settings, jxl->lossless );
|
||||
#else
|
||||
frame_settings = JxlEncoderOptionsCreate( jxl->encoder, NULL );
|
||||
JxlEncoderOptionsSetDecodingSpeed( frame_settings, jxl->tier );
|
||||
JxlEncoderOptionsSetDistance( frame_settings, jxl->distance );
|
||||
JxlEncoderOptionsSetEffort( frame_settings, jxl->effort );
|
||||
JxlEncoderOptionsSetLossless( frame_settings, jxl->lossless );
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
vips_foreign_save_jxl_print_info( &jxl->info );
|
||||
vips_foreign_save_jxl_print_format( &jxl->format );
|
||||
printf( "JxlEncoderOptions:\n" );
|
||||
printf( "JxlEncoderFrameSettings:\n" );
|
||||
printf( " tier = %d\n", jxl->tier );
|
||||
printf( " distance = %g\n", jxl->distance );
|
||||
printf( " effort = %d\n", jxl->effort );
|
||||
printf( " lossless = %d\n", jxl->lossless );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
if( JxlEncoderAddImageFrame( options, &jxl->format,
|
||||
if( JxlEncoderAddImageFrame( frame_settings, &jxl->format,
|
||||
VIPS_IMAGE_ADDR( in, 0, 0 ),
|
||||
VIPS_IMAGE_SIZEOF_IMAGE( in ) ) ) {
|
||||
vips_foreign_save_jxl_error( jxl, "JxlEncoderAddImageFrame" );
|
||||
|
@ -484,6 +484,9 @@ if libjxl_found
|
||||
if cc.has_function('JxlEncoderInitBasicInfo', prefix: '#include <jxl/encode.h>', dependencies: libjxl_dep)
|
||||
cfg_var.set('HAVE_LIBJXL_JXLENCODERINITBASICINFO', '1')
|
||||
endif
|
||||
if libjxl_dep.version().version_compare('>=0.7')
|
||||
cfg_var.set('HAVE_LIBJXL_0_7', '1')
|
||||
endif
|
||||
endif
|
||||
|
||||
libpoppler_dep = dependency('poppler-glib', version: '>=0.16.0', required: get_option('poppler'))
|
||||
|
Loading…
Reference in New Issue
Block a user