metadata.h 1.3 KB

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