mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-05-31 22:58:33 +00:00
inspect: Print plugin details of an element
This commit is contained in:
parent
a5c799cf34
commit
92ec3a6166
|
@ -65,6 +65,31 @@ fn print_factory_details_info(factory: &gst::ElementFactory) {
|
|||
print_property("Author", factory.author());
|
||||
}
|
||||
|
||||
fn print_plugin_info(plugin: &gst::Plugin) {
|
||||
println!("{}", HEADING_COLOR.paint("Plugin details:"));
|
||||
print_property("Name", plugin.plugin_name().as_str());
|
||||
print_property("Description", plugin.description().as_str());
|
||||
print_property(
|
||||
"Filename",
|
||||
&plugin.filename().map_or("(null)".to_string(), |f| {
|
||||
f.into_os_string().into_string().unwrap()
|
||||
}),
|
||||
); // FIXME: unwrap?
|
||||
print_property("Version", plugin.version().as_str());
|
||||
print_property("License", plugin.license().as_str());
|
||||
print_property("Source module", plugin.source().as_str());
|
||||
if let Some(mut release_date) = plugin.release_date_string() {
|
||||
// Convert YYYY-MM-DDTHH:MMZ => YYYY-MM-DD HH:MM (UTC)
|
||||
release_date = release_date
|
||||
.replacen('T', " ", 1)
|
||||
.replacen('Z', " (UTC)", 1)
|
||||
.into();
|
||||
print_property("Source release date", &release_date);
|
||||
}
|
||||
print_property("Binary package", plugin.package().as_str());
|
||||
print_property("Origin URL", plugin.origin().as_str());
|
||||
}
|
||||
|
||||
fn print_element_info(feature: &gst::PluginFeature) -> Result<(), String> {
|
||||
let Ok(factory) = feature.load() else {
|
||||
return Err(format!("element factory '{}' couldn't be loaded", feature.name()));
|
||||
|
@ -78,6 +103,11 @@ fn print_element_info(feature: &gst::PluginFeature) -> Result<(), String> {
|
|||
};
|
||||
|
||||
print_factory_details_info(element_factory);
|
||||
println!();
|
||||
|
||||
if let Some(plugin) = feature.plugin() {
|
||||
print_plugin_info(&plugin);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue