diff --git a/src/stream/gst/utils.rs b/src/stream/gst/utils.rs index d6cbd697..c15abbf4 100644 --- a/src/stream/gst/utils.rs +++ b/src/stream/gst/utils.rs @@ -8,20 +8,24 @@ pub struct PluginRankConfig { } #[allow(dead_code)] // TODO: Use this to check all used plugins are available -pub fn is_gst_plugin_available(plugin_name: &str, min_version: &str) -> bool { +pub fn is_gst_plugin_available(plugin_name: &str, min_version: Option<&str>) -> bool { // reference: https://github.com/GStreamer/gst/blob/b4ca58df7624b005a33e182a511904d7cceea890/tools/gst-inspect.c#L2148 if let Err(error) = gst::init() { tracing::error!("Error! {error}"); } - let version = semver::Version::parse(min_version).unwrap(); - gst::Registry::get().check_feature_version( - plugin_name, - version.major.try_into().unwrap(), - version.minor.try_into().unwrap(), - version.patch.try_into().unwrap(), - ) + if let Some(min_version) = min_version { + let version = semver::Version::parse(min_version).unwrap(); + gst::Registry::get().check_feature_version( + plugin_name, + version.major.try_into().unwrap(), + version.minor.try_into().unwrap(), + version.patch.try_into().unwrap(), + ) + } else { + gst::Registry::get().lookup_feature(plugin_name).is_some() + } } pub fn set_plugin_rank(plugin_name: &str, rank: gst::Rank) -> Result<()> {