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

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

Issue 16871017: libwebp-0.3.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 0.3.1 final -> no changes since rc2 Created 7 years, 6 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/decode.h ('k') | third_party/libwebp/webp/encode.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 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 Google Inc. All Rights Reserved.
2 // 2 //
3 // This code is licensed under the same terms as WebM: 3 // Use of this source code is governed by a BSD-style license
4 // Software License Agreement: http://www.webmproject.org/license/software/ 4 // that can be found in the COPYING file in the root of the source
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
6 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
7 // 9 //
8 // Demux API. 10 // Demux API.
9 // Enables extraction of image and extended format data from WebP files. 11 // Enables extraction of image and extended format data from WebP files.
10 12
11 // Code Example: Demuxing WebP data to extract all the frames, ICC profile 13 // Code Example: Demuxing WebP data to extract all the frames, ICC profile
12 // and EXIF/XMP metadata. 14 // and EXIF/XMP metadata.
13 // 15 //
14 // WebPDemuxer* demux = WebPDemux(&webp_data); 16 // WebPDemuxer* demux = WebPDemux(&webp_data);
15 // 17 //
(...skipping 30 matching lines...) Expand all
46 #define WEBP_WEBP_DEMUX_H_ 48 #define WEBP_WEBP_DEMUX_H_
47 49
48 #include "./mux_types.h" 50 #include "./mux_types.h"
49 51
50 #if defined(__cplusplus) || defined(c_plusplus) 52 #if defined(__cplusplus) || defined(c_plusplus)
51 extern "C" { 53 extern "C" {
52 #endif 54 #endif
53 55
54 #define WEBP_DEMUX_ABI_VERSION 0x0100 // MAJOR(8b) + MINOR(8b) 56 #define WEBP_DEMUX_ABI_VERSION 0x0100 // MAJOR(8b) + MINOR(8b)
55 57
58 // Note: forward declaring enumerations is not allowed in (strict) C and C++,
59 // the types are left here for reference.
60 // typedef enum WebPDemuxState WebPDemuxState;
61 // typedef enum WebPFormatFeature WebPFormatFeature;
56 typedef struct WebPDemuxer WebPDemuxer; 62 typedef struct WebPDemuxer WebPDemuxer;
57 #if !(defined(__cplusplus) || defined(c_plusplus))
58 typedef enum WebPDemuxState WebPDemuxState;
59 typedef enum WebPFormatFeature WebPFormatFeature;
60 #endif
61 typedef struct WebPIterator WebPIterator; 63 typedef struct WebPIterator WebPIterator;
62 typedef struct WebPChunkIterator WebPChunkIterator; 64 typedef struct WebPChunkIterator WebPChunkIterator;
63 65
64 //------------------------------------------------------------------------------ 66 //------------------------------------------------------------------------------
65 67
66 // Returns the version number of the demux library, packed in hexadecimal using 68 // Returns the version number of the demux library, packed in hexadecimal using
67 // 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507. 69 // 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507.
68 WEBP_EXTERN(int) WebPGetDemuxVersion(void); 70 WEBP_EXTERN(int) WebPGetDemuxVersion(void);
69 71
70 //------------------------------------------------------------------------------ 72 //------------------------------------------------------------------------------
71 // Life of a Demux object 73 // Life of a Demux object
72 74
73 enum WebPDemuxState { 75 typedef enum WebPDemuxState {
74 WEBP_DEMUX_PARSING_HEADER, // Not enough data to parse full header. 76 WEBP_DEMUX_PARSING_HEADER, // Not enough data to parse full header.
75 WEBP_DEMUX_PARSED_HEADER, // Header parsing complete, data may be available. 77 WEBP_DEMUX_PARSED_HEADER, // Header parsing complete, data may be available.
76 WEBP_DEMUX_DONE // Entire file has been parsed. 78 WEBP_DEMUX_DONE // Entire file has been parsed.
77 }; 79 } WebPDemuxState;
78 80
79 // Internal, version-checked, entry point 81 // Internal, version-checked, entry point
80 WEBP_EXTERN(WebPDemuxer*) WebPDemuxInternal( 82 WEBP_EXTERN(WebPDemuxer*) WebPDemuxInternal(
81 const WebPData*, int, WebPDemuxState*, int); 83 const WebPData*, int, WebPDemuxState*, int);
82 84
83 // Parses the full WebP file given by 'data'. 85 // Parses the full WebP file given by 'data'.
84 // Returns a WebPDemuxer object on successful parse, NULL otherwise. 86 // Returns a WebPDemuxer object on successful parse, NULL otherwise.
85 static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) { 87 static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) {
86 return WebPDemuxInternal(data, 0, NULL, WEBP_DEMUX_ABI_VERSION); 88 return WebPDemuxInternal(data, 0, NULL, WEBP_DEMUX_ABI_VERSION);
87 } 89 }
88 90
89 // Parses the possibly incomplete WebP file given by 'data'. 91 // Parses the possibly incomplete WebP file given by 'data'.
90 // If 'state' is non-NULL it will be set to indicate the status of the demuxer. 92 // If 'state' is non-NULL it will be set to indicate the status of the demuxer.
91 // Returns a WebPDemuxer object on successful parse, NULL otherwise. 93 // Returns a WebPDemuxer object on successful parse, NULL otherwise.
92 static WEBP_INLINE WebPDemuxer* WebPDemuxPartial( 94 static WEBP_INLINE WebPDemuxer* WebPDemuxPartial(
93 const WebPData* data, WebPDemuxState* state) { 95 const WebPData* data, WebPDemuxState* state) {
94 return WebPDemuxInternal(data, 1, state, WEBP_DEMUX_ABI_VERSION); 96 return WebPDemuxInternal(data, 1, state, WEBP_DEMUX_ABI_VERSION);
95 } 97 }
96 98
97 // Frees memory associated with 'dmux'. 99 // Frees memory associated with 'dmux'.
98 WEBP_EXTERN(void) WebPDemuxDelete(WebPDemuxer* dmux); 100 WEBP_EXTERN(void) WebPDemuxDelete(WebPDemuxer* dmux);
99 101
100 //------------------------------------------------------------------------------ 102 //------------------------------------------------------------------------------
101 // Data/information extraction. 103 // Data/information extraction.
102 104
103 enum WebPFormatFeature { 105 typedef enum WebPFormatFeature {
104 WEBP_FF_FORMAT_FLAGS, // Extended format flags present in the 'VP8X' chunk. 106 WEBP_FF_FORMAT_FLAGS, // Extended format flags present in the 'VP8X' chunk.
105 WEBP_FF_CANVAS_WIDTH, 107 WEBP_FF_CANVAS_WIDTH,
106 WEBP_FF_CANVAS_HEIGHT, 108 WEBP_FF_CANVAS_HEIGHT,
107 WEBP_FF_LOOP_COUNT, 109 WEBP_FF_LOOP_COUNT,
108 WEBP_FF_BACKGROUND_COLOR, 110 WEBP_FF_BACKGROUND_COLOR,
109 WEBP_FF_FRAME_COUNT // Number of frames present in the demux object. 111 WEBP_FF_FRAME_COUNT // Number of frames present in the demux object.
110 // In case of a partial demux, this is the number of 112 // In case of a partial demux, this is the number of
111 // frames seen so far, with the last frame possibly 113 // frames seen so far, with the last frame possibly
112 // being partial. 114 // being partial.
113 }; 115 } WebPFormatFeature;
114 116
115 // Get the 'feature' value from the 'dmux'. 117 // Get the 'feature' value from the 'dmux'.
116 // NOTE: values are only valid if WebPDemux() was used or WebPDemuxPartial() 118 // NOTE: values are only valid if WebPDemux() was used or WebPDemuxPartial()
117 // returned a state > WEBP_DEMUX_PARSING_HEADER. 119 // returned a state > WEBP_DEMUX_PARSING_HEADER.
118 WEBP_EXTERN(uint32_t) WebPDemuxGetI( 120 WEBP_EXTERN(uint32_t) WebPDemuxGetI(
119 const WebPDemuxer* dmux, WebPFormatFeature feature); 121 const WebPDemuxer* dmux, WebPFormatFeature feature);
120 122
121 //------------------------------------------------------------------------------ 123 //------------------------------------------------------------------------------
122 // Frame iteration. 124 // Frame iteration.
123 125
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // WebPDemuxDelete(). 205 // WebPDemuxDelete().
204 WEBP_EXTERN(void) WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter); 206 WEBP_EXTERN(void) WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter);
205 207
206 //------------------------------------------------------------------------------ 208 //------------------------------------------------------------------------------
207 209
208 #if defined(__cplusplus) || defined(c_plusplus) 210 #if defined(__cplusplus) || defined(c_plusplus)
209 } // extern "C" 211 } // extern "C"
210 #endif 212 #endif
211 213
212 #endif /* WEBP_WEBP_DEMUX_H_ */ 214 #endif /* WEBP_WEBP_DEMUX_H_ */
OLDNEW
« no previous file with comments | « third_party/libwebp/webp/decode.h ('k') | third_party/libwebp/webp/encode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698