Skip to content

Commit

Permalink
- Feature use-bindgen was removed from default features.
Browse files Browse the repository at this point in the history
- Updated "bindings.rs" to correspond `libheif 1.19.5`.
  • Loading branch information
Cykooz committed Jan 23, 2025
1 parent 9400715 commit 8c8265d
Show file tree
Hide file tree
Showing 9 changed files with 947 additions and 308 deletions.
61 changes: 60 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# Change Log

# [Unreleased] - ReleaseDate

### Added

- Feature `use-bindgen` was removed from default features.
- Updated "bindings.rs" to correspond `libheif 1.19.5`:
- added new values into `heif_error_code` "enum':
- `heif_error_code_heif_error_Canceled`
- added new values into `heif_suberror_code` "enum':
- `heif_suberror_code_heif_suberror_No_avcC_box`
- `heif_suberror_code_heif_suberror_Invalid_mini_box`
- `heif_suberror_code_heif_suberror_Unsupported_essential_property`
- added new values into `heif_colorspace` "enum':
- `heif_colorspace_heif_colorspace_nonvisual`
- added new values into `heif_channel` "enum':
- `heif_channel_heif_channel_filter_array`
- `heif_channel_heif_channel_depth`
- `heif_channel_heif_channel_disparity`
- added new values into `heif_reader_grow_status` "enum':
- `heif_reader_grow_status_heif_reader_grow_status_error`
- added new values into `heif_item_property_type` "enum':
- `heif_item_property_type_heif_item_property_type_tai_clock_info`
- `heif_item_property_type_heif_item_property_type_tai_timestamp`
- struct `heif_reader` was updated up to version 2, added new fields:
- `request_range`
- `preload_range_hint`
- `release_file_range`
- `release_error_msg`
- added new fields into struct `heif_decoding_options`:
- `cancel_decoding`
- added type aliases:
- `heif_entity_group_id`
- added structs:
- `heif_reader_range_request_result`
- `heif_security_limits`
- `heif_image_tiling`
- `heif_entity_group`
- `heif_ambient_viewing_environment`
- added functions:
- `heif_read_minor_version_brand`
- `heif_get_global_security_limits`
- `heif_get_disabled_security_limits`
- `heif_context_get_security_limits`
- `heif_context_set_security_limits`
- `heif_image_handle_get_image_tiling`
- `heif_image_handle_get_grid_image_tile_id`
- `heif_image_handle_decode_image_tile`
- `heif_context_get_entity_groups`
- `heif_entity_groups_release`
- `heif_color_conversion_options_set_defaults`
- `heif_image_extend_to_size_fill_with_zero`
- `heif_image_handle_get_content_light_level`
- `heif_image_handle_get_mastering_display_colour_volume`
- `heif_image_handle_get_pixel_aspect_ratio`
- `heif_context_add_grid_image`
- `heif_context_add_image_tile`
- `heif_context_add_overlay_image`
- `heif_item_get_property_uuid_type`

## [3.1.0] - 2024-12-04

### Changes
Expand Down Expand Up @@ -70,6 +129,7 @@
- `heif_item_get_property_raw_data`
- `heif_image_handle_get_number_of_region_items`
- `heif_image_handle_get_list_of_region_item_ids`
- `heif_image_handle_add_region_item`
- `heif_context_get_region_item`
- `heif_region_item_get_id`
- `heif_region_item_release`
Expand All @@ -95,7 +155,6 @@
- `heif_region_get_inline_mask_data_len`
- `heif_region_get_inline_mask_data`
- `heif_region_get_mask_image`
- `heif_image_handle_add_region_item`
- `heif_region_item_add_region_point`
- `heif_region_item_add_region_rectangle`
- `heif_region_item_add_region_ellipse`
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ libc = "0.2.162"


[features]
default = ["use-bindgen"]
default = []
# Use bindgen to generate bindings for libheif,
# instead using of pre-generated bindings.rs.
use-bindgen = ["dep:bindgen", "dep:prettyplease"]
Expand All @@ -29,9 +29,9 @@ embedded-libheif-plugins = ["compile-libheif"]

[build-dependencies]
pkg-config = "0.3.31"
prettyplease = { version = "0.2.25", optional = true }
bindgen = { version = "0.70.1", optional = true }
cmake = { version = "0.1.51", optional = true }
prettyplease = { version = "0.2.29", optional = true }
bindgen = { version = "0.71.1", optional = true }
cmake = { version = "0.1.52", optional = true }


[target.'cfg(windows)'.build-dependencies]
Expand All @@ -41,7 +41,7 @@ walkdir = "2"

[package.metadata.vcpkg]
git = "https://github.com/microsoft/vcpkg"
tag = "2024.10.21"
tag = "2025.01.13"
dependencies = ["libheif"]


Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ available.
## System dependencies

- `libheif-dev` >= 1.18.0.
- `clang` - to generate rust bindings for `libheif`.
[See bindgen requirements.](https://rust-lang.github.io/rust-bindgen/requirements.html)

`clang` wouldn't be needed if you disable `use-bindgen` feature.
In this case the pre-generated file `bindings.rs` will be used
instead of generating it on the fly with help of `bindgen` crate.

### Linux

The crate uses `pkg-confing` to find installed `libheif`.

You can also enable all or any of the following features to compile
`libheif v1.18.2` from `GitHub` and link it statically:
`libheif v1.19.5` from `GitHub` and link it statically:

- `compile-libheif`
- `embedded-libheif-plugins`
Expand Down Expand Up @@ -59,7 +53,7 @@ use std::ptr;
use libheif_sys as lh;

#[test]
fn read_and_decode_heic_file() {
fn read_and_decode_heif_file() {
unsafe {
lh::heif_init(ptr::null_mut());

Expand All @@ -75,7 +69,10 @@ fn read_and_decode_heic_file() {
assert_eq!(err.code, lh::heif_error_code_heif_error_Ok);

let mut handle = ptr::null_mut();
let err = lh::heif_context_get_primary_image_handle(ctx, &mut handle);
let err = lh::heif_context_get_primary_image_handle(
ctx,
&mut handle
);
assert_eq!(err.code, lh::heif_error_code_heif_error_Ok);
assert!(!handle.is_null());

Expand All @@ -98,9 +95,15 @@ fn read_and_decode_heic_file() {
assert!(!image.is_null());

let colorspace = lh::heif_image_get_colorspace(image);
assert_eq!(colorspace, lh::heif_colorspace_heif_colorspace_RGB);
assert_eq!(
colorspace,
lh::heif_colorspace_heif_colorspace_RGB
);
let chroma_format = lh::heif_image_get_chroma_format(image);
assert_eq!(chroma_format, lh::heif_chroma_heif_chroma_interleaved_RGB);
assert_eq!(
chroma_format,
lh::heif_chroma_heif_chroma_interleaved_RGB
);
let width = lh::heif_image_get_width(
image,
lh::heif_channel_heif_channel_interleaved
Expand Down
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::path::PathBuf;
use std::process::Command;

#[allow(dead_code)]
const MIN_LIBHEIF_VERSION: &str = "1.18";
const MIN_LIBHEIF_VERSION: &str = "1.19";
#[allow(dead_code)]
const LIBHEIF_GITHUB_VERSION: &str = "v1.18.2";
const LIBHEIF_GITHUB_VERSION: &str = "v1.19.5";

fn main() {
if std::env::var("DOCS_RS").is_ok() {
Expand Down
Loading

0 comments on commit 8c8265d

Please sign in to comment.