examples: Update playback-tutorial-6 with new getters

This commit is contained in:
Piotrek Brzeziński 2021-11-25 14:54:07 +01:00
parent abd2d4dfd7
commit 1d78ac9323

View file

@ -9,7 +9,7 @@ mod tutorials_common;
fn filter_vis_features(feature: &gst::PluginFeature) -> bool { fn filter_vis_features(feature: &gst::PluginFeature) -> bool {
match feature.downcast_ref::<gst::ElementFactory>() { match feature.downcast_ref::<gst::ElementFactory>() {
Some(factory) => { Some(factory) => {
let klass = factory.metadata(&gst::ELEMENT_METADATA_KLASS).unwrap(); let klass = factory.klass();
klass.contains("Visualization") klass.contains("Visualization")
} }
None => false, None => false,
@ -29,7 +29,7 @@ fn tutorial_main() -> Result<(), Error> {
println!("Available visualization plugins:"); println!("Available visualization plugins:");
for feature in list { for feature in list {
let factory = feature.downcast::<gst::ElementFactory>().unwrap(); let factory = feature.downcast::<gst::ElementFactory>().unwrap();
let name = factory.metadata(&gst::ELEMENT_METADATA_LONGNAME).unwrap(); let name = factory.longname();
println!(" {}", name); println!(" {}", name);
if selected_factory.is_none() && name.starts_with("GOOM") { if selected_factory.is_none() && name.starts_with("GOOM") {
@ -41,9 +41,7 @@ fn tutorial_main() -> Result<(), Error> {
let vis_factory = selected_factory.expect("No visualization plugins found."); let vis_factory = selected_factory.expect("No visualization plugins found.");
// We have now selected a factory for the visualization element // We have now selected a factory for the visualization element
let name = vis_factory let name = vis_factory.longname();
.metadata(&gst::ELEMENT_METADATA_LONGNAME)
.unwrap();
println!("Selected {}", name); println!("Selected {}", name);
let vis_plugin = vis_factory.create(None).unwrap(); let vis_plugin = vis_factory.create(None).unwrap();