# GstDeviceMonitor

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;
       }

## GstDeviceMonitor

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstDeviceMonitor

Opaque device monitor object structure.

### Members

`parent` (GstObject) –

the parent GstObject structure

Since : 1.4

### Class structure

#### GstDeviceMonitorClass

Opaque device monitor class structure.

##### Fields

`parent_class` (GstObjectClass) –

the parent GstObjectClass structure

Since : 1.4

### Gst.DeviceMonitorClass

Opaque device monitor class structure.

##### Attributes

`parent_class` (Gst.ObjectClass) –

the parent Gst.ObjectClass structure

Since : 1.4

### Gst.DeviceMonitorClass

Opaque device monitor class structure.

##### Attributes

`parent_class` (Gst.ObjectClass) –

the parent Gst.ObjectClass structure

Since : 1.4

## Gst.DeviceMonitor

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.DeviceMonitor

Opaque device monitor object structure.

### Members

`parent` (Gst.Object) –

the parent Gst.Object structure

Since : 1.4

## Gst.DeviceMonitor

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.DeviceMonitor

Opaque device monitor object structure.

### Members

`parent` (Gst.Object) –

the parent Gst.Object structure

Since : 1.4

### Constructors

#### gst_device_monitor_new

    GstDeviceMonitor *
    gst_device_monitor_new ()

Create a new GstDeviceMonitor

Returns ( [transfer: full]) –

a new device monitor.

Since : 1.4

#### Gst.DeviceMonitor.prototype.new

    function Gst.DeviceMonitor.prototype.new(): {
        // javascript wrapper for 'gst_device_monitor_new'
    }

Create a new Gst.DeviceMonitor

Returns (Gst.DeviceMonitor) –

a new device monitor.

Since : 1.4

#### Gst.DeviceMonitor.new

    def Gst.DeviceMonitor.new ():
        #python wrapper for 'gst_device_monitor_new'

Create a new Gst.DeviceMonitor

Returns (Gst.DeviceMonitor) –

a new device monitor.

Since : 1.4

### Methods

#### gst_device_monitor_add_filter

    guint
    gst_device_monitor_add_filter (GstDeviceMonitor * monitor,
                                   const gchar* classes,
                                   GstCaps * caps)

Adds a filter for which GstDevice will be monitored, any device that matches all these classes and the GstCaps will be returned.

If this function is called multiple times to add more filters, each will be matched independently. That is, adding more filters will not further restrict what devices are matched.

The GstCaps supported by the device as returned by gst_device_get_caps are not intersected with caps filters added using this function.

Filters must be added before the GstDeviceMonitor is started.

Parameters:

`monitor` –

a device monitor

`classes` ( [allow-none]) –

device classes to use as filter or NULL for any class

`caps` ( [allow-none]) –

the GstCaps to filter or NULL for ANY

Returns –

The id of the new filter or 0 if no provider matched the filter's classes.

Since : 1.4

#### Gst.DeviceMonitor.prototype.add_filter

    function Gst.DeviceMonitor.prototype.add_filter(classes: String, caps: Gst.Caps): {
        // javascript wrapper for 'gst_device_monitor_add_filter'
    }

Adds a filter for which Gst.Device will be monitored, any device that matches all these classes and the Gst.Caps will be returned.

If this function is called multiple times to add more filters, each will be matched independently. That is, adding more filters will not further restrict what devices are matched.

The Gst.Caps supported by the device as returned by Gst.Device.prototype.get_caps are not intersected with caps filters added using this function.

Filters must be added before the Gst.DeviceMonitor is started.

Parameters:

`monitor` (Gst.DeviceMonitor) –

a device monitor

`classes` (String) –

device classes to use as filter or NULL for any class

`caps` (Gst.Caps) –

the Gst.Caps to filter or NULL for ANY

Returns (Number) –

The id of the new filter or 0 if no provider matched the filter's classes.

Since : 1.4

