From e5dd06c6ddba6faeab9221888e78a65a55f710b0 Mon Sep 17 00:00:00 2001 From: redzic <48274562+redzic@users.noreply.github.com> Date: Sun, 3 Apr 2022 13:37:34 -0500 Subject: [PATCH] Include whether lsmash and ffms2 were found in version info (#606) --- av1an-cli/src/lib.rs | 30 ++++++++++++++++++++++++++---- av1an-core/src/vapoursynth.rs | 10 ++++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/av1an-cli/src/lib.rs b/av1an-cli/src/lib.rs index 7cceac9..78c0d32 100644 --- a/av1an-cli/src/lib.rs +++ b/av1an-cli/src/lib.rs @@ -30,6 +30,18 @@ use once_cell::sync::OnceCell; // needs to be static, runtime allocated string to avoid evil hacks to // concatenate non-trivial strings at compile-time fn version() -> &'static str { + fn get_vs_info() -> String { + let isfound = |found: bool| if found { "Found" } else { "Not found" }; + format!( + "\ +* VapourSynth Plugins + systems.innocent.lsmas : {} + com.vapoursynth.ffms2 : {}", + isfound(vapoursynth::is_lsmash_installed()), + isfound(vapoursynth::is_ffms2_installed()) + ) + } + static INSTANCE: OnceCell = OnceCell::new(); INSTANCE.get_or_init(|| { match ( @@ -61,7 +73,9 @@ fn version() -> &'static str { * Date Info Build Date: {} - Commit Date: {}", + Commit Date: {} + +{}", env!("CARGO_PKG_VERSION"), git_hash, cargo_profile, @@ -69,11 +83,19 @@ fn version() -> &'static str { llvm_ver, target_triple, build_date, - commit_date + commit_date, + get_vs_info(), ) } - // only include the semver on a release (when git information isn't available) - _ => env!("CARGO_PKG_VERSION").into(), + _ => format!( + "\ +{} + +{}", + // only include the semver on a release (when git information isn't available) + env!("CARGO_PKG_VERSION"), + get_vs_info() + ), } }) } diff --git a/av1an-core/src/vapoursynth.rs b/av1an-core/src/vapoursynth.rs index 555ccaf..4d40635 100644 --- a/av1an-core/src/vapoursynth.rs +++ b/av1an-core/src/vapoursynth.rs @@ -35,11 +35,17 @@ static VAPOURSYNTH_PLUGINS: Lazy> = Lazy::new(|| { }); pub fn is_lsmash_installed() -> bool { - VAPOURSYNTH_PLUGINS.contains("systems.innocent.lsmas") + static LSMASH_PRESENT: Lazy = + Lazy::new(|| VAPOURSYNTH_PLUGINS.contains("systems.innocent.lsmas")); + + *LSMASH_PRESENT } pub fn is_ffms2_installed() -> bool { - VAPOURSYNTH_PLUGINS.contains("com.vapoursynth.ffms2") + static FFMS2_PRESENT: Lazy = + Lazy::new(|| VAPOURSYNTH_PLUGINS.contains("com.vapoursynth.ffms2")); + + *FFMS2_PRESENT } pub fn best_available_chunk_method() -> ChunkMethod {