Commit d7030076 authored by Zeeshan Ali's avatar Zeeshan Ali

tmp

parent 2f45b01a
Pipeline #24309 canceled with stages
......@@ -31,7 +31,9 @@ fn main() {
}
// FIXME: Fetch `print_all` value from cmdline param
print_element_list(false);
//print_element_list(false);
print_feature_info("decodebin", true);
}
fn print_error<E: std::error::Error>(error: E, description: &str) {
......@@ -139,8 +141,57 @@ fn print_element_list(print_all: bool) {
);
}
fn print_element_info(_feature: &gst::PluginFeature, _print_names: bool) {
// FIXME: Implement.
fn print_feature_info(feature_name: &str, print_all: bool) {
let registry = gst::Registry::get();
if let Some(feature) = registry.find_feature(&feature_name, gst::ElementFactory::static_type())
{
print_element_info(&feature, print_all);
}
}
fn print_element_info(feature: &gst::PluginFeature, print_names: bool) {
if let Some(factory) = feature
.load()
.and_then(|f| f.downcast::<gst::ElementFactory>().ok())
{
if let Some(element) = factory.create(None) {
let name_prefix = if print_names {
format!("{}: ", plugin_name_color(&factory.get_name()))
} else {
String::from("")
};
print_factory_details_info(&factory, &name_prefix);
} else {
eprintln!(
"{}",
format!("{} factory could not create an element", feature.get_name()).red()
);
}
} else {
eprintln!(
"{}",
format!("{} could not be loaded", feature.get_name()).red()
);
}
}
fn print_factory_details_info(feature: &gst::ElementFactory, name_prefix: &str) {
println!("{}{}", name_prefix, heading_color("Factory_details:"));
println!(
"{:25} {}",
prop_name_color("Rank"),
prop_value_color(&format!(
"({}){}",
feature.get_rank().to_string(),
feature.get_rank()
))
);
}
fn heading_color(name: &str) -> ColoredString {
name.yellow().bold()
}
fn prop_name_color(name: &str) -> ColoredString {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment