// Copyright 2011 Google Inc. All Rights Reserved.1//2// Use of this source code is governed by a BSD-style license3// that can be found in the COPYING file in the root of the source4// tree. An additional intellectual property rights grant can be found5// in the file PATENTS. All contributing project authors may6// be found in the AUTHORS file in the root of the source tree.7// -----------------------------------------------------------------------------8//9// RIFF container manipulation and encoding for WebP images.10//11// Authors: Urvang ([email protected])12// Vikas ([email protected])1314#ifndef WEBP_WEBP_MUX_H_15#define WEBP_WEBP_MUX_H_1617#include "./mux_types.h"18#include "./types.h"1920#ifdef __cplusplus21extern "C" {22#endif2324#define WEBP_MUX_ABI_VERSION 0x0109 // MAJOR(8b) + MINOR(8b)2526//------------------------------------------------------------------------------27// Mux API28//29// This API allows manipulation of WebP container images containing features30// like color profile, metadata, animation.31//32// Code Example#1: Create a WebPMux object with image data, color profile and33// XMP metadata.34/*35int copy_data = 0;36WebPMux* mux = WebPMuxNew();37// ... (Prepare image data).38WebPMuxSetImage(mux, &image, copy_data);39// ... (Prepare ICCP color profile data).40WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data);41// ... (Prepare XMP metadata).42WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data);43// Get data from mux in WebP RIFF format.44WebPMuxAssemble(mux, &output_data);45WebPMuxDelete(mux);46// ... (Consume output_data; e.g. write output_data.bytes to file).47WebPDataClear(&output_data);48*/4950// Code Example#2: Get image and color profile data from a WebP file.51/*52int copy_data = 0;53// ... (Read data from file).54WebPMux* mux = WebPMuxCreate(&data, copy_data);55WebPMuxGetFrame(mux, 1, &image);56// ... (Consume image; e.g. call WebPDecode() to decode the data).57WebPMuxGetChunk(mux, "ICCP", &icc_profile);58// ... (Consume icc_data).59WebPMuxDelete(mux);60WebPFree(data);61*/6263// Note: forward declaring enumerations is not allowed in (strict) C and C++,64// the types are left here for reference.65// typedef enum WebPMuxError WebPMuxError;66// typedef enum WebPChunkId WebPChunkId;67typedef struct WebPMux WebPMux; // main opaque object.68typedef struct WebPMuxFrameInfo WebPMuxFrameInfo;69typedef struct WebPMuxAnimParams WebPMuxAnimParams;70typedef struct WebPAnimEncoderOptions WebPAnimEncoderOptions;7172// Error codes73typedef enum WEBP_NODISCARD WebPMuxError {74WEBP_MUX_OK = 1,75WEBP_MUX_NOT_FOUND = 0,76WEBP_MUX_INVALID_ARGUMENT = -1,77WEBP_MUX_BAD_DATA = -2,78WEBP_MUX_MEMORY_ERROR = -3,79WEBP_MUX_NOT_ENOUGH_DATA = -480} WebPMuxError;8182// IDs for different types of chunks.83typedef enum WebPChunkId {84WEBP_CHUNK_VP8X, // VP8X85WEBP_CHUNK_ICCP, // ICCP86WEBP_CHUNK_ANIM, // ANIM87WEBP_CHUNK_ANMF, // ANMF88WEBP_CHUNK_DEPRECATED, // (deprecated from FRGM)89WEBP_CHUNK_ALPHA, // ALPH90WEBP_CHUNK_IMAGE, // VP8/VP8L91WEBP_CHUNK_EXIF, // EXIF92WEBP_CHUNK_XMP, // XMP93WEBP_CHUNK_UNKNOWN, // Other chunks.94WEBP_CHUNK_NIL95} WebPChunkId;9697//------------------------------------------------------------------------------9899// Returns the version number of the mux library, packed in hexadecimal using100// 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507.101WEBP_EXTERN int WebPGetMuxVersion(void);102103//------------------------------------------------------------------------------104// Life of a Mux object105106// Internal, version-checked, entry point107WEBP_NODISCARD WEBP_EXTERN WebPMux* WebPNewInternal(int);108109// Creates an empty mux object.110// Returns:111// A pointer to the newly created empty mux object.112// Or NULL in case of memory error.113WEBP_NODISCARD static WEBP_INLINE WebPMux* WebPMuxNew(void) {114return WebPNewInternal(WEBP_MUX_ABI_VERSION);115}116117// Deletes the mux object.118// Parameters:119// mux - (in/out) object to be deleted120WEBP_EXTERN void WebPMuxDelete(WebPMux* mux);121122//------------------------------------------------------------------------------123// Mux creation.124125// Internal, version-checked, entry point126WEBP_NODISCARD WEBP_EXTERN WebPMux* WebPMuxCreateInternal(const WebPData*, int,127int);128129// Creates a mux object from raw data given in WebP RIFF format.130// Parameters:131// bitstream - (in) the bitstream data in WebP RIFF format132// copy_data - (in) value 1 indicates given data WILL be copied to the mux133// object and value 0 indicates data will NOT be copied. If the134// data is not copied, it must exist for the lifetime of the135// mux object.136// Returns:137// A pointer to the mux object created from given data - on success.138// NULL - In case of invalid data or memory error.139WEBP_NODISCARD static WEBP_INLINE WebPMux* WebPMuxCreate(140const WebPData* bitstream, int copy_data) {141return WebPMuxCreateInternal(bitstream, copy_data, WEBP_MUX_ABI_VERSION);142}143144//------------------------------------------------------------------------------145// Non-image chunks.146147// Note: Only non-image related chunks should be managed through chunk APIs.148// (Image related chunks are: "ANMF", "VP8 ", "VP8L" and "ALPH").149// To add, get and delete images, use WebPMuxSetImage(), WebPMuxPushFrame(),150// WebPMuxGetFrame() and WebPMuxDeleteFrame().151152// Adds a chunk with id 'fourcc' and data 'chunk_data' in the mux object.153// Any existing chunk(s) with the same id will be removed.154// Parameters:155// mux - (in/out) object to which the chunk is to be added156// fourcc - (in) a character array containing the fourcc of the given chunk;157// e.g., "ICCP", "XMP ", "EXIF" etc.158// chunk_data - (in) the chunk data to be added159// copy_data - (in) value 1 indicates given data WILL be copied to the mux160// object and value 0 indicates data will NOT be copied. If the161// data is not copied, it must exist until a call to162// WebPMuxAssemble() is made.163// Returns:164// WEBP_MUX_INVALID_ARGUMENT - if mux, fourcc or chunk_data is NULL165// or if fourcc corresponds to an image chunk.166// WEBP_MUX_MEMORY_ERROR - on memory allocation error.167// WEBP_MUX_OK - on success.168WEBP_EXTERN WebPMuxError WebPMuxSetChunk(169WebPMux* mux, const char fourcc[4], const WebPData* chunk_data,170int copy_data);171172// Gets a reference to the data of the chunk with id 'fourcc' in the mux object.173// The caller should NOT free the returned data.174// Parameters:175// mux - (in) object from which the chunk data is to be fetched176// fourcc - (in) a character array containing the fourcc of the chunk;177// e.g., "ICCP", "XMP ", "EXIF" etc.178// chunk_data - (out) returned chunk data179// Returns:180// WEBP_MUX_INVALID_ARGUMENT - if mux, fourcc or chunk_data is NULL181// or if fourcc corresponds to an image chunk.182// WEBP_MUX_NOT_FOUND - If mux does not contain a chunk with the given id.183// WEBP_MUX_OK - on success.184WEBP_EXTERN WebPMuxError WebPMuxGetChunk(185const WebPMux* mux, const char fourcc[4], WebPData* chunk_data);186187// Deletes the chunk with the given 'fourcc' from the mux object.188// Parameters:189// mux - (in/out) object from which the chunk is to be deleted190// fourcc - (in) a character array containing the fourcc of the chunk;191// e.g., "ICCP", "XMP ", "EXIF" etc.192// Returns:193// WEBP_MUX_INVALID_ARGUMENT - if mux or fourcc is NULL194// or if fourcc corresponds to an image chunk.195// WEBP_MUX_NOT_FOUND - If mux does not contain a chunk with the given fourcc.196// WEBP_MUX_OK - on success.197WEBP_EXTERN WebPMuxError WebPMuxDeleteChunk(198WebPMux* mux, const char fourcc[4]);199200//------------------------------------------------------------------------------201// Images.202203// Encapsulates data about a single frame.204struct WebPMuxFrameInfo {205WebPData bitstream; // image data: can be a raw VP8/VP8L bitstream206// or a single-image WebP file.207int x_offset; // x-offset of the frame.208int y_offset; // y-offset of the frame.209int duration; // duration of the frame (in milliseconds).210211WebPChunkId id; // frame type: should be one of WEBP_CHUNK_ANMF212// or WEBP_CHUNK_IMAGE213WebPMuxAnimDispose dispose_method; // Disposal method for the frame.214WebPMuxAnimBlend blend_method; // Blend operation for the frame.215uint32_t pad[1]; // padding for later use216};217218// Sets the (non-animated) image in the mux object.219// Note: Any existing images (including frames) will be removed.220// Parameters:221// mux - (in/out) object in which the image is to be set222// bitstream - (in) can be a raw VP8/VP8L bitstream or a single-image223// WebP file (non-animated)224// copy_data - (in) value 1 indicates given data WILL be copied to the mux225// object and value 0 indicates data will NOT be copied. If the226// data is not copied, it must exist until a call to227// WebPMuxAssemble() is made.228// Returns:229// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or bitstream is NULL.230// WEBP_MUX_MEMORY_ERROR - on memory allocation error.231// WEBP_MUX_OK - on success.232WEBP_EXTERN WebPMuxError WebPMuxSetImage(233WebPMux* mux, const WebPData* bitstream, int copy_data);234235// Adds a frame at the end of the mux object.236// Notes: (1) frame.id should be WEBP_CHUNK_ANMF237// (2) For setting a non-animated image, use WebPMuxSetImage() instead.238// (3) Type of frame being pushed must be same as the frames in mux.239// (4) As WebP only supports even offsets, any odd offset will be snapped240// to an even location using: offset &= ~1241// Parameters:242// mux - (in/out) object to which the frame is to be added243// frame - (in) frame data.244// copy_data - (in) value 1 indicates given data WILL be copied to the mux245// object and value 0 indicates data will NOT be copied. If the246// data is not copied, it must exist until a call to247// WebPMuxAssemble() is made.248// Returns:249// WEBP_MUX_INVALID_ARGUMENT - if mux or frame is NULL250// or if content of 'frame' is invalid.251// WEBP_MUX_MEMORY_ERROR - on memory allocation error.252// WEBP_MUX_OK - on success.253WEBP_EXTERN WebPMuxError WebPMuxPushFrame(254WebPMux* mux, const WebPMuxFrameInfo* frame, int copy_data);255256// Gets the nth frame from the mux object.257// The content of 'frame->bitstream' is allocated using WebPMalloc(), and NOT258// owned by the 'mux' object. It MUST be deallocated by the caller by calling259// WebPDataClear().260// nth=0 has a special meaning - last position.261// Parameters:262// mux - (in) object from which the info is to be fetched263// nth - (in) index of the frame in the mux object264// frame - (out) data of the returned frame265// Returns:266// WEBP_MUX_INVALID_ARGUMENT - if mux or frame is NULL.267// WEBP_MUX_NOT_FOUND - if there are less than nth frames in the mux object.268// WEBP_MUX_BAD_DATA - if nth frame chunk in mux is invalid.269// WEBP_MUX_MEMORY_ERROR - on memory allocation error.270// WEBP_MUX_OK - on success.271WEBP_EXTERN WebPMuxError WebPMuxGetFrame(272const WebPMux* mux, uint32_t nth, WebPMuxFrameInfo* frame);273274// Deletes a frame from the mux object.275// nth=0 has a special meaning - last position.276// Parameters:277// mux - (in/out) object from which a frame is to be deleted278// nth - (in) The position from which the frame is to be deleted279// Returns:280// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL.281// WEBP_MUX_NOT_FOUND - If there are less than nth frames in the mux object282// before deletion.283// WEBP_MUX_OK - on success.284WEBP_EXTERN WebPMuxError WebPMuxDeleteFrame(WebPMux* mux, uint32_t nth);285286//------------------------------------------------------------------------------287// Animation.288289// Animation parameters.290struct WebPMuxAnimParams {291uint32_t bgcolor; // Background color of the canvas stored (in MSB order) as:292// Bits 00 to 07: Alpha.293// Bits 08 to 15: Red.294// Bits 16 to 23: Green.295// Bits 24 to 31: Blue.296int loop_count; // Number of times to repeat the animation [0 = infinite].297};298299// Sets the animation parameters in the mux object. Any existing ANIM chunks300// will be removed.301// Parameters:302// mux - (in/out) object in which ANIM chunk is to be set/added303// params - (in) animation parameters.304// Returns:305// WEBP_MUX_INVALID_ARGUMENT - if mux or params is NULL.306// WEBP_MUX_MEMORY_ERROR - on memory allocation error.307// WEBP_MUX_OK - on success.308WEBP_EXTERN WebPMuxError WebPMuxSetAnimationParams(309WebPMux* mux, const WebPMuxAnimParams* params);310311// Gets the animation parameters from the mux object.312// Parameters:313// mux - (in) object from which the animation parameters to be fetched314// params - (out) animation parameters extracted from the ANIM chunk315// Returns:316// WEBP_MUX_INVALID_ARGUMENT - if mux or params is NULL.317// WEBP_MUX_NOT_FOUND - if ANIM chunk is not present in mux object.318// WEBP_MUX_OK - on success.319WEBP_EXTERN WebPMuxError WebPMuxGetAnimationParams(320const WebPMux* mux, WebPMuxAnimParams* params);321322//------------------------------------------------------------------------------323// Misc Utilities.324325// Sets the canvas size for the mux object. The width and height can be326// specified explicitly or left as zero (0, 0).327// * When width and height are specified explicitly, then this frame bound is328// enforced during subsequent calls to WebPMuxAssemble() and an error is329// reported if any animated frame does not completely fit within the canvas.330// * When unspecified (0, 0), the constructed canvas will get the frame bounds331// from the bounding-box over all frames after calling WebPMuxAssemble().332// Parameters:333// mux - (in) object to which the canvas size is to be set334// width - (in) canvas width335// height - (in) canvas height336// Returns:337// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL; or338// width or height are invalid or out of bounds339// WEBP_MUX_OK - on success.340WEBP_EXTERN WebPMuxError WebPMuxSetCanvasSize(WebPMux* mux,341int width, int height);342343// Gets the canvas size from the mux object.344// Note: This method assumes that the VP8X chunk, if present, is up-to-date.345// That is, the mux object hasn't been modified since the last call to346// WebPMuxAssemble() or WebPMuxCreate().347// Parameters:348// mux - (in) object from which the canvas size is to be fetched349// width - (out) canvas width350// height - (out) canvas height351// Returns:352// WEBP_MUX_INVALID_ARGUMENT - if mux, width or height is NULL.353// WEBP_MUX_BAD_DATA - if VP8X/VP8/VP8L chunk or canvas size is invalid.354// WEBP_MUX_OK - on success.355WEBP_EXTERN WebPMuxError WebPMuxGetCanvasSize(const WebPMux* mux,356int* width, int* height);357358// Gets the feature flags from the mux object.359// Note: This method assumes that the VP8X chunk, if present, is up-to-date.360// That is, the mux object hasn't been modified since the last call to361// WebPMuxAssemble() or WebPMuxCreate().362// Parameters:363// mux - (in) object from which the features are to be fetched364// flags - (out) the flags specifying which features are present in the365// mux object. This will be an OR of various flag values.366// Enum 'WebPFeatureFlags' can be used to test individual flag values.367// Returns:368// WEBP_MUX_INVALID_ARGUMENT - if mux or flags is NULL.369// WEBP_MUX_BAD_DATA - if VP8X/VP8/VP8L chunk or canvas size is invalid.370// WEBP_MUX_OK - on success.371WEBP_EXTERN WebPMuxError WebPMuxGetFeatures(const WebPMux* mux,372uint32_t* flags);373374// Gets number of chunks with the given 'id' in the mux object.375// Parameters:376// mux - (in) object from which the info is to be fetched377// id - (in) chunk id specifying the type of chunk378// num_elements - (out) number of chunks with the given chunk id379// Returns:380// WEBP_MUX_INVALID_ARGUMENT - if mux, or num_elements is NULL.381// WEBP_MUX_OK - on success.382WEBP_EXTERN WebPMuxError WebPMuxNumChunks(const WebPMux* mux,383WebPChunkId id, int* num_elements);384385// Assembles all chunks in WebP RIFF format and returns in 'assembled_data'.386// This function also validates the mux object.387// Note: The content of 'assembled_data' will be ignored and overwritten.388// Also, the content of 'assembled_data' is allocated using WebPMalloc(), and389// NOT owned by the 'mux' object. It MUST be deallocated by the caller by390// calling WebPDataClear(). It's always safe to call WebPDataClear() upon391// return, even in case of error.392// Parameters:393// mux - (in/out) object whose chunks are to be assembled394// assembled_data - (out) assembled WebP data395// Returns:396// WEBP_MUX_BAD_DATA - if mux object is invalid.397// WEBP_MUX_INVALID_ARGUMENT - if mux or assembled_data is NULL.398// WEBP_MUX_MEMORY_ERROR - on memory allocation error.399// WEBP_MUX_OK - on success.400WEBP_EXTERN WebPMuxError WebPMuxAssemble(WebPMux* mux,401WebPData* assembled_data);402403//------------------------------------------------------------------------------404// WebPAnimEncoder API405//406// This API allows encoding (possibly) animated WebP images.407//408// Code Example:409/*410WebPAnimEncoderOptions enc_options;411WebPAnimEncoderOptionsInit(&enc_options);412// Tune 'enc_options' as needed.413WebPAnimEncoder* enc = WebPAnimEncoderNew(width, height, &enc_options);414while(<there are more frames>) {415WebPConfig config;416WebPConfigInit(&config);417// Tune 'config' as needed.418WebPAnimEncoderAdd(enc, frame, timestamp_ms, &config);419}420WebPAnimEncoderAdd(enc, NULL, timestamp_ms, NULL);421WebPAnimEncoderAssemble(enc, webp_data);422WebPAnimEncoderDelete(enc);423// Write the 'webp_data' to a file, or re-mux it further.424*/425426typedef struct WebPAnimEncoder WebPAnimEncoder; // Main opaque object.427428// Forward declarations. Defined in encode.h.429struct WebPPicture;430struct WebPConfig;431432// Global options.433struct WebPAnimEncoderOptions {434WebPMuxAnimParams anim_params; // Animation parameters.435int minimize_size; // If true, minimize the output size (slow). Implicitly436// disables key-frame insertion.437int kmin;438int kmax; // Minimum and maximum distance between consecutive key439// frames in the output. The library may insert some key440// frames as needed to satisfy this criteria.441// Note that these conditions should hold: kmax > kmin442// and kmin >= kmax / 2 + 1. Also, if kmax <= 0, then443// key-frame insertion is disabled; and if kmax == 1,444// then all frames will be key-frames (kmin value does445// not matter for these special cases).446int allow_mixed; // If true, use mixed compression mode; may choose447// either lossy and lossless for each frame.448int verbose; // If true, print info and warning messages to stderr.449450uint32_t padding[4]; // Padding for later use.451};452453// Internal, version-checked, entry point.454WEBP_EXTERN int WebPAnimEncoderOptionsInitInternal(455WebPAnimEncoderOptions*, int);456457// Should always be called, to initialize a fresh WebPAnimEncoderOptions458// structure before modification. Returns false in case of version mismatch.459// WebPAnimEncoderOptionsInit() must have succeeded before using the460// 'enc_options' object.461WEBP_NODISCARD static WEBP_INLINE int WebPAnimEncoderOptionsInit(462WebPAnimEncoderOptions* enc_options) {463return WebPAnimEncoderOptionsInitInternal(enc_options, WEBP_MUX_ABI_VERSION);464}465466// Internal, version-checked, entry point.467WEBP_EXTERN WebPAnimEncoder* WebPAnimEncoderNewInternal(468int, int, const WebPAnimEncoderOptions*, int);469470// Creates and initializes a WebPAnimEncoder object.471// Parameters:472// width/height - (in) canvas width and height of the animation.473// enc_options - (in) encoding options; can be passed NULL to pick474// reasonable defaults.475// Returns:476// A pointer to the newly created WebPAnimEncoder object.477// Or NULL in case of memory error.478static WEBP_INLINE WebPAnimEncoder* WebPAnimEncoderNew(479int width, int height, const WebPAnimEncoderOptions* enc_options) {480return WebPAnimEncoderNewInternal(width, height, enc_options,481WEBP_MUX_ABI_VERSION);482}483484// Optimize the given frame for WebP, encode it and add it to the485// WebPAnimEncoder object.486// The last call to 'WebPAnimEncoderAdd' should be with frame = NULL, which487// indicates that no more frames are to be added. This call is also used to488// determine the duration of the last frame.489// Parameters:490// enc - (in/out) object to which the frame is to be added.491// frame - (in/out) frame data in ARGB or YUV(A) format. If it is in YUV(A)492// format, it will be converted to ARGB, which incurs a small loss.493// timestamp_ms - (in) timestamp of this frame in milliseconds.494// Duration of a frame would be calculated as495// "timestamp of next frame - timestamp of this frame".496// Hence, timestamps should be in non-decreasing order.497// config - (in) encoding options; can be passed NULL to pick498// reasonable defaults.499// Returns:500// On error, returns false and frame->error_code is set appropriately.501// Otherwise, returns true.502WEBP_NODISCARD WEBP_EXTERN int WebPAnimEncoderAdd(503WebPAnimEncoder* enc, struct WebPPicture* frame, int timestamp_ms,504const struct WebPConfig* config);505506// Assemble all frames added so far into a WebP bitstream.507// This call should be preceded by a call to 'WebPAnimEncoderAdd' with508// frame = NULL; if not, the duration of the last frame will be internally509// estimated.510// Parameters:511// enc - (in/out) object from which the frames are to be assembled.512// webp_data - (out) generated WebP bitstream.513// Returns:514// True on success.515WEBP_NODISCARD WEBP_EXTERN int WebPAnimEncoderAssemble(WebPAnimEncoder* enc,516WebPData* webp_data);517518// Get error string corresponding to the most recent call using 'enc'. The519// returned string is owned by 'enc' and is valid only until the next call to520// WebPAnimEncoderAdd() or WebPAnimEncoderAssemble() or WebPAnimEncoderDelete().521// Parameters:522// enc - (in/out) object from which the error string is to be fetched.523// Returns:524// NULL if 'enc' is NULL. Otherwise, returns the error string if the last call525// to 'enc' had an error, or an empty string if the last call was a success.526WEBP_EXTERN const char* WebPAnimEncoderGetError(WebPAnimEncoder* enc);527528// Deletes the WebPAnimEncoder object.529// Parameters:530// enc - (in/out) object to be deleted531WEBP_EXTERN void WebPAnimEncoderDelete(WebPAnimEncoder* enc);532533//------------------------------------------------------------------------------534// Non-image chunks.535536// Note: Only non-image related chunks should be managed through chunk APIs.537// (Image related chunks are: "ANMF", "VP8 ", "VP8L" and "ALPH").538539// Adds a chunk with id 'fourcc' and data 'chunk_data' in the enc object.540// Any existing chunk(s) with the same id will be removed.541// Parameters:542// enc - (in/out) object to which the chunk is to be added543// fourcc - (in) a character array containing the fourcc of the given chunk;544// e.g., "ICCP", "XMP ", "EXIF", etc.545// chunk_data - (in) the chunk data to be added546// copy_data - (in) value 1 indicates given data WILL be copied to the enc547// object and value 0 indicates data will NOT be copied. If the548// data is not copied, it must exist until a call to549// WebPAnimEncoderAssemble() is made.550// Returns:551// WEBP_MUX_INVALID_ARGUMENT - if enc, fourcc or chunk_data is NULL.552// WEBP_MUX_MEMORY_ERROR - on memory allocation error.553// WEBP_MUX_OK - on success.554WEBP_EXTERN WebPMuxError WebPAnimEncoderSetChunk(555WebPAnimEncoder* enc, const char fourcc[4], const WebPData* chunk_data,556int copy_data);557558// Gets a reference to the data of the chunk with id 'fourcc' in the enc object.559// The caller should NOT free the returned data.560// Parameters:561// enc - (in) object from which the chunk data is to be fetched562// fourcc - (in) a character array containing the fourcc of the chunk;563// e.g., "ICCP", "XMP ", "EXIF", etc.564// chunk_data - (out) returned chunk data565// Returns:566// WEBP_MUX_INVALID_ARGUMENT - if enc, fourcc or chunk_data is NULL.567// WEBP_MUX_NOT_FOUND - If enc does not contain a chunk with the given id.568// WEBP_MUX_OK - on success.569WEBP_EXTERN WebPMuxError WebPAnimEncoderGetChunk(570const WebPAnimEncoder* enc, const char fourcc[4], WebPData* chunk_data);571572// Deletes the chunk with the given 'fourcc' from the enc object.573// Parameters:574// enc - (in/out) object from which the chunk is to be deleted575// fourcc - (in) a character array containing the fourcc of the chunk;576// e.g., "ICCP", "XMP ", "EXIF", etc.577// Returns:578// WEBP_MUX_INVALID_ARGUMENT - if enc or fourcc is NULL.579// WEBP_MUX_NOT_FOUND - If enc does not contain a chunk with the given fourcc.580// WEBP_MUX_OK - on success.581WEBP_EXTERN WebPMuxError WebPAnimEncoderDeleteChunk(582WebPAnimEncoder* enc, const char fourcc[4]);583584//------------------------------------------------------------------------------585586#ifdef __cplusplus587} // extern "C"588#endif589590#endif // WEBP_WEBP_MUX_H_591592593