Commit 6c3a880d for libheif

commit 6c3a880dad22217cf812ccb26fe83a698a995274
Author: Dirk Farin <dirk.farin@gmail.com>
Date:   Tue Jan 20 12:45:45 2026 +0100

    add typedef to C API enums to allow usage without 'enum' keyword

diff --git a/libheif/api/libheif/heif_aux_images.h b/libheif/api/libheif/heif_aux_images.h
index db4c7360..ad239e63 100644
--- a/libheif/api/libheif/heif_aux_images.h
+++ b/libheif/api/libheif/heif_aux_images.h
@@ -51,12 +51,12 @@ heif_error heif_image_handle_get_depth_image_handle(const heif_image_handle* han
                                                     heif_image_handle** out_depth_handle);


-enum heif_depth_representation_type {
+typedef enum heif_depth_representation_type {
   heif_depth_representation_type_uniform_inverse_Z = 0,
   heif_depth_representation_type_uniform_disparity = 1,
   heif_depth_representation_type_uniform_Z = 2,
   heif_depth_representation_type_nonuniform_disparity = 3
-};
+} heif_depth_representation_type;

 typedef struct heif_depth_representation_info {
   uint8_t version;
diff --git a/libheif/api/libheif/heif_brands.h b/libheif/api/libheif/heif_brands.h
index b6eb2104..81263d35 100644
--- a/libheif/api/libheif/heif_brands.h
+++ b/libheif/api/libheif/heif_brands.h
@@ -311,13 +311,13 @@ const char* heif_get_file_mime_type(const uint8_t* data, int len);

 // ========================= file type check ======================

-enum heif_filetype_result
+typedef enum heif_filetype_result
 {
   heif_filetype_no,
   heif_filetype_yes_supported,   // it is heif and can be read by libheif
   heif_filetype_yes_unsupported, // it is heif, but cannot be read by libheif
   heif_filetype_maybe // not sure whether it is an heif, try detection with more input data
-};
+} heif_filetype_result;

 // input data should be at least 12 bytes
 LIBHEIF_API
@@ -342,7 +342,7 @@ int heif_check_jpeg_filetype(const uint8_t* data, int len);
 // ===================== DEPRECATED =====================

 // DEPRECATED, use heif_brand2 and the heif_brand2_* constants instead
-enum heif_brand
+typedef enum heif_brand
 {
   heif_unknown_brand,
   heif_heic, // HEIF image with h265
@@ -362,7 +362,7 @@ enum heif_brand
   heif_evbs, // EVC sequence
   heif_j2ki, // JPEG2000 image
   heif_j2is, // JPEG2000 image sequence
-};
+} heif_brand;

 // input data should be at least 12 bytes
 // DEPRECATED, use heif_read_main_brand() instead
diff --git a/libheif/api/libheif/heif_color.h b/libheif/api/libheif/heif_color.h
index 8d054cf4..c9dcfc8d 100644
--- a/libheif/api/libheif/heif_color.h
+++ b/libheif/api/libheif/heif_color.h
@@ -31,7 +31,7 @@ extern "C" {
 typedef struct heif_image heif_image;


-enum heif_chroma_downsampling_algorithm
+typedef enum heif_chroma_downsampling_algorithm
 {
   heif_chroma_downsampling_nearest_neighbor = 1,
   heif_chroma_downsampling_average = 2,
@@ -39,13 +39,13 @@ enum heif_chroma_downsampling_algorithm
   // Combine with 'heif_chroma_upsampling_bilinear' for best quality.
   // Makes edges look sharper when using YUV 420 with bilinear chroma upsampling.
   heif_chroma_downsampling_sharp_yuv = 3
-};
+} heif_chroma_downsampling_algorithm;

-enum heif_chroma_upsampling_algorithm
+typedef enum heif_chroma_upsampling_algorithm
 {
   heif_chroma_upsampling_nearest_neighbor = 1,
   heif_chroma_upsampling_bilinear = 2
-};
+} heif_chroma_upsampling_algorithm;


 typedef struct heif_color_conversion_options
