Gst Device Provider Bus Callbacks
Townsheriff
arturs.valenieks at gmail.com
Wed Mar 31 09:22:11 UTC 2021
Hey,
I'm writing a small application where I want to start a pipeline when a
device is connected. To detect device I'm using DeviceMonitor api. I'm
having trouble receiving an event from `gst_bus_add_watch_full`, but it
works fine if I do it with timed iteration `gst_bus_timed_pop`. I was
following this
<http://(https://gstreamer.freedesktop.org/documentation/gstreamer/gstdevicemonitor.html?gi-language=c>
tutorial.
What I'm doing wrong here?
fn main() -> Result<(), Error> {
gst::init();
let monitor = gst::DeviceMonitor::new();
monitor.set_show_all_devices(true);
let bus = monitor.get_bus();
let r = bus.add_watch(|bus, msg| { // never called
println!("WATCH Message {:?}", &msg);
Continue(true)
});
println!("result {:?}", r);
let caps = gst::Caps::new_any();
monitor.add_filter(None, Some(&caps));
monitor.start();
monitor.get_providers()
.into_iter().for_each(|provider| println!("provider {:?}",
String::from(provider)));
let devices =monitor.get_devices();
println!("devices {:?}", &devices);
for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { // works fine
println!("Message iter {:?}", &msg);
}
Ok(())
}
Cheers!
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list