inspect: Print element interfaces

This commit is contained in:
Fabian Orccon 2023-06-05 10:28:50 +02:00
parent dadf35f6aa
commit 0d23096ebf

View file

@ -120,6 +120,19 @@ fn print_hierarchy(type_: gst::glib::Type) {
println!();
}
fn print_interfaces(type_: gst::glib::Type) {
let interfaces = type_.interfaces();
if interfaces.is_empty() {
return;
}
println!("{}:", HEADING_COLOR.paint("Implemented Interfaces"));
for iface in interfaces.as_slice() {
println!(" {}", DATA_TYPE_COLOR.paint(iface.name()));
}
println!();
}
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()));
@ -138,7 +151,9 @@ fn print_element_info(feature: &gst::PluginFeature) -> Result<(), String> {
if let Some(plugin) = feature.plugin() {
print_plugin_info(&plugin);
}
print_hierarchy(element.type_());
print_interfaces(element.type_());
Ok(())
}