@@ -71,12 +71,12 @@ typedef struct heif_color_conversion_options
 } heif_color_conversion_options;


-enum heif_alpha_composition_mode
+typedef enum heif_alpha_composition_mode
 {
   heif_alpha_composition_mode_none,
   heif_alpha_composition_mode_solid_color,
   heif_alpha_composition_mode_checkerboard,
-};
+} heif_alpha_composition_mode;


 typedef struct heif_color_conversion_options_ext
@@ -111,13 +111,13 @@ void heif_color_conversion_options_ext_free(heif_color_conversion_options_ext*);

 // ------------------------- color profiles -------------------------

-enum heif_color_profile_type
+typedef enum heif_color_profile_type
 {
   heif_color_profile_type_not_present = 0,
   heif_color_profile_type_nclx = heif_fourcc('n', 'c', 'l', 'x'),
   heif_color_profile_type_rICC = heif_fourcc('r', 'I', 'C', 'C'),
   heif_color_profile_type_prof = heif_fourcc('p', 'r', 'o', 'f')
-};
+} heif_color_profile_type;


 // Returns 'heif_color_profile_type_not_present' if there is no color profile.
@@ -137,7 +137,7 @@ struct heif_error heif_image_handle_get_raw_color_profile(const heif_image_handl
                                                           void* out_data);


-enum heif_color_primaries
+typedef enum heif_color_primaries
 {
   heif_color_primaries_ITU_R_BT_709_5 = 1, // g=0.3;0.6, b=0.15;0.06, r=0.64;0.33, w=0.3127,0.3290
   heif_color_primaries_unspecified = 2,
@@ -151,9 +151,9 @@ enum heif_color_primaries
   heif_color_primaries_SMPTE_RP_431_2 = 11,
   heif_color_primaries_SMPTE_EG_432_1 = 12,
   heif_color_primaries_EBU_Tech_3213_E = 22
-};
+} heif_color_primaries;

-enum heif_transfer_characteristics
+typedef enum heif_transfer_characteristics
 {
   heif_transfer_characteristic_ITU_R_BT_709_5 = 1,
   heif_transfer_characteristic_unspecified = 2,
@@ -172,9 +172,9 @@ enum heif_transfer_characteristics
   heif_transfer_characteristic_ITU_R_BT_2100_0_PQ = 16,
   heif_transfer_characteristic_SMPTE_ST_428_1 = 17,
   heif_transfer_characteristic_ITU_R_BT_2100_0_HLG = 18
-};
+} heif_transfer_characteristics;

-enum heif_matrix_coefficients
+typedef enum heif_matrix_coefficients
 {
   heif_matrix_coefficients_RGB_GBR = 0,
   heif_matrix_coefficients_ITU_R_BT_709_5 = 1,  // TODO: or 709-6 according to h.273
@@ -190,7 +190,7 @@ enum heif_matrix_coefficients
   heif_matrix_coefficients_chromaticity_derived_non_constant_luminance = 12,
   heif_matrix_coefficients_chromaticity_derived_constant_luminance = 13,
   heif_matrix_coefficients_ICtCp = 14
-};
+} heif_matrix_coefficients;

 typedef struct heif_color_profile_nclx
 {
diff --git a/libheif/api/libheif/heif_context.h b/libheif/api/libheif/heif_context.h
index a9f2ff02..c978b351 100644
--- a/libheif/api/libheif/heif_context.h
+++ b/libheif/api/libheif/heif_context.h
@@ -35,7 +35,7 @@ extern "C" {
 /**
  * libheif known compression formats.
  */
-enum heif_compression_format
+typedef enum heif_compression_format
 {
   /**
    * Unspecified / undefined compression format.
@@ -115,7 +115,7 @@ enum heif_compression_format
    * The core encoding is defined in ISO/IEC 15444-15, or ITU-T T.814.
   */
   heif_compression_HTJ2K = 10
-};
+} heif_compression_format;


 // ========================= heif_context =========================
@@ -136,13 +136,13 @@ void heif_context_free(heif_context*);

 typedef struct heif_reading_options heif_reading_options;

-enum heif_reader_grow_status
+typedef enum heif_reader_grow_status
 {
   heif_reader_grow_status_size_reached,    // requested size has been reached, we can read until this point
   heif_reader_grow_status_timeout,         // size has not been reached yet, but it may still grow further (deprecated)
   heif_reader_grow_status_size_beyond_eof, // size has not been reached and never will. The file has grown to its full size
   heif_reader_grow_status_error            // an error has occurred
-};
+} heif_reader_grow_status;


 typedef struct heif_reader_range_request_result
