pylibheif 1.21.2__cp313-cp313-macosx_14_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- include/libheif/heif.h +41 -0
- include/libheif/heif_aux_images.h +182 -0
- include/libheif/heif_brands.h +376 -0
- include/libheif/heif_color.h +363 -0
- include/libheif/heif_context.h +329 -0
- include/libheif/heif_cxx.h +1390 -0
- include/libheif/heif_decoding.h +172 -0
- include/libheif/heif_encoding.h +395 -0
- include/libheif/heif_entity_groups.h +60 -0
- include/libheif/heif_error.h +304 -0
- include/libheif/heif_image.h +355 -0
- include/libheif/heif_image_handle.h +129 -0
- include/libheif/heif_items.h +260 -0
- include/libheif/heif_library.h +219 -0
- include/libheif/heif_metadata.h +136 -0
- include/libheif/heif_plugin.h +378 -0
- include/libheif/heif_properties.h +235 -0
- include/libheif/heif_regions.h +868 -0
- include/libheif/heif_security.h +107 -0
- include/libheif/heif_sequences.h +644 -0
- include/libheif/heif_tai_timestamps.h +202 -0
- include/libheif/heif_text.h +161 -0
- include/libheif/heif_tiling.h +137 -0
- include/libheif/heif_uncompressed.h +109 -0
- include/libheif/heif_version.h +38 -0
- lib/cmake/libheif/libheif-config-release.cmake +19 -0
- lib/cmake/libheif/libheif-config-version.cmake +83 -0
- lib/cmake/libheif/libheif-config.cmake +108 -0
- lib/libheif.a +0 -0
- lib/pkgconfig/libheif.pc +15 -0
- pylibheif-1.21.2.dist-info/METADATA +409 -0
- pylibheif-1.21.2.dist-info/RECORD +41 -0
- pylibheif-1.21.2.dist-info/WHEEL +5 -0
- pylibheif-1.21.2.dist-info/licenses/LICENSE +165 -0
- pylibheif.cpython-313-darwin.so +0 -0
- pylibheif.dylibs/libaom.3.13.1.dylib +0 -0
- pylibheif.dylibs/libdav1d.7.dylib +0 -0
- pylibheif.dylibs/libde265.0.dylib +0 -0
- pylibheif.dylibs/libopenjp2.2.5.4.dylib +0 -0
- pylibheif.dylibs/libvmaf.3.dylib +0 -0
- pylibheif.dylibs/libx265.215.dylib +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017-2025 Dirk Farin <dirk.farin@gmail.com>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of libheif.
|
|
6
|
+
*
|
|
7
|
+
* libheif is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of
|
|
10
|
+
* the License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* libheif is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef LIBHEIF_HEIF_IMAGE_HANDLE_H
|
|
22
|
+
#define LIBHEIF_HEIF_IMAGE_HANDLE_H
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#include <stddef.h>
|
|
29
|
+
#include <stdint.h>
|
|
30
|
+
|
|
31
|
+
#include <libheif/heif_library.h>
|
|
32
|
+
#include <libheif/heif_image.h>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// ========================= heif_image_handle =========================
|
|
36
|
+
|
|
37
|
+
// An heif_image_handle is a handle to a logical image in the HEIF file.
|
|
38
|
+
// To get the actual pixel data, you have to decode the handle to an heif_image.
|
|
39
|
+
// An heif_image_handle also gives you access to the thumbnails and Exif data
|
|
40
|
+
// associated with an image.
|
|
41
|
+
|
|
42
|
+
// Once you obtained an heif_image_handle, you can already release the heif_context,
|
|
43
|
+
// since it is internally ref-counted.
|
|
44
|
+
|
|
45
|
+
// Release image handle.
|
|
46
|
+
LIBHEIF_API
|
|
47
|
+
void heif_image_handle_release(const heif_image_handle*);
|
|
48
|
+
|
|
49
|
+
// Check whether the given image_handle is the primary image of the file.
|
|
50
|
+
LIBHEIF_API
|
|
51
|
+
int heif_image_handle_is_primary_image(const heif_image_handle* handle);
|
|
52
|
+
|
|
53
|
+
LIBHEIF_API
|
|
54
|
+
heif_item_id heif_image_handle_get_item_id(const heif_image_handle* handle);
|
|
55
|
+
|
|
56
|
+
/** Get the image width.
|
|
57
|
+
*
|
|
58
|
+
* If 'handle' is invalid (NULL) or if the image size exceeds the range of `int`, 0 is returned.
|
|
59
|
+
*/
|
|
60
|
+
LIBHEIF_API
|
|
61
|
+
int heif_image_handle_get_width(const heif_image_handle* handle);
|
|
62
|
+
|
|
63
|
+
/** Get the image height.
|
|
64
|
+
*
|
|
65
|
+
* If 'handle' is invalid (NULL) or if the image size exceeds the range of `int`, 0 is returned.
|
|
66
|
+
*/
|
|
67
|
+
LIBHEIF_API
|
|
68
|
+
int heif_image_handle_get_height(const heif_image_handle* handle);
|
|
69
|
+
|
|
70
|
+
LIBHEIF_API
|
|
71
|
+
int heif_image_handle_has_alpha_channel(const heif_image_handle*);
|
|
72
|
+
|
|
73
|
+
LIBHEIF_API
|
|
74
|
+
int heif_image_handle_is_premultiplied_alpha(const heif_image_handle*);
|
|
75
|
+
|
|
76
|
+
// Returns -1 on error, e.g. if this information is not present in the image.
|
|
77
|
+
// Only defined for images coded in the YCbCr or monochrome colorspace.
|
|
78
|
+
LIBHEIF_API
|
|
79
|
+
int heif_image_handle_get_luma_bits_per_pixel(const heif_image_handle*);
|
|
80
|
+
|
|
81
|
+
// Returns -1 on error, e.g. if this information is not present in the image.
|
|
82
|
+
// Only defined for images coded in the YCbCr colorspace.
|
|
83
|
+
LIBHEIF_API
|
|
84
|
+
int heif_image_handle_get_chroma_bits_per_pixel(const heif_image_handle*);
|
|
85
|
+
|
|
86
|
+
// Return the colorspace that libheif proposes to use for decoding.
|
|
87
|
+
// Usually, these will be either YCbCr or Monochrome, but it may also propose RGB for images
|
|
88
|
+
// encoded with matrix_coefficients=0 or for images coded natively in RGB.
|
|
89
|
+
// It may also return *_undefined if the file misses relevant information to determine this without decoding.
|
|
90
|
+
// These are only proposed values that avoid colorspace conversions as much as possible.
|
|
91
|
+
// You can still request the output in your preferred colorspace, but this may involve an internal conversion.
|
|
92
|
+
LIBHEIF_API
|
|
93
|
+
heif_error heif_image_handle_get_preferred_decoding_colorspace(const heif_image_handle* image_handle,
|
|
94
|
+
enum heif_colorspace* out_colorspace,
|
|
95
|
+
enum heif_chroma* out_chroma);
|
|
96
|
+
|
|
97
|
+
// Get the image width from the 'ispe' box. This is the original image size without
|
|
98
|
+
// any transformations applied to it. Do not use this unless you know exactly what
|
|
99
|
+
// you are doing.
|
|
100
|
+
LIBHEIF_API
|
|
101
|
+
int heif_image_handle_get_ispe_width(const heif_image_handle* handle);
|
|
102
|
+
|
|
103
|
+
LIBHEIF_API
|
|
104
|
+
int heif_image_handle_get_ispe_height(const heif_image_handle* handle);
|
|
105
|
+
|
|
106
|
+
// Returns whether the image has 'pixel aspect ratio information' information. If 0 is returned, the output is filled with the 1:1 default.
|
|
107
|
+
LIBHEIF_API
|
|
108
|
+
int heif_image_handle_get_pixel_aspect_ratio(const heif_image_handle*, uint32_t* aspect_h, uint32_t* aspect_v);
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// This gets the context associated with the image handle.
|
|
112
|
+
// Note that you have to release the returned context with heif_context_free() in any case.
|
|
113
|
+
//
|
|
114
|
+
// This means: when you have several image-handles that originate from the same file and you get the
|
|
115
|
+
// context of each of them, the returned pointer may be different even though it refers to the same
|
|
116
|
+
// logical context. You have to call heif_context_free() on all those context pointers.
|
|
117
|
+
// After you freed a context pointer, you can still use the context through a different pointer that you
|
|
118
|
+
// might have acquired from elsewhere.
|
|
119
|
+
LIBHEIF_API
|
|
120
|
+
heif_context* heif_image_handle_get_context(const heif_image_handle* handle);
|
|
121
|
+
|
|
122
|
+
LIBHEIF_API
|
|
123
|
+
const char* heif_image_handle_get_gimi_content_id(const heif_image_handle* handle);
|
|
124
|
+
|
|
125
|
+
#ifdef __cplusplus
|
|
126
|
+
}
|
|
127
|
+
#endif
|
|
128
|
+
|
|
129
|
+
#endif
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2023 Dirk Farin <dirk.farin@gmail.com>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of libheif.
|
|
6
|
+
*
|
|
7
|
+
* libheif is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of
|
|
10
|
+
* the License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* libheif is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef LIBHEIF_HEIF_ITEMS_H
|
|
22
|
+
#define LIBHEIF_HEIF_ITEMS_H
|
|
23
|
+
|
|
24
|
+
#include "heif_library.h"
|
|
25
|
+
#include "heif_error.h"
|
|
26
|
+
#include "heif_metadata.h"
|
|
27
|
+
|
|
28
|
+
#ifdef __cplusplus
|
|
29
|
+
extern "C" {
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Gets the number of items.
|
|
35
|
+
*
|
|
36
|
+
* This is not the same as the number of images, since there can be other types of items,
|
|
37
|
+
* such as metadata.
|
|
38
|
+
*
|
|
39
|
+
* @param ctx the file context
|
|
40
|
+
* @return the number of items
|
|
41
|
+
*/
|
|
42
|
+
LIBHEIF_API
|
|
43
|
+
int heif_context_get_number_of_items(const heif_context* ctx);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Get the item identifiers.
|
|
47
|
+
*
|
|
48
|
+
* Fills in the item IDs into the user-supplied array {@code ID_array}, preallocated with {@code count} entries.
|
|
49
|
+
*
|
|
50
|
+
* @param ctx the file context
|
|
51
|
+
* @param ID_array the output array.
|
|
52
|
+
* @param count the number of items allocated within {@code ID_array}.
|
|
53
|
+
* @return the total number of IDs filled into the array, which may be less than {@code count}.
|
|
54
|
+
*/
|
|
55
|
+
LIBHEIF_API
|
|
56
|
+
int heif_context_get_list_of_item_IDs(const heif_context* ctx,
|
|
57
|
+
heif_item_id* ID_array,
|
|
58
|
+
int count);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Gets the item type.
|
|
62
|
+
*
|
|
63
|
+
* Usually, this is a four character code (e.g. `mime` or `uri `), but it can theoretically be
|
|
64
|
+
* any 4-byte number. Thus, the type is returned as an integer. You can use {@link heif_fourcc} to map
|
|
65
|
+
* between the two representations.
|
|
66
|
+
*
|
|
67
|
+
* @param ctx the file context
|
|
68
|
+
* @param item_id the item identifier for the item
|
|
69
|
+
* @return the item type
|
|
70
|
+
*/
|
|
71
|
+
LIBHEIF_API
|
|
72
|
+
uint32_t heif_item_get_item_type(const heif_context* ctx, heif_item_id item_id);
|
|
73
|
+
|
|
74
|
+
#define heif_item_type_mime heif_fourcc('m','i','m','e')
|
|
75
|
+
#define heif_item_type_uri heif_fourcc('u','r','i',' ')
|
|
76
|
+
|
|
77
|
+
LIBHEIF_API
|
|
78
|
+
int heif_item_is_item_hidden(const heif_context* ctx, heif_item_id item_id);
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Gets the MIME content_type for an item.
|
|
83
|
+
*
|
|
84
|
+
* Only valid if the item type is `mime`.
|
|
85
|
+
* If the item does not exist, or if it is not a `mime` item, NULL is returned.
|
|
86
|
+
*
|
|
87
|
+
* @param ctx the file context
|
|
88
|
+
* @param item_id the item identifier for the item
|
|
89
|
+
* @return the item content_type
|
|
90
|
+
*/
|
|
91
|
+
LIBHEIF_API
|
|
92
|
+
const char* heif_item_get_mime_item_content_type(const heif_context* ctx, heif_item_id item_id);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Gets the content_encoding for a MIME item.
|
|
96
|
+
*
|
|
97
|
+
* Only valid if the item type is `mime`.
|
|
98
|
+
* If the item does not exist, or if it is not a `mime` item, NULL is returned.
|
|
99
|
+
*
|
|
100
|
+
* If the item is not encoded, the returned value will be an empty string (not null).
|
|
101
|
+
*
|
|
102
|
+
* @param ctx the file context
|
|
103
|
+
* @param item_id the item identifier for the item
|
|
104
|
+
* @return the item content_type
|
|
105
|
+
*/
|
|
106
|
+
LIBHEIF_API
|
|
107
|
+
const char* heif_item_get_mime_item_content_encoding(const heif_context* ctx, heif_item_id item_id);
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Gets the item_uri_type for an item.
|
|
111
|
+
*
|
|
112
|
+
* Only valid if the item type is `uri `.
|
|
113
|
+
* If the item does not exist, or if it is not a `uri ` item, NULL is returned.
|
|
114
|
+
*
|
|
115
|
+
* @param ctx the file context
|
|
116
|
+
* @param item_id the item identifier for the item
|
|
117
|
+
* @return the item item_uri_type
|
|
118
|
+
*/
|
|
119
|
+
LIBHEIF_API
|
|
120
|
+
const char* heif_item_get_uri_item_uri_type(const heif_context* ctx, heif_item_id item_id);
|
|
121
|
+
|
|
122
|
+
LIBHEIF_API
|
|
123
|
+
const char* heif_item_get_item_name(const heif_context* ctx, heif_item_id item_id);
|
|
124
|
+
|
|
125
|
+
LIBHEIF_API
|
|
126
|
+
heif_error heif_item_set_item_name(heif_context* ctx,
|
|
127
|
+
heif_item_id item,
|
|
128
|
+
const char* item_name);
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Gets the raw metadata, as stored in the HEIF file.
|
|
133
|
+
*
|
|
134
|
+
* Data in a "mime" item with "content_encoding" can be compressed.
|
|
135
|
+
* When `out_compression_format` is NULL, the decompressed data will be returned.
|
|
136
|
+
* Otherwise, the compressed data is returned and `out_compression_format` will be filled with the
|
|
137
|
+
* compression format.
|
|
138
|
+
* If the compression method is not supported, an error will be returned.
|
|
139
|
+
*
|
|
140
|
+
* It is valid to set `out_data` to NULL. In that case, only the `out_data_size` is filled.
|
|
141
|
+
* Note that it is inefficient to use `out_data=NULL` just to get the size of compressed data.
|
|
142
|
+
* In general, this should be avoided.
|
|
143
|
+
*
|
|
144
|
+
* If there is no data assigned to the item or there is an error, `out_data_size` is set to zero.
|
|
145
|
+
*
|
|
146
|
+
* @param ctx the file context
|
|
147
|
+
* @param item_id the item identifier for the item
|
|
148
|
+
* @param out_compression_format how the data is compressed. If the pointer is NULL, the decompressed data will be returned.
|
|
149
|
+
* @param out_data the corresponding raw metadata
|
|
150
|
+
* @param out_data_size the size of the metadata in bytes
|
|
151
|
+
* @return whether the call succeeded, or there was an error
|
|
152
|
+
*/
|
|
153
|
+
LIBHEIF_API
|
|
154
|
+
heif_error heif_item_get_item_data(const heif_context* ctx,
|
|
155
|
+
heif_item_id item_id,
|
|
156
|
+
enum heif_metadata_compression* out_compression_format,
|
|
157
|
+
uint8_t** out_data, size_t* out_data_size);
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Free the item data.
|
|
161
|
+
*
|
|
162
|
+
* This is used to free memory associated with the data returned by
|
|
163
|
+
* {@link heif_item_get_item_data} in 'out_data' and set the pointer to NULL.
|
|
164
|
+
*
|
|
165
|
+
* @param ctx the file context
|
|
166
|
+
* @param item_data the data to free
|
|
167
|
+
*/
|
|
168
|
+
LIBHEIF_API
|
|
169
|
+
void heif_release_item_data(const heif_context* ctx, uint8_t** item_data);
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
// ------------------------- item language -------------------------
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Get the extended language associated with the item.
|
|
176
|
+
* The item is usually a text item.
|
|
177
|
+
*
|
|
178
|
+
* @param context the heif file context containg the item.
|
|
179
|
+
* @param itemId the identifier for the item
|
|
180
|
+
* @param out_language output parameter with the item's language. Free with heif_string_release().
|
|
181
|
+
* @return heif_error_ok on success, or an error value indicating the problem
|
|
182
|
+
*/
|
|
183
|
+
LIBHEIF_API
|
|
184
|
+
heif_error heif_item_get_property_extended_language(const heif_context* context,
|
|
185
|
+
heif_item_id itemId,
|
|
186
|
+
char** out_language);
|
|
187
|
+
|
|
188
|
+
LIBHEIF_API
|
|
189
|
+
heif_error heif_item_set_property_extended_language(heif_context* context,
|
|
190
|
+
heif_item_id item_id,
|
|
191
|
+
const char* language, heif_property_id* out_optional_propertyId);
|
|
192
|
+
|
|
193
|
+
// ------------------------- item references -------------------------
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Get the item ids that reference the given item.
|
|
197
|
+
*
|
|
198
|
+
* @param ctx the file context.
|
|
199
|
+
* @param from_item_id the item identifier for the item.
|
|
200
|
+
* @param index the index of the reference to get.
|
|
201
|
+
* @param out_reference_type_4cc The 4cc of the reference. (e.g dimg, thmb, cdsc, or auxl)
|
|
202
|
+
* @param out_references_to the item references. Use {@link heif_release_item_references} to free the memory.
|
|
203
|
+
* @return the number of items that reference the given item. Returns 0 if the index exceeds the number of references.
|
|
204
|
+
*/
|
|
205
|
+
LIBHEIF_API
|
|
206
|
+
size_t heif_context_get_item_references(const heif_context* ctx,
|
|
207
|
+
heif_item_id from_item_id,
|
|
208
|
+
int index,
|
|
209
|
+
uint32_t* out_reference_type_4cc,
|
|
210
|
+
heif_item_id** out_references_to);
|
|
211
|
+
|
|
212
|
+
LIBHEIF_API
|
|
213
|
+
void heif_release_item_references(const heif_context* ctx, heif_item_id** references);
|
|
214
|
+
|
|
215
|
+
LIBHEIF_API
|
|
216
|
+
heif_error heif_context_add_item_reference(heif_context* ctx,
|
|
217
|
+
uint32_t reference_type,
|
|
218
|
+
heif_item_id from_item,
|
|
219
|
+
heif_item_id to_item);
|
|
220
|
+
|
|
221
|
+
LIBHEIF_API
|
|
222
|
+
heif_error heif_context_add_item_references(heif_context* ctx,
|
|
223
|
+
uint32_t reference_type,
|
|
224
|
+
heif_item_id from_item,
|
|
225
|
+
const heif_item_id* to_item,
|
|
226
|
+
int num_to_items);
|
|
227
|
+
|
|
228
|
+
// ------------------------- adding new items -------------------------
|
|
229
|
+
|
|
230
|
+
LIBHEIF_API
|
|
231
|
+
heif_error heif_context_add_item(heif_context* ctx,
|
|
232
|
+
const char* item_type,
|
|
233
|
+
const void* data, int size,
|
|
234
|
+
heif_item_id* out_item_id);
|
|
235
|
+
|
|
236
|
+
LIBHEIF_API
|
|
237
|
+
heif_error heif_context_add_mime_item(heif_context* ctx,
|
|
238
|
+
const char* content_type,
|
|
239
|
+
enum heif_metadata_compression content_encoding,
|
|
240
|
+
const void* data, int size,
|
|
241
|
+
heif_item_id* out_item_id);
|
|
242
|
+
|
|
243
|
+
LIBHEIF_API
|
|
244
|
+
heif_error heif_context_add_precompressed_mime_item(heif_context* ctx,
|
|
245
|
+
const char* content_type,
|
|
246
|
+
const char* content_encoding,
|
|
247
|
+
const void* data, int size,
|
|
248
|
+
heif_item_id* out_item_id);
|
|
249
|
+
|
|
250
|
+
LIBHEIF_API
|
|
251
|
+
heif_error heif_context_add_uri_item(heif_context* ctx,
|
|
252
|
+
const char* item_uri_type,
|
|
253
|
+
const void* data, int size,
|
|
254
|
+
heif_item_id* out_item_id);
|
|
255
|
+
|
|
256
|
+
#ifdef __cplusplus
|
|
257
|
+
}
|
|
258
|
+
#endif
|
|
259
|
+
|
|
260
|
+
#endif
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017-2023 Dirk Farin <dirk.farin@gmail.com>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of libheif.
|
|
6
|
+
*
|
|
7
|
+
* libheif is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of
|
|
10
|
+
* the License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* libheif is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef LIBHEIF_HEIF_LIBRARY_H
|
|
22
|
+
#define LIBHEIF_HEIF_LIBRARY_H
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#include <stddef.h>
|
|
29
|
+
#include <stdint.h>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// API versions table
|
|
33
|
+
//
|
|
34
|
+
// release dec.options enc.options heif_reader heif_writer depth.rep col.profile
|
|
35
|
+
// ------------------------------------------------------------------------------------------
|
|
36
|
+
// 1.0 1 N/A N/A N/A 1 N/A
|
|
37
|
+
// 1.1 1 N/A N/A 1 1 N/A
|
|
38
|
+
// 1.3 1 1 1 1 1 N/A
|
|
39
|
+
// 1.4 1 1 1 1 1 1
|
|
40
|
+
// 1.7 2 1 1 1 1 1
|
|
41
|
+
// 1.9.2 2 2 1 1 1 1
|
|
42
|
+
// 1.10 2 3 1 1 1 1
|
|
43
|
+
// 1.11 2 4 1 1 1 1
|
|
44
|
+
// 1.13 3 4 1 1 1 1
|
|
45
|
+
// 1.14 3 5 1 1 1 1
|
|
46
|
+
// 1.15 4 5 1 1 1 1
|
|
47
|
+
// 1.16 5 6 1 1 1 1
|
|
48
|
+
// 1.18 5 7 1 1 1 1
|
|
49
|
+
// 1.19 6 7 2 1 1 1
|
|
50
|
+
// 1.20 7 7 2 1 1 1
|
|
51
|
+
|
|
52
|
+
#if (defined(_WIN32) || defined __CYGWIN__) && !defined(LIBHEIF_STATIC_BUILD)
|
|
53
|
+
#ifdef LIBHEIF_EXPORTS
|
|
54
|
+
#define LIBHEIF_API __declspec(dllexport)
|
|
55
|
+
#else
|
|
56
|
+
#define LIBHEIF_API __declspec(dllimport)
|
|
57
|
+
#endif
|
|
58
|
+
#elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
|
|
59
|
+
#ifdef LIBHEIF_EXPORTS
|
|
60
|
+
#define LIBHEIF_API __attribute__((__visibility__("default")))
|
|
61
|
+
#else
|
|
62
|
+
#define LIBHEIF_API
|
|
63
|
+
#endif
|
|
64
|
+
#else
|
|
65
|
+
#define LIBHEIF_API
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Build a 32 bit integer from a 4-character code.
|
|
70
|
+
*/
|
|
71
|
+
#define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
|
|
72
|
+
|
|
73
|
+
#include <libheif/heif_version.h>
|
|
74
|
+
#include <libheif/heif_error.h>
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/* === version numbers === */
|
|
78
|
+
|
|
79
|
+
// Version string of linked libheif library.
|
|
80
|
+
LIBHEIF_API const char* heif_get_version(void);
|
|
81
|
+
|
|
82
|
+
// Numeric version of linked libheif library, encoded as 0xHHMMLL00 = hh.mm.ll, where hh, mm, ll is the decimal representation of HH, MM, LL.
|
|
83
|
+
// For example: 0x02150300 is version 2.21.3
|
|
84
|
+
LIBHEIF_API uint32_t heif_get_version_number(void);
|
|
85
|
+
|
|
86
|
+
// Numeric part "HH" from above. Returned as a decimal number.
|
|
87
|
+
LIBHEIF_API int heif_get_version_number_major(void);
|
|
88
|
+
// Numeric part "MM" from above. Returned as a decimal number.
|
|
89
|
+
LIBHEIF_API int heif_get_version_number_minor(void);
|
|
90
|
+
// Numeric part "LL" from above. Returned as a decimal number.
|
|
91
|
+
LIBHEIF_API int heif_get_version_number_maintenance(void);
|
|
92
|
+
|
|
93
|
+
// Helper macros to check for given versions of libheif at compile time.
|
|
94
|
+
#define LIBHEIF_MAKE_VERSION(h, m, l) ((h) << 24 | (m) << 16 | (l) << 8)
|
|
95
|
+
#define LIBHEIF_HAVE_VERSION(h, m, l) (LIBHEIF_NUMERIC_VERSION >= LIBHEIF_MAKE_VERSION(h, m, l))
|
|
96
|
+
|
|
97
|
+
typedef struct heif_context heif_context;
|
|
98
|
+
typedef struct heif_image_handle heif_image_handle;
|
|
99
|
+
|
|
100
|
+
typedef uint32_t heif_item_id;
|
|
101
|
+
typedef uint32_t heif_property_id;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Free a string returned by libheif in various API functions.
|
|
105
|
+
* You may pass NULL.
|
|
106
|
+
*/
|
|
107
|
+
LIBHEIF_API
|
|
108
|
+
void heif_string_release(const char*);
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// ========================= library initialization ======================
|
|
112
|
+
|
|
113
|
+
typedef struct heif_init_params
|
|
114
|
+
{
|
|
115
|
+
int version;
|
|
116
|
+
|
|
117
|
+
// currently no parameters
|
|
118
|
+
} heif_init_params;
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Initialise library.
|
|
123
|
+
*
|
|
124
|
+
* You should call heif_init() when you start using libheif and heif_deinit() when you are finished.
|
|
125
|
+
* These calls are reference counted. Each call to heif_init() should be matched by one call to heif_deinit().
|
|
126
|
+
*
|
|
127
|
+
* For backwards compatibility, it is not really necessary to call heif_init(), but some library memory objects
|
|
128
|
+
* will never be freed if you do not call heif_init()/heif_deinit().
|
|
129
|
+
*
|
|
130
|
+
* heif_init() will load the external modules installed in the default plugin path. Thus, you need it when you
|
|
131
|
+
* want to load external plugins from the default path.
|
|
132
|
+
* Codec plugins that are compiled into the library directly (selected by the compile-time parameters of libheif)
|
|
133
|
+
* will be available even without heif_init().
|
|
134
|
+
*
|
|
135
|
+
* Make sure that you do not have one part of your program use heif_init()/heif_deinit() and another part that does
|
|
136
|
+
* not use it as the latter may try to use an uninitialized library. If in doubt, enclose everything with init/deinit.
|
|
137
|
+
*
|
|
138
|
+
* You may pass nullptr to get default parameters. Currently, no parameters are supported.
|
|
139
|
+
*/
|
|
140
|
+
LIBHEIF_API
|
|
141
|
+
heif_error heif_init(heif_init_params*);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Deinitialise and clean up library.
|
|
145
|
+
*
|
|
146
|
+
* You should call heif_init() when you start using libheif and heif_deinit() when you are finished.
|
|
147
|
+
* These calls are reference counted. Each call to heif_init() should be matched by one call to heif_deinit().
|
|
148
|
+
*
|
|
149
|
+
* Note: heif_deinit() must not be called after exit(), for example in a global C++ object's destructor.
|
|
150
|
+
* If you do, global variables in libheif might have already been released when heif_deinit() is running,
|
|
151
|
+
* leading to a crash.
|
|
152
|
+
*
|
|
153
|
+
* \sa heif_init()
|
|
154
|
+
*/
|
|
155
|
+
LIBHEIF_API
|
|
156
|
+
void heif_deinit(void);
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
// --- Codec plugins ---
|
|
160
|
+
|
|
161
|
+
// --- Plugins are currently only supported on Unix platforms.
|
|
162
|
+
|
|
163
|
+
typedef enum heif_plugin_type
|
|
164
|
+
{
|
|
165
|
+
heif_plugin_type_encoder,
|
|
166
|
+
heif_plugin_type_decoder
|
|
167
|
+
} heif_plugin_type;
|
|
168
|
+
|
|
169
|
+
typedef struct heif_plugin_info
|
|
170
|
+
{
|
|
171
|
+
int version; // version of this info struct
|
|
172
|
+
enum heif_plugin_type type;
|
|
173
|
+
const void* plugin;
|
|
174
|
+
void* internal_handle; // for internal use only
|
|
175
|
+
} heif_plugin_info;
|
|
176
|
+
|
|
177
|
+
LIBHEIF_API
|
|
178
|
+
heif_error heif_load_plugin(const char* filename, heif_plugin_info const** out_plugin);
|
|
179
|
+
|
|
180
|
+
LIBHEIF_API
|
|
181
|
+
heif_error heif_load_plugins(const char* directory,
|
|
182
|
+
const heif_plugin_info** out_plugins,
|
|
183
|
+
int* out_nPluginsLoaded,
|
|
184
|
+
int output_array_size);
|
|
185
|
+
|
|
186
|
+
LIBHEIF_API
|
|
187
|
+
heif_error heif_unload_plugin(const heif_plugin_info* plugin);
|
|
188
|
+
|
|
189
|
+
// Get a NULL terminated array of the plugin directories that are searched by libheif.
|
|
190
|
+
// This includes the paths specified in the environment variable LIBHEIF_PLUGIN_PATHS and the built-in path
|
|
191
|
+
// (if not overridden by the environment variable).
|
|
192
|
+
LIBHEIF_API
|
|
193
|
+
const char* const* heif_get_plugin_directories(void);
|
|
194
|
+
|
|
195
|
+
LIBHEIF_API
|
|
196
|
+
void heif_free_plugin_directories(const char* const*);
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
// --- register plugins
|
|
200
|
+
|
|
201
|
+
typedef struct heif_decoder_plugin heif_decoder_plugin;
|
|
202
|
+
typedef struct heif_encoder_plugin heif_encoder_plugin;
|
|
203
|
+
|
|
204
|
+
LIBHEIF_API
|
|
205
|
+
heif_error heif_register_decoder_plugin(const heif_decoder_plugin*);
|
|
206
|
+
|
|
207
|
+
LIBHEIF_API
|
|
208
|
+
heif_error heif_register_encoder_plugin(const heif_encoder_plugin*);
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
// DEPRECATED. Use heif_register_decoder_plugin(const struct heif_decoder_plugin*) instead.
|
|
212
|
+
LIBHEIF_API
|
|
213
|
+
heif_error heif_register_decoder(heif_context* heif, const heif_decoder_plugin*);
|
|
214
|
+
|
|
215
|
+
#ifdef __cplusplus
|
|
216
|
+
}
|
|
217
|
+
#endif
|
|
218
|
+
|
|
219
|
+
#endif
|