diff --git a/src/dec/webp.c b/src/dec/webp.c index ec05ff2f..10b2e264 100644 --- a/src/dec/webp.c +++ b/src/dec/webp.c @@ -276,6 +276,7 @@ static VP8StatusCode ParseHeadersInternal(const uint8_t* data, int* const width, int* const height, int* const has_alpha, + int* const has_animation, WebPHeaderStructure* const headers) { int found_riff = 0; int found_vp8x = 0; @@ -309,6 +310,7 @@ static VP8StatusCode ParseHeadersInternal(const uint8_t* data, return VP8_STATUS_BITSTREAM_ERROR; } if (has_alpha != NULL) *has_alpha = !!(flags & ALPHA_FLAG); + if (has_animation != NULL) *has_animation = !!(flags & ANIMATION_FLAG); if (found_vp8x && headers == NULL) { return VP8_STATUS_OK; // Return features from VP8X header. } @@ -371,9 +373,9 @@ static VP8StatusCode ParseHeadersInternal(const uint8_t* data, VP8StatusCode WebPParseHeaders(WebPHeaderStructure* const headers) { assert(headers != NULL); - // fill out headers, ignore width/height/has_alpha. + // fill out headers, ignore width/height/has_alpha/has_animation. return ParseHeadersInternal(headers->data, headers->data_size, - NULL, NULL, NULL, headers); + NULL, NULL, NULL, NULL, headers); } //------------------------------------------------------------------------------ @@ -625,10 +627,11 @@ static VP8StatusCode GetFeatures(const uint8_t* const data, size_t data_size, } DefaultFeatures(features); - // Only parse enough of the data to retrieve width/height/has_alpha. + // Only parse enough of the data to retrieve the features. return ParseHeadersInternal(data, data_size, &features->width, &features->height, - &features->has_alpha, NULL); + &features->has_alpha, &features->has_animation, + NULL); } //------------------------------------------------------------------------------ diff --git a/src/webp/decode.h b/src/webp/decode.h index 089ff66a..181eb186 100644 --- a/src/webp/decode.h +++ b/src/webp/decode.h @@ -392,9 +392,10 @@ WEBP_EXTERN(const WebPDecBuffer*) WebPIDecodedArea( // Features gathered from the bitstream struct WebPBitstreamFeatures { - int width; // Width in pixels, as read from the bitstream. - int height; // Height in pixels, as read from the bitstream. - int has_alpha; // True if the bitstream contains an alpha channel. + int width; // Width in pixels, as read from the bitstream. + int height; // Height in pixels, as read from the bitstream. + int has_alpha; // True if the bitstream contains an alpha channel. + int has_animation; // True if the bitstream is an animation. // Unused for now: int bitstream_version; // should be 0 for now. TODO(later) @@ -402,7 +403,7 @@ struct WebPBitstreamFeatures { // recommended. int rotate; // TODO(later) int uv_sampling; // should be 0 for now. TODO(later) - uint32_t pad[3]; // padding for later use + uint32_t pad[2]; // padding for later use }; // Internal, version-checked, entry point