gst.device_monitor

Module for [DeviceMonitor] class

Types 3

Applications should create a #GstDeviceMonitor when they want to probe, list and monitor devices of a specific type. The #GstDeviceMonitor will create the appropriate #GstDeviceProvider objects and manage them. It will then post messages on its #GstBus for devices that have been added and removed.

The device monitor will monitor all devices matching the filters that the application has set.

The basic use pattern of a device monitor is as follows:

static gboolean
 my_bus_func (GstBus * bus, GstMessage * message, gpointer user_data)
 {
    GstDevice *device;
    gchar *name;

    switch (GST_MESSAGE_TYPE (message)) {
      case GST_MESSAGE_DEVICE_ADDED:
        gst_message_parse_device_added (message, &device);
        name = gst_device_get_display_name (device);
        g_print("Device added: %s\n", name);
        g_free (name);
        gst_object_unref (device);
        break;
      case GST_MESSAGE_DEVICE_REMOVED:
        gst_message_parse_device_removed (message, &device);
        name = gst_device_get_display_name (device);
        g_print("Device removed: %s\n", name);
        g_free (name);
        gst_object_unref (device);
        break;
      default:
        break;
    }

    return G_SOURCE_CONTINUE;
 }

 GstDeviceMonitor *
 setup_raw_video_source_device_monitor (void) {
    GstDeviceMonitor *monitor;
    GstBus *bus;
    GstCaps *caps;

    monitor = gst_device_monitor_new ();

    bus = gst_device_monitor_get_bus (monitor);
    gst_bus_add_watch (bus, my_bus_func, NULL);
    gst_object_unref (bus);

    caps = gst_caps_new_empty_simple ("video/x-raw");
    gst_device_monitor_add_filter (monitor, "Video/Source", caps);
    gst_caps_unref (caps);

    gst_device_monitor_start (monitor);

    return monitor;
 }

Methods
GType _gType() @property
DeviceMonitor self()Returns `this`, for use in `with` statements.
DeviceMonitorGidBuilder builder()Get builder for [gst.device_monitor.DeviceMonitor] Returns: New builder object
bool showAll() @property
void showAll(bool propval) @property
uint addFilter(string classes = null, gst.caps.Caps caps = null)Adds a filter for which #GstDevice will be monitored, any device that matches all these classes and the #GstCaps will be returned.
gst.bus.Bus getBus()Gets the #GstBus of this #GstDeviceMonitor Returns: a #GstBus
gst.device.Device[] getDevices()Gets a list of devices from all of the relevant monitors. This may actually probe the hardware if the monitor is not currently started. Returns: a #GList of #GstDevice
string[] getProviders()Get a list of the currently selected device provider factories.
bool getShowAllDevices()Get if monitor is currently showing all devices, even those from hidden providers. Returns: true when all devices will be shown.
bool removeFilter(uint filterId)Removes a filter from the #GstDeviceMonitor using the id that was returned by [gst.device_monitor.DeviceMonitor.addFilter].
void setShowAllDevices(bool showAll)Set if all devices should be visible, even those devices from hidden providers. Setting show_all to true might show some devices multiple times.
bool start()Starts monitoring the devices, one this has succeeded, the [gst.types.MessageType.DeviceAdded] and [gst.types.MessageType.DeviceRemoved] messages will be emitted on the bus when the list of devices...
void stop()Stops monitoring the devices.
Constructors
this(void * ptr, Flag!"Take" take)
this()Create a new #GstDeviceMonitor Returns: a new device monitor.

Fluent builder for [gst.device_monitor.DeviceMonitor]