diff --git a/libvips/foreign/webp2vips.c b/libvips/foreign/webp2vips.c index 8e813e7f..5ccfe12d 100644 --- a/libvips/foreign/webp2vips.c +++ b/libvips/foreign/webp2vips.c @@ -55,9 +55,7 @@ #include #include -#ifdef HAVE_LIBWEBPMUX #include -#endif /*HAVE_LIBWEBPMUX*/ #include #include @@ -221,6 +219,10 @@ const int vips__n_webp_names = VIPS_NUMBER( vips__webp_names ); static int read_header( Read *read, VipsImage *out ) { + WebPData bitstream; + WebPMux *mux; + int i; + vips_image_init_fields( out, read->width, read->height, read->config.input.has_alpha ? 4 : 3, @@ -230,12 +232,6 @@ read_header( Read *read, VipsImage *out ) vips_image_pipelinev( out, VIPS_DEMAND_STYLE_THINSTRIP, NULL ); -#ifdef HAVE_LIBWEBPMUX -{ - WebPData bitstream; - WebPMux *mux; - int i; - /* We have to parse the whole file again to get the metadata out. * * Don't make parse failure an error. We don't want to refuse to read @@ -254,9 +250,13 @@ read_header( Read *read, VipsImage *out ) WebPData data; + printf( "webp2vips: checking for %s ...\n", webp ); + if( WebPMuxGetChunk( mux, webp, &data ) == WEBP_MUX_OK ) { void *blob; + printf( "webp2vips: found\n" ); + if( !(blob = vips_malloc( NULL, data.size )) ) { WebPMuxDelete( mux ); return( -1 ); @@ -269,8 +269,6 @@ read_header( Read *read, VipsImage *out ) } WebPMuxDelete( mux ); -} -#endif /*HAVE_LIBWEBPMUX*/ return( 0 ); }