Skip to content

Commit

Permalink
use ffmpeg-sys-next, single version of bindgen (#162)
Browse files Browse the repository at this point in the history
* use ffmpeg-sys-next, single version of bindgen

One version is easier to keep track of and should reduce build times.

* replace ffmpeg-sys with ffmpeg-sys-next, which (among other things)
  uses bindgen 0.64. ffmpeg-sys was using a pre-0.60 version, so in
  some of our call sites, it hit build errors on Rust 1.70 due to
  rust-lang/rust-bindgen#2083
  https://github.com/rust-lang/rust-bindgen/blob/main/CHANGELOG.md#0600

* update cargo lock stuff to use the same version

* remove stale comments about older versions

* fix xilinx build errors with bindgen 0.64
  • Loading branch information
scottlamb committed Jun 22, 2023
1 parent 91e066f commit 2a8b6ba
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 93 deletions.
108 changes: 22 additions & 86 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions ffmpeg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
# XXX: ffmpeg-sys doesn't seem to build without avcodec.
ffmpeg-sys = {git = "https://github.com/meh/rust-ffmpeg-sys", rev="8ba86ee3f9b85a3ad86002d980fb518f5e90afb1", default-features = false, features = ["avcodec"] }
# XXX: ffmpeg-sys-next doesn't seem to build without avcodec.
ffmpeg-sys = { package = "ffmpeg-sys-next", version = "6.0.1", default-features = false, features = ["avcodec"] }
thiserror = "1.0"

[features]
Expand Down
3 changes: 0 additions & 3 deletions macos/video-toolbox/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ fn main() {

let sdk_root = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk";

// the "whitelist_" functions have been renamed in newer bindgen versions, but we use the
// old names for wider compatibility
#[allow(deprecated)]
let bindings = bindgen::Builder::default()
.clang_arg(format!("-isysroot{}", sdk_root))
.header("src/lib.hpp")
Expand Down
2 changes: 1 addition & 1 deletion xilinx/src/xlnx_enc_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ impl XlnxXmaEncoderProperties {
) {
enc_params[0].name = ENC_OPTIONS_PARAM_NAME.as_ptr() as *mut i8;
enc_params[0].type_ = XmaDataType_XMA_STRING;
enc_params[0].length = enc_options.len() as u64;
enc_params[0].length = enc_options.len();
enc_params[0].value = enc_options_ptr_ptr as *mut std::ffi::c_void;

enc_params[1].name = LATENCY_LOGGING_PARAM_NAME.as_ptr() as *mut i8;
Expand Down
2 changes: 1 addition & 1 deletion xilinx/src/xlnx_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl XlnxEncoder {
let enc_session = xlnx_create_enc_session(xma_enc_props, xlnx_enc_ctx)?;

let buffer_size = xma_enc_props.height * xma_enc_props.width * xma_enc_props.bits_per_pixel;
let out_buffer = unsafe { xma_data_buffer_alloc(buffer_size as u64, false) };
let out_buffer = unsafe { xma_data_buffer_alloc(buffer_size as usize, false) };

Ok(Self {
enc_session,
Expand Down

0 comments on commit 2a8b6ba

Please sign in to comment.