mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
WebPBitstreamFeatures: add has_animation field
Change-Id: I3e181ce463b0e4833bfd29f8052b21ebe0bca977
This commit is contained in:
parent
4b956be095
commit
ad452735c3
@ -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);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user