Include whether lsmash and ffms2 were found in version info (#606)

This commit is contained in:
redzic 2022-04-03 13:37:34 -05:00 committed by GitHub
parent 154a9141f5
commit e5dd06c6dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 6 deletions

View file

@ -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<String> = 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()
),
}
})
}

View file

@ -35,11 +35,17 @@ static VAPOURSYNTH_PLUGINS: Lazy<HashSet<String>> = Lazy::new(|| {
});
pub fn is_lsmash_installed() -> bool {
VAPOURSYNTH_PLUGINS.contains("systems.innocent.lsmas")
static LSMASH_PRESENT: Lazy<bool> =
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<bool> =
Lazy::new(|| VAPOURSYNTH_PLUGINS.contains("com.vapoursynth.ffms2"));
*FFMS2_PRESENT
}
pub fn best_available_chunk_method() -> ChunkMethod {