notify when a device is added or removed
Michiel Konstapel
michiel at aanmelder.nl
Tue Sep 6 07:40:23 UTC 2022
On 06-09-2022 07:40, 136_B4_USAMA _TAHSEEN via gstreamer-devel wrote:
> I can get all available cameras and mics using
> GList *devices = gst_device_monitor_get_devices(monitor);
> I want an event to be called whenever a new device is added or an
> existing device is disconnected.
>
I have not used the device monitor, but looking at the docs:
https://gstreamer.freedesktop.org/documentation/gstreamer/gstdevicemonitor.html?gi-language=c#gst_device_monitor_start
"Starts monitoring the devices, one this has succeeded, the
GST_MESSAGE_DEVICE_ADDED and GST_MESSAGE_DEVICE_REMOVED messages will be
emitted on the bus when the list of devices changes."
So you'll have to listen for messages on the bus, which is a messaging
system attached to the pipeline:
https://gstreamer.freedesktop.org/documentation/application-development/basics/bus.html
HTH,
Michiel
More information about the gstreamer-devel
mailing list