Last active
April 20, 2021 09:55
-
-
Save compiaffe/5314d0b82cc2d7f3d77a7dc16c865594 to your computer and use it in GitHub Desktop.
NOT WORKING CODE: How to look at factories for gst autoplug-select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) | |
// } |
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
NOTE: not working code!