github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/image/webp/libwebp/examples/metadata.h (about)

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