#### Gst.DeviceMonitor.add_filter

    def Gst.DeviceMonitor.add_filter (self, classes, caps):
        #python wrapper for 'gst_device_monitor_add_filter'

Adds a filter for which Gst.Device will be monitored, any device that matches all these classes and the Gst.Caps will be returned.

If this function is called multiple times to add more filters, each will be matched independently. That is, adding more filters will not further restrict what devices are matched.

The Gst.Caps supported by the device as returned by Gst.Device.get_caps are not intersected with caps filters added using this function.

Filters must be added before the Gst.DeviceMonitor is started.

Parameters:

`monitor` (Gst.DeviceMonitor) –

a device monitor

`classes` (str) –

device classes to use as filter or NULL for any class

`caps` (Gst.Caps) –

the Gst.Caps to filter or NULL for ANY

Returns (int) –

The id of the new filter or 0 if no provider matched the filter's classes.

Since : 1.4

#### gst_device_monitor_get_bus

    GstBus *
    gst_device_monitor_get_bus (GstDeviceMonitor * monitor)

Gets the GstBus of this GstDeviceMonitor

Parameters:

`monitor` –

a GstDeviceProvider

Returns ( [transfer: full]) –

a GstBus

Since : 1.4

#### Gst.DeviceMonitor.prototype.get_bus

    function Gst.DeviceMonitor.prototype.get_bus(): {
        // javascript wrapper for 'gst_device_monitor_get_bus'
    }

Gets the Gst.Bus of this Gst.DeviceMonitor

Parameters:

`monitor` (Gst.DeviceMonitor) –

a Gst.DeviceProvider

Returns (Gst.Bus) –

a Gst.Bus

Since : 1.4

#### Gst.DeviceMonitor.get_bus

    def Gst.DeviceMonitor.get_bus (self):
        #python wrapper for 'gst_device_monitor_get_bus'

Gets the Gst.Bus of this Gst.DeviceMonitor

Parameters:

`monitor` (Gst.DeviceMonitor) –

a Gst.DeviceProvider

Returns (Gst.Bus) –

a Gst.Bus

Since : 1.4

#### gst_device_monitor_get_devices

    GList *
    gst_device_monitor_get_devices (GstDeviceMonitor * monitor)

Gets a list of devices from all of the relevant monitors. This may actually probe the hardware if the monitor is not currently started.

Parameters:

`monitor` –

A GstDeviceProvider

Returns ( [transfer: full][element-typeGstDevice][nullable]) –

a GList of GstDevice

Since : 1.4

#### Gst.DeviceMonitor.prototype.get_devices

    function Gst.DeviceMonitor.prototype.get_devices(): {
        // javascript wrapper for 'gst_device_monitor_get_devices'
    }

Gets a list of devices from all of the relevant monitors. This may actually probe the hardware if the monitor is not currently started.

Parameters:

`monitor` (Gst.DeviceMonitor) –

A Gst.DeviceProvider

Returns ([ Gst.Device ]) –

a GLib.List of Gst.Device

Since : 1.4

#### Gst.DeviceMonitor.get_devices

    def Gst.DeviceMonitor.get_devices (self):
        #python wrapper for 'gst_device_monitor_get_devices'

Gets a list of devices from all of the relevant monitors. This may actually probe the hardware if the monitor is not currently started.

Parameters:

`monitor` (Gst.DeviceMonitor) –

A Gst.DeviceProvider

Returns ([ Gst.Device ]) –

a GLib.List of Gst.Device

Since : 1.4

#### gst_device_monitor_get_providers

    gchar**
    gst_device_monitor_get_providers (GstDeviceMonitor * monitor)

Get a list of the currently selected device provider factories.

This

Parameters:

`monitor` –

a GstDeviceMonitor

Returns –

(transfer full) (array zero-terminated=1) (element-type gchar*): A list of device provider factory names that are currently being monitored by monitor or NULL when nothing is being monitored.

Since : 1.6

#### Gst.DeviceMonitor.prototype.get_providers

    function Gst.DeviceMonitor.prototype.get_providers(): {
        // javascript wrapper for 'gst_device_monitor_get_providers'
    }