diff --git a/libheif/api/libheif/heif_decoding.h b/libheif/api/libheif/heif_decoding.h
index 26118dec..e580b162 100644
--- a/libheif/api/libheif/heif_decoding.h
+++ b/libheif/api/libheif/heif_decoding.h
@@ -46,11 +46,11 @@ LIBHEIF_API
 int heif_have_decoder_for_format(enum heif_compression_format format);


-enum heif_progress_step
+typedef enum heif_progress_step
 {
   heif_progress_step_total = 0,
   heif_progress_step_load_tile = 1
-};
+} heif_progress_step;


 typedef struct heif_decoding_options
diff --git a/libheif/api/libheif/heif_encoding.h b/libheif/api/libheif/heif_encoding.h
index 2a20edd9..2261340d 100644
--- a/libheif/api/libheif/heif_encoding.h
+++ b/libheif/api/libheif/heif_encoding.h
@@ -146,12 +146,12 @@ LIBHEIF_API
 const char* heif_encoder_parameter_get_name(const heif_encoder_parameter*);


-enum heif_encoder_parameter_type
+typedef enum heif_encoder_parameter_type
 {
   heif_encoder_parameter_type_integer = 1,
   heif_encoder_parameter_type_boolean = 2,
   heif_encoder_parameter_type_string = 3
-};
+} heif_encoder_parameter_type;

 // Return the parameter type.
 LIBHEIF_API
@@ -256,7 +256,7 @@ int heif_encoder_has_default(heif_encoder*,


 // The orientation values are defined equal to the EXIF Orientation tag.
-enum heif_orientation
+typedef enum heif_orientation
 {
   heif_orientation_normal = 1,
   heif_orientation_flip_horizontally = 2,
@@ -266,7 +266,7 @@ enum heif_orientation
   heif_orientation_rotate_90_cw = 6,
   heif_orientation_rotate_90_cw_then_flip_vertically = 7,
   heif_orientation_rotate_270_cw = 8
-};
+} heif_orientation;


 typedef struct heif_encoding_options
diff --git a/libheif/api/libheif/heif_error.h b/libheif/api/libheif/heif_error.h
index 0c247fbf..a5097bcc 100644
--- a/libheif/api/libheif/heif_error.h
+++ b/libheif/api/libheif/heif_error.h
@@ -29,7 +29,7 @@ extern "C" {
 #include <stdint.h>


-enum heif_error_code
+typedef enum heif_error_code
 {
   // Everything ok, no error occurred.
   heif_error_Ok = 0,
@@ -71,10 +71,10 @@ enum heif_error_code
   heif_error_Canceled = 12,

   heif_error_End_of_sequence = 13
-};
+} heif_error_code;


-enum heif_suberror_code
+typedef enum heif_suberror_code
 {
   // no further information available
   heif_suberror_Unspecified = 0,
@@ -278,7 +278,7 @@ enum heif_suberror_code
   heif_suberror_Plugin_is_not_loaded = 6001,         // trying to remove a plugin that is not loaded
   heif_suberror_Cannot_read_plugin_directory = 6002, // error while scanning the directory for plugins
   heif_suberror_No_matching_decoder_installed = 6003 // no decoder found for that compression format
-};
+} heif_suberror_code;


 typedef struct heif_error
diff --git a/libheif/api/libheif/heif_experimental.h b/libheif/api/libheif/heif_experimental.h
index dc16f369..8776eee9 100644
--- a/libheif/api/libheif/heif_experimental.h
+++ b/libheif/api/libheif/heif_experimental.h
@@ -179,14 +179,14 @@ void heif_pyramid_layer_info_release(heif_pyramid_layer_info*);

 // --- other pixel datatype support

