parent
d4823489dc
commit
23e13ea6ed
|
@ -55,9 +55,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <webp/decode.h>
|
#include <webp/decode.h>
|
||||||
#ifdef HAVE_LIBWEBPMUX
|
|
||||||
#include <webp/mux.h>
|
#include <webp/mux.h>
|
||||||
#endif /*HAVE_LIBWEBPMUX*/
|
|
||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
|
@ -221,6 +219,10 @@ const int vips__n_webp_names = VIPS_NUMBER( vips__webp_names );
|
||||||
static int
|
static int
|
||||||
read_header( Read *read, VipsImage *out )
|
read_header( Read *read, VipsImage *out )
|
||||||
{
|
{
|
||||||
|
WebPData bitstream;
|
||||||
|
WebPMux *mux;
|
||||||
|
int i;
|
||||||
|
|
||||||
vips_image_init_fields( out,
|
vips_image_init_fields( out,
|
||||||
read->width, read->height,
|
read->width, read->height,
|
||||||
read->config.input.has_alpha ? 4 : 3,
|
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 );
|
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.
|
/* 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
|
* 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;
|
WebPData data;
|
||||||
|
|
||||||
|
printf( "webp2vips: checking for %s ...\n", webp );
|
||||||
|
|
||||||
if( WebPMuxGetChunk( mux, webp, &data ) == WEBP_MUX_OK ) {
|
if( WebPMuxGetChunk( mux, webp, &data ) == WEBP_MUX_OK ) {
|
||||||
void *blob;
|
void *blob;
|
||||||
|
|
||||||
|
printf( "webp2vips: found\n" );
|
||||||
|
|
||||||
if( !(blob = vips_malloc( NULL, data.size )) ) {
|
if( !(blob = vips_malloc( NULL, data.size )) ) {
|
||||||
WebPMuxDelete( mux );
|
WebPMuxDelete( mux );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
@ -269,8 +269,6 @@ read_header( Read *read, VipsImage *out )
|
||||||
}
|
}
|
||||||
|
|
||||||
WebPMuxDelete( mux );
|
WebPMuxDelete( mux );
|
||||||
}
|
|
||||||
#endif /*HAVE_LIBWEBPMUX*/
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue