## GstDevice

GstDevice — Object representing a device

## Functions

GstElement * | gst_device_create_element ()
GstCaps * | gst_device_get_caps ()
gchar * | gst_device_get_device_class ()
gchar * | gst_device_get_display_name ()
gboolean | gst_device_has_classes ()
gboolean | gst_device_has_classesv ()
gboolean | gst_device_reconfigure_element ()
GstStructure * | gst_device_get_properties ()

## Types and Values

struct | GstDevice
struct | GstDeviceClass

## Includes

    #include <gst/gst.h>

## Description

GstDevice are objects representing a device, they contain relevant metadata about the device, such as its class and the GstCaps representing the media types it can produce or handle.

GstDevice are created by GstDeviceProvider objects which can be aggregated by GstDeviceMonitor objects.

## Functions

### gst_device_create_element ()

    GstElement *
    gst_device_create_element (GstDevice *device,
                               const gchar *name);

Creates the element with all of the required parameters set to use this device.

#### Parameters

device | a GstDevice |
name | name of new element, or `NULL` to automatically create a unique name. | [allow-none]

#### Returns

a new GstElement configured to use this device.

[transfer full][nullable]

Since: 1.4

### gst_device_get_caps ()

    GstCaps *
    gst_device_get_caps (GstDevice *device);

Getter for the GstCaps that this device supports.

#### Parameters

device | a GstDevice |

#### Returns

The GstCaps supported by this device. Unref with `gst_caps_unref()` when done.

[nullable]

Since: 1.4

### gst_device_get_device_class ()

    gchar *
    gst_device_get_device_class (GstDevice *device);

Gets the "class" of a device. This is a "/" separated list of classes that represent this device. They are a subset of the classes of the GstDeviceProvider that produced this device.

#### Parameters

device | a GstDevice |

#### Returns

The device class. Free with `g_free()` after use.

Since: 1.4

### gst_device_get_display_name ()

    gchar *
    gst_device_get_display_name (GstDevice *device);

Gets the user-friendly name of the device.

#### Parameters

device | a GstDevice |

#### Returns

The device name. Free with `g_free()` after use.

Since: 1.4

### gst_device_has_classes ()

    gboolean
    gst_device_has_classes (GstDevice *device,
                            const gchar *classes);

Check if `device` matches all of the given classes

#### Parameters

device | a GstDevice |
classes | a "/"-separated list of device classes to match, only match if all classes are matched |

#### Returns

`TRUE` if `device` matches.

Since: 1.4

### gst_device_has_classesv ()

    gboolean
    gst_device_has_classesv (GstDevice *device,
                             gchar **classes);

Check if `factory` matches all of the given classes

#### Parameters

device | a GstDevice |
classes | a `NULL` terminated array of classes to match, only match if all classes are matched. | [array zero-terminated=1]

#### Returns

`TRUE` if `device` matches.

Since: 1.4

### gst_device_reconfigure_element ()

    gboolean
    gst_device_reconfigure_element (GstDevice *device,
                                    GstElement *element);

Tries to reconfigure an existing element to use the device. If this function fails, then one must destroy the element and create a new one using `gst_device_create_element()`.

Note: This should only be implemented for elements can change their device in the PLAYING state.

#### Parameters

device | a GstDevice |
element | a GstElement |

#### Returns

`TRUE` if the element could be reconfigured to use this device, `FALSE` otherwise.

Since: 1.4

### gst_device_get_properties ()

    GstStructure *
    gst_device_get_properties (GstDevice *device);

Gets the extra properties of a device.

#### Parameters

device | a GstDevice |

#### Returns

The extra properties or `NULL` when there are none. Free with `gst_structure_free()` after use.

[nullable]

Since: 1.6

## Types and Values

### struct GstDevice

    struct GstDevice {
      GstObject         parent;
    };

A device object.

#### Members

GstObject `parent`; | The parent GstObject structure. |

Since: 1.4

### struct GstDeviceClass

    struct GstDeviceClass {
      GstObjectClass    parent_class;

      GstElement * (*create_element)      (GstDevice * device, const gchar * name);
      gboolean     (*reconfigure_element) (GstDevice * device, GstElement * element);
    };

The class structure for a GstDevice object.

#### Members

`create_element` () | Creates the fully configured element to access this device. Subclasses need to override this and return a new element. |
`reconfigure_element` () | This only needs to be implemented by subclasses if the element can be reconfigured to use a different device. See the documentation for `gst_device_reconfigure_element()`. |

Since: 1.4

## See Also

GstDeviceProvider