-enum heif_channel_datatype
+typedef enum heif_channel_datatype
 {
   heif_channel_datatype_undefined = 0,
   heif_channel_datatype_unsigned_integer = 1,
   heif_channel_datatype_signed_integer = 2,
   heif_channel_datatype_floating_point = 3,
   heif_channel_datatype_complex_number = 4
-};
+} heif_channel_datatype;

 #if HEIF_ENABLE_EXPERIMENTAL_FEATURES
 LIBHEIF_API
diff --git a/libheif/api/libheif/heif_image.h b/libheif/api/libheif/heif_image.h
index 5e63930f..32a11628 100644
--- a/libheif/api/libheif/heif_image.h
+++ b/libheif/api/libheif/heif_image.h
@@ -31,7 +31,7 @@ extern "C" {
 #include <stdint.h>


-enum heif_chroma
+typedef enum heif_chroma
 {
   heif_chroma_undefined = 99,
   heif_chroma_monochrome = 0,
@@ -44,14 +44,14 @@ enum heif_chroma
   heif_chroma_interleaved_RRGGBBAA_BE = 13, // HDR, big endian.
   heif_chroma_interleaved_RRGGBB_LE = 14,   // HDR, little endian.
   heif_chroma_interleaved_RRGGBBAA_LE = 15  // HDR, little endian.
-};
+} heif_chroma;

 // DEPRECATED ENUM NAMES
 #define heif_chroma_interleaved_24bit  heif_chroma_interleaved_RGB
 #define heif_chroma_interleaved_32bit  heif_chroma_interleaved_RGBA


-enum heif_colorspace
+typedef enum heif_colorspace
 {
   heif_colorspace_undefined = 99,

@@ -76,9 +76,9 @@ enum heif_colorspace

   // Indicates that this image has no visual channels.
   heif_colorspace_nonvisual = 3
-};
+} heif_colorspace;

-enum heif_channel
+typedef enum heif_channel
 {
   heif_channel_Y = 0,
   heif_channel_Cb = 1,
@@ -91,7 +91,7 @@ enum heif_channel
   heif_channel_filter_array = 11,
   heif_channel_depth = 12,
   heif_channel_disparity = 13
-};
+} heif_channel;


 // An heif_image contains a decoded pixel image in various colorspaces, chroma formats,
diff --git a/libheif/api/libheif/heif_library.h b/libheif/api/libheif/heif_library.h
index f1852efb..f6fbcb81 100644
--- a/libheif/api/libheif/heif_library.h
+++ b/libheif/api/libheif/heif_library.h
@@ -160,11 +160,11 @@ void heif_deinit(void);

 // --- Plugins are currently only supported on Unix platforms.

-enum heif_plugin_type
+typedef enum heif_plugin_type
 {
   heif_plugin_type_encoder,
   heif_plugin_type_decoder
-};
+} heif_plugin_type;

 typedef struct heif_plugin_info
 {
diff --git a/libheif/api/libheif/heif_metadata.h b/libheif/api/libheif/heif_metadata.h
index 031a763d..94ba76ce 100644
--- a/libheif/api/libheif/heif_metadata.h
+++ b/libheif/api/libheif/heif_metadata.h
@@ -28,7 +28,7 @@ extern "C" {
 #include <libheif/heif_library.h>


-enum heif_metadata_compression
+typedef enum heif_metadata_compression
 {
   heif_metadata_compression_off = 0,
   heif_metadata_compression_auto = 1,
@@ -36,7 +36,7 @@ enum heif_metadata_compression
   heif_metadata_compression_deflate = 3,
   heif_metadata_compression_zlib = 4,    // do not use for header data
   heif_metadata_compression_brotli = 5
-};
+} heif_metadata_compression;

 LIBHEIF_API
 int heif_metadata_compression_method_supported(enum heif_metadata_compression method);
diff --git a/libheif/api/libheif/heif_plugin.h b/libheif/api/libheif/heif_plugin.h
index a45d2343..ce7a9859 100644
--- a/libheif/api/libheif/heif_plugin.h
+++ b/libheif/api/libheif/heif_plugin.h
@@ -162,24 +162,24 @@ typedef struct heif_decoder_plugin
 } heif_decoder_plugin;


