Gst Device Provider Bus Callbacks

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Gst Device Provider Bus Callbacks

Townsheriff
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/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gst Device Provider Bus Callbacks

Ilya Aleshkov
Hi,

Have you tried to use gst_bus_set_sync_handler?

Thanks,
Ilya

On Wed, Mar 31, 2021 at 1:30 PM Townsheriff <[hidden email]> wrote:
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/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel