don't write webp metadata we can't read back

stops tests failing
This commit is contained in:
John Cupitt 2016-11-08 17:08:41 +00:00
parent d5934d606a
commit 3d459a82c1
3 changed files with 17 additions and 5 deletions

View File

@ -766,7 +766,7 @@ AC_ARG_WITH([libwebp],
AS_HELP_STRING([--without-libwebp], [build without libwebp (default: test)]))
if test x"$with_libwebp" != "xno"; then
PKG_CHECK_MODULES(LIBWEBP, libwebp >= 0.3.1,
PKG_CHECK_MODULES(LIBWEBP, libwebp >= 0.1.3,
[AC_DEFINE(HAVE_LIBWEBP,1,[define if you have libwebp installed.])
with_libwebp=yes
PACKAGES_USED="$PACKAGES_USED libwebp"

View File

@ -519,16 +519,14 @@ vips__exif_parse( VipsImage *image )
/* Orientation handling. We look for the first Orientation EXIF tag
* (there can be many of them) and use that to set our own
* VIPS_META_ORIENTATION.
*
* ifd0 is usually the image, ifd1 the thumbnail.
*/
(void) vips_image_map( image, vips_exif_get_orientation, NULL );
return( 0 );
}
static void
vips_exif_set_int( ExifData *ed,
ExifEntry *entry, unsigned long component, void *data )

View File

@ -147,6 +147,13 @@ vips_webp_writer_append( VipsWebPWriter *writer,
return( 1 );
}
/* We don't actually use libwebpmux here, but we shouldn't attach metadata we
* can't read back because we'll be unable to test ourselves.
*
* Only attach metadata if we have something to read it back, otherwise
* lots of our tests start failing.
*/
#ifdef HAVE_LIBWEBPMUX
static int
vips_webp_writer_appendle( VipsWebPWriter *writer, uint32_t val, int n )
{
@ -199,6 +206,7 @@ vips_webp_writer_appendc( VipsWebPWriter *writer,
return( 1 );
}
#endif /*HAVE_LIBWEBPMUX*/
static void
vips_webp_writer_unset( VipsWebPWriter *writer )
@ -296,6 +304,7 @@ write_webp( WebPPicture *pic, VipsImage *in,
return( 0 );
}
#ifdef HAVE_LIBWEBPMUX
static int
vips_webp_add_chunk( VipsWebPWriter *writer, VipsImage *image,
const char *vips, const char webp[4] )
@ -490,6 +499,7 @@ vips_webp_add_metadata( VipsWebPWriter *writer, VipsImage *image )
return( 0 );
}
#endif /*HAVE_LIBWEBPMUX*/
int
vips__webp_write_file( VipsImage *in, const char *filename,
@ -520,11 +530,13 @@ vips__webp_write_file( VipsImage *in, const char *filename,
WebPPictureFree( &pic );
#ifdef HAVE_LIBWEBPMUX
if( !strip &&
vips_webp_add_metadata( &writer, in ) ) {
vips_webp_writer_unset( &writer );
return( -1 );
}
#endif /*HAVE_LIBWEBPMUX*/
if( !(fp = vips__file_open_write( filename, FALSE )) ) {
vips_webp_writer_unset( &writer );
@ -571,11 +583,13 @@ vips__webp_write_buffer( VipsImage *in, void **obuf, size_t *olen,
WebPPictureFree( &pic );
#ifdef HAVE_LIBWEBPMUX
if( !strip &&
vips_webp_add_metadata( &writer, in ) ) {
vips_webp_writer_unset( &writer );
return( -1 );
}
#endif /*HAVE_LIBWEBPMUX*/
*obuf = writer.mem;
*olen = writer.size;