metadata.h (1321B)
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 // Metadata types and functions. 11 // 12 13 #ifndef WEBP_IMAGEIO_METADATA_H_ 14 #define WEBP_IMAGEIO_METADATA_H_ 15 16 #include <stddef.h> 17 18 #include "webp/types.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 typedef struct MetadataPayload { 25 uint8_t* bytes; 26 size_t size; 27 } MetadataPayload; 28 29 typedef struct Metadata { 30 MetadataPayload exif; 31 MetadataPayload iccp; 32 MetadataPayload xmp; 33 } Metadata; 34 35 #define METADATA_OFFSET(x) offsetof(Metadata, x) 36 37 void MetadataInit(Metadata* const metadata); 38 void MetadataPayloadDelete(MetadataPayload* const payload); 39 void MetadataFree(Metadata* const metadata); 40 41 // Stores 'metadata' to 'payload->bytes', returns false on allocation error. 42 int MetadataCopy(const char* metadata, size_t metadata_len, 43 MetadataPayload* const payload); 44 45 #ifdef __cplusplus 46 } // extern "C" 47 #endif 48 49 #endif // WEBP_IMAGEIO_METADATA_H_