| Webcam Library Reference Documentation | ![]() |
Webcam library declarations. More...
#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... | |
Macros | |
| #define | USE_UVCVIDEO |
| Whether private controls of the Linux UVC driver should be used or not. | |
| #define | ENABLE_UVCVIDEO_DYNCTRL |
| Whether to compile in support functions for the Linux UVC driver's dynamic controls. More... | |
| #define | USE_LOGITECH_DYNCTRL |
| Whether to include the automatically generated Logitech dynamic controls header file. More... | |
| #define | ENABLE_V4L2_ADVANCED_CONTROL_ENUMERATION |
| Whether to include support for raw controls. More... | |
| #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. More... | |
| #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. More... | |
| #define | GUID_SIZE 16 |
| Size of a GUID in bytes. | |
| #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. More... | |
| #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. | |
| #define | GUID_FORMAT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" |
| Format string to print a GUID byte array with printf. | |
| #define | GUID_ARGS(guid) |
| Argument macro to print a GUID byte array with printf. More... | |
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. More... | |
| typedef struct _HandleList | HandleList |
| Base structure that contains an array of device handles and associated data. | |
Functions | |
| void | print_error (char *format,...) |
| int | open_v4l2_device (char *device_name) |
| Open the V4L2 device node with the given name. More... | |
| static CResult | lock_mutex (pthread_mutex_t *mutex) |
| Acquire a mutex. More... | |
| static void | unlock_mutex (pthread_mutex_t *mutex) |
| Release a mutex. More... | |
| 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. More... | |
Variables | |
| int | initialized |
| A flag indicating whether the library was initialized. | |
| HandleList | handle_list |
| The fixed size list of file handles. | |
Webcam library declarations.
| #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_UVCVIDEO_DYNCTRL |
Whether to compile in support functions for the Linux UVC driver's dynamic controls.
| #define ENABLE_V4L2_ADVANCED_CONTROL_ENUMERATION |
Whether to include support for raw controls.
Note that this requires V4L2_CTRL_TYPE_STRING to be available (i.e. V4L2 >= 2.6.32). This is disabled by default but CMake enables it if it finds V4L2_CTRL_TYPE_STRING. Whether to use the V4L2_CTRL_FLAG_NEXT_CTRL flag when enumerating V4L2 controls
| #define GUID_ARGS | ( | guid | ) |
Argument macro to print a GUID byte array with printf.
Referenced by process_control().
| #define USE_LOGITECH_DYNCTRL |
Whether 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:
|
inlinestatic |
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().
|
inlinestatic |
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().
| int open_v4l2_device | ( | char * | device_name | ) |
Open the V4L2 device node with the given name.
| device_name | A device name as accepted by c_open_device() |
References C_INVALID_ARG.
Referenced by add_control_mappings(), c_enum_frame_intervals(), c_enum_frame_sizes(), c_enum_pixel_formats(), read_v4l2_control(), refresh_control_list(), refresh_device_details(), and write_v4l2_control().
|
inlinestatic |
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().