-enum heif_encoded_data_type
+typedef enum heif_encoded_data_type
 {
   heif_encoded_data_type_HEVC_header = 1,
   heif_encoded_data_type_HEVC_image = 2,
   heif_encoded_data_type_HEVC_depth_SEI = 3
-};
+} heif_encoded_data_type;


 // Specifies the class of the input image content.
 // The encoder may want to encode different classes with different parameters
 // (e.g. always encode alpha lossless)
-enum heif_image_input_class
+typedef enum heif_image_input_class
 {
   heif_image_input_class_normal = 1,
   heif_image_input_class_alpha = 2,
   heif_image_input_class_depth = 3,
   heif_image_input_class_thumbnail = 4
-};
+} heif_image_input_class;


 typedef struct heif_encoder_plugin
diff --git a/libheif/api/libheif/heif_properties.h b/libheif/api/libheif/heif_properties.h
index 9a3f15b5..ceda2aa2 100644
--- a/libheif/api/libheif/heif_properties.h
+++ b/libheif/api/libheif/heif_properties.h
@@ -29,7 +29,7 @@ extern "C" {

 // ------------------------- item properties -------------------------

-enum heif_item_property_type
+typedef enum heif_item_property_type
 {
 //  heif_item_property_unknown = -1,
   heif_item_property_type_invalid = 0,
@@ -42,7 +42,7 @@ enum heif_item_property_type
   heif_item_property_type_tai_clock_info = heif_fourcc('t', 'a', 'i', 'c'),
   heif_item_property_type_tai_timestamp = heif_fourcc('i', 't', 'a', 'i'),
   heif_item_property_type_extended_language = heif_fourcc('e', 'l', 'n', 'g')
-};
+} heif_item_property_type;

 // Get the heif_property_id for a heif_item_id.
 // You may specify which property 'type' you want to receive.
@@ -105,12 +105,12 @@ heif_error heif_item_add_property_user_description(const heif_context* context,
 LIBHEIF_API
 void heif_property_user_description_release(heif_property_user_description*);

-enum heif_transform_mirror_direction
+typedef enum heif_transform_mirror_direction
 {
   heif_transform_mirror_direction_invalid = -1,
   heif_transform_mirror_direction_vertical = 0,    // flip image vertically
   heif_transform_mirror_direction_horizontal = 1   // flip image horizontally
-};
+} heif_transform_mirror_direction;

 // Will return 'heif_transform_mirror_direction_invalid' in case of error.
 // If 'propertyId==0', it returns the first imir property found.
diff --git a/libheif/api/libheif/heif_regions.h b/libheif/api/libheif/heif_regions.h
index f1820b3d..d9a3f61f 100644
--- a/libheif/api/libheif/heif_regions.h
+++ b/libheif/api/libheif/heif_regions.h
@@ -42,7 +42,7 @@ typedef struct heif_region_item heif_region_item;
  * Each region item will contain zero or more regions, which may have different geometry or
  * mask representations.
 */
-enum heif_region_type
+typedef enum heif_region_type
 {
   /**
    * Point geometry.
@@ -121,7 +121,7 @@ enum heif_region_type
    * considered to form a closed surface. Only the edge is part of the region.
   */
   heif_region_type_polyline = 6
-};
+} heif_region_type;

 typedef struct heif_region heif_region;

diff --git a/libheif/api/libheif/heif_sequences.h b/libheif/api/libheif/heif_sequences.h
index 997a89ee..179d364e 100644
--- a/libheif/api/libheif/heif_sequences.h
+++ b/libheif/api/libheif/heif_sequences.h
@@ -111,13 +111,13 @@ heif_track* heif_context_get_track(const heif_context*, uint32_t id);

 typedef uint32_t heif_track_type;

