libheif
|
#include "libheif/heif.h"
Go to the source code of this file.
Macros | |
#define | heif_item_type_mime heif_fourcc('m','i','m','e') |
#define | heif_item_type_uri heif_fourcc('u','r','i',' ') |
Functions | |
LIBHEIF_API int | heif_context_get_number_of_items (const struct heif_context *ctx) |
Gets the number of items. | |
LIBHEIF_API int | heif_context_get_list_of_item_IDs (const struct heif_context *ctx, heif_item_id *ID_array, int count) |
Get the item identifiers. | |
LIBHEIF_API uint32_t | heif_item_get_item_type (const struct heif_context *ctx, heif_item_id item_id) |
Gets the item type. | |
LIBHEIF_API int | heif_item_is_item_hidden (const struct heif_context *ctx, heif_item_id item_id) |
LIBHEIF_API const char * | heif_item_get_mime_item_content_type (const struct heif_context *ctx, heif_item_id item_id) |
Gets the MIME content_type for an item. | |
LIBHEIF_API const char * | heif_item_get_mime_item_content_encoding (const struct heif_context *ctx, heif_item_id item_id) |
Gets the content_encoding for a MIME item. | |
LIBHEIF_API const char * | heif_item_get_uri_item_uri_type (const struct heif_context *ctx, heif_item_id item_id) |
Gets the item_uri_type for an item. | |
LIBHEIF_API const char * | heif_item_get_item_name (const struct heif_context *ctx, heif_item_id item_id) |
LIBHEIF_API struct heif_error | heif_item_set_item_name (struct heif_context *ctx, heif_item_id item, const char *item_name) |
LIBHEIF_API struct heif_error | heif_item_get_item_data (const struct heif_context *ctx, heif_item_id item_id, enum heif_metadata_compression *out_compression_format, uint8_t **out_data, size_t *out_data_size) |
Gets the raw metadata, as stored in the HEIF file. | |
LIBHEIF_API void | heif_release_item_data (const struct heif_context *ctx, uint8_t **item_data) |
Free the item data. | |
LIBHEIF_API size_t | heif_context_get_item_references (const struct heif_context *ctx, heif_item_id from_item_id, int index, uint32_t *out_reference_type_4cc, heif_item_id **out_references_to) |
Get the item ids that reference the given item. | |
LIBHEIF_API void | heif_release_item_references (const struct heif_context *ctx, heif_item_id **references) |
LIBHEIF_API struct heif_error | heif_context_add_item_reference (struct heif_context *ctx, uint32_t reference_type, heif_item_id from_item, heif_item_id to_item) |
LIBHEIF_API struct heif_error | heif_context_add_item_references (struct heif_context *ctx, uint32_t reference_type, heif_item_id from_item, const heif_item_id *to_item, int num_to_items) |
LIBHEIF_API struct heif_error | heif_context_add_item (struct heif_context *ctx, const char *item_type, const void *data, int size, heif_item_id *out_item_id) |
LIBHEIF_API struct heif_error | heif_context_add_mime_item (struct heif_context *ctx, const char *content_type, enum heif_metadata_compression content_encoding, const void *data, int size, heif_item_id *out_item_id) |
LIBHEIF_API struct heif_error | heif_context_add_precompressed_mime_item (struct heif_context *ctx, const char *content_type, const char *content_encoding, const void *data, int size, heif_item_id *out_item_id) |
LIBHEIF_API struct heif_error | heif_context_add_uri_item (struct heif_context *ctx, const char *item_uri_type, const void *data, int size, heif_item_id *out_item_id) |
#define heif_item_type_mime heif_fourcc('m','i','m','e') |
#define heif_item_type_uri heif_fourcc('u','r','i',' ') |
LIBHEIF_API struct heif_error heif_context_add_item | ( | struct heif_context * | ctx, |
const char * | item_type, | ||
const void * | data, | ||
int | size, | ||
heif_item_id * | out_item_id ) |
LIBHEIF_API struct heif_error heif_context_add_item_reference | ( | struct heif_context * | ctx, |
uint32_t | reference_type, | ||
heif_item_id | from_item, | ||
heif_item_id | to_item ) |
LIBHEIF_API struct heif_error heif_context_add_item_references | ( | struct heif_context * | ctx, |
uint32_t | reference_type, | ||
heif_item_id | from_item, | ||
const heif_item_id * | to_item, | ||
int | num_to_items ) |
LIBHEIF_API struct heif_error heif_context_add_mime_item | ( | struct heif_context * | ctx, |
const char * | content_type, | ||
enum heif_metadata_compression | content_encoding, | ||
const void * | data, | ||
int | size, | ||
heif_item_id * | out_item_id ) |
LIBHEIF_API struct heif_error heif_context_add_precompressed_mime_item | ( | struct heif_context * | ctx, |
const char * | content_type, | ||
const char * | content_encoding, | ||
const void * | data, | ||
int | size, | ||
heif_item_id * | out_item_id ) |
LIBHEIF_API struct heif_error heif_context_add_uri_item | ( | struct heif_context * | ctx, |
const char * | item_uri_type, | ||
const void * | data, | ||
int | size, | ||
heif_item_id * | out_item_id ) |
LIBHEIF_API size_t heif_context_get_item_references | ( | const struct heif_context * | ctx, |
heif_item_id | from_item_id, | ||
int | index, | ||
uint32_t * | out_reference_type_4cc, | ||
heif_item_id ** | out_references_to ) |
Get the item ids that reference the given item.
ctx | the file context. |
from_item_id | the item identifier for the item. |
index | the index of the reference to get. |
out_reference_type_4cc | The 4cc of the reference. (e.g dimg, thmb, cdsc, or auxl) |
out_references_to | the item references. Use heif_release_item_references to free the memory. |
LIBHEIF_API int heif_context_get_list_of_item_IDs | ( | const struct heif_context * | ctx, |
heif_item_id * | ID_array, | ||
int | count ) |
Get the item identifiers.
Fills in the item IDs into the user-supplied array ID_array
, preallocated with count
entries.
ctx | the file context |
ID_array | the output array. |
count | the number of items allocated within ID_array . |
count
. LIBHEIF_API int heif_context_get_number_of_items | ( | const struct heif_context * | ctx | ) |
Gets the number of items.
This is not the same as the number of images, since there can be other types of items, such as metadata.
ctx | the file context |
LIBHEIF_API struct heif_error heif_item_get_item_data | ( | const struct heif_context * | ctx, |
heif_item_id | item_id, | ||
enum heif_metadata_compression * | out_compression_format, | ||
uint8_t ** | out_data, | ||
size_t * | out_data_size ) |
Gets the raw metadata, as stored in the HEIF file.
Data in a "mime" item with "content_encoding" can be compressed. When out_compression_format
is NULL, the decompressed data will be returned. Otherwise, the compressed data is returned and out_compression_format
will be filled with the compression format. If the compression method is not supported, an error will be returned.
It is valid to set out_data
to NULL. In that case, only the out_data_size
is filled. Note that it is inefficient to use out_data=NULL
just to get the size of compressed data. In general, this should be avoided.
If there is no data assigned to the item or there is an error, out_data_size
is set to zero.
ctx | the file context |
item_id | the item identifier for the item |
out_compression_format | how the data is compressed. If the pointer is NULL, the decompressed data will be returned. |
out_data | the corresponding raw metadata |
out_data_size | the size of the metadata in bytes |
LIBHEIF_API const char * heif_item_get_item_name | ( | const struct heif_context * | ctx, |
heif_item_id | item_id ) |
LIBHEIF_API uint32_t heif_item_get_item_type | ( | const struct heif_context * | ctx, |
heif_item_id | item_id ) |
Gets the item type.
Usually, this is a four character code (e.g. mime
or uri
), but it can theoretically be any 4-byte number. Thus, the type is returned as an integer. You can use heif_fourcc
to map between the two representations.
ctx | the file context |
item_id | the item identifier for the item |
LIBHEIF_API const char * heif_item_get_mime_item_content_encoding | ( | const struct heif_context * | ctx, |
heif_item_id | item_id ) |
Gets the content_encoding for a MIME item.
Only valid if the item type is mime
. If the item does not exist, or if it is not a mime
item, NULL is returned.
If the item is not encoded, the returned value will be an empty string (not null).
ctx | the file context |
item_id | the item identifier for the item |
LIBHEIF_API const char * heif_item_get_mime_item_content_type | ( | const struct heif_context * | ctx, |
heif_item_id | item_id ) |
Gets the MIME content_type for an item.
Only valid if the item type is mime
. If the item does not exist, or if it is not a mime
item, NULL is returned.
ctx | the file context |
item_id | the item identifier for the item |
LIBHEIF_API const char * heif_item_get_uri_item_uri_type | ( | const struct heif_context * | ctx, |
heif_item_id | item_id ) |
Gets the item_uri_type for an item.
Only valid if the item type is uri
. If the item does not exist, or if it is not a uri
item, NULL is returned.
ctx | the file context |
item_id | the item identifier for the item |
LIBHEIF_API int heif_item_is_item_hidden | ( | const struct heif_context * | ctx, |
heif_item_id | item_id ) |
LIBHEIF_API struct heif_error heif_item_set_item_name | ( | struct heif_context * | ctx, |
heif_item_id | item, | ||
const char * | item_name ) |
LIBHEIF_API void heif_release_item_data | ( | const struct heif_context * | ctx, |
uint8_t ** | item_data ) |
Free the item data.
This is used to free memory associated with the data returned by heif_item_get_item_data
in 'out_data' and set the pointer to NULL.
ctx | the file context |
item_data | the data to free |
LIBHEIF_API void heif_release_item_references | ( | const struct heif_context * | ctx, |
heif_item_id ** | references ) |