@cpp.js/package-webp 1.0.0-beta.24 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/cppjs.config.js +12 -11
  4. package/package.json +8 -12
  5. package/dist/prebuilt/Android-arm64-v8a/include/webp/decode.h +0 -506
  6. package/dist/prebuilt/Android-arm64-v8a/include/webp/demux.h +0 -367
  7. package/dist/prebuilt/Android-arm64-v8a/include/webp/encode.h +0 -557
  8. package/dist/prebuilt/Android-arm64-v8a/include/webp/mux.h +0 -591
  9. package/dist/prebuilt/Android-arm64-v8a/include/webp/mux_types.h +0 -99
  10. package/dist/prebuilt/Android-arm64-v8a/include/webp/sharpyuv/sharpyuv.h +0 -172
  11. package/dist/prebuilt/Android-arm64-v8a/include/webp/sharpyuv/sharpyuv_csp.h +0 -60
  12. package/dist/prebuilt/Android-arm64-v8a/include/webp/types.h +0 -93
  13. package/dist/prebuilt/Android-arm64-v8a/lib/libsharpyuv.la +0 -41
  14. package/dist/prebuilt/Android-arm64-v8a/lib/libsharpyuv.so +0 -0
  15. package/dist/prebuilt/Android-arm64-v8a/lib/libwebp.la +0 -41
  16. package/dist/prebuilt/Android-arm64-v8a/lib/libwebp.so +0 -0
  17. package/dist/prebuilt/Android-arm64-v8a/lib/libwebpdemux.la +0 -41
  18. package/dist/prebuilt/Android-arm64-v8a/lib/libwebpdemux.so +0 -0
  19. package/dist/prebuilt/Android-arm64-v8a/lib/libwebpmux.la +0 -41
  20. package/dist/prebuilt/Android-arm64-v8a/lib/libwebpmux.so +0 -0
  21. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/libsharpyuv.pc +0 -11
  22. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/libwebp.pc +0 -12
  23. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/libwebpdemux.pc +0 -11
  24. package/dist/prebuilt/Android-arm64-v8a/lib/pkgconfig/libwebpmux.pc +0 -12
  25. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/cwebp.1 +0 -332
  26. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/dwebp.1 +0 -150
  27. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/img2webp.1 +0 -117
  28. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/webpinfo.1 +0 -80
  29. package/dist/prebuilt/Android-arm64-v8a/share/man/man1/webpmux.1 +0 -271
  30. package/dist/prebuilt/Android-x86_64/include/webp/decode.h +0 -506
  31. package/dist/prebuilt/Android-x86_64/include/webp/demux.h +0 -367
  32. package/dist/prebuilt/Android-x86_64/include/webp/encode.h +0 -557
  33. package/dist/prebuilt/Android-x86_64/include/webp/mux.h +0 -591
  34. package/dist/prebuilt/Android-x86_64/include/webp/mux_types.h +0 -99
  35. package/dist/prebuilt/Android-x86_64/include/webp/sharpyuv/sharpyuv.h +0 -172
  36. package/dist/prebuilt/Android-x86_64/include/webp/sharpyuv/sharpyuv_csp.h +0 -60
  37. package/dist/prebuilt/Android-x86_64/include/webp/types.h +0 -93
  38. package/dist/prebuilt/Android-x86_64/lib/libsharpyuv.la +0 -41
  39. package/dist/prebuilt/Android-x86_64/lib/libsharpyuv.so +0 -0
  40. package/dist/prebuilt/Android-x86_64/lib/libwebp.la +0 -41
  41. package/dist/prebuilt/Android-x86_64/lib/libwebp.so +0 -0
  42. package/dist/prebuilt/Android-x86_64/lib/libwebpdemux.la +0 -41
  43. package/dist/prebuilt/Android-x86_64/lib/libwebpdemux.so +0 -0
  44. package/dist/prebuilt/Android-x86_64/lib/libwebpmux.la +0 -41
  45. package/dist/prebuilt/Android-x86_64/lib/libwebpmux.so +0 -0
  46. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/libsharpyuv.pc +0 -11
  47. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/libwebp.pc +0 -12
  48. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/libwebpdemux.pc +0 -11
  49. package/dist/prebuilt/Android-x86_64/lib/pkgconfig/libwebpmux.pc +0 -12
  50. package/dist/prebuilt/Android-x86_64/share/man/man1/cwebp.1 +0 -332
  51. package/dist/prebuilt/Android-x86_64/share/man/man1/dwebp.1 +0 -150
  52. package/dist/prebuilt/Android-x86_64/share/man/man1/img2webp.1 +0 -117
  53. package/dist/prebuilt/Android-x86_64/share/man/man1/webpinfo.1 +0 -80
  54. package/dist/prebuilt/Android-x86_64/share/man/man1/webpmux.1 +0 -271
  55. package/dist/prebuilt/CMakeLists.txt +0 -44
  56. package/dist/prebuilt/Emscripten-x86_64/include/webp/decode.h +0 -506
  57. package/dist/prebuilt/Emscripten-x86_64/include/webp/demux.h +0 -367
  58. package/dist/prebuilt/Emscripten-x86_64/include/webp/encode.h +0 -557
  59. package/dist/prebuilt/Emscripten-x86_64/include/webp/mux.h +0 -591
  60. package/dist/prebuilt/Emscripten-x86_64/include/webp/mux_types.h +0 -99
  61. package/dist/prebuilt/Emscripten-x86_64/include/webp/sharpyuv/sharpyuv.h +0 -172
  62. package/dist/prebuilt/Emscripten-x86_64/include/webp/sharpyuv/sharpyuv_csp.h +0 -60
  63. package/dist/prebuilt/Emscripten-x86_64/include/webp/types.h +0 -93
  64. package/dist/prebuilt/Emscripten-x86_64/lib/libsharpyuv.a +0 -0
  65. package/dist/prebuilt/Emscripten-x86_64/lib/libsharpyuv.la +0 -41
  66. package/dist/prebuilt/Emscripten-x86_64/lib/libwebp.a +0 -0
  67. package/dist/prebuilt/Emscripten-x86_64/lib/libwebp.la +0 -41
  68. package/dist/prebuilt/Emscripten-x86_64/lib/libwebpdemux.a +0 -0
  69. package/dist/prebuilt/Emscripten-x86_64/lib/libwebpdemux.la +0 -41
  70. package/dist/prebuilt/Emscripten-x86_64/lib/libwebpmux.a +0 -0
  71. package/dist/prebuilt/Emscripten-x86_64/lib/libwebpmux.la +0 -41
  72. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/libsharpyuv.pc +0 -11
  73. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/libwebp.pc +0 -12
  74. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/libwebpdemux.pc +0 -11
  75. package/dist/prebuilt/Emscripten-x86_64/lib/pkgconfig/libwebpmux.pc +0 -12
  76. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/cwebp.1 +0 -332
  77. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/dwebp.1 +0 -150
  78. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/img2webp.1 +0 -117
  79. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/webpinfo.1 +0 -80
  80. package/dist/prebuilt/Emscripten-x86_64/share/man/man1/webpmux.1 +0 -271
  81. package/dist/prebuilt/iOS-iphoneos/include/webp/decode.h +0 -506
  82. package/dist/prebuilt/iOS-iphoneos/include/webp/demux.h +0 -367
  83. package/dist/prebuilt/iOS-iphoneos/include/webp/encode.h +0 -557
  84. package/dist/prebuilt/iOS-iphoneos/include/webp/mux.h +0 -591
  85. package/dist/prebuilt/iOS-iphoneos/include/webp/mux_types.h +0 -99
  86. package/dist/prebuilt/iOS-iphoneos/include/webp/sharpyuv/sharpyuv.h +0 -172
  87. package/dist/prebuilt/iOS-iphoneos/include/webp/sharpyuv/sharpyuv_csp.h +0 -60
  88. package/dist/prebuilt/iOS-iphoneos/include/webp/types.h +0 -93
  89. package/dist/prebuilt/iOS-iphoneos/lib/libsharpyuv.a +0 -0
  90. package/dist/prebuilt/iOS-iphoneos/lib/libsharpyuv.la +0 -41
  91. package/dist/prebuilt/iOS-iphoneos/lib/libwebp.a +0 -0
  92. package/dist/prebuilt/iOS-iphoneos/lib/libwebp.la +0 -41
  93. package/dist/prebuilt/iOS-iphoneos/lib/libwebpdemux.a +0 -0
  94. package/dist/prebuilt/iOS-iphoneos/lib/libwebpdemux.la +0 -41
  95. package/dist/prebuilt/iOS-iphoneos/lib/libwebpmux.a +0 -0
  96. package/dist/prebuilt/iOS-iphoneos/lib/libwebpmux.la +0 -41
  97. package/dist/prebuilt/iOS-iphoneos/lib/pkgconfig/libsharpyuv.pc +0 -11
  98. package/dist/prebuilt/iOS-iphoneos/lib/pkgconfig/libwebp.pc +0 -12
  99. package/dist/prebuilt/iOS-iphoneos/lib/pkgconfig/libwebpdemux.pc +0 -11
  100. package/dist/prebuilt/iOS-iphoneos/lib/pkgconfig/libwebpmux.pc +0 -12
  101. package/dist/prebuilt/iOS-iphoneos/share/man/man1/cwebp.1 +0 -332
  102. package/dist/prebuilt/iOS-iphoneos/share/man/man1/dwebp.1 +0 -150
  103. package/dist/prebuilt/iOS-iphoneos/share/man/man1/img2webp.1 +0 -117
  104. package/dist/prebuilt/iOS-iphoneos/share/man/man1/webpinfo.1 +0 -80
  105. package/dist/prebuilt/iOS-iphoneos/share/man/man1/webpmux.1 +0 -271
  106. package/dist/prebuilt/iOS-iphonesimulator/include/webp/decode.h +0 -506
  107. package/dist/prebuilt/iOS-iphonesimulator/include/webp/demux.h +0 -367
  108. package/dist/prebuilt/iOS-iphonesimulator/include/webp/encode.h +0 -557
  109. package/dist/prebuilt/iOS-iphonesimulator/include/webp/mux.h +0 -591
  110. package/dist/prebuilt/iOS-iphonesimulator/include/webp/mux_types.h +0 -99
  111. package/dist/prebuilt/iOS-iphonesimulator/include/webp/sharpyuv/sharpyuv.h +0 -172
  112. package/dist/prebuilt/iOS-iphonesimulator/include/webp/sharpyuv/sharpyuv_csp.h +0 -60
  113. package/dist/prebuilt/iOS-iphonesimulator/include/webp/types.h +0 -93
  114. package/dist/prebuilt/iOS-iphonesimulator/lib/libsharpyuv.a +0 -0
  115. package/dist/prebuilt/iOS-iphonesimulator/lib/libsharpyuv.la +0 -41
  116. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebp.a +0 -0
  117. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebp.la +0 -41
  118. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebpdemux.a +0 -0
  119. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebpdemux.la +0 -41
  120. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebpmux.a +0 -0
  121. package/dist/prebuilt/iOS-iphonesimulator/lib/libwebpmux.la +0 -41
  122. package/dist/prebuilt/iOS-iphonesimulator/lib/pkgconfig/libsharpyuv.pc +0 -11
  123. package/dist/prebuilt/iOS-iphonesimulator/lib/pkgconfig/libwebp.pc +0 -12
  124. package/dist/prebuilt/iOS-iphonesimulator/lib/pkgconfig/libwebpdemux.pc +0 -11
  125. package/dist/prebuilt/iOS-iphonesimulator/lib/pkgconfig/libwebpmux.pc +0 -12
  126. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/cwebp.1 +0 -332
  127. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/dwebp.1 +0 -150
  128. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/img2webp.1 +0 -117
  129. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/webpinfo.1 +0 -80
  130. package/dist/prebuilt/iOS-iphonesimulator/share/man/man1/webpmux.1 +0 -271
  131. package/sharpyuv.xcframework/Info.plist +0 -50
  132. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/decode.h +0 -506
  133. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/demux.h +0 -367
  134. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/encode.h +0 -557
  135. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/mux.h +0 -591
  136. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/mux_types.h +0 -99
  137. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/sharpyuv/sharpyuv.h +0 -172
  138. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/sharpyuv/sharpyuv_csp.h +0 -60
  139. package/sharpyuv.xcframework/ios-arm64_arm64e/Headers/webp/types.h +0 -93
  140. package/sharpyuv.xcframework/ios-arm64_arm64e/libsharpyuv.a +0 -0
  141. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/decode.h +0 -506
  142. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/demux.h +0 -367
  143. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/encode.h +0 -557
  144. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/mux.h +0 -591
  145. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/mux_types.h +0 -99
  146. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/sharpyuv/sharpyuv.h +0 -172
  147. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/sharpyuv/sharpyuv_csp.h +0 -60
  148. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/types.h +0 -93
  149. package/sharpyuv.xcframework/ios-arm64_arm64e_x86_64-simulator/libsharpyuv.a +0 -0
  150. package/webp.xcframework/Info.plist +0 -50
  151. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/decode.h +0 -506
  152. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/demux.h +0 -367
  153. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/encode.h +0 -557
  154. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/mux.h +0 -591
  155. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/mux_types.h +0 -99
  156. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/sharpyuv/sharpyuv.h +0 -172
  157. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/sharpyuv/sharpyuv_csp.h +0 -60
  158. package/webp.xcframework/ios-arm64_arm64e/Headers/webp/types.h +0 -93
  159. package/webp.xcframework/ios-arm64_arm64e/libwebp.a +0 -0
  160. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/decode.h +0 -506
  161. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/demux.h +0 -367
  162. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/encode.h +0 -557
  163. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/mux.h +0 -591
  164. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/mux_types.h +0 -99
  165. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/sharpyuv/sharpyuv.h +0 -172
  166. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/sharpyuv/sharpyuv_csp.h +0 -60
  167. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/Headers/webp/types.h +0 -93
  168. package/webp.xcframework/ios-arm64_arm64e_x86_64-simulator/libwebp.a +0 -0
