Skip to content

Commit

Permalink
- Updated version of bindgen to 0.65.
Browse files Browse the repository at this point in the history
- Use `pkg-config` in `build.rs` ([#1](#1)).
  • Loading branch information
Cykooz committed Jun 5, 2023
1 parent 32945e7 commit 2de2880
Show file tree
Hide file tree
Showing 8 changed files with 275 additions and 65 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/target
**/*.rs.bk
Cargo.lock
.*
!/.gitignore
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [Unreleased] - ReleaseDate

- Updated version of `bindgen` to 0.65.
- Use `pkg-config` in `build.rs` ([#1](https://github.com/Cykooz/libheif-sys/pull/1)).

## [1.14.2] - 2023-01-31

- Updated version of `bindgen` to 0.63.0.
Expand Down
258 changes: 258 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use-bindgen = ["bindgen"]


[build-dependencies]
bindgen = { version = "0.63.0", optional = true }
bindgen = { version = "0.65", optional = true }
pkg-config = "0.3.15"


Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,46 @@

```rust
use std::ffi;
use std::mem::MaybeUninit;
use std::ptr;

use libheif_sys as lh;

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

let ctx = lh::heif_context_alloc();
assert_ne!(ctx, ptr::null_mut());

let c_name = ffi::CString::new("tests/window.heic").unwrap();
let err = lh::heif_context_read_from_file(ctx, c_name.as_ptr(), ptr::null());
assert_eq!(err.code, 0);

let mut handle = MaybeUninit::<_>::uninit();
let err = lh::heif_context_get_primary_image_handle(ctx, handle.as_mut_ptr());
let mut handle = ptr::null_mut();
let err = lh::heif_context_get_primary_image_handle(ctx, &mut handle);
assert_eq!(err.code, 0);
assert!(!handle.is_null());

let handle = handle.assume_init();
let width = lh::heif_image_handle_get_width(handle);
assert_eq!(width, 4032);
let height = lh::heif_image_handle_get_height(handle);
assert_eq!(height, 3024);

let options = lh::heif_decoding_options_alloc();

let mut image = MaybeUninit::<_>::uninit();
let mut image = ptr::null_mut();
let err = lh::heif_decode_image(
handle,
image.as_mut_ptr(),
&mut image,
lh::heif_colorspace_heif_colorspace_RGB,
lh::heif_chroma_heif_chroma_444,
options,
);
lh::heif_decoding_options_free(options);
assert_eq!(err.code, 0);
assert!(!image.is_null());

let image = image.assume_init();
let colorspace = lh::heif_image_get_colorspace(image);
assert_eq!(colorspace, lh::heif_colorspace_heif_colorspace_RGB);
let chroma_format = lh::heif_image_get_chroma_format(image);
Expand Down
2 changes: 1 addition & 1 deletion src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.63.0 */
/* automatically generated by rust-bindgen 0.65.1 */

extern "C" {
pub fn heif_get_version() -> *const libc::c_char;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![doc = include_str!("../README.md")]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
Expand Down
Loading

0 comments on commit 2de2880

Please sign in to comment.