fix versions for sws/swr/avfi
Some checks failed
build / Windows - FFmpeg 4.4 - build, test and lint (push) Has been cancelled
build / Windows - FFmpeg 5.0 - build, test and lint (push) Has been cancelled
build / Windows - FFmpeg 5.1 - build, test and lint (push) Has been cancelled
build / Windows - FFmpeg 6.0 - build, test and lint (push) Has been cancelled
build / Windows - FFmpeg 6.1 - build, test and lint (push) Has been cancelled
build / Linux - FFmpeg 4.3 - build, test and lint (push) Has been cancelled
build / Linux - FFmpeg 4.2 - build, test and lint (push) Has been cancelled
build / Linux - FFmpeg 4.4 - build, test and lint (push) Has been cancelled
build / Linux - FFmpeg 5.1 - build, test and lint (push) Has been cancelled
build / Linux - FFmpeg 6.1 - build, test and lint (push) Has been cancelled
build / Linux - FFmpeg 7.0 - build, test and lint (push) Has been cancelled
build / Linux - FFmpeg 7.1 - build, test and lint (push) Has been cancelled
build / macOS - FFmpeg 4 - build, test and lint (push) Has been cancelled
build / macOS - FFmpeg 5 - build, test and lint (push) Has been cancelled
build / macOS - FFmpeg 6 - build, test and lint (push) Has been cancelled
build / macOS - FFmpeg 7 - build, test and lint (push) Has been cancelled
build / Windows - FFmpeg 7.0 - build, test and lint (push) Has been cancelled
build / Windows - FFmpeg 7.1 - build, test and lint (push) Has been cancelled
build / msrv (push) Has been cancelled

This commit is contained in:
kieran 2024-11-21 14:25:09 +00:00
parent e5f8e077b0
commit bdc65868e7
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941

View File

@ -22,6 +22,7 @@ struct Library {
optional: bool, optional: bool,
features: &'static [AVFeature], features: &'static [AVFeature],
headers: &'static [AVHeader], headers: &'static [AVHeader],
min_major_version: u64,
} }
impl Library { impl Library {
@ -29,12 +30,14 @@ impl Library {
name: &'static str, name: &'static str,
features: &'static [AVFeature], features: &'static [AVFeature],
headers: &'static [AVHeader], headers: &'static [AVHeader],
min_version: u64,
) -> Self { ) -> Self {
Self { Self {
name, name,
optional: false, optional: false,
features, features,
headers, headers,
min_major_version: min_version,
} }
} }
@ -42,12 +45,14 @@ impl Library {
name: &'static str, name: &'static str,
features: &'static [AVFeature], features: &'static [AVFeature],
headers: &'static [AVHeader], headers: &'static [AVHeader],
min_version: u64,
) -> Self { ) -> Self {
Self { Self {
name, name,
optional: true, optional: true,
features, features,
headers, headers,
min_major_version: min_version,
} }
} }
@ -61,14 +66,14 @@ impl Library {
} }
static LIBRARIES: &[Library] = &[ static LIBRARIES: &[Library] = &[
Library::required("avutil", AVUTIL_FEATURES, AVUTIL_HEADERS), Library::required("avutil", AVUTIL_FEATURES, AVUTIL_HEADERS, 50),
Library::optional("avcodec", AVCODEC_FEATURES, AVCODEC_HEADERS), Library::optional("avcodec", AVCODEC_FEATURES, AVCODEC_HEADERS, 50),
Library::optional("avformat", AVFORMAT_FEATURES, AVFORMAT_HEADERS), Library::optional("avformat", AVFORMAT_FEATURES, AVFORMAT_HEADERS, 50),
Library::optional("avdevice", AVDEVICE_FEATURES, AVDEVICE_HEADERS), Library::optional("avdevice", AVDEVICE_FEATURES, AVDEVICE_HEADERS, 50),
Library::optional("avfilter", AVFILTER_FEATURES, AVFILTER_HEADERS), Library::optional("avfilter", AVFILTER_FEATURES, AVFILTER_HEADERS, 0),
Library::optional("swscale", SWSCALE_FEATURES, SWSCALE_HEADERS), Library::optional("swscale", SWSCALE_FEATURES, SWSCALE_HEADERS, 0),
Library::optional("swresample", SWRESAMPLE_FEATURES, SWRESAMPLE_HEADERS), Library::optional("swresample", SWRESAMPLE_FEATURES, SWRESAMPLE_HEADERS, 0),
Library::optional("postproc", POSTPROC_FEATURES, POSTPROC_HEADERS), Library::optional("postproc", POSTPROC_FEATURES, POSTPROC_HEADERS, 50),
]; ];
#[derive(Debug)] #[derive(Debug)]
@ -769,20 +774,22 @@ fn check_features(include_paths: &[PathBuf]) {
} }
} }
let begin_version_major = 57; for lib in enabled_libraries() {
let end_version_major = 62; let ver = if let Some(v) = versions.get(&lib.name) {
let begin_version_minor = 0; v
let end_version_minor = 134; } else {
for (lib, version) in &versions { continue;
println!("lib{lib} version = {}_{}", (*version).0, (*version).1); };
for version_major in begin_version_major..end_version_major { for major in lib.min_major_version..=(*ver).0 {
for version_minor in begin_version_minor..end_version_minor { for minor in 0..=135 {
if *version >= (version_major, version_minor) { if *ver >= (major, minor) {
println!( println!(
r#"cargo:rustc-cfg=feature="{lib}_version_greater_than_{version_major}_{version_minor}""# r#"cargo:rustc-cfg=feature="{}_version_greater_than_{major}_{minor}""#,
lib.name,
); );
println!( println!(
r#"cargo:{lib}_version_greater_than_{version_major}_{version_minor}=true"# r#"cargo:{}_version_greater_than_{major}_{minor}=true"#,
lib.name,
); );
} }
} }