Skip to content

Commit

Permalink
Remove FFmpeg 4 and 5 support (#131)
Browse files Browse the repository at this point in the history
ldm0 authored Jan 1, 2024
1 parent c96c66b commit 13a4716
Showing 7 changed files with 8 additions and 36 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ jobs:

- run: |
export FFMPEG_PKG_CONFIG_PATH=${PWD}/tmp/ffmpeg_build/lib/pkgconfig
cargo clippy --features ffmpeg6 -vv -- -D warnings
cargo clippy -vv -- -D warnings
rust_clippy_check_windows:
runs-on: windows-latest
@@ -99,28 +99,22 @@ jobs:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
LIBCLANG_PATH: ${{ github.workspace }}/clang/lib
LLVM_CONFIG_PATH: ${{ github.workspace }}/clang/bin/llvm-config
run: cargo clippy --features ffmpeg6 -- -D warnings
run: cargo clippy -- -D warnings

build_static_and_test_ubuntu:
runs-on: ubuntu-latest
strategy:
matrix:
ffmpeg-version: ["release/4.3", "release/5.0", "release/6.1"]
ffmpeg-version: ["release/6.0", "release/6.1"]
rust: ["nightly", "1.70.0"]
valgrind: ["valgrind", "no valgrind"]
include:
- ffmpeg-version: "release/5.0"
cargo-features: --features ffmpeg5
- ffmpeg-version: "release/6.1"
cargo-features: --features ffmpeg6
- rust: "nightly"
should_test: "true"
exclude:
# Only run valgrind with latest FFmpeg and nightly rust to reduce resource consumption.
- valgrind: "valgrind"
ffmpeg-version: "release/5.0"
- valgrind: "valgrind"
ffmpeg-version: "release/4.3"
ffmpeg-version: "release/6.0"
- valgrind: "valgrind"
rust: "1.70.0"
fail-fast: false
@@ -284,7 +278,7 @@ jobs:
LLVM_CONFIG_PATH: ${{ github.workspace }}/clang/bin/llvm-config
run: |
copy ${{ github.workspace }}/ffmpeg_prebuilt_cross/lib/libffmpeg.dll .
cargo test --tests --features ffmpeg6 --target i686-pc-windows-msvc -vv -- --skip transcoding
cargo test --tests --target i686-pc-windows-msvc -vv -- --skip transcoding
# Check if correct documentation can be generated by docs.rs
docs_rs_check:
@@ -312,4 +306,4 @@ jobs:
- name: Set env
run: echo "DOCS_RS=1" >> $GITHUB_ENV
- name: Document Generation
run: cargo doc --features ffmpeg6 -vv
run: cargo doc -vv
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -26,9 +26,5 @@ once_cell = "1.12.0"
tempdir = "0.3.7"

[features]
# FFmpeg 5.* support
ffmpeg5 = ["rusty_ffmpeg/ffmpeg5"]
# FFmpeg 6.* support
ffmpeg6 = ["rusty_ffmpeg/ffmpeg6"]
# linking system ffmpeg as fallback.
link_system_ffmpeg = ["rusty_ffmpeg/link_system_ffmpeg"]
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,11 +10,7 @@ Taking advantage of Rust's language design, you can build robust multi-media pro

## Dependency requirements

Supported FFmpeg versions are:
- `4.3`
- `4.4`
- `5.*`(Enabled by feature `ffmpeg5`)
- `6.*`(Enabled by feature `ffmpeg6`).
Supported FFmpeg versions are `6.*`.

Minimum Supported Rust Version is 1.70.0(Stable channel).

3 changes: 0 additions & 3 deletions src/avcodec/bitstream.rs
Original file line number Diff line number Diff line change
@@ -231,10 +231,7 @@ mod test {
#[test]
fn test_null_filter() {
let ctx = AVBSFContextUninit::get_null();
#[cfg(any(feature = "ffmpeg5", feature = "ffmpeg6"))]
assert_eq!(cstr!("null"), ctx.filter().name());
#[cfg(not(any(feature = "ffmpeg5", feature = "ffmpeg6")))]
assert_eq!(cstr!("bsf_list"), ctx.filter().name());
}

#[test]
4 changes: 0 additions & 4 deletions src/avutil/dict.rs
Original file line number Diff line number Diff line change
@@ -157,7 +157,6 @@ impl<'dict> AVDictionary {
}

/// Iterates through all entries in the dictionary by reference.
#[cfg(feature = "ffmpeg6")]
pub fn iter(&'dict self) -> AVDictionaryIter<'dict> {
AVDictionaryIter {
dict: self,
@@ -185,7 +184,6 @@ impl Drop for AVDictionary {
}
}

#[cfg(feature = "ffmpeg6")]
impl<'dict> IntoIterator for &'dict AVDictionary {
type IntoIter = AVDictionaryIter<'dict>;
type Item = AVDictionaryEntryRef<'dict>;
@@ -195,14 +193,12 @@ impl<'dict> IntoIterator for &'dict AVDictionary {
}

/// Iterator over [`AVDictionary`] by reference.
#[cfg(feature = "ffmpeg6")]
pub struct AVDictionaryIter<'dict> {
dict: &'dict AVDictionary,
ptr: *const ffi::AVDictionaryEntry,
_phantom: std::marker::PhantomData<&'dict ()>,
}

#[cfg(feature = "ffmpeg6")]
impl<'dict> Iterator for AVDictionaryIter<'dict> {
type Item = AVDictionaryEntryRef<'dict>;
fn next(&mut self) -> Option<Self::Item> {
8 changes: 1 addition & 7 deletions src/avutil/frame.rs
Original file line number Diff line number Diff line change
@@ -226,16 +226,10 @@ wrap_ref!(AVFrameSideData: ffi::AVFrameSideData);

impl<'frame> AVFrameSideDataRef<'frame> {
unsafe fn as_motion_vectors(&self) -> &'frame [AVMotionVector] {
// FFmpeg 4 defines `AVFrameSideData::size` as `int`
// ref: https://github.com/CCExtractor/rusty_ffmpeg/issues/93
#[cfg(not(any(feature = "ffmpeg5", feature = "ffmpeg6")))]
let size = self.size as usize;
#[cfg(any(feature = "ffmpeg5", feature = "ffmpeg6"))]
let size = self.size;
unsafe {
slice::from_raw_parts(
self.data as *const _ as *const ffi::AVMotionVector,
size / size_of::<ffi::AVMotionVector>(),
self.size / size_of::<ffi::AVMotionVector>(),
)
}
}
1 change: 0 additions & 1 deletion tests/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![cfg(feature = "ffmpeg6")]
use anyhow::{Context, Result};
use rsmpeg::{avcodec::AVCodecContext, avformat::AVFormatContextInput, avutil::av_q2d, ffi};
use std::ffi::CString;

0 comments on commit 13a4716

Please sign in to comment.