## CheeseCameraDeviceMonitor CheeseCameraDeviceMonitor — Simple object to enumerate v4l devices |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <cheese/cheese-camera-device-monitor.h>

    struct              CheeseCameraDeviceMonitorClass;
    struct              CheeseCameraDeviceMonitor;
    CheeseCameraDeviceMonitor * cheese_camera_device_monitor_new
                                                            (void);
    void                cheese_camera_device_monitor_coldplug
                                                            (CheeseCameraDeviceMonitor *monitor);

## Object Hierarchy

      GObject
       +----CheeseCameraDeviceMonitor

## Signals

      "added"                                          : Action
      "removed"                                        : Action

## Description

CheeseCameraDeviceMonitor provides a basic interface for video4linux device enumeration and hotplugging.

It uses either GUdev or some platform specific code to list video devices. It is also capable (right now in Linux only, with the udev backend) to monitor device plugging and emit a CheeseCameraDeviceMonitor::added or CheeseCameraDeviceMonitor::removed signal when an event happens.

## Details

### struct CheeseCameraDeviceMonitorClass

    struct CheeseCameraDeviceMonitorClass {
      void (*added)(CheeseCameraDeviceMonitor *monitor,
                    CheeseCameraDevice        *device);
      void (*removed)(CheeseCameraDeviceMonitor *monitor, const gchar *uuid);
    };

Class for CheeseCameraDeviceMonitor.

`added` () | invoked when a new video capture device is connected
`removed` () | invoked when a video capture device is removed

### struct CheeseCameraDeviceMonitor

    struct CheeseCameraDeviceMonitor;

Use the accessor functions below.

### cheese_camera_device_monitor_new ()

    CheeseCameraDeviceMonitor * cheese_camera_device_monitor_new
                                                            (void);

Returns a new CheeseCameraDeviceMonitor object.

Returns : | a new CheeseCameraDeviceMonitor object.

### cheese_camera_device_monitor_coldplug ()

    void                cheese_camera_device_monitor_coldplug
                                                            (CheeseCameraDeviceMonitor *monitor);

Enumerate plugged in cameras and emit ::added for those which already exist. This is only required when your program starts, so be sure to connect to at least the ::added signal before calling this function.

`monitor` : | a CheeseCameraDeviceMonitor

## Signal Details

### The `"added"` signal

    void                user_function                      (CheeseCameraDeviceMonitor *monitor,
                                                            CheeseCameraDevice        *device,
                                                            gpointer                   user_data)      : Action

The ::added signal is emitted when a camera is added, or on start-up after `cheese_camera_device_monitor_coldplug()` is called.

`monitor` : | the CheeseCameraDeviceMonitor that emitted the signal
`device` : | a new CheeseCameraDevice representing the video capture device
`user_data` : | user data set when the signal handler was connected.

### The `"removed"` signal

    void                user_function                      (CheeseCameraDeviceMonitor *monitor,
                                                            gchar                     *uuid,
                                                            gpointer                   user_data)      : Action

The ::removed signal is emitted when a camera is unplugged, or disabled on the system.

`monitor` : | the CheeseCameraDeviceMonitor that emitted the signal
`uuid` : | UUID for the device on the system
`user_data` : | user data set when the signal handler was connected.