@@ -1020,7 +1020,8 @@ struct heif_error heif_image_handle_get_tile_size(const struct heif_image_handle
10201020
10211021
10221022struct heif_entity_group * heif_context_get_entity_groups (const struct heif_context * ctx,
1023- uint32_t type_filter, uint32_t item_filter,
1023+ uint32_t type_filter,
1024+ heif_item_id item_filter,
10241025 int * out_num_groups)
10251026{
10261027 std::shared_ptr<Box_grpl> grplBox = ctx->context ->get_heif_file ()->get_grpl_box ();
@@ -1557,7 +1558,7 @@ void heif_image_get_content_light_level(const struct heif_image* image, struct h
15571558
15581559int heif_image_handle_get_content_light_level (const struct heif_image_handle * handle, struct heif_content_light_level * out)
15591560{
1560- auto clli = handle->image ->get_file ()-> get_property <Box_clli>(handle-> image -> get_id () );
1561+ auto clli = handle->image ->get_property <Box_clli>();
15611562 if (out && clli) {
15621563 *out = clli->clli ;
15631564 }
@@ -1587,7 +1588,7 @@ void heif_image_get_mastering_display_colour_volume(const struct heif_image* ima
15871588
15881589int heif_image_handle_get_mastering_display_colour_volume (const struct heif_image_handle * handle, struct heif_mastering_display_colour_volume * out)
15891590{
1590- auto mdcv = handle->image ->get_file ()-> get_property <Box_mdcv>(handle-> image -> get_id () );
1591+ auto mdcv = handle->image ->get_property <Box_mdcv>();
15911592 if (out && mdcv) {
15921593 *out = mdcv->mdcv ;
15931594 }
@@ -1664,7 +1665,7 @@ void heif_image_get_pixel_aspect_ratio(const struct heif_image* image, uint32_t*
16641665
16651666int heif_image_handle_get_pixel_aspect_ratio (const struct heif_image_handle * handle, uint32_t * aspect_h, uint32_t * aspect_v)
16661667{
1667- auto pasp = handle->image ->get_file ()-> get_property <Box_pasp>(handle-> image -> get_id () );
1668+ auto pasp = handle->image ->get_property <Box_pasp>();
16681669 if (pasp) {
16691670 *aspect_h = pasp->hSpacing ;
16701671 *aspect_v = pasp->vSpacing ;
@@ -1773,7 +1774,7 @@ heif_error heif_image_crop(struct heif_image* img,
17731774 " Image size exceeds maximum supported size" };
17741775 }
17751776
1776- auto cropResult = img->image ->crop (left, static_cast <int >(w) - 1 - right, top, static_cast <int >(h) - 1 - bottom);
1777+ auto cropResult = img->image ->crop (left, static_cast <int >(w) - 1 - right, top, static_cast <int >(h) - 1 - bottom, nullptr );
17771778 if (cropResult.error ) {
17781779 return cropResult.error .error_struct (img->image .get ());
17791780 }
@@ -1805,11 +1806,9 @@ int heif_image_has_channel(const struct heif_image* img, enum heif_channel chann
18051806struct heif_error heif_image_add_plane (struct heif_image * image,
18061807 heif_channel channel, int width, int height, int bit_depth)
18071808{
1808- if (!image->image ->add_plane (channel, width, height, bit_depth)) {
1809- struct heif_error err = {heif_error_Memory_allocation_error,
1810- heif_suberror_Unspecified,
1811- " Cannot allocate memory for image plane" };
1812- return err;
1809+ // Note: no security limit, because this is explicitly requested by the user.
1810+ if (auto err = image->image ->add_plane (channel, width, height, bit_depth, nullptr )) {
1811+ return err.error_struct (image->image .get ());
18131812 }
18141813 else {
18151814 return heif_error_success;
@@ -1822,7 +1821,7 @@ struct heif_error heif_image_add_channel(struct heif_image* image,
18221821 int width, int height,
18231822 heif_channel_datatype datatype, int bit_depth)
18241823{
1825- if (!image->image ->add_channel (channel, width, height, datatype, bit_depth)) {
1824+ if (!image->image ->add_channel (channel, width, height, datatype, bit_depth, nullptr )) {
18261825 struct heif_error err = {heif_error_Memory_allocation_error,
18271826 heif_suberror_Unspecified,
18281827 " Cannot allocate memory for image plane" };
@@ -1996,11 +1995,9 @@ int heif_image_is_premultiplied_alpha(struct heif_image* image)
19961995
19971996struct heif_error heif_image_extend_padding_to_size (struct heif_image * image, int min_physical_width, int min_physical_height)
19981997{
1999- bool mem_alloc_success = image->image ->extend_padding_to_size (min_physical_width, min_physical_height);
2000- if (!mem_alloc_success) {
2001- return heif_error{heif_error_Memory_allocation_error,
2002- heif_suberror_Unspecified,
2003- " Cannot allocate image memory." };
1998+ Error err = image->image ->extend_padding_to_size (min_physical_width, min_physical_height, false , nullptr );
1999+ if (err) {
2000+ return err.error_struct (image->image .get ());
20042001 }
20052002 else {
20062003 return heif_error_success;
@@ -2015,7 +2012,7 @@ struct heif_error heif_image_scale_image(const struct heif_image* input,
20152012{
20162013 std::shared_ptr<HeifPixelImage> out_img;
20172014
2018- Error err = input->image ->scale_nearest_neighbor (out_img, width, height);
2015+ Error err = input->image ->scale_nearest_neighbor (out_img, width, height, nullptr );
20192016 if (err) {
20202017 return err.error_struct (input->image .get ());
20212018 }
@@ -2030,11 +2027,9 @@ struct heif_error heif_image_scale_image(const struct heif_image* input,
20302027struct heif_error heif_image_extend_to_size_fill_with_zero (struct heif_image * image,
20312028 uint32_t width, uint32_t height)
20322029{
2033- bool success = image->image ->extend_to_size_with_zero (width, height);
2034- if (!success) {
2035- return heif_error{heif_error_Memory_allocation_error,
2036- heif_suberror_Unspecified,
2037- " Not enough memory to extend image size." };
2030+ Error err = image->image ->extend_to_size_with_zero (width, height, nullptr );
2031+ if (err) {
2032+ return err.error_struct (image->image .get ());
20382033 }
20392034
20402035 return heif_error_ok;
@@ -3055,7 +3050,7 @@ heif_encoder_parameter_get_valid_integer_range(const struct heif_encoder_paramet
30553050 return heif_error_success;
30563051}
30573052
3058- LIBHEIF_API
3053+
30593054struct heif_error heif_encoder_parameter_get_valid_integer_values (const struct heif_encoder_parameter * param,
30603055 int * have_minimum, int * have_maximum,
30613056 int * minimum, int * maximum,
@@ -3650,7 +3645,7 @@ struct heif_error heif_context_add_image_tile(struct heif_context* ctx,
36503645 }
36513646#endif
36523647 else if (auto grid_item = std::dynamic_pointer_cast<ImageItem_Grid>(tiled_image->image )) {
3653- Error err = grid_item->add_image_tile (tiled_image-> image -> get_id (), tile_x, tile_y, image->image , encoder);
3648+ Error err = grid_item->add_image_tile (tile_x, tile_y, image->image , encoder);
36543649 return err.error_struct (ctx->context .get ());
36553650 }
36563651 else {
0 commit comments