Change metadata type from uint8_t to uint32_t. The metadata_type syntax element in the bitstream is of the type leb128(), which can be from 0 to 1^32 - 1. It would be good to declare the metadata type field or function parameter as uint32_t to be future-proof. Also declare the "uint8_t *data" parameter of aom_img_add_metadata() and aom_img_metadata_alloc() as const. BUG=aomedia:2507 Change-Id: If00379639119788da04bfc9cd56a3980314db742
diff --git a/aom/aom_image.h b/aom/aom_image.h index d07d485..7f6c916 100644 --- a/aom/aom_image.h +++ b/aom/aom_image.h
@@ -142,7 +142,7 @@ /*!\brief Metadata payload. */ typedef struct aom_metadata { - uint8_t type; /**< Metadata type */ + uint32_t type; /**< Metadata type */ uint8_t *payload; /**< Metadata payload data */ size_t sz; /**< Metadata payload size */ } aom_metadata_t; @@ -347,7 +347,7 @@ * \param[in] data Metadata contents * \param[in] sz Metadata contents size */ -int aom_img_add_metadata(aom_image_t *img, uint8_t type, uint8_t *data, +int aom_img_add_metadata(aom_image_t *img, uint32_t type, const uint8_t *data, size_t sz); /*!\brief Remove metadata from image. @@ -373,7 +373,8 @@ * \param[in] data Metadata data pointer * \param[in] sz Metadata size */ -aom_metadata_t *aom_img_metadata_alloc(uint8_t type, uint8_t *data, size_t sz); +aom_metadata_t *aom_img_metadata_alloc(uint32_t type, const uint8_t *data, + size_t sz); /*!\brief Free metadata struct. *
diff --git a/aom/src/aom_image.c b/aom/src/aom_image.c index 9f7ed99..2148253 100644 --- a/aom/src/aom_image.c +++ b/aom/src/aom_image.c
@@ -288,7 +288,8 @@ return img->d_h; } -aom_metadata_t *aom_img_metadata_alloc(uint8_t type, uint8_t *data, size_t sz) { +aom_metadata_t *aom_img_metadata_alloc(uint32_t type, const uint8_t *data, + size_t sz) { aom_metadata_t *metadata = (aom_metadata_t *)calloc(1, sizeof(aom_metadata_t)); if (!metadata) return NULL; @@ -345,7 +346,7 @@ return deleted_metadatas; } -int aom_img_add_metadata(aom_image_t *img, uint8_t type, uint8_t *data, +int aom_img_add_metadata(aom_image_t *img, uint32_t type, const uint8_t *data, size_t sz) { if (!img) return -1; if (!img->metadata) {