| Webcam Library Reference Documentation | ![]() |
#include <assert.h>
Go to the source code of this file.
Data Structures | |
| struct | _Control |
| An internal control description associated with a device. More... | |
| struct | _ControlList |
| Base structure that contains a list of controls and associated data. More... | |
| struct | _Device |
| Internal device information. More... | |
| struct | _DeviceList |
| Base structure that contains a list of devices and associated data. More... | |
| struct | _Handle |
| Information associated with a device handle. More... | |
| struct | _HandleList |
| Base structure that contains an array of device handles and associated data. More... | |
Defines | |
| #define | USE_UVCVIDEO |
| Whether private controls of the Linux UVC driver should be used or not. | |
| #define | USE_LOGITECH_DYNCTRL |
| Whether or not to include the automatically generated Logitech dynamic controls header file. | |
| #define | ENABLE_V4L2_ADVANCED_CONTROL_ENUMERATION |
| Whether to compile in support functions for the Linux UVC driver's dynamic controls. | |
| #define | DYNCTRL_IGNORE_EEXIST_AFTER_PASS1 |
| Ignore EEXIST errors for the UVCIOC_CTRL_ADD and UVCIOC_CTRL_MAP ioctls for all but the first device. | |
| #define | MAX_HANDLES 32 |
| The maximum number (plus 1) of handles libwebcam supports. | |
| #define | DISABLE_LOCKING 1 |
| Debug option to disable locking. | |
| #define | DEBUG_LOCKING 1 |
| Debug option to add verbosity to locking and unlocking. | |
| #define | UNKNOWN_CONTROL_NAME "Unknown control" |
| The name used for controls whose name could not be retrieved. | |
| #define | CONTROL_IO_ERROR_RETRIES 2 |
| Number of retries for failed V4L2 ioctl requests. | |
| #define | GET_HANDLE(handle) (handle_list.handles[(handle)]) |
| Returns the given handle structure. | |
| #define | HANDLE_OPEN(handle) ((handle) < MAX_HANDLES && GET_HANDLE(handle).open) |
| Returns true if the given handle is open (valid or invalid). | |
| #define | HANDLE_VALID(handle) (HANDLE_OPEN(handle) && GET_HANDLE(handle).device) |
| Returns true if the given handle is open and valid. | |
| #define | V4L2_MENU_CTRL_MAX_NAME_SIZE sizeof(((struct v4l2_querymenu *)NULL)->name) |
| Returns the maximum number of characters that a menu-type control choice can have in V4L2. | |
| #define | MAKE_FOURCC(c1, c2, c3, c4) (unsigned int)((long)c1 | (long)c2 << 8 | (long)c3 << 16 | (long)c4 << 24) |
| Converts the given characters into a FourCC code. | |
Typedefs | |
| typedef struct _Control | Control |
| An internal control description associated with a device. | |
| typedef struct _ControlList | ControlList |
| Base structure that contains a list of controls and associated data. | |
| typedef struct _Device | Device |
| Internal device information. | |
| typedef struct _DeviceList | DeviceList |
| Base structure that contains a list of devices and associated data. | |
| typedef struct _Handle | Handle |
| Information associated with a device handle. | |
| typedef struct _HandleList | HandleList |
| Base structure that contains an array of device handles and associated data. | |
Functions | |
| int | open_v4l2_device (char *device_name) |
| static CResult | lock_mutex (pthread_mutex_t *mutex) |
| Acquire a mutex. | |
| static void | unlock_mutex (pthread_mutex_t *mutex) |
| Release a mutex. | |
| static void | copy_string_to_buffer (char **target, char *source, void *buffer, unsigned int *offset) |
| Copies a variable-length string to the part of an enumeration buffer that is reserved for dynamic data. | |
Variables | |
| int | initialized |
| A flag indicating whether the library was initialized. | |
| HandleList | handle_list |
| The fixed size list of file handles. | |
| #define CONTROL_IO_ERROR_RETRIES 2 |
Number of retries for failed V4L2 ioctl requests.
This is a workaround for faulty devices.
Referenced by refresh_control_list().
| #define DYNCTRL_IGNORE_EEXIST_AFTER_PASS1 |
Ignore EEXIST errors for the UVCIOC_CTRL_ADD and UVCIOC_CTRL_MAP ioctls for all but the first device.
This is required if the driver uses global controls instead of per-device controls.
Referenced by process_control(), and process_mapping().
| #define ENABLE_V4L2_ADVANCED_CONTROL_ENUMERATION |
Whether to compile in support functions for the Linux UVC driver's dynamic controls.
Whether to use the V4L2_CTRL_FLAG_NEXT_CTRL flag when enumerating V4L2 controls
| #define USE_LOGITECH_DYNCTRL |
Whether or not to include the automatically generated Logitech dynamic controls header file.
| #define V4L2_MENU_CTRL_MAX_NAME_SIZE sizeof(((struct v4l2_querymenu *)NULL)->name) |
Returns the maximum number of characters that a menu-type control choice can have in V4L2.
Referenced by create_control_choices().
Information associated with a device handle.
Note that a handle can have three different states:
| static void copy_string_to_buffer | ( | char ** | target, | |
| char * | source, | |||
| void * | buffer, | |||
| unsigned int * | offset | |||
| ) | [inline, static] |
Copies a variable-length string to the part of an enumeration buffer that is reserved for dynamic data.
This function is used by the enumeration functions.
Referenced by c_enum_devices(), c_enum_pixel_formats(), and c_get_device_info().
| static CResult lock_mutex | ( | pthread_mutex_t * | mutex | ) | [inline, static] |
Acquire a mutex.
This function is identical to pthread_mutex_lock except that it has different return values and supports some debug flags.
References C_SUCCESS, and C_SYNC_ERROR.
Referenced by c_cleanup(), c_enum_controls(), c_enum_devices(), clear_control_list(), close_handle(), create_handle(), delete_device(), refresh_control_list(), and refresh_device_list().
| static void unlock_mutex | ( | pthread_mutex_t * | mutex | ) | [inline, static] |
Release a mutex.
This function is identical to pthread_mutex_unlock except that it has different return values and supports some debug flags.
Referenced by c_cleanup(), c_enum_controls(), c_enum_devices(), clear_control_list(), close_handle(), create_handle(), delete_device(), refresh_control_list(), and refresh_device_list().