| Index: third_party/libwebp/webp/demux.h
|
| diff --git a/third_party/libwebp/webp/demux.h b/third_party/libwebp/webp/demux.h
|
| index 894ff4ef247e1842c54756fe92ee2bd52f688c2c..2da3239dd9dc5423f916d5a36f865989e6abee54 100644
|
| --- a/third_party/libwebp/webp/demux.h
|
| +++ b/third_party/libwebp/webp/demux.h
|
| @@ -12,44 +12,45 @@
|
|
|
| // Code Example: Demuxing WebP data to extract all the frames, ICC profile
|
| // and EXIF/XMP metadata.
|
| -//
|
| -// WebPDemuxer* demux = WebPDemux(&webp_data);
|
| -//
|
| -// uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
|
| -// uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
|
| -// // ... (Get information about the features present in the WebP file).
|
| -// uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
|
| -//
|
| -// // ... (Iterate over all frames).
|
| -// WebPIterator iter;
|
| -// if (WebPDemuxGetFrame(demux, 1, &iter)) {
|
| -// do {
|
| -// // ... (Consume 'iter'; e.g. Decode 'iter.fragment' with WebPDecode(),
|
| -// // ... and get other frame properties like width, height, offsets etc.
|
| -// // ... see 'struct WebPIterator' below for more info).
|
| -// } while (WebPDemuxNextFrame(&iter));
|
| -// WebPDemuxReleaseIterator(&iter);
|
| -// }
|
| -//
|
| -// // ... (Extract metadata).
|
| -// WebPChunkIterator chunk_iter;
|
| -// if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter);
|
| -// // ... (Consume the ICC profile in 'chunk_iter.chunk').
|
| -// WebPDemuxReleaseChunkIterator(&chunk_iter);
|
| -// if (flags & EXIF_FLAG) WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter);
|
| -// // ... (Consume the EXIF metadata in 'chunk_iter.chunk').
|
| -// WebPDemuxReleaseChunkIterator(&chunk_iter);
|
| -// if (flags & XMP_FLAG) WebPDemuxGetChunk(demux, "XMP ", 1, &chunk_iter);
|
| -// // ... (Consume the XMP metadata in 'chunk_iter.chunk').
|
| -// WebPDemuxReleaseChunkIterator(&chunk_iter);
|
| -// WebPDemuxDelete(demux);
|
| +/*
|
| + WebPDemuxer* demux = WebPDemux(&webp_data);
|
| +
|
| + uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
|
| + uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
|
| + // ... (Get information about the features present in the WebP file).
|
| + uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
|
| +
|
| + // ... (Iterate over all frames).
|
| + WebPIterator iter;
|
| + if (WebPDemuxGetFrame(demux, 1, &iter)) {
|
| + do {
|
| + // ... (Consume 'iter'; e.g. Decode 'iter.fragment' with WebPDecode(),
|
| + // ... and get other frame properties like width, height, offsets etc.
|
| + // ... see 'struct WebPIterator' below for more info).
|
| + } while (WebPDemuxNextFrame(&iter));
|
| + WebPDemuxReleaseIterator(&iter);
|
| + }
|
| +
|
| + // ... (Extract metadata).
|
| + WebPChunkIterator chunk_iter;
|
| + if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter);
|
| + // ... (Consume the ICC profile in 'chunk_iter.chunk').
|
| + WebPDemuxReleaseChunkIterator(&chunk_iter);
|
| + if (flags & EXIF_FLAG) WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter);
|
| + // ... (Consume the EXIF metadata in 'chunk_iter.chunk').
|
| + WebPDemuxReleaseChunkIterator(&chunk_iter);
|
| + if (flags & XMP_FLAG) WebPDemuxGetChunk(demux, "XMP ", 1, &chunk_iter);
|
| + // ... (Consume the XMP metadata in 'chunk_iter.chunk').
|
| + WebPDemuxReleaseChunkIterator(&chunk_iter);
|
| + WebPDemuxDelete(demux);
|
| +*/
|
|
|
| #ifndef WEBP_WEBP_DEMUX_H_
|
| #define WEBP_WEBP_DEMUX_H_
|
|
|
| #include "./mux_types.h"
|
|
|
| -#if defined(__cplusplus) || defined(c_plusplus)
|
| +#ifdef __cplusplus
|
| extern "C" {
|
| #endif
|
|
|
| @@ -73,9 +74,11 @@ WEBP_EXTERN(int) WebPGetDemuxVersion(void);
|
| // Life of a Demux object
|
|
|
| typedef enum WebPDemuxState {
|
| - WEBP_DEMUX_PARSING_HEADER, // Not enough data to parse full header.
|
| - WEBP_DEMUX_PARSED_HEADER, // Header parsing complete, data may be available.
|
| - WEBP_DEMUX_DONE // Entire file has been parsed.
|
| + WEBP_DEMUX_PARSE_ERROR = -1, // An error occurred while parsing.
|
| + WEBP_DEMUX_PARSING_HEADER = 0, // Not enough data to parse full header.
|
| + WEBP_DEMUX_PARSED_HEADER = 1, // Header parsing complete,
|
| + // data may be available.
|
| + WEBP_DEMUX_DONE = 2 // Entire file has been parsed.
|
| } WebPDemuxState;
|
|
|
| // Internal, version-checked, entry point
|
| @@ -90,7 +93,12 @@ static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) {
|
|
|
| // Parses the possibly incomplete WebP file given by 'data'.
|
| // If 'state' is non-NULL it will be set to indicate the status of the demuxer.
|
| -// Returns a WebPDemuxer object on successful parse, NULL otherwise.
|
| +// Returns NULL in case of error or if there isn't enough data to start parsing;
|
| +// and a WebPDemuxer object on successful parse.
|
| +// Note that WebPDemuxer keeps internal pointers to 'data' memory segment.
|
| +// If this data is volatile, the demuxer object should be deleted (by calling
|
| +// WebPDemuxDelete()) and WebPDemuxPartial() called again on the new data.
|
| +// This is usually an inexpensive operation.
|
| static WEBP_INLINE WebPDemuxer* WebPDemuxPartial(
|
| const WebPData* data, WebPDemuxState* state) {
|
| return WebPDemuxInternal(data, 1, state, WEBP_DEMUX_ABI_VERSION);
|
| @@ -145,7 +153,7 @@ struct WebPIterator {
|
|
|
| // Retrieves frame 'frame_number' from 'dmux'.
|
| // 'iter->fragment' points to the first fragment on return from this function.
|
| -// Individual fragments may be extracted using WebPDemuxSetFragment().
|
| +// Individual fragments may be extracted using WebPDemuxSelectFragment().
|
| // Setting 'frame_number' equal to 0 will return the last frame of the image.
|
| // Returns false if 'dmux' is NULL or frame 'frame_number' is not present.
|
| // Call WebPDemuxReleaseIterator() when use of the iterator is complete.
|
| @@ -209,7 +217,7 @@ WEBP_EXTERN(void) WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter);
|
|
|
| //------------------------------------------------------------------------------
|
|
|
| -#if defined(__cplusplus) || defined(c_plusplus)
|
| +#ifdef __cplusplus
|
| } // extern "C"
|
| #endif
|
|
|
|
|