-enum heif_track_type_4cc
+typedef enum heif_track_type_4cc
 {
   heif_track_type_video = heif_fourcc('v', 'i', 'd', 'e'),
   heif_track_type_image_sequence = heif_fourcc('p', 'i', 'c', 't'),
   heif_track_type_auxiliary = heif_fourcc('a', 'u', 'x', 'v'),
   heif_track_type_metadata = heif_fourcc('m', 'e', 't', 'a')
-};
+} heif_track_type_4cc;

 /**
  * Get the four-cc track handler type.
@@ -130,11 +130,11 @@ LIBHEIF_API
 heif_track_type heif_track_get_track_handler_type(const heif_track*);


-enum heif_auxiliary_track_info_type
+typedef enum heif_auxiliary_track_info_type
 {
   heif_auxiliary_track_info_type_unknown = 0,
   heif_auxiliary_track_info_type_alpha = 1
-};
+} heif_auxiliary_track_info_type;

 LIBHEIF_API
 enum heif_auxiliary_track_info_type heif_track_get_auxiliary_info_type(const heif_track*);
@@ -275,12 +275,12 @@ void heif_context_set_number_of_sequence_repetitions(heif_context*, uint32_t num
  * The difference between `heif_sample_aux_info_presence_optional` and `heif_sample_aux_info_presence_mandatory`
  * is that `heif_sample_aux_info_presence_mandatory` will throw an error if the data is missing when writing a sample.
  */
-enum heif_sample_aux_info_presence
+typedef enum heif_sample_aux_info_presence
 {
   heif_sample_aux_info_presence_none = 0,
   heif_sample_aux_info_presence_optional = 1,
   heif_sample_aux_info_presence_mandatory = 2
-};
+} heif_sample_aux_info_presence;


 typedef struct heif_track_options heif_track_options;
@@ -338,7 +338,7 @@ void heif_track_options_set_gimi_track_id(heif_track_options*,

 // --- writing visual tracks

-enum heif_sequence_gop_structure
+typedef enum heif_sequence_gop_structure
 {
   // Only independently decodable keyframes.
   heif_sequence_gop_structure_intra_only,
@@ -349,7 +349,7 @@ enum heif_sequence_gop_structure
   // All frame types are allowed, including frame reordering, to achieve
   // the best compression ratio.
   heif_sequence_gop_structure_unrestricted
-};
+} heif_sequence_gop_structure;


 typedef struct heif_sequence_encoding_options
@@ -588,12 +588,12 @@ const heif_tai_clock_info* heif_track_get_tai_clock_info_of_first_cluster(heif_t

 // --- track references

-enum heif_track_reference_type
+typedef enum heif_track_reference_type
 {
   heif_track_reference_type_description = heif_fourcc('c', 'd', 's', 'c'), // track_description
   heif_track_reference_type_thumbnails = heif_fourcc('t', 'h', 'm', 'b'), // thumbnails
   heif_track_reference_type_auxiliary = heif_fourcc('a', 'u', 'x', 'l') // auxiliary data (e.g. depth maps or alpha channel)
-};
+} heif_track_reference_type;

 /**
  * Add a reference between tracks.
diff --git a/libheif/api/libheif/heif_uncompressed.h b/libheif/api/libheif/heif_uncompressed.h
index 7c21ac87..427c7a1f 100644
--- a/libheif/api/libheif/heif_uncompressed.h
+++ b/libheif/api/libheif/heif_uncompressed.h
@@ -38,7 +38,7 @@ extern "C" {

 // This is similar to heif_metadata_compression. We should try to keep the integers compatible, but each enum will just
 // contain the allowed values.
-enum heif_unci_compression
+typedef enum heif_unci_compression
 {
   heif_unci_compression_off = 0,
   //heif_unci_compression_auto = 1,
@@ -46,7 +46,7 @@ enum heif_unci_compression
   heif_unci_compression_deflate = 3,
   heif_unci_compression_zlib = 4,
   heif_unci_compression_brotli = 5
-};
+} heif_unci_compression;


 typedef struct heif_unci_image_parameters