@@ -1,367 +0,0 @@
1
- // Copyright 2012 Google Inc. All Rights Reserved.
2
- //
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
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.
8
- // -----------------------------------------------------------------------------
9
- //
10
- // Demux API.
11
- // Enables extraction of image and extended format data from WebP files.
12
-
13
- // Code Example: Demuxing WebP data to extract all the frames, ICC profile
14
- // and EXIF/XMP metadata.
15
- /*
16
- WebPDemuxer* demux = WebPDemux(&webp_data);
17
-
18
- uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
19
- uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
20
- // ... (Get information about the features present in the WebP file).
21
- uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
22
-
23
- // ... (Iterate over all frames).
24
- WebPIterator iter;
25
- if (WebPDemuxGetFrame(demux, 1, &iter)) {
26
- do {
27
- // ... (Consume 'iter'; e.g. Decode 'iter.fragment' with WebPDecode(),
28
- // ... and get other frame properties like width, height, offsets etc.
29
- // ... see 'struct WebPIterator' below for more info).
30
- } while (WebPDemuxNextFrame(&iter));
31
- WebPDemuxReleaseIterator(&iter);
32
- }
33
-
34
- // ... (Extract metadata).
35
- WebPChunkIterator chunk_iter;
36
- if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter);
37
- // ... (Consume the ICC profile in 'chunk_iter.chunk').
38
- WebPDemuxReleaseChunkIterator(&chunk_iter);
39
- if (flags & EXIF_FLAG) WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter);
40
- // ... (Consume the EXIF metadata in 'chunk_iter.chunk').
41
- WebPDemuxReleaseChunkIterator(&chunk_iter);
42
- if (flags & XMP_FLAG) WebPDemuxGetChunk(demux, "XMP ", 1, &chunk_iter);
43
- // ... (Consume the XMP metadata in 'chunk_iter.chunk').
44
- WebPDemuxReleaseChunkIterator(&chunk_iter);
45
- WebPDemuxDelete(demux);
46
- */
47
-
48
- #ifndef WEBP_WEBP_DEMUX_H_
49
- #define WEBP_WEBP_DEMUX_H_
50
-
51
- #include "./decode.h" // for WEBP_CSP_MODE
52
- #include "./mux_types.h"
53
- #include "./types.h"
54
-
55
- #ifdef __cplusplus
56
- extern "C" {
57
- #endif
58
-
59
- #define WEBP_DEMUX_ABI_VERSION 0x0107 // MAJOR(8b) + MINOR(8b)
60
-
61
- // Note: forward declaring enumerations is not allowed in (strict) C and C++,
62
- // the types are left here for reference.
63
- // typedef enum WebPDemuxState WebPDemuxState;
64
- // typedef enum WebPFormatFeature WebPFormatFeature;
65
- typedef struct WebPDemuxer WebPDemuxer;
66
- typedef struct WebPIterator WebPIterator;
67
- typedef struct WebPChunkIterator WebPChunkIterator;
68
- typedef struct WebPAnimInfo WebPAnimInfo;
69
- typedef struct WebPAnimDecoderOptions WebPAnimDecoderOptions;
70
-
71
- //------------------------------------------------------------------------------
72
-
73
- // Returns the version number of the demux library, packed in hexadecimal using
74
- // 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507.
75
- WEBP_EXTERN int WebPGetDemuxVersion(void);
76
-
77
- //------------------------------------------------------------------------------
78
- // Life of a Demux object
79
-
80
- typedef enum WebPDemuxState {
81
- WEBP_DEMUX_PARSE_ERROR = -1, // An error occurred while parsing.
82
- WEBP_DEMUX_PARSING_HEADER = 0, // Not enough data to parse full header.
83
- WEBP_DEMUX_PARSED_HEADER = 1, // Header parsing complete,
84
- // data may be available.
85
- WEBP_DEMUX_DONE = 2 // Entire file has been parsed.
86
- } WebPDemuxState;
87
-
88
- // Internal, version-checked, entry point
89
- WEBP_NODISCARD WEBP_EXTERN WebPDemuxer* WebPDemuxInternal(
90
- const WebPData*, int, WebPDemuxState*, int);
91
-
92
- // Parses the full WebP file given by 'data'. For single images the WebP file
93
- // header alone or the file header and the chunk header may be absent.
94
- // Returns a WebPDemuxer object on successful parse, NULL otherwise.
95
- WEBP_NODISCARD static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) {
96
- return WebPDemuxInternal(data, 0, NULL, WEBP_DEMUX_ABI_VERSION);
97
- }
98
-
99
- // Parses the possibly incomplete WebP file given by 'data'.
100
- // If 'state' is non-NULL it will be set to indicate the status of the demuxer.
101
- // Returns NULL in case of error or if there isn't enough data to start parsing;
102
- // and a WebPDemuxer object on successful parse.
103
- // Note that WebPDemuxer keeps internal pointers to 'data' memory segment.
104
- // If this data is volatile, the demuxer object should be deleted (by calling
105
- // WebPDemuxDelete()) and WebPDemuxPartial() called again on the new data.
106
- // This is usually an inexpensive operation.
107
- WEBP_NODISCARD static WEBP_INLINE WebPDemuxer* WebPDemuxPartial(
108
- const WebPData* data, WebPDemuxState* state) {
109
- return WebPDemuxInternal(data, 1, state, WEBP_DEMUX_ABI_VERSION);
110
- }
111
-
112
- // Frees memory associated with 'dmux'.
113
- WEBP_EXTERN void WebPDemuxDelete(WebPDemuxer* dmux);
114
-
115
- //------------------------------------------------------------------------------
116
- // Data/information extraction.
117
-
118
- typedef enum WebPFormatFeature {
119
- WEBP_FF_FORMAT_FLAGS, // bit-wise combination of WebPFeatureFlags
120
- // corresponding to the 'VP8X' chunk (if present).
121
- WEBP_FF_CANVAS_WIDTH,
122
- WEBP_FF_CANVAS_HEIGHT,
123
- WEBP_FF_LOOP_COUNT, // only relevant for animated file
124
- WEBP_FF_BACKGROUND_COLOR, // idem.
125
- WEBP_FF_FRAME_COUNT // Number of frames present in the demux object.
126
- // In case of a partial demux, this is the number
127
- // of frames seen so far, with the last frame
128
- // possibly being partial.
129
- } WebPFormatFeature;
130
-
131
- // Get the 'feature' value from the 'dmux'.
132
- // NOTE: values are only valid if WebPDemux() was used or WebPDemuxPartial()
133
- // returned a state > WEBP_DEMUX_PARSING_HEADER.
134
- // If 'feature' is WEBP_FF_FORMAT_FLAGS, the returned value is a bit-wise
135
- // combination of WebPFeatureFlags values.
136
- // If 'feature' is WEBP_FF_LOOP_COUNT, WEBP_FF_BACKGROUND_COLOR, the returned
137
- // value is only meaningful if the bitstream is animated.
138
- WEBP_EXTERN uint32_t WebPDemuxGetI(
139
- const WebPDemuxer* dmux, WebPFormatFeature feature);
140
-
141
- //------------------------------------------------------------------------------
142
- // Frame iteration.
143
-
144
- struct WebPIterator {
145
- int frame_num;
146
- int num_frames; // equivalent to WEBP_FF_FRAME_COUNT.
147
- int x_offset, y_offset; // offset relative to the canvas.
148
- int width, height; // dimensions of this frame.
149
- int duration; // display duration in milliseconds.
150
- WebPMuxAnimDispose dispose_method; // dispose method for the frame.
151
- int complete; // true if 'fragment' contains a full frame. partial images
152
- // may still be decoded with the WebP incremental decoder.
153
- WebPData fragment; // The frame given by 'frame_num'. Note for historical
154
- // reasons this is called a fragment.
155
- int has_alpha; // True if the frame contains transparency.
156
- WebPMuxAnimBlend blend_method; // Blend operation for the frame.
157
-
158
- uint32_t pad[2]; // padding for later use.
159
- void* private_; // for internal use only.
160
- };
161
-
162
- // Retrieves frame 'frame_number' from 'dmux'.
163
- // 'iter->fragment' points to the frame on return from this function.
164
- // Setting 'frame_number' equal to 0 will return the last frame of the image.
165
- // Returns false if 'dmux' is NULL or frame 'frame_number' is not present.
166
- // Call WebPDemuxReleaseIterator() when use of the iterator is complete.
167
- // NOTE: 'dmux' must persist for the lifetime of 'iter'.
168
- WEBP_NODISCARD WEBP_EXTERN int WebPDemuxGetFrame(
169
- const WebPDemuxer* dmux, int frame_number, WebPIterator* iter);
170
-
171
- // Sets 'iter->fragment' to point to the next ('iter->frame_num' + 1) or
172
- // previous ('iter->frame_num' - 1) frame. These functions do not loop.
173
- // Returns true on success, false otherwise.
174
- WEBP_NODISCARD WEBP_EXTERN int WebPDemuxNextFrame(WebPIterator* iter);
175
- WEBP_NODISCARD WEBP_EXTERN int WebPDemuxPrevFrame(WebPIterator* iter);
176
-
177
- // Releases any memory associated with 'iter'.
178
- // Must be called before any subsequent calls to WebPDemuxGetChunk() on the same
179
- // iter. Also, must be called before destroying the associated WebPDemuxer with
180
- // WebPDemuxDelete().
181
- WEBP_EXTERN void WebPDemuxReleaseIterator(WebPIterator* iter);
182
-
183
- //------------------------------------------------------------------------------
184
- // Chunk iteration.
185
-
186
- struct WebPChunkIterator {
187
- // The current and total number of chunks with the fourcc given to
188
- // WebPDemuxGetChunk().
189
- int chunk_num;
190
- int num_chunks;
191
- WebPData chunk; // The payload of the chunk.
192
-
193
- uint32_t pad[6]; // padding for later use
194
- void* private_;
195
- };
196
-
197
- // Retrieves the 'chunk_number' instance of the chunk with id 'fourcc' from
198
- // 'dmux'.
199
- // 'fourcc' is a character array containing the fourcc of the chunk to return,
200
- // e.g., "ICCP", "XMP ", "EXIF", etc.
201
- // Setting 'chunk_number' equal to 0 will return the last chunk in a set.
202
- // Returns true if the chunk is found, false otherwise. Image related chunk
203
- // payloads are accessed through WebPDemuxGetFrame() and related functions.
204
- // Call WebPDemuxReleaseChunkIterator() when use of the iterator is complete.
205
- // NOTE: 'dmux' must persist for the lifetime of the iterator.
206
- WEBP_NODISCARD WEBP_EXTERN int WebPDemuxGetChunk(const WebPDemuxer* dmux,
207
- const char fourcc[4],
208
- int chunk_number,
209
- WebPChunkIterator* iter);
210
-
211
- // Sets 'iter->chunk' to point to the next ('iter->chunk_num' + 1) or previous
212
- // ('iter->chunk_num' - 1) chunk. These functions do not loop.
213
- // Returns true on success, false otherwise.
214
- WEBP_NODISCARD WEBP_EXTERN int WebPDemuxNextChunk(WebPChunkIterator* iter);
215
- WEBP_NODISCARD WEBP_EXTERN int WebPDemuxPrevChunk(WebPChunkIterator* iter);
216
-
217
- // Releases any memory associated with 'iter'.
218
- // Must be called before destroying the associated WebPDemuxer with
219
- // WebPDemuxDelete().
220
- WEBP_EXTERN void WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter);
221
-
222
- //------------------------------------------------------------------------------
223
- // WebPAnimDecoder API
224
- //
225
- // This API allows decoding (possibly) animated WebP images.
226
- //
227
- // Code Example:
228
- /*
229
- WebPAnimDecoderOptions dec_options;
230
- WebPAnimDecoderOptionsInit(&dec_options);
231
- // Tune 'dec_options' as needed.
232
- WebPAnimDecoder* dec = WebPAnimDecoderNew(webp_data, &dec_options);
233
- WebPAnimInfo anim_info;
234
- WebPAnimDecoderGetInfo(dec, &anim_info);
235
- for (uint32_t i = 0; i < anim_info.loop_count; ++i) {
236
- while (WebPAnimDecoderHasMoreFrames(dec)) {
237
- uint8_t* buf;
238
- int timestamp;
239
- WebPAnimDecoderGetNext(dec, &buf, &timestamp);
240
- // ... (Render 'buf' based on 'timestamp').
241
- // ... (Do NOT free 'buf', as it is owned by 'dec').
242
- }
243
- WebPAnimDecoderReset(dec);
244
- }
245
- const WebPDemuxer* demuxer = WebPAnimDecoderGetDemuxer(dec);
246
- // ... (Do something using 'demuxer'; e.g. get EXIF/XMP/ICC data).
247
- WebPAnimDecoderDelete(dec);
248
- */
249
-
250
- typedef struct WebPAnimDecoder WebPAnimDecoder; // Main opaque object.
251
-
252
- // Global options.
253
- struct WebPAnimDecoderOptions {
254
- // Output colorspace. Only the following modes are supported:
255
- // MODE_RGBA, MODE_BGRA, MODE_rgbA and MODE_bgrA.
256
- WEBP_CSP_MODE color_mode;
257
- int use_threads; // If true, use multi-threaded decoding.
258
- uint32_t padding[7]; // Padding for later use.
259
- };
260
-
261
- // Internal, version-checked, entry point.
262
- WEBP_NODISCARD WEBP_EXTERN int WebPAnimDecoderOptionsInitInternal(
263
- WebPAnimDecoderOptions*, int);
264
-
265
- // Should always be called, to initialize a fresh WebPAnimDecoderOptions
266
- // structure before modification. Returns false in case of version mismatch.
267
- // WebPAnimDecoderOptionsInit() must have succeeded before using the
268
- // 'dec_options' object.
269
- WEBP_NODISCARD static WEBP_INLINE int WebPAnimDecoderOptionsInit(
270
- WebPAnimDecoderOptions* dec_options) {
271
- return WebPAnimDecoderOptionsInitInternal(dec_options,
272
- WEBP_DEMUX_ABI_VERSION);
273
- }
274
-
275
- // Internal, version-checked, entry point.
276
- WEBP_NODISCARD WEBP_EXTERN WebPAnimDecoder* WebPAnimDecoderNewInternal(
277
- const WebPData*, const WebPAnimDecoderOptions*, int);
278
-
279
- // Creates and initializes a WebPAnimDecoder object.
280
- // Parameters:
281
- // webp_data - (in) WebP bitstream. This should remain unchanged during the
282
- // lifetime of the output WebPAnimDecoder object.
283
- // dec_options - (in) decoding options. Can be passed NULL to choose
284
- // reasonable defaults (in particular, color mode MODE_RGBA
285
- // will be picked).
286
- // Returns:
287
- // A pointer to the newly created WebPAnimDecoder object, or NULL in case of
288
- // parsing error, invalid option or memory error.
289
- WEBP_NODISCARD static WEBP_INLINE WebPAnimDecoder* WebPAnimDecoderNew(
290
- const WebPData* webp_data, const WebPAnimDecoderOptions* dec_options) {
291
- return WebPAnimDecoderNewInternal(webp_data, dec_options,
292
- WEBP_DEMUX_ABI_VERSION);
293
- }
294
-
295
- // Global information about the animation..
296
- struct WebPAnimInfo {
297
- uint32_t canvas_width;
298
- uint32_t canvas_height;
299
- uint32_t loop_count;
300
- uint32_t bgcolor;
301
- uint32_t frame_count;
302
- uint32_t pad[4]; // padding for later use
303
- };
304
-
305
- // Get global information about the animation.
306
- // Parameters:
307
- // dec - (in) decoder instance to get information from.
308
- // info - (out) global information fetched from the animation.
309
- // Returns:
310
- // True on success.
311
- WEBP_NODISCARD WEBP_EXTERN int WebPAnimDecoderGetInfo(
312
- const WebPAnimDecoder* dec, WebPAnimInfo* info);
313
-
314
- // Fetch the next frame from 'dec' based on options supplied to
315
- // WebPAnimDecoderNew(). This will be a fully reconstructed canvas of size
316
- // 'canvas_width * 4 * canvas_height', and not just the frame sub-rectangle. The
317
- // returned buffer 'buf' is valid only until the next call to
318
- // WebPAnimDecoderGetNext(), WebPAnimDecoderReset() or WebPAnimDecoderDelete().
319
- // Parameters:
320
- // dec - (in/out) decoder instance from which the next frame is to be fetched.
321
- // buf - (out) decoded frame.
322
- // timestamp - (out) timestamp of the frame in milliseconds.
323
- // Returns:
324
- // False if any of the arguments are NULL, or if there is a parsing or
325
- // decoding error, or if there are no more frames. Otherwise, returns true.
326
- WEBP_NODISCARD WEBP_EXTERN int WebPAnimDecoderGetNext(WebPAnimDecoder* dec,
327
- uint8_t** buf,
328
- int* timestamp);
329
-
330
- // Check if there are more frames left to decode.
331
- // Parameters:
332
- // dec - (in) decoder instance to be checked.
333
- // Returns:
334
- // True if 'dec' is not NULL and some frames are yet to be decoded.
335
- // Otherwise, returns false.
336
- WEBP_NODISCARD WEBP_EXTERN int WebPAnimDecoderHasMoreFrames(
337
- const WebPAnimDecoder* dec);
338
-
339
- // Resets the WebPAnimDecoder object, so that next call to
340
- // WebPAnimDecoderGetNext() will restart decoding from 1st frame. This would be
341
- // helpful when all frames need to be decoded multiple times (e.g.
342
- // info.loop_count times) without destroying and recreating the 'dec' object.
343
- // Parameters:
344
- // dec - (in/out) decoder instance to be reset
345
- WEBP_EXTERN void WebPAnimDecoderReset(WebPAnimDecoder* dec);
346
-
347
- // Grab the internal demuxer object.
348
- // Getting the demuxer object can be useful if one wants to use operations only
349
- // available through demuxer; e.g. to get XMP/EXIF/ICC metadata. The returned
350
- // demuxer object is owned by 'dec' and is valid only until the next call to
351
- // WebPAnimDecoderDelete().
352
- //
353
- // Parameters:
354
- // dec - (in) decoder instance from which the demuxer object is to be fetched.
355
- WEBP_NODISCARD WEBP_EXTERN const WebPDemuxer* WebPAnimDecoderGetDemuxer(
356
- const WebPAnimDecoder* dec);
357
-
358
- // Deletes the WebPAnimDecoder object.
359
- // Parameters:
360
- // dec - (in/out) decoder instance to be deleted
361
- WEBP_EXTERN void WebPAnimDecoderDelete(WebPAnimDecoder* dec);
362
-
363
- #ifdef __cplusplus
364
- } // extern "C"
365
- #endif
366
-
367
- #endif // WEBP_WEBP_DEMUX_H_