From e3d3c4a11ed5ea602e158670c9efd1ea08e66249 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Tue, 7 Mar 2023 13:29:18 -0500 Subject: [PATCH] Fix ffmpeg 4.x --- CHANGELOG.md | 12 ++++++++++++ Cargo.toml | 2 +- src/filter/filter.rs | 36 ++++++++++++++++++++++++++++-------- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a49fe8..dd5db75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## Version 1.2.1 + +- Fix ffmpeg 4.x support that was broken in 1.2.0 + +## Version 1.2.0 + +- Add ffmpeg 6.0 support + +## _sys_ Version 1.1.0 + +- Add ffmpeg 6.0 support + ## _sys_ Version 1.0.2 - Fix building against clang 16 by using latest bindgen crate diff --git a/Cargo.toml b/Cargo.toml index df936f0..8f87108 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ffmpeg-the-third" -version = "1.2.0+ffmpeg-6.0.0" +version = "1.2.1+ffmpeg-6.0.0" build = "build.rs" authors = ["meh. ", "Zhiming Wang "] diff --git a/src/filter/filter.rs b/src/filter/filter.rs index 8140083..070bbc5 100644 --- a/src/filter/filter.rs +++ b/src/filter/filter.rs @@ -47,10 +47,20 @@ impl Filter { if ptr.is_null() { None } else { - Some(PadIter::new( - (*self.as_ptr()).inputs, - (*self.as_ptr()).nb_inputs as isize, - )) + #[cfg(feature = "ffmpeg_5_0")] + { + Some(PadIter::new( + (*self.as_ptr()).inputs, + (*self.as_ptr()).nb_inputs as isize, + )) + } + #[cfg(not(feature = "ffmpeg_5_0"))] + { + Some(PadIter::new( + (*self.as_ptr()).inputs, + (*self.as_ptr()).inputs as isize, + )) + } } } } @@ -62,10 +72,20 @@ impl Filter { if ptr.is_null() { None } else { - Some(PadIter::new( - (*self.as_ptr()).outputs, - (*self.as_ptr()).nb_outputs as isize, - )) + #[cfg(feature = "ffmpeg_5_0")] + { + Some(PadIter::new( + (*self.as_ptr()).outputs, + (*self.as_ptr()).nb_outputs as isize, + )) + } + #[cfg(not(feature = "ffmpeg_5_0"))] + { + Some(PadIter::new( + (*self.as_ptr()).outputs, + (*self.as_ptr()).outputs as isize, + )) + } } } }