Get a list of the currently selected device provider factories.

This

Parameters:

`monitor` (Gst.DeviceMonitor) –

a Gst.DeviceMonitor

Returns ([ String ]) –

(transfer full) (array zero-terminated=1) (element-type gchar*): A list of device provider factory names that are currently being monitored by monitor or NULL when nothing is being monitored.

Since : 1.6

#### Gst.DeviceMonitor.get_providers

    def Gst.DeviceMonitor.get_providers (self):
        #python wrapper for 'gst_device_monitor_get_providers'

Get a list of the currently selected device provider factories.

This

Parameters:

`monitor` (Gst.DeviceMonitor) –

a Gst.DeviceMonitor

Returns ([ str ]) –

(transfer full) (array zero-terminated=1) (element-type gchar*): A list of device provider factory names that are currently being monitored by monitor or NULL when nothing is being monitored.

Since : 1.6

#### gst_device_monitor_get_show_all_devices

    gboolean
    gst_device_monitor_get_show_all_devices (GstDeviceMonitor * monitor)

Get if monitor is currently showing all devices, even those from hidden providers.

Parameters:

`monitor` –

a GstDeviceMonitor

Returns –

TRUE when all devices will be shown.

Since : 1.6

#### Gst.DeviceMonitor.prototype.get_show_all_devices

    function Gst.DeviceMonitor.prototype.get_show_all_devices(): {
        // javascript wrapper for 'gst_device_monitor_get_show_all_devices'
    }

Get if monitor is currently showing all devices, even those from hidden providers.

Parameters:

`monitor` (Gst.DeviceMonitor) –

a Gst.DeviceMonitor

Returns (Number) –

TRUE when all devices will be shown.

Since : 1.6

#### Gst.DeviceMonitor.get_show_all_devices

    def Gst.DeviceMonitor.get_show_all_devices (self):
        #python wrapper for 'gst_device_monitor_get_show_all_devices'

Get if monitor is currently showing all devices, even those from hidden providers.

Parameters:

`monitor` (Gst.DeviceMonitor) –

a Gst.DeviceMonitor

Returns (bool) –

TRUE when all devices will be shown.

Since : 1.6

#### gst_device_monitor_remove_filter

    gboolean
    gst_device_monitor_remove_filter (GstDeviceMonitor * monitor,
                                      guint filter_id)

Removes a filter from the GstDeviceMonitor using the id that was returned by gst_device_monitor_add_filter.

Parameters:

`monitor` –

a device monitor

`filter_id` –

the id of the filter

Returns –

TRUE of the filter id was valid, FALSE otherwise

Since : 1.4

#### Gst.DeviceMonitor.prototype.remove_filter

    function Gst.DeviceMonitor.prototype.remove_filter(filter_id: Number): {
        // javascript wrapper for 'gst_device_monitor_remove_filter'
    }

Removes a filter from the Gst.DeviceMonitor using the id that was returned by Gst.DeviceMonitor.prototype.add_filter.

Parameters:

`monitor` (Gst.DeviceMonitor) –

a device monitor

`filter_id` (Number) –

the id of the filter

Returns (Number) –

TRUE of the filter id was valid, FALSE otherwise

Since : 1.4

#### Gst.DeviceMonitor.remove_filter

    def Gst.DeviceMonitor.remove_filter (self, filter_id):
        #python wrapper for 'gst_device_monitor_remove_filter'

Removes a filter from the Gst.DeviceMonitor using the id that was returned by Gst.DeviceMonitor.add_filter.

Parameters:

`monitor` (Gst.DeviceMonitor) –

a device monitor

`filter_id` (int) –

the id of the filter

Returns (bool) –

TRUE of the filter id was valid, FALSE otherwise

Since : 1.4

#### gst_device_monitor_set_show_all_devices

    gst_device_monitor_set_show_all_devices (GstDeviceMonitor * monitor,
                                             gboolean show_all)

