Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: third_party/libwebp/webp/mux.h

Issue 116213006: Update libwebp to 0.4.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: After Blink Roll Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/libwebp/webp/encode.h ('k') | third_party/libwebp/webp/mux_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 Google Inc. All Rights Reserved. 1 // Copyright 2011 Google Inc. All Rights Reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license 3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source 4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may 6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree. 7 // be found in the AUTHORS file in the root of the source tree.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 // 9 //
10 // RIFF container manipulation for WEBP images. 10 // RIFF container manipulation for WebP images.
11 // 11 //
12 // Authors: Urvang (urvang@google.com) 12 // Authors: Urvang (urvang@google.com)
13 // Vikas (vikasa@google.com) 13 // Vikas (vikasa@google.com)
14 14
15 // This API allows manipulation of WebP container images containing features 15 // This API allows manipulation of WebP container images containing features
16 // like color profile, metadata, animation and fragmented images. 16 // like color profile, metadata, animation and fragmented images.
17 // 17 //
18 // Code Example#1: Creating a MUX with image data, color profile and XMP 18 // Code Example#1: Create a WebPMux object with image data, color profile and
19 // metadata. 19 // XMP metadata.
20 // 20 /*
21 // int copy_data = 0; 21 int copy_data = 0;
22 // WebPMux* mux = WebPMuxNew(); 22 WebPMux* mux = WebPMuxNew();
23 // // ... (Prepare image data). 23 // ... (Prepare image data).
24 // WebPMuxSetImage(mux, &image, copy_data); 24 WebPMuxSetImage(mux, &image, copy_data);
25 // // ... (Prepare ICCP color profile data). 25 // ... (Prepare ICCP color profile data).
26 // WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data); 26 WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data);
27 // // ... (Prepare XMP metadata). 27 // ... (Prepare XMP metadata).
28 // WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data); 28 WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data);
29 // // Get data from mux in WebP RIFF format. 29 // Get data from mux in WebP RIFF format.
30 // WebPMuxAssemble(mux, &output_data); 30 WebPMuxAssemble(mux, &output_data);
31 // WebPMuxDelete(mux); 31 WebPMuxDelete(mux);
32 // // ... (Consume output_data; e.g. write output_data.bytes to file). 32 // ... (Consume output_data; e.g. write output_data.bytes to file).
33 // WebPDataClear(&output_data); 33 WebPDataClear(&output_data);
34 // 34 */
35
35 // Code Example#2: Get image and color profile data from a WebP file. 36 // Code Example#2: Get image and color profile data from a WebP file.
36 // 37 /*
37 // int copy_data = 0; 38 int copy_data = 0;
38 // // ... (Read data from file). 39 // ... (Read data from file).
39 // WebPMux* mux = WebPMuxCreate(&data, copy_data); 40 WebPMux* mux = WebPMuxCreate(&data, copy_data);
40 // WebPMuxGetFrame(mux, 1, &image); 41 WebPMuxGetFrame(mux, 1, &image);
41 // // ... (Consume image; e.g. call WebPDecode() to decode the data). 42 // ... (Consume image; e.g. call WebPDecode() to decode the data).
42 // WebPMuxGetChunk(mux, "ICCP", &icc_profile); 43 WebPMuxGetChunk(mux, "ICCP", &icc_profile);
43 // // ... (Consume icc_data). 44 // ... (Consume icc_data).
44 // WebPMuxDelete(mux); 45 WebPMuxDelete(mux);
45 // free(data); 46 free(data);
47 */
46 48
47 #ifndef WEBP_WEBP_MUX_H_ 49 #ifndef WEBP_WEBP_MUX_H_
48 #define WEBP_WEBP_MUX_H_ 50 #define WEBP_WEBP_MUX_H_
49 51
50 #include "./mux_types.h" 52 #include "./mux_types.h"
51 53
52 #if defined(__cplusplus) || defined(c_plusplus) 54 #ifdef __cplusplus
53 extern "C" { 55 extern "C" {
54 #endif 56 #endif
55 57
56 #define WEBP_MUX_ABI_VERSION 0x0100 // MAJOR(8b) + MINOR(8b) 58 #define WEBP_MUX_ABI_VERSION 0x0101 // MAJOR(8b) + MINOR(8b)
57 59
58 // Note: forward declaring enumerations is not allowed in (strict) C and C++, 60 // Note: forward declaring enumerations is not allowed in (strict) C and C++,
59 // the types are left here for reference. 61 // the types are left here for reference.
60 // typedef enum WebPMuxError WebPMuxError; 62 // typedef enum WebPMuxError WebPMuxError;
61 // typedef enum WebPChunkId WebPChunkId; 63 // typedef enum WebPChunkId WebPChunkId;
62 typedef struct WebPMux WebPMux; // main opaque object. 64 typedef struct WebPMux WebPMux; // main opaque object.
63 typedef struct WebPMuxFrameInfo WebPMuxFrameInfo; 65 typedef struct WebPMuxFrameInfo WebPMuxFrameInfo;
64 typedef struct WebPMuxAnimParams WebPMuxAnimParams; 66 typedef struct WebPMuxAnimParams WebPMuxAnimParams;
65 67
66 // Error codes 68 // Error codes
(...skipping 17 matching lines...) Expand all
84 WEBP_CHUNK_IMAGE, // VP8/VP8L 86 WEBP_CHUNK_IMAGE, // VP8/VP8L
85 WEBP_CHUNK_EXIF, // EXIF 87 WEBP_CHUNK_EXIF, // EXIF
86 WEBP_CHUNK_XMP, // XMP 88 WEBP_CHUNK_XMP, // XMP
87 WEBP_CHUNK_UNKNOWN, // Other chunks. 89 WEBP_CHUNK_UNKNOWN, // Other chunks.
88 WEBP_CHUNK_NIL 90 WEBP_CHUNK_NIL
89 } WebPChunkId; 91 } WebPChunkId;
90 92
91 //------------------------------------------------------------------------------ 93 //------------------------------------------------------------------------------
92 94
93 // Returns the version number of the mux library, packed in hexadecimal using 95 // Returns the version number of the mux library, packed in hexadecimal using
94 // 8bits or each of major/minor/revision. E.g: v2.5.7 is 0x020507. 96 // 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507.
95 WEBP_EXTERN(int) WebPGetMuxVersion(void); 97 WEBP_EXTERN(int) WebPGetMuxVersion(void);
96 98
97 //------------------------------------------------------------------------------ 99 //------------------------------------------------------------------------------
98 // Life of a Mux object 100 // Life of a Mux object
99 101
100 // Internal, version-checked, entry point 102 // Internal, version-checked, entry point
101 WEBP_EXTERN(WebPMux*) WebPNewInternal(int); 103 WEBP_EXTERN(WebPMux*) WebPNewInternal(int);
102 104
103 // Creates an empty mux object. 105 // Creates an empty mux object.
104 // Returns: 106 // Returns:
(...skipping 10 matching lines...) Expand all
115 //------------------------------------------------------------------------------ 117 //------------------------------------------------------------------------------
116 // Mux creation. 118 // Mux creation.
117 119
118 // Internal, version-checked, entry point 120 // Internal, version-checked, entry point
119 WEBP_EXTERN(WebPMux*) WebPMuxCreateInternal(const WebPData*, int, int); 121 WEBP_EXTERN(WebPMux*) WebPMuxCreateInternal(const WebPData*, int, int);
120 122
121 // Creates a mux object from raw data given in WebP RIFF format. 123 // Creates a mux object from raw data given in WebP RIFF format.
122 // Parameters: 124 // Parameters:
123 // bitstream - (in) the bitstream data in WebP RIFF format 125 // bitstream - (in) the bitstream data in WebP RIFF format
124 // copy_data - (in) value 1 indicates given data WILL be copied to the mux 126 // copy_data - (in) value 1 indicates given data WILL be copied to the mux
125 // and value 0 indicates data will NOT be copied. 127 // object and value 0 indicates data will NOT be copied.
126 // Returns: 128 // Returns:
127 // A pointer to the mux object created from given data - on success. 129 // A pointer to the mux object created from given data - on success.
128 // NULL - In case of invalid data or memory error. 130 // NULL - In case of invalid data or memory error.
129 static WEBP_INLINE WebPMux* WebPMuxCreate(const WebPData* bitstream, 131 static WEBP_INLINE WebPMux* WebPMuxCreate(const WebPData* bitstream,
130 int copy_data) { 132 int copy_data) {
131 return WebPMuxCreateInternal(bitstream, copy_data, WEBP_MUX_ABI_VERSION); 133 return WebPMuxCreateInternal(bitstream, copy_data, WEBP_MUX_ABI_VERSION);
132 } 134 }
133 135
134 //------------------------------------------------------------------------------ 136 //------------------------------------------------------------------------------
135 // Non-image chunks. 137 // Non-image chunks.
136 138
137 // Note: Only non-image related chunks should be managed through chunk APIs. 139 // Note: Only non-image related chunks should be managed through chunk APIs.
138 // (Image related chunks are: "ANMF", "FRGM", "VP8 ", "VP8L" and "ALPH"). 140 // (Image related chunks are: "ANMF", "FRGM", "VP8 ", "VP8L" and "ALPH").
139 // To add, get and delete images, use APIs WebPMuxSetImage(), 141 // To add, get and delete images, use WebPMuxSetImage(), WebPMuxPushFrame(),
140 // WebPMuxPushFrame(), WebPMuxGetFrame() and WebPMuxDeleteFrame(). 142 // WebPMuxGetFrame() and WebPMuxDeleteFrame().
141 143
142 // Adds a chunk with id 'fourcc' and data 'chunk_data' in the mux object. 144 // Adds a chunk with id 'fourcc' and data 'chunk_data' in the mux object.
143 // Any existing chunk(s) with the same id will be removed. 145 // Any existing chunk(s) with the same id will be removed.
144 // Parameters: 146 // Parameters:
145 // mux - (in/out) object to which the chunk is to be added 147 // mux - (in/out) object to which the chunk is to be added
146 // fourcc - (in) a character array containing the fourcc of the given chunk; 148 // fourcc - (in) a character array containing the fourcc of the given chunk;
147 // e.g., "ICCP", "XMP ", "EXIF" etc. 149 // e.g., "ICCP", "XMP ", "EXIF" etc.
148 // chunk_data - (in) the chunk data to be added 150 // chunk_data - (in) the chunk data to be added
149 // copy_data - (in) value 1 indicates given data WILL be copied to the mux 151 // copy_data - (in) value 1 indicates given data WILL be copied to the mux
150 // and value 0 indicates data will NOT be copied. 152 // object and value 0 indicates data will NOT be copied.
151 // Returns: 153 // Returns:
152 // WEBP_MUX_INVALID_ARGUMENT - if mux, fourcc or chunk_data is NULL 154 // WEBP_MUX_INVALID_ARGUMENT - if mux, fourcc or chunk_data is NULL
153 // or if fourcc corresponds to an image chunk. 155 // or if fourcc corresponds to an image chunk.
154 // WEBP_MUX_MEMORY_ERROR - on memory allocation error. 156 // WEBP_MUX_MEMORY_ERROR - on memory allocation error.
155 // WEBP_MUX_OK - on success. 157 // WEBP_MUX_OK - on success.
156 WEBP_EXTERN(WebPMuxError) WebPMuxSetChunk( 158 WEBP_EXTERN(WebPMuxError) WebPMuxSetChunk(
157 WebPMux* mux, const char fourcc[4], const WebPData* chunk_data, 159 WebPMux* mux, const char fourcc[4], const WebPData* chunk_data,
158 int copy_data); 160 int copy_data);
159 161
160 // Gets a reference to the data of the chunk with id 'fourcc' in the mux object. 162 // Gets a reference to the data of the chunk with id 'fourcc' in the mux object.
161 // The caller should NOT free the returned data. 163 // The caller should NOT free the returned data.
162 // Parameters: 164 // Parameters:
163 // mux - (in) object from which the chunk data is to be fetched 165 // mux - (in) object from which the chunk data is to be fetched
164 // fourcc - (in) a character array containing the fourcc of the chunk; 166 // fourcc - (in) a character array containing the fourcc of the chunk;
165 // e.g., "ICCP", "XMP ", "EXIF" etc. 167 // e.g., "ICCP", "XMP ", "EXIF" etc.
166 // chunk_data - (out) returned chunk data 168 // chunk_data - (out) returned chunk data
167 // Returns: 169 // Returns:
168 // WEBP_MUX_INVALID_ARGUMENT - if either mux, fourcc or chunk_data is NULL 170 // WEBP_MUX_INVALID_ARGUMENT - if mux, fourcc or chunk_data is NULL
169 // or if fourcc corresponds to an image chunk. 171 // or if fourcc corresponds to an image chunk.
170 // WEBP_MUX_NOT_FOUND - If mux does not contain a chunk with the given id. 172 // WEBP_MUX_NOT_FOUND - If mux does not contain a chunk with the given id.
171 // WEBP_MUX_OK - on success. 173 // WEBP_MUX_OK - on success.
172 WEBP_EXTERN(WebPMuxError) WebPMuxGetChunk( 174 WEBP_EXTERN(WebPMuxError) WebPMuxGetChunk(
173 const WebPMux* mux, const char fourcc[4], WebPData* chunk_data); 175 const WebPMux* mux, const char fourcc[4], WebPData* chunk_data);
174 176
175 // Deletes the chunk with the given 'fourcc' from the mux object. 177 // Deletes the chunk with the given 'fourcc' from the mux object.
176 // Parameters: 178 // Parameters:
177 // mux - (in/out) object from which the chunk is to be deleted 179 // mux - (in/out) object from which the chunk is to be deleted
178 // fourcc - (in) a character array containing the fourcc of the chunk; 180 // fourcc - (in) a character array containing the fourcc of the chunk;
179 // e.g., "ICCP", "XMP ", "EXIF" etc. 181 // e.g., "ICCP", "XMP ", "EXIF" etc.
180 // Returns: 182 // Returns:
181 // WEBP_MUX_INVALID_ARGUMENT - if mux or fourcc is NULL 183 // WEBP_MUX_INVALID_ARGUMENT - if mux or fourcc is NULL
182 // or if fourcc corresponds to an image chunk. 184 // or if fourcc corresponds to an image chunk.
183 // WEBP_MUX_NOT_FOUND - If mux does not contain a chunk with the given fourcc. 185 // WEBP_MUX_NOT_FOUND - If mux does not contain a chunk with the given fourcc.
184 // WEBP_MUX_OK - on success. 186 // WEBP_MUX_OK - on success.
185 WEBP_EXTERN(WebPMuxError) WebPMuxDeleteChunk( 187 WEBP_EXTERN(WebPMuxError) WebPMuxDeleteChunk(
186 WebPMux* mux, const char fourcc[4]); 188 WebPMux* mux, const char fourcc[4]);
187 189
188 //------------------------------------------------------------------------------ 190 //------------------------------------------------------------------------------
189 // Images. 191 // Images.
190 192
191 // Encapsulates data about a single frame/fragment. 193 // Encapsulates data about a single frame/fragment.
192 struct WebPMuxFrameInfo { 194 struct WebPMuxFrameInfo {
193 WebPData bitstream; // image data: can either be a raw VP8/VP8L bitstream 195 WebPData bitstream; // image data: can be a raw VP8/VP8L bitstream
194 // or a single-image WebP file. 196 // or a single-image WebP file.
195 int x_offset; // x-offset of the frame. 197 int x_offset; // x-offset of the frame.
196 int y_offset; // y-offset of the frame. 198 int y_offset; // y-offset of the frame.
197 int duration; // duration of the frame (in milliseconds). 199 int duration; // duration of the frame (in milliseconds).
198 200
199 WebPChunkId id; // frame type: should be one of WEBP_CHUNK_ANMF, 201 WebPChunkId id; // frame type: should be one of WEBP_CHUNK_ANMF,
200 // WEBP_CHUNK_FRGM or WEBP_CHUNK_IMAGE 202 // WEBP_CHUNK_FRGM or WEBP_CHUNK_IMAGE
201 WebPMuxAnimDispose dispose_method; // Disposal method for the frame. 203 WebPMuxAnimDispose dispose_method; // Disposal method for the frame.
202 WebPMuxAnimBlend blend_method; // Blend operation for the frame. 204 WebPMuxAnimBlend blend_method; // Blend operation for the frame.
203 uint32_t pad[1]; // padding for later use 205 uint32_t pad[1]; // padding for later use
204 }; 206 };
205 207
206 // Sets the (non-animated and non-fragmented) image in the mux object. 208 // Sets the (non-animated and non-fragmented) image in the mux object.
207 // Note: Any existing images (including frames/fragments) will be removed. 209 // Note: Any existing images (including frames/fragments) will be removed.
208 // Parameters: 210 // Parameters:
209 // mux - (in/out) object in which the image is to be set 211 // mux - (in/out) object in which the image is to be set
210 // bitstream - (in) can either be a raw VP8/VP8L bitstream or a single-image 212 // bitstream - (in) can be a raw VP8/VP8L bitstream or a single-image
211 // WebP file (non-animated and non-fragmented) 213 // WebP file (non-animated and non-fragmented)
212 // copy_data - (in) value 1 indicates given data WILL be copied to the mux 214 // copy_data - (in) value 1 indicates given data WILL be copied to the mux
213 // and value 0 indicates data will NOT be copied. 215 // object and value 0 indicates data will NOT be copied.
214 // Returns: 216 // Returns:
215 // WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or bitstream is NULL. 217 // WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or bitstream is NULL.
216 // WEBP_MUX_MEMORY_ERROR - on memory allocation error. 218 // WEBP_MUX_MEMORY_ERROR - on memory allocation error.
217 // WEBP_MUX_OK - on success. 219 // WEBP_MUX_OK - on success.
218 WEBP_EXTERN(WebPMuxError) WebPMuxSetImage( 220 WEBP_EXTERN(WebPMuxError) WebPMuxSetImage(
219 WebPMux* mux, const WebPData* bitstream, int copy_data); 221 WebPMux* mux, const WebPData* bitstream, int copy_data);
220 222
221 // Adds a frame at the end of the mux object. 223 // Adds a frame at the end of the mux object.
222 // Notes: (1) frame.id should be one of WEBP_CHUNK_ANMF or WEBP_CHUNK_FRGM 224 // Notes: (1) frame.id should be one of WEBP_CHUNK_ANMF or WEBP_CHUNK_FRGM
223 // (2) For setting a non-animated non-fragmented image, use 225 // (2) For setting a non-animated non-fragmented image, use
224 // WebPMuxSetImage() instead. 226 // WebPMuxSetImage() instead.
225 // (3) Type of frame being pushed must be same as the frames in mux. 227 // (3) Type of frame being pushed must be same as the frames in mux.
226 // (4) As WebP only supports even offsets, any odd offset will be snapped 228 // (4) As WebP only supports even offsets, any odd offset will be snapped
227 // to an even location using: offset &= ~1 229 // to an even location using: offset &= ~1
228 // Parameters: 230 // Parameters:
229 // mux - (in/out) object to which the frame is to be added 231 // mux - (in/out) object to which the frame is to be added
230 // frame - (in) frame data. 232 // frame - (in) frame data.
231 // copy_data - (in) value 1 indicates given data WILL be copied to the mux 233 // copy_data - (in) value 1 indicates given data WILL be copied to the mux
232 // and value 0 indicates data will NOT be copied. 234 // object and value 0 indicates data will NOT be copied.
233 // Returns: 235 // Returns:
234 // WEBP_MUX_INVALID_ARGUMENT - if mux or frame is NULL 236 // WEBP_MUX_INVALID_ARGUMENT - if mux or frame is NULL
235 // or if content of 'frame' is invalid. 237 // or if content of 'frame' is invalid.
236 // WEBP_MUX_MEMORY_ERROR - on memory allocation error. 238 // WEBP_MUX_MEMORY_ERROR - on memory allocation error.
237 // WEBP_MUX_OK - on success. 239 // WEBP_MUX_OK - on success.
238 WEBP_EXTERN(WebPMuxError) WebPMuxPushFrame( 240 WEBP_EXTERN(WebPMuxError) WebPMuxPushFrame(
239 WebPMux* mux, const WebPMuxFrameInfo* frame, int copy_data); 241 WebPMux* mux, const WebPMuxFrameInfo* frame, int copy_data);
240 242
241 // Gets the nth frame from the mux object. 243 // Gets the nth frame from the mux object.
242 // The content of 'frame->bitstream' is allocated using malloc(), and NOT 244 // The content of 'frame->bitstream' is allocated using malloc(), and NOT
243 // owned by the 'mux' object. It MUST be deallocated by the caller by calling 245 // owned by the 'mux' object. It MUST be deallocated by the caller by calling
244 // WebPDataClear(). 246 // WebPDataClear().
245 // nth=0 has a special meaning - last position. 247 // nth=0 has a special meaning - last position.
246 // Parameters: 248 // Parameters:
247 // mux - (in) object from which the info is to be fetched 249 // mux - (in) object from which the info is to be fetched
248 // nth - (in) index of the frame in the mux object 250 // nth - (in) index of the frame in the mux object
249 // frame - (out) data of the returned frame 251 // frame - (out) data of the returned frame
250 // Returns: 252 // Returns:
251 // WEBP_MUX_INVALID_ARGUMENT - if mux or frame is NULL. 253 // WEBP_MUX_INVALID_ARGUMENT - if mux or frame is NULL.
252 // WEBP_MUX_NOT_FOUND - if there are less than nth frames in the mux object. 254 // WEBP_MUX_NOT_FOUND - if there are less than nth frames in the mux object.
253 // WEBP_MUX_BAD_DATA - if nth frame chunk in mux is invalid. 255 // WEBP_MUX_BAD_DATA - if nth frame chunk in mux is invalid.
256 // WEBP_MUX_MEMORY_ERROR - on memory allocation error.
254 // WEBP_MUX_OK - on success. 257 // WEBP_MUX_OK - on success.
255 WEBP_EXTERN(WebPMuxError) WebPMuxGetFrame( 258 WEBP_EXTERN(WebPMuxError) WebPMuxGetFrame(
256 const WebPMux* mux, uint32_t nth, WebPMuxFrameInfo* frame); 259 const WebPMux* mux, uint32_t nth, WebPMuxFrameInfo* frame);
257 260
258 // Deletes a frame from the mux object. 261 // Deletes a frame from the mux object.
259 // nth=0 has a special meaning - last position. 262 // nth=0 has a special meaning - last position.
260 // Parameters: 263 // Parameters:
261 // mux - (in/out) object from which a frame is to be deleted 264 // mux - (in/out) object from which a frame is to be deleted
262 // nth - (in) The position from which the frame is to be deleted 265 // nth - (in) The position from which the frame is to be deleted
263 // Returns: 266 // Returns:
(...skipping 15 matching lines...) Expand all
279 // Bits 24 to 31: Blue. 282 // Bits 24 to 31: Blue.
280 int loop_count; // Number of times to repeat the animation [0 = infinite]. 283 int loop_count; // Number of times to repeat the animation [0 = infinite].
281 }; 284 };
282 285
283 // Sets the animation parameters in the mux object. Any existing ANIM chunks 286 // Sets the animation parameters in the mux object. Any existing ANIM chunks
284 // will be removed. 287 // will be removed.
285 // Parameters: 288 // Parameters:
286 // mux - (in/out) object in which ANIM chunk is to be set/added 289 // mux - (in/out) object in which ANIM chunk is to be set/added
287 // params - (in) animation parameters. 290 // params - (in) animation parameters.
288 // Returns: 291 // Returns:
289 // WEBP_MUX_INVALID_ARGUMENT - if either mux or params is NULL 292 // WEBP_MUX_INVALID_ARGUMENT - if mux or params is NULL.
290 // WEBP_MUX_MEMORY_ERROR - on memory allocation error. 293 // WEBP_MUX_MEMORY_ERROR - on memory allocation error.
291 // WEBP_MUX_OK - on success. 294 // WEBP_MUX_OK - on success.
292 WEBP_EXTERN(WebPMuxError) WebPMuxSetAnimationParams( 295 WEBP_EXTERN(WebPMuxError) WebPMuxSetAnimationParams(
293 WebPMux* mux, const WebPMuxAnimParams* params); 296 WebPMux* mux, const WebPMuxAnimParams* params);
294 297
295 // Gets the animation parameters from the mux object. 298 // Gets the animation parameters from the mux object.
296 // Parameters: 299 // Parameters:
297 // mux - (in) object from which the animation parameters to be fetched 300 // mux - (in) object from which the animation parameters to be fetched
298 // params - (out) animation parameters extracted from the ANIM chunk 301 // params - (out) animation parameters extracted from the ANIM chunk
299 // Returns: 302 // Returns:
300 // WEBP_MUX_INVALID_ARGUMENT - if either of mux or params is NULL 303 // WEBP_MUX_INVALID_ARGUMENT - if mux or params is NULL.
301 // WEBP_MUX_NOT_FOUND - if ANIM chunk is not present in mux object. 304 // WEBP_MUX_NOT_FOUND - if ANIM chunk is not present in mux object.
302 // WEBP_MUX_OK - on success. 305 // WEBP_MUX_OK - on success.
303 WEBP_EXTERN(WebPMuxError) WebPMuxGetAnimationParams( 306 WEBP_EXTERN(WebPMuxError) WebPMuxGetAnimationParams(
304 const WebPMux* mux, WebPMuxAnimParams* params); 307 const WebPMux* mux, WebPMuxAnimParams* params);
305 308
306 //------------------------------------------------------------------------------ 309 //------------------------------------------------------------------------------
307 // Misc Utilities. 310 // Misc Utilities.
308 311
312 // Gets the canvas size from the mux object.
313 // Note: This method assumes that the VP8X chunk, if present, is up-to-date.
314 // That is, the mux object hasn't been modified since the last call to
315 // WebPMuxAssemble() or WebPMuxCreate().
316 // Parameters:
317 // mux - (in) object from which the canvas size is to be fetched
318 // width - (out) canvas width
319 // height - (out) canvas height
320 // Returns:
321 // WEBP_MUX_INVALID_ARGUMENT - if mux, width or height is NULL.
322 // WEBP_MUX_BAD_DATA - if VP8X/VP8/VP8L chunk or canvas size is invalid.
323 // WEBP_MUX_OK - on success.
324 WEBP_EXTERN(WebPMuxError) WebPMuxGetCanvasSize(const WebPMux* mux,
325 int* width, int* height);
326
309 // Gets the feature flags from the mux object. 327 // Gets the feature flags from the mux object.
328 // Note: This method assumes that the VP8X chunk, if present, is up-to-date.
329 // That is, the mux object hasn't been modified since the last call to
330 // WebPMuxAssemble() or WebPMuxCreate().
310 // Parameters: 331 // Parameters:
311 // mux - (in) object from which the features are to be fetched 332 // mux - (in) object from which the features are to be fetched
312 // flags - (out) the flags specifying which features are present in the 333 // flags - (out) the flags specifying which features are present in the
313 // mux object. This will be an OR of various flag values. 334 // mux object. This will be an OR of various flag values.
314 // Enum 'WebPFeatureFlags' can be used to test individual flag values. 335 // Enum 'WebPFeatureFlags' can be used to test individual flag values.
315 // Returns: 336 // Returns:
316 // WEBP_MUX_INVALID_ARGUMENT - if mux or flags is NULL 337 // WEBP_MUX_INVALID_ARGUMENT - if mux or flags is NULL.
317 // WEBP_MUX_NOT_FOUND - if VP8X chunk is not present in mux object. 338 // WEBP_MUX_BAD_DATA - if VP8X/VP8/VP8L chunk or canvas size is invalid.
318 // WEBP_MUX_BAD_DATA - if VP8X chunk in mux is invalid.
319 // WEBP_MUX_OK - on success. 339 // WEBP_MUX_OK - on success.
320 WEBP_EXTERN(WebPMuxError) WebPMuxGetFeatures(const WebPMux* mux, 340 WEBP_EXTERN(WebPMuxError) WebPMuxGetFeatures(const WebPMux* mux,
321 uint32_t* flags); 341 uint32_t* flags);
322 342
323 // Gets number of chunks having tag value tag in the mux object. 343 // Gets number of chunks with the given 'id' in the mux object.
324 // Parameters: 344 // Parameters:
325 // mux - (in) object from which the info is to be fetched 345 // mux - (in) object from which the info is to be fetched
326 // id - (in) chunk id specifying the type of chunk 346 // id - (in) chunk id specifying the type of chunk
327 // num_elements - (out) number of chunks with the given chunk id 347 // num_elements - (out) number of chunks with the given chunk id
328 // Returns: 348 // Returns:
329 // WEBP_MUX_INVALID_ARGUMENT - if either mux, or num_elements is NULL 349 // WEBP_MUX_INVALID_ARGUMENT - if mux, or num_elements is NULL.
330 // WEBP_MUX_OK - on success. 350 // WEBP_MUX_OK - on success.
331 WEBP_EXTERN(WebPMuxError) WebPMuxNumChunks(const WebPMux* mux, 351 WEBP_EXTERN(WebPMuxError) WebPMuxNumChunks(const WebPMux* mux,
332 WebPChunkId id, int* num_elements); 352 WebPChunkId id, int* num_elements);
333 353
334 // Assembles all chunks in WebP RIFF format and returns in 'assembled_data'. 354 // Assembles all chunks in WebP RIFF format and returns in 'assembled_data'.
335 // This function also validates the mux object. 355 // This function also validates the mux object.
336 // Note: The content of 'assembled_data' will be ignored and overwritten. 356 // Note: The content of 'assembled_data' will be ignored and overwritten.
337 // Also, the content of 'assembled_data' is allocated using malloc(), and NOT 357 // Also, the content of 'assembled_data' is allocated using malloc(), and NOT
338 // owned by the 'mux' object. It MUST be deallocated by the caller by calling 358 // owned by the 'mux' object. It MUST be deallocated by the caller by calling
339 // WebPDataClear(). 359 // WebPDataClear().
340 // Parameters: 360 // Parameters:
341 // mux - (in/out) object whose chunks are to be assembled 361 // mux - (in/out) object whose chunks are to be assembled
342 // assembled_data - (out) assembled WebP data 362 // assembled_data - (out) assembled WebP data
343 // Returns: 363 // Returns:
344 // WEBP_MUX_BAD_DATA - if mux object is invalid. 364 // WEBP_MUX_BAD_DATA - if mux object is invalid.
345 // WEBP_MUX_INVALID_ARGUMENT - if either mux, output_data or output_size is 365 // WEBP_MUX_INVALID_ARGUMENT - if mux or assembled_data is NULL.
346 // NULL.
347 // WEBP_MUX_MEMORY_ERROR - on memory allocation error. 366 // WEBP_MUX_MEMORY_ERROR - on memory allocation error.
348 // WEBP_MUX_OK - on success 367 // WEBP_MUX_OK - on success.
349 WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* mux, 368 WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* mux,
350 WebPData* assembled_data); 369 WebPData* assembled_data);
351 370
352 //------------------------------------------------------------------------------ 371 //------------------------------------------------------------------------------
353 372
354 #if defined(__cplusplus) || defined(c_plusplus) 373 #ifdef __cplusplus
355 } // extern "C" 374 } // extern "C"
356 #endif 375 #endif
357 376
358 #endif /* WEBP_WEBP_MUX_H_ */ 377 #endif /* WEBP_WEBP_MUX_H_ */
OLDNEW
« no previous file with comments | « third_party/libwebp/webp/encode.h ('k') | third_party/libwebp/webp/mux_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698