mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-14 21:09:55 +02:00
Chunk fourCCs for XMP/EXIF
Use separate fourCCs "XMP " and "EXIF" instead of a common "META" Also, some refactorization in webpmux.c Change-Id: Iad3337e5c1b81e785c60670ce28b1f536dd7ee31
This commit is contained in:
@ -70,12 +70,14 @@ typedef enum {
|
||||
#define FRGM_CHUNK_SIZE 6 // Size of a FRGM chunk.
|
||||
#define VP8X_CHUNK_SIZE 10 // Size of a VP8X chunk.
|
||||
|
||||
#define TILING_FLAG_BIT 0x01 // Set if tiles are possibly used.
|
||||
#define ANIMATION_FLAG_BIT 0x02 // Set if some animation is expected
|
||||
#define ICC_FLAG_BIT 0x04 // Whether ICC is present or not.
|
||||
#define METADATA_FLAG_BIT 0x08 // Set if some META chunk is possibly present.
|
||||
#define ALPHA_FLAG_BIT 0x10 // Should be same as the ALPHA_FLAG in mux.h
|
||||
#define ROTATION_FLAG_BITS 0xe0 // all 3 bits for rotation + symmetry
|
||||
// VP8X Feature Flags. These should be the same as the corresponding values in
|
||||
// the 'WebPFeatureFlags' enum defined in mux.h.
|
||||
#define FRAGMENTS_FLAG_BIT 0x01
|
||||
#define ANIMATION_FLAG_BIT 0x02
|
||||
#define XMP_FLAG_BIT 0x04
|
||||
#define EXIF_FLAG_BIT 0x08
|
||||
#define ALPHA_FLAG_BIT 0x10
|
||||
#define ICC_FLAG_BIT 0x20
|
||||
|
||||
#define MAX_CANVAS_SIZE (1 << 24) // 24-bit max for VP8X width/height.
|
||||
#define MAX_IMAGE_AREA (1ULL << 32) // 32-bit max for width x height.
|
||||
|
@ -11,7 +11,7 @@
|
||||
// Vikas (vikasa@google.com)
|
||||
|
||||
// This API allows manipulation of WebP container images containing features
|
||||
// like Color profile, XMP metadata, Animation and Tiling.
|
||||
// like color profile, metadata, animation and tiling.
|
||||
//
|
||||
// Code Example#1: Creating a MUX with image data, color profile and XMP
|
||||
// metadata.
|
||||
@ -23,7 +23,7 @@
|
||||
// // ... (Prepare ICCP color profile data).
|
||||
// WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data);
|
||||
// // ... (Prepare XMP metadata).
|
||||
// WebPMuxSetChunk(mux, "META", &xmp, copy_data);
|
||||
// WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data);
|
||||
// // Get data from mux in WebP RIFF format.
|
||||
// WebPMuxAssemble(mux, &output_data);
|
||||
// WebPMuxDelete(mux);
|
||||
@ -84,9 +84,10 @@ enum WebPMuxError {
|
||||
enum WebPFeatureFlags {
|
||||
TILE_FLAG = 0x00000001,
|
||||
ANIMATION_FLAG = 0x00000002,
|
||||
ICCP_FLAG = 0x00000004,
|
||||
META_FLAG = 0x00000008,
|
||||
ALPHA_FLAG = 0x00000010
|
||||
XMP_FLAG = 0x00000004,
|
||||
EXIF_FLAG = 0x00000008,
|
||||
ALPHA_FLAG = 0x00000010,
|
||||
ICCP_FLAG = 0x00000020
|
||||
};
|
||||
|
||||
// IDs for different types of chunks.
|
||||
@ -98,7 +99,8 @@ enum WebPChunkId {
|
||||
WEBP_CHUNK_FRGM, // FRGM
|
||||
WEBP_CHUNK_ALPHA, // ALPH
|
||||
WEBP_CHUNK_IMAGE, // VP8/VP8L
|
||||
WEBP_CHUNK_META, // META
|
||||
WEBP_CHUNK_EXIF, // EXIF
|
||||
WEBP_CHUNK_XMP, // XMP
|
||||
WEBP_CHUNK_UNKNOWN, // Other chunks.
|
||||
WEBP_CHUNK_NIL
|
||||
};
|
||||
@ -174,7 +176,7 @@ static WEBP_INLINE WebPMux* WebPMuxCreate(const WebPData* bitstream,
|
||||
// Parameters:
|
||||
// mux - (in/out) object to which the chunk is to be added
|
||||
// fourcc - (in) a character array containing the fourcc of the given chunk;
|
||||
// e.g., "ICCP", "META" etc.
|
||||
// e.g., "ICCP", "XMP ", "EXIF" etc.
|
||||
// chunk_data - (in) the chunk data to be added
|
||||
// copy_data - (in) value 1 indicates given data WILL be copied to the mux
|
||||
// and value 0 indicates data will NOT be copied.
|
||||
@ -192,7 +194,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetChunk(
|
||||
// Parameters:
|
||||
// mux - (in) object from which the chunk data is to be fetched
|
||||
// fourcc - (in) a character array containing the fourcc of the chunk;
|
||||
// e.g., "ICCP", "META" etc.
|
||||
// e.g., "ICCP", "XMP ", "EXIF" etc.
|
||||
// chunk_data - (out) returned chunk data
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux, fourcc or chunk_data is NULL
|
||||
@ -206,7 +208,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetChunk(
|
||||
// Parameters:
|
||||
// mux - (in/out) object from which the chunk is to be deleted
|
||||
// fourcc - (in) a character array containing the fourcc of the chunk;
|
||||
// e.g., "ICCP", "META" etc.
|
||||
// e.g., "ICCP", "XMP ", "EXIF" etc.
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux or fourcc is NULL
|
||||
// or if fourcc corresponds to an image chunk.
|
||||
@ -481,7 +483,7 @@ struct WebPChunkIterator {
|
||||
// Retrieves the 'chunk_number' instance of the chunk with id 'fourcc' from
|
||||
// 'dmux'.
|
||||
// 'fourcc' is a character array containing the fourcc of the chunk to return,
|
||||
// e.g., "ICCP", "META", "EXIF", etc.
|
||||
// e.g., "ICCP", "XMP ", "EXIF", etc.
|
||||
// Setting 'chunk_number' equal to 0 will return the last chunk in a set.
|
||||
// Returns true if the chunk is found, false otherwise. Image related chunk
|
||||
// payloads are accessed through WebPDemuxGetFrame() and related functions.
|
||||
|
Reference in New Issue
Block a user