CheeseCameraDeviceMonitor

CheeseCameraDeviceMonitor — Simple object to enumerate v4l devices

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 {
  GObjectClass parent_class;

  void (*added)(CheeseCameraDeviceMonitor *camera,
                const char                *id,
                const char                *device_file,
                const char                *product_name,
                int                        api_version);
  void (*removed)(CheeseCameraDeviceMonitor *camera, const char *id);
};

struct CheeseCameraDeviceMonitor

struct CheeseCameraDeviceMonitor;

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

Will actively look for plugged in cameras and emit ::added for those new cameras. This is only required when your program starts, so as to connect to those signals before they are emitted.

monitor :

a CheeseCameraDeviceMonitor object.

Signal Details

The "added" signal

void                user_function                      (CheeseCameraDeviceMonitor *device,
                                                        gchar                     *id,
                                                        gchar                     *device,
                                                        gchar                     *product_name,
                                                        gint                       api_version,
                                                        gpointer                   user_data)         : Action

The ::added signal is emitted when a camera is added, or on start-up after cheese_camera_device_monitor_colplug is called.

device :

A private object representing the newly added camera.

id :

Device unique identifier.

device :

Device file name (e.g. /dev/video2).

product_name :

Device product name (human readable, intended to be displayed in a UI).

api_version :

Supported video4linux API: 1 for v4l, 2 for v4l2.

user_data :

user data set when the signal handler was connected.

The "removed" signal

void                user_function                      (CheeseCameraDeviceMonitor *device,
                                                        gchar                     *id,
                                                        gpointer                   user_data)      : Action

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

device :

A private object representing the newly added camera

id :

Device unique identifier.

user_data :

user data set when the signal handler was connected.