@img/sharp-libvips-dev 1.3.0-rc.0 → 1.3.0-rc.2

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.
@@ -47,7 +47,7 @@ HB_BEGIN_DECLS
47
47
  *
48
48
  * The minor component of the library version available at compile-time.
49
49
  */
50
- #define HB_VERSION_MINOR 2
50
+ #define HB_VERSION_MINOR 3
51
51
  /**
52
52
  * HB_VERSION_MICRO:
53
53
  *
@@ -60,7 +60,7 @@ HB_BEGIN_DECLS
60
60
  *
61
61
  * A string literal containing the library version available at compile-time.
62
62
  */
63
- #define HB_VERSION_STRING "12.2.0"
63
+ #define HB_VERSION_STRING "12.3.0"
64
64
 
65
65
  /**
66
66
  * HB_VERSION_ATLEAST:
@@ -251,6 +251,9 @@ typedef uint32_t heif_brand2;
251
251
  #define heif_brand2_avcs heif_fourcc('a','v','c','s')
252
252
 
253
253
  #define heif_brand2_iso8 heif_fourcc('i','s','o','8')
254
+ #define heif_brand2_isom heif_fourcc('i','s','o','m')
255
+ #define heif_brand2_mp41 heif_fourcc('m','p','4','1')
256
+ #define heif_brand2_mp42 heif_fourcc('m','p','4','2')
254
257
 
255
258
  // input data should be at least 12 bytes
256
259
  LIBHEIF_API
@@ -297,6 +297,9 @@ int heif_image_handle_get_content_light_level(const heif_image_handle*, heif_con
297
297
  LIBHEIF_API
298
298
  void heif_image_set_content_light_level(const heif_image*, const heif_content_light_level* in);
299
299
 
300
+ LIBHEIF_API
301
+ void heif_image_handle_set_content_light_level(const heif_image_handle*, const heif_content_light_level* in);
302
+
300
303
 
301
304
  // --- mastering display colour volume ---
302
305
 
@@ -342,6 +345,9 @@ int heif_image_handle_get_mastering_display_colour_volume(const heif_image_handl
342
345
  LIBHEIF_API
343
346
  void heif_image_set_mastering_display_colour_volume(const heif_image*, const heif_mastering_display_colour_volume* in);
344
347
 
348
+ LIBHEIF_API
349
+ void heif_image_handle_set_mastering_display_colour_volume(const heif_image_handle*, const heif_mastering_display_colour_volume* in);
350
+
345
351
 
346
352
  // Converts the internal numeric representation of heif_mastering_display_colour_volume to the
347
353
  // normalized values, collected in heif_decoded_mastering_display_colour_volume.
@@ -283,7 +283,7 @@ namespace heif {
283
283
  public:
284
284
  ColorProfile_nclx();
285
285
 
286
- ~ColorProfile_nclx();
286
+ ~ColorProfile_nclx() = default;
287
287
 
288
288
  heif_color_primaries get_color_primaries() const;
289
289
 
@@ -305,10 +305,9 @@ namespace heif {
305
305
  void set_full_range_flag(bool is_full_range);
306
306
 
307
307
  private:
308
- ColorProfile_nclx(heif_color_profile_nclx* nclx)
309
- { mProfile = nclx; }
308
+ ColorProfile_nclx(heif_color_profile_nclx* nclx);
310
309
 
311
- heif_color_profile_nclx* mProfile;
310
+ std::shared_ptr<heif_color_profile_nclx> mProfile;
312
311
 
313
312
  friend class Image;
314
313
  };
@@ -813,12 +812,15 @@ namespace heif {
813
812
 
814
813
  inline ColorProfile_nclx::ColorProfile_nclx()
815
814
  {
816
- mProfile = heif_nclx_color_profile_alloc();
815
+ auto profile = heif_nclx_color_profile_alloc();
816
+ mProfile = std::shared_ptr<heif_color_profile_nclx>(profile,
817
+ [](heif_color_profile_nclx* p) { heif_nclx_color_profile_free(p); });
817
818
  }
818
819
 
819
- inline ColorProfile_nclx::~ColorProfile_nclx()
820
+ inline ColorProfile_nclx::ColorProfile_nclx(heif_color_profile_nclx* nclx)
820
821
  {
821
- heif_nclx_color_profile_free(mProfile);
822
+ mProfile = std::shared_ptr<heif_color_profile_nclx>(nclx,
823
+ [](heif_color_profile_nclx* p) { heif_nclx_color_profile_free(p); });
822
824
  }
823
825
 
824
826
  inline heif_color_primaries ColorProfile_nclx::get_color_primaries() const
@@ -938,7 +940,7 @@ namespace heif {
938
940
 
939
941
  inline void Image::set_nclx_color_profile(const ColorProfile_nclx& nclx)
940
942
  {
941
- Error err = Error(heif_image_set_nclx_color_profile(m_image.get(), nclx.mProfile));
943
+ Error err = Error(heif_image_set_nclx_color_profile(m_image.get(), nclx.mProfile.get()));
942
944
  if (err) {
943
945
  throw err;
944
946
  }
@@ -101,6 +101,16 @@ typedef struct heif_decoding_options
101
101
 
102
102
  // When set to NULL, default options will be used
103
103
  heif_color_conversion_options_ext* color_conversion_options_ext;
104
+
105
+ // version 8 options (v1.21.0)
106
+
107
+ // If enabled, it will decode the media timeline, ignoring the sequence tracks edit-list.
108
+ int ignore_sequence_editlist; // bool
109
+
110
+ heif_color_profile_nclx* output_image_nclx_profile;
111
+
112
+ int num_library_threads; // 0 = let libheif decide (TODO, currently ignored)
113
+ int num_codec_threads; // 0 = use decoder default
104
114
  } heif_decoding_options;
105
115
 
106
116
 
@@ -37,7 +37,9 @@ extern "C" {
37
37
 
38
38
  // ----- encoder -----
39
39
 
40
- // The encoder used for actually encoding an image.
40
+ /**
41
+ * Opaque object that represents the encoder used to code the images.
42
+ */
41
43
  typedef struct heif_encoder heif_encoder;
