Skip to content

Instantly share code, notes, and snippets.

@compiaffe
Last active April 20, 2021 09:55
Show Gist options
  • Save compiaffe/5314d0b82cc2d7f3d77a7dc16c865594 to your computer and use it in GitHub Desktop.
Save compiaffe/5314d0b82cc2d7f3d77a7dc16c865594 to your computer and use it in GitHub Desktop.
NOT WORKING CODE: How to look at factories for gst autoplug-select
// decodebin
// .connect("autoplug-select", false, move |values| {
// // Obtain a copy of the values field 3 - aka factories:
// // See https://gstreamer.freedesktop.org/documentation/playback/decodebin.html?gi-language=c#decodebin::autoplug-sort
// let factories = values[3].get::<gst::ElementFactory>().unwrap().unwrap();
// // let index = 0;
// // while let Some(val) = factories.get_nth(index) {
// // let elmf = val
// // .downcast_ref::<gst::ElementFactory>()
// // .expect("Not an ElementFactory")
// // .get()
// // .map_or_else(
// // || "Was a None".to_string(),
// // |elm| elm.get_element_type().name(),
// // );
// gst_info!(CAT, "decodebin found the factory:\n{:?}", elmf);
// }
// // let factory_names = factories
// // .iter()
// // .map(|f| {
// // f.downcast_ref::<gst::ElementFactory>()
// // .expect("Not an ElementFactory")
// // .get()
// // .map_or_else(
// // || "Was a None".to_string(),
// // |elm| elm.get_element_type().name(),
// // )
// // })
// // .collect::<Vec<String>>();
// // gst_info!(
// // CAT,
// // "decodebin found the following factories:\n{:?}",
// // factory_names
// // );
// Some(factories.to_value())
// })
// .unwrap();
// Ok(bin)
// }
@compiaffe
Copy link
Author

NOTE: not working code!

@compiaffe
Copy link
Author

when using autoplug-sort and then using the iter() or while loop we panic on the .expect("Not an ElementFactory")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment