pylibheif 1.21.2__cp312-cp312-macosx_26_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.
Potentially problematic release.
This version of pylibheif might be problematic. Click here for more details.
- 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 +239 -0
- pylibheif-1.21.2.dist-info/RECORD +34 -0
- pylibheif-1.21.2.dist-info/WHEEL +5 -0
- pylibheif.cpython-312-darwin.so +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
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_METADATA_H
|
|
22
|
+
#define LIBHEIF_HEIF_METADATA_H
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#include <libheif/heif_library.h>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
typedef enum heif_metadata_compression
|
|
32
|
+
{
|
|
33
|
+
heif_metadata_compression_off = 0,
|
|
34
|
+
heif_metadata_compression_auto = 1,
|
|
35
|
+
heif_metadata_compression_unknown = 2, // only used when reading unknown method from input file
|
|
36
|
+
heif_metadata_compression_deflate = 3,
|
|
37
|
+
heif_metadata_compression_zlib = 4, // do not use for header data
|
|
38
|
+
heif_metadata_compression_brotli = 5
|
|
39
|
+
} heif_metadata_compression;
|
|
40
|
+
|
|
41
|
+
LIBHEIF_API
|
|
42
|
+
int heif_metadata_compression_method_supported(enum heif_metadata_compression method);
|
|
43
|
+
|
|
44
|
+
// ------------------------- metadata (Exif / XMP) -------------------------
|
|
45
|
+
|
|
46
|
+
// How many metadata blocks are attached to an image. If you only want to get EXIF data,
|
|
47
|
+
// set the type_filter to "Exif". Otherwise, set the type_filter to NULL.
|
|
48
|
+
LIBHEIF_API
|
|
49
|
+
int heif_image_handle_get_number_of_metadata_blocks(const heif_image_handle* handle,
|
|
50
|
+
const char* type_filter);
|
|
51
|
+
|
|
52
|
+
// 'type_filter' can be used to get only metadata of specific types, like "Exif".
|
|
53
|
+
// If 'type_filter' is NULL, it will return all types of metadata IDs.
|
|
54
|
+
LIBHEIF_API
|
|
55
|
+
int heif_image_handle_get_list_of_metadata_block_IDs(const heif_image_handle* handle,
|
|
56
|
+
const char* type_filter,
|
|
57
|
+
heif_item_id* ids, int count);
|
|
58
|
+
|
|
59
|
+
// Return a string indicating the type of the metadata, as specified in the HEIF file.
|
|
60
|
+
// Exif data will have the type string "Exif".
|
|
61
|
+
// This string will be valid until the next call to a libheif function.
|
|
62
|
+
// You do not have to free this string.
|
|
63
|
+
LIBHEIF_API
|
|
64
|
+
const char* heif_image_handle_get_metadata_type(const heif_image_handle* handle,
|
|
65
|
+
heif_item_id metadata_id);
|
|
66
|
+
|
|
67
|
+
// For EXIF, the content type is empty.
|
|
68
|
+
// For XMP, the content type is "application/rdf+xml".
|
|
69
|
+
LIBHEIF_API
|
|
70
|
+
const char* heif_image_handle_get_metadata_content_type(const heif_image_handle* handle,
|
|
71
|
+
heif_item_id metadata_id);
|
|
72
|
+
|
|
73
|
+
// Get the size of the raw metadata, as stored in the HEIF file.
|
|
74
|
+
LIBHEIF_API
|
|
75
|
+
size_t heif_image_handle_get_metadata_size(const heif_image_handle* handle,
|
|
76
|
+
heif_item_id metadata_id);
|
|
77
|
+
|
|
78
|
+
// 'out_data' must point to a memory area of the size reported by heif_image_handle_get_metadata_size().
|
|
79
|
+
// The data is returned exactly as stored in the HEIF file.
|
|
80
|
+
// For Exif data, you probably have to skip the first four bytes of the data, since they
|
|
81
|
+
// indicate the offset to the start of the TIFF header of the Exif data.
|
|
82
|
+
LIBHEIF_API
|
|
83
|
+
heif_error heif_image_handle_get_metadata(const heif_image_handle* handle,
|
|
84
|
+
heif_item_id metadata_id,
|
|
85
|
+
void* out_data);
|
|
86
|
+
|
|
87
|
+
// Only valid for item type == "uri ", an absolute URI
|
|
88
|
+
LIBHEIF_API
|
|
89
|
+
const char* heif_image_handle_get_metadata_item_uri_type(const heif_image_handle* handle,
|
|
90
|
+
heif_item_id metadata_id);
|
|
91
|
+
|
|
92
|
+
// --- writing Exif / XMP metadata ---
|
|
93
|
+
|
|
94
|
+
// Add EXIF metadata to an image.
|
|
95
|
+
LIBHEIF_API
|
|
96
|
+
heif_error heif_context_add_exif_metadata(heif_context*,
|
|
97
|
+
const heif_image_handle* image_handle,
|
|
98
|
+
const void* data, int size);
|
|
99
|
+
|
|
100
|
+
// Add XMP metadata to an image.
|
|
101
|
+
LIBHEIF_API
|
|
102
|
+
heif_error heif_context_add_XMP_metadata(heif_context*,
|
|
103
|
+
const heif_image_handle* image_handle,
|
|
104
|
+
const void* data, int size);
|
|
105
|
+
|
|
106
|
+
// New version of heif_context_add_XMP_metadata() with data compression (experimental).
|
|
107
|
+
LIBHEIF_API
|
|
108
|
+
heif_error heif_context_add_XMP_metadata2(heif_context*,
|
|
109
|
+
const heif_image_handle* image_handle,
|
|
110
|
+
const void* data, int size,
|
|
111
|
+
enum heif_metadata_compression compression);
|
|
112
|
+
|
|
113
|
+
// Add generic, proprietary metadata to an image. You have to specify an 'item_type' that will
|
|
114
|
+
// identify your metadata. 'content_type' can be an additional type, or it can be NULL.
|
|
115
|
+
// For example, this function can be used to add IPTC metadata (IIM stream, not XMP) to an image.
|
|
116
|
+
// Although not standard, we propose to store IPTC data with item type="iptc", content_type=NULL.
|
|
117
|
+
LIBHEIF_API
|
|
118
|
+
heif_error heif_context_add_generic_metadata(heif_context* ctx,
|
|
119
|
+
const heif_image_handle* image_handle,
|
|
120
|
+
const void* data, int size,
|
|
121
|
+
const char* item_type, const char* content_type);
|
|
122
|
+
|
|
123
|
+
// Add generic metadata with item_type "uri ". Items with this type do not have a content_type, but
|
|
124
|
+
// an item_uri_type and they have no content_encoding (they are always stored uncompressed).
|
|
125
|
+
LIBHEIF_API
|
|
126
|
+
heif_error heif_context_add_generic_uri_metadata(heif_context* ctx,
|
|
127
|
+
const heif_image_handle* image_handle,
|
|
128
|
+
const void* data, int size,
|
|
129
|
+
const char* item_uri_type,
|
|
130
|
+
heif_item_id* out_item_id);
|
|
131
|
+
|
|
132
|
+
#ifdef __cplusplus
|
|
133
|
+
}
|
|
134
|
+
#endif
|
|
135
|
+
|
|
136
|
+
#endif
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017 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_PLUGIN_H
|
|
22
|
+
#define LIBHEIF_HEIF_PLUGIN_H
|
|
23
|
+
#include "heif_sequences.h"
|
|
24
|
+
|
|
25
|
+
#ifdef __cplusplus
|
|
26
|
+
extern "C" {
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#include <libheif/heif_encoding.h>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// ====================================================================================================
|
|
33
|
+
// This file is for codec plugin developers only.
|
|
34
|
+
// ====================================================================================================
|
|
35
|
+
|
|
36
|
+
// API versions table
|
|
37
|
+
//
|
|
38
|
+
// release decoder encoder enc.params
|
|
39
|
+
// -----------------------------------------
|
|
40
|
+
// 1.0 1 N/A N/A
|
|
41
|
+
// 1.1 1 1 1
|
|
42
|
+
// 1.4 1 1 2
|
|
43
|
+
// 1.8 1 2 2
|
|
44
|
+
// 1.13 2 3 2
|
|
45
|
+
// 1.15 3 3 2
|
|
46
|
+
// 1.20 4 3 2
|
|
47
|
+
// 1.21 5 4 2
|
|
48
|
+
|
|
49
|
+
#define heif_decoder_plugin_latest_version 5
|
|
50
|
+
#define heif_encoder_plugin_latest_version 4
|
|
51
|
+
|
|
52
|
+
// The minimum plugin versions that can be used with this libheif version.
|
|
53
|
+
#define heif_decoder_plugin_minimum_version 5
|
|
54
|
+
#define heif_encoder_plugin_minimum_version 4
|
|
55
|
+
|
|
56
|
+
// ====================================================================================================
|
|
57
|
+
// Decoder plugin API
|
|
58
|
+
// In order to decode images in other formats than HEVC, additional compression codecs can be
|
|
59
|
+
// added as plugins. A plugin has to implement the functions specified in heif_decoder_plugin
|
|
60
|
+
// and the plugin has to be registered to the libheif library using heif_register_decoder().
|
|
61
|
+
|
|
62
|
+
typedef struct heif_decoder_plugin_compressed_format_description
|
|
63
|
+
{
|
|
64
|
+
enum heif_compression_format format;
|
|
65
|
+
|
|
66
|
+
} heif_decoder_plugin_compressed_format_description;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
typedef struct heif_decoder_plugin_options
|
|
70
|
+
{
|
|
71
|
+
enum heif_compression_format format;
|
|
72
|
+
int strict_decoding; // bool
|
|
73
|
+
int num_threads; // 0 - undefined, use decoder default
|
|
74
|
+
|
|
75
|
+
} heif_decoder_plugin_options;
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
typedef struct heif_decoder_plugin
|
|
79
|
+
{
|
|
80
|
+
// API version supported by this plugin (see table above for supported versions)
|
|
81
|
+
int plugin_api_version;
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
// --- version 1 functions ---
|
|
85
|
+
|
|
86
|
+
// Human-readable name of the plugin
|
|
87
|
+
const char* (* get_plugin_name)(void);
|
|
88
|
+
|
|
89
|
+
// Global plugin initialization (may be NULL)
|
|
90
|
+
void (* init_plugin)(void);
|
|
91
|
+
|
|
92
|
+
// Global plugin deinitialization (may be NULL)
|
|
93
|
+
void (* deinit_plugin)(void);
|
|
94
|
+
|
|
95
|
+
// Query whether the plugin supports decoding of the given format
|
|
96
|
+
// Result is a priority value. The plugin with the largest value wins.
|
|
97
|
+
// Default priority is 100. Returning 0 indicates that the plugin cannot decode this format.
|
|
98
|
+
int (* does_support_format)(enum heif_compression_format format);
|
|
99
|
+
|
|
100
|
+
// Create a new decoder context for decoding an image
|
|
101
|
+
heif_error (* new_decoder)(void** decoder);
|
|
102
|
+
|
|
103
|
+
// Free the decoder context (heif_image can still be used after destruction)
|
|
104
|
+
void (* free_decoder)(void* decoder);
|
|
105
|
+
|
|
106
|
+
// Push more data into the decoder. This can be called multiple times.
|
|
107
|
+
// This may not be called after any decode_*() function has been called.
|
|
108
|
+
heif_error (* push_data)(void* decoder, const void* data, size_t size);
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// --- After pushing the data into the decoder, the decode functions may be called only once.
|
|
112
|
+
|
|
113
|
+
heif_error (* decode_image)(void* decoder, heif_image** out_img);
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
// --- version 2 functions ---
|
|
117
|
+
|
|
118
|
+
void (* set_strict_decoding)(void* decoder, int flag);
|
|
119
|
+
|
|
120
|
+
// If not NULL, this can provide a specialized function to convert YCbCr to sRGB, because
|
|
121
|
+
// only the codec itself knows how to interpret the chroma samples and their locations.
|
|
122
|
+
/*
|
|
123
|
+
struct heif_error (*convert_YCbCr_to_sRGB)(void* decoder,
|
|
124
|
+
struct heif_image* in_YCbCr_img,
|
|
125
|
+
struct heif_image** out_sRGB_img);
|
|
126
|
+
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
// Reset decoder, such that we can feed in new data for another image.
|
|
130
|
+
// void (*reset_image)(void* decoder);
|
|
131
|
+
|
|
132
|
+
// --- version 3 functions ---
|
|
133
|
+
|
|
134
|
+
const char* id_name;
|
|
135
|
+
|
|
136
|
+
// --- version 4 functions ---
|
|
137
|
+
|
|
138
|
+
heif_error (* decode_next_image)(void* decoder, heif_image** out_img,
|
|
139
|
+
const heif_security_limits* limits);
|
|
140
|
+
|
|
141
|
+
// --- version 5 functions will follow below ... ---
|
|
142
|
+
|
|
143
|
+
uint32_t minimum_required_libheif_version;
|
|
144
|
+
|
|
145
|
+
// Query whether the plugin supports decoding of the given format
|
|
146
|
+
// Result is a priority value. The plugin with the largest value wins.
|
|
147
|
+
// Default priority is 100. Returning 0 indicates that the plugin cannot decode this format.
|
|
148
|
+
int (* does_support_format2)(const heif_decoder_plugin_compressed_format_description* format);
|
|
149
|
+
|
|
150
|
+
// Create a new decoder context for decoding an image
|
|
151
|
+
heif_error (* new_decoder2)(void** decoder, const heif_decoder_plugin_options*);
|
|
152
|
+
|
|
153
|
+
heif_error (* push_data2)(void* decoder, const void* data, size_t size, uintptr_t user_data);
|
|
154
|
+
|
|
155
|
+
heif_error (* flush_data)(void* decoder);
|
|
156
|
+
|
|
157
|
+
heif_error (* decode_next_image2)(void* decoder, heif_image** out_img,
|
|
158
|
+
uintptr_t* out_user_data,
|
|
159
|
+
const heif_security_limits* limits);
|
|
160
|
+
|
|
161
|
+
// --- Note: when adding new versions, also update `heif_decoder_plugin_latest_version`.
|
|
162
|
+
} heif_decoder_plugin;
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
typedef enum heif_encoded_data_type
|
|
166
|
+
{
|
|
167
|
+
heif_encoded_data_type_HEVC_header = 1,
|
|
168
|
+
heif_encoded_data_type_HEVC_image = 2,
|
|
169
|
+
heif_encoded_data_type_HEVC_depth_SEI = 3
|
|
170
|
+
} heif_encoded_data_type;
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
// Specifies the class of the input image content.
|
|
174
|
+
// The encoder may want to encode different classes with different parameters
|
|
175
|
+
// (e.g. always encode alpha lossless)
|
|
176
|
+
typedef enum heif_image_input_class
|
|
177
|
+
{
|
|
178
|
+
heif_image_input_class_normal = 1,
|
|
179
|
+
heif_image_input_class_alpha = 2,
|
|
180
|
+
heif_image_input_class_depth = 3,
|
|
181
|
+
heif_image_input_class_thumbnail = 4
|
|
182
|
+
} heif_image_input_class;
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
typedef struct heif_encoder_plugin
|
|
186
|
+
{
|
|
187
|
+
// API version supported by this plugin (see table above for supported versions)
|
|
188
|
+
int plugin_api_version;
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
// --- version 1 functions ---
|
|
192
|
+
|
|
193
|
+
// The compression format generated by this plugin.
|
|
194
|
+
enum heif_compression_format compression_format;
|
|
195
|
+
|
|
196
|
+
// Short name of the encoder that can be used as command line parameter when selecting an encoder.
|
|
197
|
+
// Hence, it should stay stable and not contain any version numbers that will change.
|
|
198
|
+
const char* id_name;
|
|
199
|
+
|
|
200
|
+
// Default priority is 100.
|
|
201
|
+
int priority;
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
// Feature support
|
|
205
|
+
int supports_lossy_compression;
|
|
206
|
+
int supports_lossless_compression;
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
// Human-readable name of the plugin
|
|
210
|
+
const char* (* get_plugin_name)(void);
|
|
211
|
+
|
|
212
|
+
// Global plugin initialization (may be NULL)
|
|
213
|
+
void (* init_plugin)(void);
|
|
214
|
+
|
|
215
|
+
// Global plugin cleanup (may be NULL).
|
|
216
|
+
// Free data that was allocated in init_plugin()
|
|
217
|
+
void (* cleanup_plugin)(void);
|
|
218
|
+
|
|
219
|
+
// Create a new decoder context for decoding an image
|
|
220
|
+
heif_error (* new_encoder)(void** encoder);
|
|
221
|
+
|
|
222
|
+
// Free the decoder context (heif_image can still be used after destruction)
|
|
223
|
+
void (* free_encoder)(void* encoder);
|
|
224
|
+
|
|
225
|
+
heif_error (* set_parameter_quality)(void* encoder, int quality);
|
|
226
|
+
|
|
227
|
+
heif_error (* get_parameter_quality)(void* encoder, int* quality);
|
|
228
|
+
|
|
229
|
+
heif_error (* set_parameter_lossless)(void* encoder, int lossless);
|
|
230
|
+
|
|
231
|
+
heif_error (* get_parameter_lossless)(void* encoder, int* lossless);
|
|
232
|
+
|
|
233
|
+
heif_error (* set_parameter_logging_level)(void* encoder, int logging);
|
|
234
|
+
|
|
235
|
+
heif_error (* get_parameter_logging_level)(void* encoder, int* logging);
|
|
236
|
+
|
|
237
|
+
const heif_encoder_parameter** (* list_parameters)(void* encoder);
|
|
238
|
+
|
|
239
|
+
heif_error (* set_parameter_integer)(void* encoder, const char* name, int value);
|
|
240
|
+
|
|
241
|
+
heif_error (* get_parameter_integer)(void* encoder, const char* name, int* value);
|
|
242
|
+
|
|
243
|
+
heif_error (* set_parameter_boolean)(void* encoder, const char* name, int value);
|
|
244
|
+
|
|
245
|
+
heif_error (* get_parameter_boolean)(void* encoder, const char* name, int* value);
|
|
246
|
+
|
|
247
|
+
heif_error (* set_parameter_string)(void* encoder, const char* name, const char* value);
|
|
248
|
+
|
|
249
|
+
heif_error (* get_parameter_string)(void* encoder, const char* name, char* value, int value_size);
|
|
250
|
+
|
|
251
|
+
// Replace the input colorspace/chroma with the one that is supported by the encoder and that
|
|
252
|
+
// comes as close to the input colorspace/chroma as possible.
|
|
253
|
+
void (* query_input_colorspace)(enum heif_colorspace* inout_colorspace,
|
|
254
|
+
enum heif_chroma* inout_chroma);
|
|
255
|
+
|
|
256
|
+
// Encode an image.
|
|
257
|
+
// After pushing an image into the encoder, you should call get_compressed_data() to
|
|
258
|
+
// get compressed data until it returns a NULL data pointer.
|
|
259
|
+
heif_error (* encode_image)(void* encoder, const heif_image* image,
|
|
260
|
+
enum heif_image_input_class image_class);
|
|
261
|
+
|
|
262
|
+
// Get a packet of decoded data. The data format depends on the codec.
|
|
263
|
+
// For HEVC, each packet shall contain exactly one NAL, starting with the NAL header without startcode.
|
|
264
|
+
heif_error (* get_compressed_data)(void* encoder, uint8_t** data, int* size,
|
|
265
|
+
enum heif_encoded_data_type* type);
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
// --- version 2 ---
|
|
269
|
+
|
|
270
|
+
void (* query_input_colorspace2)(void* encoder,
|
|
271
|
+
enum heif_colorspace* inout_colorspace,
|
|
272
|
+
enum heif_chroma* inout_chroma);
|
|
273
|
+
|
|
274
|
+
// --- version 3 ---
|
|
275
|
+
|
|
276
|
+
// The encoded image size may be different from the input frame size, e.g. because
|
|
277
|
+
// of required rounding, or a required minimum size. Use this function to return
|
|
278
|
+
// the encoded size for a given input image size.
|
|
279
|
+
// You may set this to NULL if no padding is required for any image size.
|
|
280
|
+
void (* query_encoded_size)(void* encoder, uint32_t input_width, uint32_t input_height,
|
|
281
|
+
uint32_t* encoded_width, uint32_t* encoded_height);
|
|
282
|
+
|
|
283
|
+
// --- version 4 ---
|
|
284
|
+
|
|
285
|
+
uint32_t minimum_required_libheif_version;
|
|
286
|
+
|
|
287
|
+
heif_error (* start_sequence_encoding)(void* encoder, const heif_image* image,
|
|
288
|
+
enum heif_image_input_class image_class,
|
|
289
|
+
uint32_t framerate_num, uint32_t framerate_denom,
|
|
290
|
+
const heif_sequence_encoding_options* options);
|
|
291
|
+
// TODO: is heif_sequence_encoding_options a good choice here?
|
|
292
|
+
|
|
293
|
+
heif_error (* encode_sequence_frame)(void* encoder, const heif_image* image, uintptr_t frame_nr);
|
|
294
|
+
|
|
295
|
+
heif_error (* end_sequence_encoding)(void* encoder);
|
|
296
|
+
|
|
297
|
+
heif_error (* get_compressed_data2)(void* encoder, uint8_t** data, int* size,
|
|
298
|
+
uintptr_t* frame_nr,
|
|
299
|
+
int* is_keyframe, int* more_frame_packets);
|
|
300
|
+
|
|
301
|
+
int does_indicate_keyframes;
|
|
302
|
+
|
|
303
|
+
// --- version 5 functions will follow below ... ---
|
|
304
|
+
|
|
305
|
+
// --- Note: when adding new versions, also update `heif_encoder_plugin_latest_version`.
|
|
306
|
+
} heif_encoder_plugin;
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
// Names for standard parameters. These should only be used by the encoder plugins.
|
|
310
|
+
#define heif_encoder_parameter_name_quality "quality"
|
|
311
|
+
#define heif_encoder_parameter_name_lossless "lossless"
|
|
312
|
+
|
|
313
|
+
// For use only by the encoder plugins.
|
|
314
|
+
// Application programs should use the access functions.
|
|
315
|
+
// NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
|
|
316
|
+
typedef struct heif_encoder_parameter
|
|
317
|
+
{
|
|
318
|
+
int version; // current version: 2
|
|
319
|
+
|
|
320
|
+
// --- version 1 fields ---
|
|
321
|
+
|
|
322
|
+
const char* name;
|
|
323
|
+
enum heif_encoder_parameter_type type;
|
|
324
|
+
|
|
325
|
+
union
|
|
326
|
+
{
|
|
327
|
+
struct
|
|
328
|
+
{
|
|
329
|
+
int default_value;
|
|
330
|
+
|
|
331
|
+
uint8_t have_minimum_maximum; // bool
|
|
332
|
+
int minimum;
|
|
333
|
+
int maximum;
|
|
334
|
+
|
|
335
|
+
int* valid_values;
|
|
336
|
+
int num_valid_values;
|
|
337
|
+
} integer;
|
|
338
|
+
|
|
339
|
+
struct
|
|
340
|
+
{
|
|
341
|
+
const char* default_value;
|
|
342
|
+
|
|
343
|
+
const char* const* valid_values;
|
|
344
|
+
} string; // NOLINT
|
|
345
|
+
|
|
346
|
+
struct
|
|
347
|
+
{
|
|
348
|
+
int default_value;
|
|
349
|
+
} boolean;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
// --- version 2 fields
|
|
353
|
+
|
|
354
|
+
int has_default;
|
|
355
|
+
} heif_encoder_parameter;
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
extern heif_error heif_error_ok;
|
|
359
|
+
extern heif_error heif_error_unsupported_parameter;
|
|
360
|
+
extern heif_error heif_error_invalid_parameter_value;
|
|
361
|
+
|
|
362
|
+
#define HEIF_WARN_OR_FAIL(strict, image, cmd, cleanupBlock) \
|
|
363
|
+
{ heif_error e = cmd; \
|
|
364
|
+
if (e.code != heif_error_Ok) { \
|
|
365
|
+
if (strict) { \
|
|
366
|
+
cleanupBlock \
|
|
367
|
+
return e; \
|
|
368
|
+
} \
|
|
369
|
+
else { \
|
|
370
|
+
heif_image_add_decoding_warning(image, e); \
|
|
371
|
+
} \
|
|
372
|
+
} \
|
|
373
|
+
}
|
|
374
|
+
#ifdef __cplusplus
|
|
375
|
+
}
|
|
376
|
+
#endif
|
|
377
|
+
|
|
378
|
+
#endif
|