meh / rust-ffmpeg

Safe FFmpeg wrapper.
Do What The F*ck You Want To Public License
462 stars 96 forks source link

Add feature flags to support older ffmpeg versions #137

Closed shssoichiro closed 3 years ago

shssoichiro commented 3 years ago

Currently, this crate will fail to compile if an older version of the ffmpeg libraries are installed on the machine. This change causes this crate to support FFMpeg 3.0 and newer by default. Newer API features can be enabled by setting the appropriate feature flag e.g. ffmpeg_3_4, although this will cause the crate using this crate to fail to compile on older versions of ffmpeg.

Most immediately, this is required for CI on https://github.com/rust-av/av-metrics/pull/218 to function correctly, as Github Actions includes Ubuntu Bionic, which only includes up to FFMpeg 3.4.

Closes #136

meh commented 3 years ago

How do the features work, I see stuff enabled only for specific versions but I think it should be incremental?

I support the endeavor.

shssoichiro commented 3 years ago

In the Cargo.toml, each feature inherits the previous version's feature flag. So e.g. 3.2 will automatically enable 3.1 and below. 3.3 will enable 3.2 and below. And so on.

meh commented 3 years ago

Oh I right, I missed that part, sorry about that.

Sounds good then!