Set if all devices should be visible, even those devices from hidden providers. Setting show_all to true might show some devices multiple times.

Parameters:

`monitor` –

a GstDeviceMonitor

`show_all` –

show all devices

Since : 1.6

#### Gst.DeviceMonitor.prototype.set_show_all_devices

    function Gst.DeviceMonitor.prototype.set_show_all_devices(show_all: Number): {
        // javascript wrapper for 'gst_device_monitor_set_show_all_devices'
    }

Set if all devices should be visible, even those devices from hidden providers. Setting show_all to true might show some devices multiple times.

Parameters:

`monitor` (Gst.DeviceMonitor) –

a Gst.DeviceMonitor

`show_all` (Number) –

show all devices

Since : 1.6

#### Gst.DeviceMonitor.set_show_all_devices

    def Gst.DeviceMonitor.set_show_all_devices (self, show_all):
        #python wrapper for 'gst_device_monitor_set_show_all_devices'

Set if all devices should be visible, even those devices from hidden providers. Setting show_all to true might show some devices multiple times.

Parameters:

`monitor` (Gst.DeviceMonitor) –

a Gst.DeviceMonitor

`show_all` (bool) –

show all devices

Since : 1.6

#### gst_device_monitor_start

    gboolean
    gst_device_monitor_start (GstDeviceMonitor * monitor)

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.

Parameters:

`monitor` –

A GstDeviceMonitor

Returns –

TRUE if the device monitoring could be started, i.e. at least a single device provider was started successfully.

Since : 1.4

#### Gst.DeviceMonitor.prototype.start

    function Gst.DeviceMonitor.prototype.start(): {
        // javascript wrapper for 'gst_device_monitor_start'
    }

Starts monitoring the devices, one this has succeeded, the Gst.MessageType.DEVICE_ADDED and Gst.MessageType.DEVICE_REMOVED messages will be emitted on the bus when the list of devices changes.

Parameters:

`monitor` (Gst.DeviceMonitor) –

A Gst.DeviceMonitor

Returns (Number) –

TRUE if the device monitoring could be started, i.e. at least a single device provider was started successfully.

Since : 1.4

#### Gst.DeviceMonitor.start

    def Gst.DeviceMonitor.start (self):
        #python wrapper for 'gst_device_monitor_start'

Starts monitoring the devices, one this has succeeded, the Gst.MessageType.DEVICE_ADDED and Gst.MessageType.DEVICE_REMOVED messages will be emitted on the bus when the list of devices changes.

Parameters:

`monitor` (Gst.DeviceMonitor) –

A Gst.DeviceMonitor

Returns (bool) –

TRUE if the device monitoring could be started, i.e. at least a single device provider was started successfully.

Since : 1.4

#### gst_device_monitor_stop

    gst_device_monitor_stop (GstDeviceMonitor * monitor)

Stops monitoring the devices.

Parameters:

`monitor` –

A GstDeviceProvider

Since : 1.4

#### Gst.DeviceMonitor.prototype.stop

    function Gst.DeviceMonitor.prototype.stop(): {
        // javascript wrapper for 'gst_device_monitor_stop'
    }

Stops monitoring the devices.

Parameters:

`monitor` (Gst.DeviceMonitor) –

A Gst.DeviceProvider

Since : 1.4

#### Gst.DeviceMonitor.stop

    def Gst.DeviceMonitor.stop (self):
        #python wrapper for 'gst_device_monitor_stop'

Stops monitoring the devices.

Parameters:

`monitor` (Gst.DeviceMonitor) –

A Gst.DeviceProvider

Since : 1.4

### Properties

#### show-all

    “show-all” gboolean

Flags : Read / Write

#### show-all

    “show-all” Number

Flags : Read / Write

#### show_all

    “self.props.show_all” bool

Flags : Read / Write

## Function Macros

### GST_DEVICE_MONITOR_CAST

    #define GST_DEVICE_MONITOR_CAST(obj)            ((GstDeviceMonitor *)(obj))

The results of the search are