42
44
 
43
45
  // A description of the encoder's capabilities and name.
@@ -100,7 +102,9 @@ heif_error heif_context_get_encoder_for_format(heif_context* context,
100
102
  enum heif_compression_format format,
101
103
  heif_encoder**);
102
104
 
103
- // You have to release the encoder after use.
105
+ /**
106
+ * Release the encoder object after use.
107
+ */
104
108
  LIBHEIF_API
105
109
  void heif_encoder_release(heif_encoder*);
106
110
 
@@ -254,6 +254,8 @@ enum heif_suberror_code
254
254
 
255
255
  heif_suberror_Unsupported_essential_property = 3007,
256
256
 
257
+ heif_suberror_Unsupported_track_type = 3008,
258
+
257
259
  // --- Encoder_plugin_error ---
258
260
 
259
261
  heif_suberror_Unsupported_bit_depth = 4000,
@@ -208,7 +208,7 @@ uint8_t* heif_image_get_plane(heif_image*,
208
208
  // These are safer variants of the two functions above.
209
209
  // The 'stride' parameter is often multiplied by the image height in the client application.
210
210
  // For very large images, this can lead to integer overflows and, consequently, illegal memory accesses.
211
- // The changed 'stride' parameter types eliminates this common error.
211
+ // The changed 'stride' parameter type eliminates this common error.
212
212
  LIBHEIF_API
213
213
  const uint8_t* heif_image_get_plane_readonly2(const heif_image*,
214
214
  enum heif_channel channel,
@@ -262,6 +262,9 @@ void heif_image_get_pixel_aspect_ratio(const heif_image*, uint32_t* aspect_h, ui
262
262
  LIBHEIF_API
263
263
  void heif_image_set_pixel_aspect_ratio(heif_image*, uint32_t aspect_h, uint32_t aspect_v);
264
264
 
265
+ LIBHEIF_API
266
+ void heif_image_handle_set_pixel_aspect_ratio(heif_image_handle*, uint32_t aspect_h, uint32_t aspect_v);
267
+
265
268
 
266
269
  // --- heif_image allocation
267
270
 
@@ -53,10 +53,17 @@ int heif_image_handle_is_primary_image(const heif_image_handle* handle);
53
53
  LIBHEIF_API
54
54
  heif_item_id heif_image_handle_get_item_id(const heif_image_handle* handle);
55
55
 
56
- // Get the resolution of an image.
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
+ */
57
60
  LIBHEIF_API
58
61
  int heif_image_handle_get_width(const heif_image_handle* handle);
59
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
+ */
60
67
  LIBHEIF_API
61
68
  int heif_image_handle_get_height(const heif_image_handle* handle);
62
69
 
@@ -112,6 +119,8 @@ int heif_image_handle_get_pixel_aspect_ratio(const heif_image_handle*, uint32_t*
112
119
  LIBHEIF_API
113
120
  heif_context* heif_image_handle_get_context(const heif_image_handle* handle);
114
121
 
122
+ LIBHEIF_API
123
+ const char* heif_image_handle_get_gimi_content_id(const heif_image_handle* handle);
115
124
 
116
125
  #ifdef __cplusplus
117
126
  }
@@ -21,7 +21,9 @@
21
21
  #ifndef LIBHEIF_HEIF_ITEMS_H
22
22
  #define LIBHEIF_HEIF_ITEMS_H
23
23
 
24
- #include "libheif/heif.h"
24
+ #include "heif_library.h"
25
+ #include "heif_error.h"
26
+ #include "heif_metadata.h"
25
27
 
26
28
  #ifdef __cplusplus
27
29
  extern "C" {
@@ -167,6 +169,27 @@ LIBHEIF_API
167
169
  void heif_release_item_data(const heif_context* ctx, uint8_t** item_data);
168
170
 
169
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
+
170
193
  // ------------------------- item references -------------------------
171
194
 
172
195
  /**
@@ -65,6 +65,9 @@ extern "C" {
65
65
  #define LIBHEIF_API
66
66
  #endif
67
67
 
68
+ /**
69
+ * Build a 32 bit integer from a 4-character code.
70
+ */
68
71
  #define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
69
72
 
70
73
  #include <libheif/heif_version.h>
@@ -38,6 +38,9 @@ enum heif_metadata_compression
38
38
  heif_metadata_compression_brotli = 5
39
39
  };
40
40
 
41
+ LIBHEIF_API
42
+ int heif_metadata_compression_method_supported(enum heif_metadata_compression method);
43
+
41
44
  // ------------------------- metadata (Exif / XMP) -------------------------
42
45
 
43
46
  // How many metadata blocks are attached to an image. If you only want to get EXIF data,
@@ -20,6 +20,7 @@
20
20
 
21
21
  #ifndef LIBHEIF_HEIF_PLUGIN_H
22
22
  #define LIBHEIF_HEIF_PLUGIN_H
23
+ #include "heif_sequences.h"
23
24
 
24
25
  #ifdef __cplusplus
25
26
  extern "C" {
@@ -43,9 +44,14 @@ extern "C" {
43
44
  // 1.13 2 3 2
44
45
  // 1.15 3 3 2
45
46
  // 1.20 4 3 2
47
+ // 1.21 5 4 2
46
48
 
47
- #define heif_decoder_plugin_latest_version 4
48
- #define heif_encoder_plugin_latest_version 3
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
49
55
 
50
56
  // ====================================================================================================
51
57
  // Decoder plugin API
@@ -53,6 +59,22 @@ extern "C" {
53
59
  // added as plugins. A plugin has to implement the functions specified in heif_decoder_plugin
54
60
  // and the plugin has to be registered to the libheif library using heif_register_decoder().
55
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
+
56
78
  typedef struct heif_decoder_plugin
57
79
  {
58
80
  // API version supported by this plugin (see table above for supported versions)
@@ -118,6 +140,24 @@ typedef struct heif_decoder_plugin
118
140
 
119
141
  // --- version 5 functions will follow below ... ---
120
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
+
121
161
  // --- Note: when adding new versions, also update `heif_decoder_plugin_latest_version`.
122
162
  } heif_decoder_plugin;
123
163
 
@@ -240,7 +280,27 @@ typedef struct heif_encoder_plugin
240
280
  void (* query_encoded_size)(void* encoder, uint32_t input_width, uint32_t input_height,
241
281
  uint32_t* encoded_width, uint32_t* encoded_height);
242
282
 
243
- // --- version 4 functions will follow below ... ---
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 ... ---
244
304
 
245
305
  // --- Note: when adding new versions, also update `heif_encoder_plugin_latest_version`.
246
306
  } heif_encoder_plugin;
@@ -40,7 +40,8 @@ enum heif_item_property_type
40
40
  heif_item_property_type_image_size = heif_fourcc('i', 's', 'p', 'e'),
41
41
  heif_item_property_type_uuid = heif_fourcc('u', 'u', 'i', 'd'),
42
42
  heif_item_property_type_tai_clock_info = heif_fourcc('t', 'a', 'i', 'c'),
43
- heif_item_property_type_tai_timestamp = heif_fourcc('i', 't', 'a', 'i')
43
+ heif_item_property_type_tai_timestamp = heif_fourcc('i', 't', 'a', 'i'),
44
+ heif_item_property_type_extended_language = heif_fourcc('e', 'l', 'n', 'g')
44
45
  };
45
46
 
46
47
  // Get the heif_property_id for a heif_item_id.
@@ -112,6 +113,7 @@ enum heif_transform_mirror_direction
112
113
  };
113
114
 
114
115
  // Will return 'heif_transform_mirror_direction_invalid' in case of error.
116
+ // If 'propertyId==0', it returns the first imir property found.
115
117
  LIBHEIF_API
116
118
  enum heif_transform_mirror_direction heif_item_get_property_transform_mirror(const heif_context* context,
117
119
  heif_item_id itemId,
@@ -119,6 +121,7 @@ enum heif_transform_mirror_direction heif_item_get_property_transform_mirror(con
119
121
 
120
122
  // Returns only 0, 90, 180, or 270 angle values.
121
123
  // Returns -1 in case of error (but it will only return an error in case of wrong usage).
124
+ // If 'propertyId==0', it returns the first irot property found.
122
125
  LIBHEIF_API
123
126
  int heif_item_get_property_transform_rotation_ccw(const heif_context* context,
124
127
  heif_item_id itemId,
@@ -127,6 +130,7 @@ int heif_item_get_property_transform_rotation_ccw(const heif_context* context,
127
130
  // Returns the number of pixels that should be removed from the four edges.
128
131
  // Because of the way this data is stored, you have to pass the image size at the moment of the crop operation
129
132
  // to compute the cropped border sizes.
133
+ // If 'propertyId==0', it returns the first clap property found.
130
134
  LIBHEIF_API
131
135
  void heif_item_get_property_transform_crop_borders(const heif_context* context,
132
136
  heif_item_id itemId,
@@ -22,7 +22,9 @@
22
22
  #ifndef LIBHEIF_HEIF_REGIONS_H
23
23
  #define LIBHEIF_HEIF_REGIONS_H
24
24
 
25
- #include "heif.h"
25
+ #include "heif_image_handle.h"
26
+ #include "heif_library.h"
27
+ #include "heif_error.h"
26
28
 
27
29
  #ifdef __cplusplus
28
30
  extern "C" {
@@ -63,6 +63,11 @@ typedef struct heif_security_limits
63
63
  uint64_t max_total_memory;
64
64
  uint32_t max_sample_description_box_entries;
65
65
  uint32_t max_sample_group_description_box_entries;
66
+
67
+ // --- version 3
68
+
69
+ uint32_t max_sequence_frames;
70
+ uint32_t max_number_of_file_brands;
66
71
  } heif_security_limits;
67
72
 
68
73
 
@@ -115,6 +115,7 @@ enum heif_track_type_4cc
115
115
  {
116
116
  heif_track_type_video = heif_fourcc('v', 'i', 'd', 'e'),
117
117
  heif_track_type_image_sequence = heif_fourcc('p', 'i', 'c', 't'),
118
+ heif_track_type_auxiliary = heif_fourcc('a', 'u', 'x', 'v'),
118
119
  heif_track_type_metadata = heif_fourcc('m', 'e', 't', 'a')
119
120
  };
120
121
 
@@ -128,6 +129,22 @@ enum heif_track_type_4cc
128
129
  LIBHEIF_API
129
130
  heif_track_type heif_track_get_track_handler_type(const heif_track*);
130
131
 
132
+
133
+ enum heif_auxiliary_track_info_type
134
+ {
135
+ heif_auxiliary_track_info_type_unknown = 0,
136
+ heif_auxiliary_track_info_type_alpha = 1
137
+ };
138
+
139
+ LIBHEIF_API
140
+ heif_auxiliary_track_info_type heif_track_get_auxiliary_info_type(const heif_track*);
141
+
142
+ LIBHEIF_API
143
+ const char* heif_track_get_auxiliary_info_type_urn(const heif_track*);
144
+
145
+ LIBHEIF_API
146
+ int heif_track_has_alpha_channel(const heif_track*);
147
+
131
148
  /**
132
149
  * Get the timescale (clock ticks per second) for this track.
133
150
  * Note that this can be different from the timescale used at sequence level.
@@ -189,7 +206,8 @@ uint32_t heif_track_get_sample_entry_type_of_first_cluster(const heif_track*);
189
206
  * @param out_uri A string with the URI will be returned. Free this string with `heif_string_release()`.
190
207
  */
191
208
  LIBHEIF_API
192
- heif_error heif_track_get_urim_sample_entry_uri_of_first_cluster(const heif_track* track, const char** out_uri);
209
+ heif_error heif_track_get_urim_sample_entry_uri_of_first_cluster(const heif_track*,
210
+ const char** out_uri);
193
211
 
194
212
 
195
213
  /** Sequence sample object that can hold any raw byte data.
@@ -245,6 +263,12 @@ uint32_t heif_raw_sequence_sample_get_duration(const heif_raw_sequence_sample*);
245
263
  LIBHEIF_API
246
264
  void heif_context_set_sequence_timescale(heif_context*, uint32_t timescale);
247
265
 
266
+ // Number of times the sequence should be played in total (default = 1).
267
+ // Can be set to heif_sequence_maximum_number_of_repetitions.
268
+ LIBHEIF_API
269
+ void heif_context_set_number_of_sequence_repetitions(heif_context*, uint32_t number_of_repetitions);
270
+
271
+ #define heif_sequence_maximum_number_of_repetitions 0
248
272
 
249
273
  /**
250
274
  * Specifies whether a 'sample auxiliary info' is stored with the samples.
@@ -288,6 +312,8 @@ void heif_track_options_set_timescale(heif_track_options*, uint32_t timescale);
288
312
  *
289
313
  * If 'false', all aux_info will be written as one block after the compressed image data.
290
314
  * This has the advantage that no aux_info offsets have to be written.
315
+ *
316
+ * Note: currently ignored. Interleaved writing is disabled.
291
317
  */
292
318
  LIBHEIF_API
293
319
  void heif_track_options_set_interleaved_sample_aux_infos(heif_track_options*, int interleaved_flag);
@@ -312,7 +338,20 @@ void heif_track_options_set_gimi_track_id(heif_track_options*,
312
338
 
313
339
  // --- writing visual tracks
314
340
 
315
- // This structure is for future use. It is not defined yet.
341
+ enum heif_sequence_gop_structure
342
+ {
343
+ // Only independently decodable keyframes.
344
+ heif_sequence_gop_structure_intra_only,
345
+
346
+ // No frame reordering, usually an IPPPP structure.
347
+ heif_sequence_gop_structure_lowdelay,
348
+
349
+ // All frame types are allowed, including frame reordering, to achieve
350
+ // the best compression ratio.
351
+ heif_sequence_gop_structure_unrestricted
352
+ };
353
+
354
+
316
355
  typedef struct heif_sequence_encoding_options
317
356
  {
318
357
  uint8_t version;
@@ -324,8 +363,17 @@ typedef struct heif_sequence_encoding_options
324
363
  const heif_color_profile_nclx* output_nclx_profile;
325
364
 
326
365
  heif_color_conversion_options color_conversion_options;
366
+
367
+ // version 2 options
368
+
369
+ enum heif_sequence_gop_structure gop_structure;
370
+ int keyframe_distance_min; // 0 - undefined
371
+ int keyframe_distance_max; // 0 - undefined
372
+
373
+ int save_alpha_channel;
327
374
  } heif_sequence_encoding_options;
328
375
 
376
+
329
377
  LIBHEIF_API
330
378
  heif_sequence_encoding_options* heif_sequence_encoding_options_alloc(void);
331
379
 
@@ -362,6 +410,8 @@ void heif_image_set_duration(heif_image*, uint32_t duration);
362
410
  * Encode the image into a visual track.
363
411
  * If the passed track is no visual track, an error will be returned.
364
412
  *
413
+ * @param image The input image to append to the sequence.
414
+ * @param encoder The encoder used for encoding the image.
365
415
  * @param sequence_encoding_options Options for sequence encoding. If NULL, default options will be used.
366
416
  */
367
417
  LIBHEIF_API
@@ -370,14 +420,31 @@ heif_error heif_track_encode_sequence_image(heif_track*,
370
420
  heif_encoder* encoder,
371
421
  const heif_sequence_encoding_options* sequence_encoding_options);
372
422
 
423
+ /**
424
+ * When all sequence frames have been sent, you can to call this function to let the
425
+ * library know that no more frames will follow. This is strongly recommended, but optional
426
+ * for backwards compatibility.
427
+ * If you do not end the sequence explicitly with this function, it will be closed
428
+ * automatically when the HEIF file is written. Using this function has the advantage
429
+ * that you can free the {@link heif_encoder} afterwards (with {@link heif_encoder_release}).
430
+ * If you do not use call function, you have to keep the {@link heif_encoder} alive
431
+ * until the HEIF file is written.
432
+ */
433
+ LIBHEIF_API
434
+ heif_error heif_track_encode_end_of_sequence(heif_track*,
435
+ heif_encoder* encoder);
436
+
373
437
  // --- metadata tracks
374
438
 
375
439
  /**
376
440
  * Add a metadata track.
441
+ * The track is created as a 'urim' "URI Meta Sample Entry".
377
442
  * The track content type is specified by the 'uri' parameter.
378
- * This will be created as a 'urim' "URI Meta Sample Entry".
379
443
  *
380
- * @param options Optional track creation options. If NULL, default options will be used.
444
+ * @param uri Track content type.
445
+ * @param options Optional track creation options. If NULL, default options will be used.
446
+ * @param out_track Returns the created track object. If this is not NULL, you have to
447
+ * free the returned track with {@link heif_track_release}.
381
448
  */
382
449
  LIBHEIF_API
383
450
  heif_error heif_context_add_uri_metadata_sequence_track(heif_context*,
@@ -0,0 +1,161 @@
1
+ /*
2
+ * HEIF codec.
3
+ * Copyright (c) 2023 Dirk Farin <dirk.farin@gmail.com>
4
+ * Copyright (c) 2025 Brad Hards <bradh@frogmouth.net>
5
+ *
6
+ * This file is part of libheif.
7
+ *
8
+ * libheif is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU Lesser General Public License as
10
+ * published by the Free Software Foundation, either version 3 of
11
+ * the License, or (at your option) any later version.
12
+ *
13
+ * libheif is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public License
19
+ * along with libheif. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+ #ifndef LIBHEIF_HEIF_TEXT_H
23
+ #define LIBHEIF_HEIF_TEXT_H
24
+
25
+ #include "heif_image_handle.h"
26
+ #include "heif_library.h"
27
+ #include "heif_error.h"
28
+
29
+ #ifdef __cplusplus
30
+ extern "C" {
31
+ #endif
32
+
33
+ // --- text items and fonts
34
+
35
+ // See ISO/IEC 23008-12:2025 Section 6.10 "Text and font items"
36
+
37
+ typedef struct heif_text_item heif_text_item;
38
+
39
+ /**
40
+ * Get the number of text items that are attached to an image.
41
+ *
42
+ * @param image_handle the image handle for the image to query.
43
+ * @return the number of text items, which can be zero.
44
+ */
45
+ LIBHEIF_API
46
+ int heif_image_handle_get_number_of_text_items(const heif_image_handle* image_handle);
47
+
48
+ /**
49
+ * Get the text item identifiers for the text items attached to an image.
50
+ *
51
+ * Possible usage (in C++):
52
+ * @code
53
+ * int numTextItems = heif_image_handle_get_number_of_text_items(handle);
54
+ * if (numTextItems > 0) {
55
+ * std::vector<heif_item_id> text_item_ids(numTextItems);
56
+ * heif_image_handle_get_list_of_text_item_ids(handle, text_item_ids.data(), numTextItems);
57
+ * // use text item ids
58
+ * }
59
+ * @endcode
60
+ *
61
+ * @param image_handle the image handle for the parent image to query
62
+ * @param text_item_ids_array array to put the item identifiers into
63
+ * @param max_count the maximum number of text identifiers
64
+ * @return the number of text item identifiers that were returned.
65
+ */
66
+ LIBHEIF_API
67
+ int heif_image_handle_get_list_of_text_item_ids(const heif_image_handle* image_handle,
68
+ heif_item_id* text_item_ids_array,
69
+ int max_count);
70
+
71
+
72
+ /**
73
+ * Get the text item.
74
+ *
75
+ * Caller is responsible for release of the output heif_text_item with heif_text_item_release().
76
+ *
77
+ * @param context the context to get the text item from, usually from a file operation
78
+ * @param text_item_id the identifier for the text item
79
+ * @param out pointer to pointer to the resulting text item
80
+ * @return heif_error_ok on success, or an error value indicating the problem
81
+ */
82
+ LIBHEIF_API
83
+ heif_error heif_context_get_text_item(const heif_context* context,
84
+ heif_item_id text_item_id,
85
+ heif_text_item** out);
86
+
87
+ /**
88
+ * Get the item identifier for a text item.
89
+ *
90
+ * @param text_item the text item to query
91
+ * @return the text item identifier (or 0 if the text_item is null)
92
+ */
93
+ LIBHEIF_API
94
+ heif_item_id heif_text_item_get_id(heif_text_item* text_item);
95
+
96
+ /**
97
+ * Get the item content for a text item.
98
+ *
99
+ * This is the payload text, in the format given by the associated content_type.
100
+ *
101
+ * @param text_item the text item to query
102
+ * @return the text item content (or null if the text_item is null). The returned string shall be released
103
+ * with heif_string_release().
104
+ */
105
+ LIBHEIF_API
106
+ const char* heif_text_item_get_content(heif_text_item* text_item);
107
+
108
+ /**
109
+ * This function is similar to heif_item_get_property_extended_language(), but
110
+ * takes a `heif_text_item` as parameter.
111
+ *
112
+ * @param text_item The text item for which we are requesting the language.
113
+ * @param out_language Output parameter for the text language. Free with heif_string_release().
114
+ * @return
115
+ */
116
+ LIBHEIF_API
117
+ heif_error heif_text_item_get_property_extended_language(const heif_text_item* text_item,
118
+ char** out_language);
119
+
120
+ // --- adding text items
121
+
122
+ /**
123
+ * Add a text item to an image.
124
+ */
125
+ LIBHEIF_API
126
+ heif_error heif_image_handle_add_text_item(heif_image_handle *image_handle,
127
+ const char *content_type,
128
+ const char *text,
129
+ heif_text_item** out_text_item);
130
+
131
+ /**
132
+ * Release a text item.
133
+ *
134
+ * This should be called on items from heif_context_add_text_item().
135
+ *
136
+ * @param text_item the item to release.
137
+ */
138
+ LIBHEIF_API
139
+ void heif_text_item_release(heif_text_item* text_item);
140
+
141
+ /**
142
+ * Set the extended language property to the text item.
143
+ *
144
+ * This adds an RFC 5346 (IETF BCP 47) extended language tag, such as "en-AU".
145
+ *
146
+ * @param text_item the text item to query
147
+ * @param language the language to set
148
+ * @param out_optional_propertyId Output parameter for the property ID of the language property.
149
+ * This parameter may be NULL if the info is not required.
150
+ * @return heif_error_ok on success, or an error value indicating the problem
151
+ */
152
+ LIBHEIF_API
153
+ heif_error heif_text_item_set_extended_language(heif_text_item* text_item,
154
+ const char *language,
155
+ heif_property_id* out_optional_propertyId);
156
+
157
+ #ifdef __cplusplus
158
+ }
159
+ #endif
160
+
161
+ #endif
@@ -28,10 +28,10 @@
28
28
  #define LIBHEIF_HEIF_VERSION_H
29
29
 
30
30
  /* Numeric representation of the version */
31
- #define LIBHEIF_NUMERIC_VERSION ((1<<24) | (20<<16) | (2<<8) | 0)
31
+ #define LIBHEIF_NUMERIC_VERSION ((1<<24) | (21<<16) | (1<<8) | 0)
32
32
 
33
33
  /* Version string */
34
- #define LIBHEIF_VERSION "1.20.2"
34
+ #define LIBHEIF_VERSION "1.21.1"
35
35
 
36
36
  #define LIBHEIF_PLUGIN_DIRECTORY "/target/lib/libheif"
37
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@img/sharp-libvips-dev",
3
- "version": "1.3.0-rc.0",
3
+ "version": "1.3.0-rc.2",
4
4
  "description": "Header files and C++ sources for libvips and dependencies required when compiling sharp from source",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://sharp.pixelplumbing.com",
package/versions.json CHANGED
@@ -9,9 +9,9 @@
9
9
  "fontconfig": "2.17.1",
10
10
  "freetype": "2.14.1",
11
11
  "fribidi": "1.0.16",
12
- "glib": "2.87.0",
13
- "harfbuzz": "12.2.0",
14
- "heif": "1.20.2",
12
+ "glib": "2.87.1",
13
+ "harfbuzz": "12.3.0",
14
+ "heif": "1.21.1",
15
15
  "highway": "1.3.0",
16
16
  "imagequant": "2.4.1",
17
17
  "lcms": "2.17",
@@ -23,7 +23,7 @@
23
23
  "rsvg": "2.61.3",
24
24
  "tiff": "4.7.1",
25
25
  "uhdr": "1.4.0",
26
- "vips": "8.18.0-rc2",
26
+ "vips": "8.18.0",
27
27
  "webp": "1.6.0",
28
28
  "xml2": "2.15.1",
29
29
  "zlib-ng": "2.3.2"