xref: /aosp_15_r20/external/webp/imageio/metadata.h (revision b2055c353e87c8814eb2b6b1b11112a1562253bd)
1*b2055c35SXin Li // Copyright 2012 Google Inc. All Rights Reserved.
2*b2055c35SXin Li //
3*b2055c35SXin Li // Use of this source code is governed by a BSD-style license
4*b2055c35SXin Li // that can be found in the COPYING file in the root of the source
5*b2055c35SXin Li // tree. An additional intellectual property rights grant can be found
6*b2055c35SXin Li // in the file PATENTS. All contributing project authors may
7*b2055c35SXin Li // be found in the AUTHORS file in the root of the source tree.
8*b2055c35SXin Li // -----------------------------------------------------------------------------
9*b2055c35SXin Li //
10*b2055c35SXin Li //  Metadata types and functions.
11*b2055c35SXin Li //
12*b2055c35SXin Li 
13*b2055c35SXin Li #ifndef WEBP_IMAGEIO_METADATA_H_
14*b2055c35SXin Li #define WEBP_IMAGEIO_METADATA_H_
15*b2055c35SXin Li 
16*b2055c35SXin Li #include "webp/types.h"
17*b2055c35SXin Li 
18*b2055c35SXin Li #ifdef __cplusplus
19*b2055c35SXin Li extern "C" {
20*b2055c35SXin Li #endif
21*b2055c35SXin Li 
22*b2055c35SXin Li typedef struct MetadataPayload {
23*b2055c35SXin Li   uint8_t* bytes;
24*b2055c35SXin Li   size_t size;
25*b2055c35SXin Li } MetadataPayload;
26*b2055c35SXin Li 
27*b2055c35SXin Li typedef struct Metadata {
28*b2055c35SXin Li   MetadataPayload exif;
29*b2055c35SXin Li   MetadataPayload iccp;
30*b2055c35SXin Li   MetadataPayload xmp;
31*b2055c35SXin Li } Metadata;
32*b2055c35SXin Li 
33*b2055c35SXin Li #define METADATA_OFFSET(x) offsetof(Metadata, x)
34*b2055c35SXin Li 
35*b2055c35SXin Li void MetadataInit(Metadata* const metadata);
36*b2055c35SXin Li void MetadataPayloadDelete(MetadataPayload* const payload);
37*b2055c35SXin Li void MetadataFree(Metadata* const metadata);
38*b2055c35SXin Li 
39*b2055c35SXin Li // Stores 'metadata' to 'payload->bytes', returns false on allocation error.
40*b2055c35SXin Li int MetadataCopy(const char* metadata, size_t metadata_len,
41*b2055c35SXin Li                  MetadataPayload* const payload);
42*b2055c35SXin Li 
43*b2055c35SXin Li #ifdef __cplusplus
44*b2055c35SXin Li }    // extern "C"
45*b2055c35SXin Li #endif
46*b2055c35SXin Li 
47*b2055c35SXin Li #endif  // WEBP_IMAGEIO_METADATA_H_
48