11 #include <libuvc/libuvc_config.h>
13 struct libusb_context;
14 struct libusb_device_handle;
60 UVC_FRAME_FORMAT_UNKNOWN = 0,
63 UVC_FRAME_FORMAT_UNCOMPRESSED,
64 UVC_FRAME_FORMAT_COMPRESSED,
69 UVC_FRAME_FORMAT_UYVY,
75 UVC_FRAME_FORMAT_H264,
78 UVC_FRAME_FORMAT_GRAY16,
81 UVC_FRAME_FORMAT_BA81,
82 UVC_FRAME_FORMAT_SGRBG8,
83 UVC_FRAME_FORMAT_SGBRG8,
84 UVC_FRAME_FORMAT_SRGGB8,
85 UVC_FRAME_FORMAT_SBGGR8,
96 #define UVC_COLOR_FORMAT_UNKNOWN UVC_FRAME_FORMAT_UNKNOWN
97 #define UVC_COLOR_FORMAT_UNCOMPRESSED UVC_FRAME_FORMAT_UNCOMPRESSED
98 #define UVC_COLOR_FORMAT_COMPRESSED UVC_FRAME_FORMAT_COMPRESSED
99 #define UVC_COLOR_FORMAT_YUYV UVC_FRAME_FORMAT_YUYV
100 #define UVC_COLOR_FORMAT_UYVY UVC_FRAME_FORMAT_UYVY
101 #define UVC_COLOR_FORMAT_RGB UVC_FRAME_FORMAT_RGB
102 #define UVC_COLOR_FORMAT_BGR UVC_FRAME_FORMAT_BGR
103 #define UVC_COLOR_FORMAT_MJPEG UVC_FRAME_FORMAT_MJPEG
104 #define UVC_COLOR_FORMAT_GRAY8 UVC_FRAME_FORMAT_GRAY8
105 #define UVC_COLOR_FORMAT_GRAY16 UVC_FRAME_FORMAT_GRAY16
106 #define UVC_COLOR_FORMAT_NV12 UVC_FRAME_FORMAT_NV12
109 enum uvc_vs_desc_subtype {
110 UVC_VS_UNDEFINED = 0x00,
111 UVC_VS_INPUT_HEADER = 0x01,
112 UVC_VS_OUTPUT_HEADER = 0x02,
113 UVC_VS_STILL_IMAGE_FRAME = 0x03,
114 UVC_VS_FORMAT_UNCOMPRESSED = 0x04,
115 UVC_VS_FRAME_UNCOMPRESSED = 0x05,
116 UVC_VS_FORMAT_MJPEG = 0x06,
117 UVC_VS_FRAME_MJPEG = 0x07,
118 UVC_VS_FORMAT_MPEG2TS = 0x0a,
119 UVC_VS_FORMAT_DV = 0x0c,
120 UVC_VS_COLORFORMAT = 0x0d,
121 UVC_VS_FORMAT_FRAME_BASED = 0x10,
122 UVC_VS_FRAME_FRAME_BASED = 0x11,
123 UVC_VS_FORMAT_STREAM_BASED = 0x12
129 typedef struct uvc_still_frame_res {
130 struct uvc_still_frame_res *prev, *next;
131 uint8_t bResolutionIndex;
136 } uvc_still_frame_res_t;
138 typedef struct uvc_still_frame_desc {
140 struct uvc_still_frame_desc *prev, *next;
142 enum uvc_vs_desc_subtype bDescriptorSubtype;
144 uint8_t bEndPointAddress;
145 uvc_still_frame_res_t* imageSizePatterns;
146 uint8_t bNumCompressionPattern;
148 uint8_t* bCompression;
149 } uvc_still_frame_desc_t;
164 uint8_t bmCapabilities;
197 struct uvc_streaming_interface *parent;
203 uint8_t bNumFrameDescriptors;
206 uint8_t guidFormat[16];
207 uint8_t fourccFormat[4];
218 uint8_t bAspectRatioX;
219 uint8_t bAspectRatioY;
220 uint8_t bmInterlaceFlags;
221 uint8_t bCopyProtect;
222 uint8_t bVariableSize;
225 struct uvc_still_frame_desc *still_frame_desc;
230 UVC_RC_UNDEFINED = 0x00,
241 enum uvc_device_power_mode {
242 UVC_VC_VIDEO_POWER_MODE_FULL = 0x000b,
243 UVC_VC_VIDEO_POWER_MODE_DEVICE_DEPENDENT = 0x001b,
247 enum uvc_ct_ctrl_selector {
248 UVC_CT_CONTROL_UNDEFINED = 0x00,
249 UVC_CT_SCANNING_MODE_CONTROL = 0x01,
250 UVC_CT_AE_MODE_CONTROL = 0x02,
251 UVC_CT_AE_PRIORITY_CONTROL = 0x03,
252 UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL = 0x04,
253 UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL = 0x05,
254 UVC_CT_FOCUS_ABSOLUTE_CONTROL = 0x06,
255 UVC_CT_FOCUS_RELATIVE_CONTROL = 0x07,
256 UVC_CT_FOCUS_AUTO_CONTROL = 0x08,
257 UVC_CT_IRIS_ABSOLUTE_CONTROL = 0x09,
258 UVC_CT_IRIS_RELATIVE_CONTROL = 0x0a,
259 UVC_CT_ZOOM_ABSOLUTE_CONTROL = 0x0b,
260 UVC_CT_ZOOM_RELATIVE_CONTROL = 0x0c,
261 UVC_CT_PANTILT_ABSOLUTE_CONTROL = 0x0d,
262 UVC_CT_PANTILT_RELATIVE_CONTROL = 0x0e,
263 UVC_CT_ROLL_ABSOLUTE_CONTROL = 0x0f,
264 UVC_CT_ROLL_RELATIVE_CONTROL = 0x10,
265 UVC_CT_PRIVACY_CONTROL = 0x11,
266 UVC_CT_FOCUS_SIMPLE_CONTROL = 0x12,
267 UVC_CT_DIGITAL_WINDOW_CONTROL = 0x13,
268 UVC_CT_REGION_OF_INTEREST_CONTROL = 0x14
272 enum uvc_pu_ctrl_selector {
273 UVC_PU_CONTROL_UNDEFINED = 0x00,
274 UVC_PU_BACKLIGHT_COMPENSATION_CONTROL = 0x01,
275 UVC_PU_BRIGHTNESS_CONTROL = 0x02,
276 UVC_PU_CONTRAST_CONTROL = 0x03,
277 UVC_PU_GAIN_CONTROL = 0x04,
278 UVC_PU_POWER_LINE_FREQUENCY_CONTROL = 0x05,
279 UVC_PU_HUE_CONTROL = 0x06,
280 UVC_PU_SATURATION_CONTROL = 0x07,
281 UVC_PU_SHARPNESS_CONTROL = 0x08,
282 UVC_PU_GAMMA_CONTROL = 0x09,
283 UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL = 0x0a,
284 UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL = 0x0b,
285 UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL = 0x0c,
286 UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL = 0x0d,
287 UVC_PU_DIGITAL_MULTIPLIER_CONTROL = 0x0e,
288 UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL = 0x0f,
289 UVC_PU_HUE_AUTO_CONTROL = 0x10,
290 UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL = 0x11,
291 UVC_PU_ANALOG_LOCK_STATUS_CONTROL = 0x12,
292 UVC_PU_CONTRAST_AUTO_CONTROL = 0x13
297 UVC_TT_VENDOR_SPECIFIC = 0x0100,
298 UVC_TT_STREAMING = 0x0101
303 UVC_ITT_VENDOR_SPECIFIC = 0x0200,
304 UVC_ITT_CAMERA = 0x0201,
305 UVC_ITT_MEDIA_TRANSPORT_INPUT = 0x0202
310 UVC_OTT_VENDOR_SPECIFIC = 0x0300,
311 UVC_OTT_DISPLAY = 0x0301,
312 UVC_OTT_MEDIA_TRANSPORT_OUTPUT = 0x0302
317 UVC_EXTERNAL_VENDOR_SPECIFIC = 0x0400,
318 UVC_COMPOSITE_CONNECTOR = 0x0401,
319 UVC_SVIDEO_CONNECTOR = 0x0402,
320 UVC_COMPONENT_CONNECTOR = 0x0403
330 typedef struct uvc_context uvc_context_t;
337 typedef struct uvc_device uvc_device_t;
344 struct uvc_device_handle;
345 typedef struct uvc_device_handle uvc_device_handle_t;
352 struct uvc_stream_handle;
353 typedef struct uvc_stream_handle uvc_stream_handle_t;
362 uint16_t wObjectiveFocalLengthMin;
363 uint16_t wObjectiveFocalLengthMax;
364 uint16_t wOcularFocalLength;
369 typedef struct uvc_output_terminal {
370 struct uvc_output_terminal *prev, *next;
372 } uvc_output_terminal_t;
403 enum uvc_status_class {
404 UVC_STATUS_CLASS_CONTROL = 0x10,
405 UVC_STATUS_CLASS_CONTROL_CAMERA = 0x11,
406 UVC_STATUS_CLASS_CONTROL_PROCESSING = 0x12,
409 enum uvc_status_attribute {
410 UVC_STATUS_ATTRIBUTE_VALUE_CHANGE = 0x00,
411 UVC_STATUS_ATTRIBUTE_INFO_CHANGE = 0x01,
412 UVC_STATUS_ATTRIBUTE_FAILURE_CHANGE = 0x02,
413 UVC_STATUS_ATTRIBUTE_UNKNOWN = 0xff
422 enum uvc_status_attribute status_attribute,
423 void *data,
size_t data_len,
500 uint8_t bFormatIndex;
502 uint32_t dwFrameInterval;
503 uint16_t wKeyFrameRate;
504 uint16_t wPFrameRate;
505 uint16_t wCompQuality;
506 uint16_t wCompWindowSize;
508 uint32_t dwMaxVideoFrameSize;
509 uint32_t dwMaxPayloadTransferSize;
510 uint32_t dwClockFrequency;
511 uint8_t bmFramingInfo;
512 uint8_t bPreferredVersion;
515 uint8_t bInterfaceNumber;
518 typedef struct uvc_still_ctrl {
520 uint8_t bFormatIndex;
524 uint8_t bCompressionIndex;
526 uint32_t dwMaxVideoFrameSize;
528 uint32_t dwMaxPayloadTransferSize;
529 uint8_t bInterfaceNumber;
537 uvc_device_t ***list);
552 int vid,
int pid,
const char *sn);
556 uvc_device_t ***devs,
557 int vid,
int pid,
const char *sn);
559 #if LIBUSB_API_VERSION >= 0x01000107
562 uvc_context_t *context,
563 uvc_device_handle_t **devh);
568 uvc_device_handle_t **devh);
569 void uvc_close(uvc_device_handle_t *devh);
575 void uvc_unref_device(uvc_device_t *dev);
587 const uvc_output_terminal_t *uvc_get_output_terminals(uvc_device_handle_t *devh);
593 uvc_device_handle_t *devh,
596 int width,
int height,
601 uvc_device_handle_t *devh,
603 uvc_still_ctrl_t *still_ctrl,
604 int width,
int height);
607 uvc_device_handle_t *devh,
608 uvc_still_ctrl_t *still_ctrl);
613 uvc_device_handle_t *devh,
617 uvc_device_handle_t *devh,
618 uvc_still_ctrl_t *still_ctrl);
621 uvc_device_handle_t *devh,
628 uvc_device_handle_t *devh,
645 uvc_stream_handle_t *strmh,
652 int uvc_get_ctrl_len(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl);
653 int uvc_get_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl,
void *data,
int len,
enum uvc_req_code req_code);
654 int uvc_set_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl,
void *data,
int len);
656 uvc_error_t uvc_get_power_mode(uvc_device_handle_t *devh,
enum uvc_device_power_mode *mode,
enum uvc_req_code req_code);
657 uvc_error_t uvc_set_power_mode(uvc_device_handle_t *devh,
enum uvc_device_power_mode mode);
696 uvc_error_t uvc_get_zoom_rel(uvc_device_handle_t *devh, int8_t* zoom_rel, uint8_t* digital_zoom, uint8_t* speed,
enum uvc_req_code req_code);
702 uvc_error_t uvc_get_pantilt_rel(uvc_device_handle_t *devh, int8_t* pan_rel, uint8_t* pan_speed, int8_t* tilt_rel, uint8_t* tilt_speed,
enum uvc_req_code req_code);
714 uvc_error_t uvc_get_digital_window(uvc_device_handle_t *devh, uint16_t* window_top, uint16_t* window_left, uint16_t* window_bottom, uint16_t* window_right, uint16_t* num_steps, uint16_t* num_steps_units,
enum uvc_req_code req_code);
715 uvc_error_t uvc_set_digital_window(uvc_device_handle_t *devh, uint16_t window_top, uint16_t window_left, uint16_t window_bottom, uint16_t window_right, uint16_t num_steps, uint16_t num_steps_units);
717 uvc_error_t uvc_get_digital_roi(uvc_device_handle_t *devh, uint16_t* roi_top, uint16_t* roi_left, uint16_t* roi_bottom, uint16_t* roi_right, uint16_t* auto_controls,
enum uvc_req_code req_code);
718 uvc_error_t uvc_set_digital_roi(uvc_device_handle_t *devh, uint16_t roi_top, uint16_t roi_left, uint16_t roi_bottom, uint16_t roi_right, uint16_t auto_controls);
802 #ifdef LIBUVC_HAS_JPEG
uvc_error_t uvc_set_roll_rel(uvc_device_handle_t *devh, int8_t roll_rel, uint8_t speed)
Sets the ROLL_RELATIVE control.
Definition: ctrl-gen.c:956
uvc_error_t uvc_set_privacy(uvc_device_handle_t *devh, uint8_t privacy)
Sets the PRIVACY control.
Definition: ctrl-gen.c:1011
uvc_error_t uvc_get_contrast(uvc_device_handle_t *devh, uint16_t *contrast, enum uvc_req_code req_code)
Reads the CONTRAST control.
Definition: ctrl-gen.c:1290
uvc_error_t uvc_set_focus_simple_range(uvc_device_handle_t *devh, uint8_t focus)
Sets the FOCUS_SIMPLE control.
Definition: ctrl-gen.c:443
uvc_error_t uvc_get_analog_video_standard(uvc_device_handle_t *devh, uint8_t *video_standard, enum uvc_req_code req_code)
Reads the ANALOG_VIDEO_STANDARD control.
Definition: ctrl-gen.c:2104
uvc_error_t uvc_get_focus_simple_range(uvc_device_handle_t *devh, uint8_t *focus, enum uvc_req_code req_code)
Reads the FOCUS_SIMPLE control.
Definition: ctrl-gen.c:416
uvc_error_t uvc_get_iris_abs(uvc_device_handle_t *devh, uint16_t *iris, enum uvc_req_code req_code)
Reads the IRIS_ABSOLUTE control.
Definition: ctrl-gen.c:524
uvc_error_t uvc_get_digital_window(uvc_device_handle_t *devh, uint16_t *window_top, uint16_t *window_left, uint16_t *window_bottom, uint16_t *window_right, uint16_t *num_steps, uint16_t *num_steps_units, enum uvc_req_code req_code)
Reads the DIGITAL_WINDOW control.
Definition: ctrl-gen.c:1043
uvc_error_t uvc_get_digital_multiplier(uvc_device_handle_t *devh, uint16_t *multiplier_step, enum uvc_req_code req_code)
Reads the DIGITAL_MULTIPLIER control.
Definition: ctrl-gen.c:1996
uvc_error_t uvc_get_sharpness(uvc_device_handle_t *devh, uint16_t *sharpness, enum uvc_req_code req_code)
Reads the SHARPNESS control.
Definition: ctrl-gen.c:1668
uvc_error_t uvc_get_digital_roi(uvc_device_handle_t *devh, uint16_t *roi_top, uint16_t *roi_left, uint16_t *roi_bottom, uint16_t *roi_right, uint16_t *auto_controls, enum uvc_req_code req_code)
Reads the REGION_OF_INTEREST control.
Definition: ctrl-gen.c:1116
int uvc_get_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len, enum uvc_req_code req_code)
Perform a GET_* request from an extension unit.
Definition: ctrl.c:90
uvc_error_t uvc_set_analog_video_standard(uvc_device_handle_t *devh, uint8_t video_standard)
Sets the ANALOG_VIDEO_STANDARD control.
Definition: ctrl-gen.c:2131
uvc_error_t uvc_set_roll_abs(uvc_device_handle_t *devh, int16_t roll)
Sets the ROLL_ABSOLUTE control.
Definition: ctrl-gen.c:899
uvc_error_t uvc_get_exposure_rel(uvc_device_handle_t *devh, int8_t *step, enum uvc_req_code req_code)
Reads the exposure time relative to the current setting.
Definition: ctrl-gen.c:250
uvc_error_t uvc_get_gain(uvc_device_handle_t *devh, uint16_t *gain, enum uvc_req_code req_code)
Reads the GAIN control.
Definition: ctrl-gen.c:1398
uvc_error_t uvc_set_hue_auto(uvc_device_handle_t *devh, uint8_t hue_auto)
Sets the HUE_AUTO control.
Definition: ctrl-gen.c:1587
uvc_error_t uvc_set_gain(uvc_device_handle_t *devh, uint16_t gain)
Sets the GAIN control.
Definition: ctrl-gen.c:1425
uvc_error_t uvc_get_hue(uvc_device_handle_t *devh, int16_t *hue, enum uvc_req_code req_code)
Reads the HUE control.
Definition: ctrl-gen.c:1506
uvc_error_t uvc_get_white_balance_component(uvc_device_handle_t *devh, uint16_t *blue, uint16_t *red, enum uvc_req_code req_code)
Reads the WHITE_BALANCE_COMPONENT control.
Definition: ctrl-gen.c:1885
uvc_error_t uvc_set_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t multiplier_step)
Sets the DIGITAL_MULTIPLIER_LIMIT control.
Definition: ctrl-gen.c:2077
uvc_error_t uvc_get_pantilt_rel(uvc_device_handle_t *devh, int8_t *pan_rel, uint8_t *pan_speed, int8_t *tilt_rel, uint8_t *tilt_speed, enum uvc_req_code req_code)
Reads the PANTILT_RELATIVE control.
Definition: ctrl-gen.c:809
uvc_error_t uvc_get_focus_abs(uvc_device_handle_t *devh, uint16_t *focus, enum uvc_req_code req_code)
Reads the distance at which an object is optimally focused.
Definition: ctrl-gen.c:304
uvc_error_t uvc_set_power_line_frequency(uvc_device_handle_t *devh, uint8_t power_line_frequency)
Sets the POWER_LINE_FREQUENCY control.
Definition: ctrl-gen.c:1479
uvc_error_t uvc_set_brightness(uvc_device_handle_t *devh, int16_t brightness)
Sets the BRIGHTNESS control.
Definition: ctrl-gen.c:1263
uvc_error_t uvc_get_focus_rel(uvc_device_handle_t *devh, int8_t *focus_rel, uint8_t *speed, enum uvc_req_code req_code)
Reads the FOCUS_RELATIVE control.
Definition: ctrl-gen.c:359
uvc_error_t uvc_set_contrast(uvc_device_handle_t *devh, uint16_t contrast)
Sets the CONTRAST control.
Definition: ctrl-gen.c:1317
uvc_error_t uvc_get_iris_rel(uvc_device_handle_t *devh, uint8_t *iris_rel, enum uvc_req_code req_code)
Reads the IRIS_RELATIVE control.
Definition: ctrl-gen.c:578
uvc_error_t uvc_get_roll_abs(uvc_device_handle_t *devh, int16_t *roll, enum uvc_req_code req_code)
Reads the ROLL_ABSOLUTE control.
Definition: ctrl-gen.c:872
uvc_error_t uvc_set_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t white_balance_component_auto)
Sets the WHITE_BALANCE_COMPONENT_AUTO control.
Definition: ctrl-gen.c:1969
uvc_error_t uvc_set_exposure_abs(uvc_device_handle_t *devh, uint32_t time)
Sets the absolute exposure time.
Definition: ctrl-gen.c:223
uvc_error_t uvc_get_zoom_rel(uvc_device_handle_t *devh, int8_t *zoom_rel, uint8_t *digital_zoom, uint8_t *speed, enum uvc_req_code req_code)
Reads the ZOOM_RELATIVE control.
Definition: ctrl-gen.c:688
uvc_error_t uvc_get_zoom_abs(uvc_device_handle_t *devh, uint16_t *focal_length, enum uvc_req_code req_code)
Reads the ZOOM_ABSOLUTE control.
Definition: ctrl-gen.c:632
uvc_error_t uvc_get_hue_auto(uvc_device_handle_t *devh, uint8_t *hue_auto, enum uvc_req_code req_code)
Reads the HUE_AUTO control.
Definition: ctrl-gen.c:1560
uvc_error_t uvc_set_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t temperature_auto)
Sets the WHITE_BALANCE_TEMPERATURE_AUTO control.
Definition: ctrl-gen.c:1857
uvc_error_t uvc_get_roll_rel(uvc_device_handle_t *devh, int8_t *roll_rel, uint8_t *speed, enum uvc_req_code req_code)
Reads the ROLL_RELATIVE control.
Definition: ctrl-gen.c:927
uvc_error_t uvc_set_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t status)
Sets the ANALOG_LOCK_STATUS control.
Definition: ctrl-gen.c:2185
uvc_error_t uvc_set_iris_rel(uvc_device_handle_t *devh, uint8_t iris_rel)
Sets the IRIS_RELATIVE control.
Definition: ctrl-gen.c:605
uvc_error_t uvc_set_white_balance_temperature(uvc_device_handle_t *devh, uint16_t temperature)
Sets the WHITE_BALANCE_TEMPERATURE control.
Definition: ctrl-gen.c:1803
uvc_error_t uvc_set_digital_roi(uvc_device_handle_t *devh, uint16_t roi_top, uint16_t roi_left, uint16_t roi_bottom, uint16_t roi_right, uint16_t auto_controls)
Sets the REGION_OF_INTEREST control.
Definition: ctrl-gen.c:1151
uvc_error_t uvc_get_saturation(uvc_device_handle_t *devh, uint16_t *saturation, enum uvc_req_code req_code)
Reads the SATURATION control.
Definition: ctrl-gen.c:1614
uvc_error_t uvc_get_privacy(uvc_device_handle_t *devh, uint8_t *privacy, enum uvc_req_code req_code)
Reads the PRIVACY control.
Definition: ctrl-gen.c:984
uvc_error_t uvc_get_ae_priority(uvc_device_handle_t *devh, uint8_t *priority, enum uvc_req_code req_code)
Checks whether the camera may vary the frame rate for exposure control reasons.
Definition: ctrl-gen.c:133
int uvc_get_ctrl_len(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl)
Get the length of a control on a terminal or unit.
Definition: ctrl.c:59
uvc_error_t uvc_set_focus_rel(uvc_device_handle_t *devh, int8_t focus_rel, uint8_t speed)
Sets the FOCUS_RELATIVE control.
Definition: ctrl-gen.c:388
uvc_error_t uvc_get_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t *white_balance_component_auto, enum uvc_req_code req_code)
Reads the WHITE_BALANCE_COMPONENT_AUTO control.
Definition: ctrl-gen.c:1942
uvc_error_t uvc_get_white_balance_temperature(uvc_device_handle_t *devh, uint16_t *temperature, enum uvc_req_code req_code)
Reads the WHITE_BALANCE_TEMPERATURE control.
Definition: ctrl-gen.c:1776
uvc_error_t uvc_set_zoom_rel(uvc_device_handle_t *devh, int8_t zoom_rel, uint8_t digital_zoom, uint8_t speed)
Sets the ZOOM_RELATIVE control.
Definition: ctrl-gen.c:719
uvc_error_t uvc_get_brightness(uvc_device_handle_t *devh, int16_t *brightness, enum uvc_req_code req_code)
Reads the BRIGHTNESS control.
Definition: ctrl-gen.c:1236
uvc_error_t uvc_set_digital_multiplier(uvc_device_handle_t *devh, uint16_t multiplier_step)
Sets the DIGITAL_MULTIPLIER control.
Definition: ctrl-gen.c:2023
uvc_error_t uvc_set_hue(uvc_device_handle_t *devh, int16_t hue)
Sets the HUE control.
Definition: ctrl-gen.c:1533
uvc_error_t uvc_get_scanning_mode(uvc_device_handle_t *devh, uint8_t *mode, enum uvc_req_code req_code)
Reads the SCANNING_MODE control.
Definition: ctrl-gen.c:14
uvc_error_t uvc_set_ae_mode(uvc_device_handle_t *devh, uint8_t mode)
Sets camera's auto-exposure mode.
Definition: ctrl-gen.c:105
uvc_error_t uvc_set_ae_priority(uvc_device_handle_t *devh, uint8_t priority)
Chooses whether the camera may vary the frame rate for exposure control reasons.
Definition: ctrl-gen.c:163
uvc_error_t uvc_get_backlight_compensation(uvc_device_handle_t *devh, uint16_t *backlight_compensation, enum uvc_req_code req_code)
Reads the BACKLIGHT_COMPENSATION control.
Definition: ctrl-gen.c:1182
uvc_error_t uvc_get_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t *multiplier_step, enum uvc_req_code req_code)
Reads the DIGITAL_MULTIPLIER_LIMIT control.
Definition: ctrl-gen.c:2050
int uvc_set_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len)
Perform a SET_CUR request to a terminal or unit.
Definition: ctrl.c:113
uvc_error_t uvc_set_focus_auto(uvc_device_handle_t *devh, uint8_t state)
Sets the FOCUS_AUTO control.
Definition: ctrl-gen.c:497
uvc_error_t uvc_set_zoom_abs(uvc_device_handle_t *devh, uint16_t focal_length)
Sets the ZOOM_ABSOLUTE control.
Definition: ctrl-gen.c:659
uvc_error_t uvc_set_digital_window(uvc_device_handle_t *devh, uint16_t window_top, uint16_t window_left, uint16_t window_bottom, uint16_t window_right, uint16_t num_steps, uint16_t num_steps_units)
Sets the DIGITAL_WINDOW control.
Definition: ctrl-gen.c:1080
uvc_error_t uvc_set_sharpness(uvc_device_handle_t *devh, uint16_t sharpness)
Sets the SHARPNESS control.
Definition: ctrl-gen.c:1695
uvc_error_t uvc_set_backlight_compensation(uvc_device_handle_t *devh, uint16_t backlight_compensation)
Sets the BACKLIGHT_COMPENSATION control.
Definition: ctrl-gen.c:1209
uvc_error_t uvc_get_input_select(uvc_device_handle_t *devh, uint8_t *selector, enum uvc_req_code req_code)
Reads the INPUT_SELECT control.
Definition: ctrl-gen.c:2212
uvc_error_t uvc_set_contrast_auto(uvc_device_handle_t *devh, uint8_t contrast_auto)
Sets the CONTRAST_AUTO control.
Definition: ctrl-gen.c:1371
uvc_error_t uvc_get_exposure_abs(uvc_device_handle_t *devh, uint32_t *time, enum uvc_req_code req_code)
Gets the absolute exposure time.
Definition: ctrl-gen.c:192
uvc_error_t uvc_set_focus_abs(uvc_device_handle_t *devh, uint16_t focus)
Sets the distance at which an object is optimally focused.
Definition: ctrl-gen.c:331
uvc_error_t uvc_set_white_balance_component(uvc_device_handle_t *devh, uint16_t blue, uint16_t red)
Sets the WHITE_BALANCE_COMPONENT control.
Definition: ctrl-gen.c:1914
uvc_error_t uvc_set_input_select(uvc_device_handle_t *devh, uint8_t selector)
Sets the INPUT_SELECT control.
Definition: ctrl-gen.c:2239
uvc_error_t uvc_set_scanning_mode(uvc_device_handle_t *devh, uint8_t mode)
Sets the SCANNING_MODE control.
Definition: ctrl-gen.c:41
uvc_error_t uvc_get_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t *temperature_auto, enum uvc_req_code req_code)
Reads the WHITE_BALANCE_TEMPERATURE_AUTO control.
Definition: ctrl-gen.c:1830
uvc_error_t uvc_set_saturation(uvc_device_handle_t *devh, uint16_t saturation)
Sets the SATURATION control.
Definition: ctrl-gen.c:1641
uvc_error_t uvc_set_exposure_rel(uvc_device_handle_t *devh, int8_t step)
Sets the exposure time relative to the current setting.
Definition: ctrl-gen.c:277
uvc_error_t uvc_get_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t *status, enum uvc_req_code req_code)
Reads the ANALOG_LOCK_STATUS control.
Definition: ctrl-gen.c:2158
uvc_error_t uvc_get_contrast_auto(uvc_device_handle_t *devh, uint8_t *contrast_auto, enum uvc_req_code req_code)
Reads the CONTRAST_AUTO control.
Definition: ctrl-gen.c:1344
uvc_error_t uvc_get_focus_auto(uvc_device_handle_t *devh, uint8_t *state, enum uvc_req_code req_code)
Reads the FOCUS_AUTO control.
Definition: ctrl-gen.c:470
uvc_error_t uvc_get_gamma(uvc_device_handle_t *devh, uint16_t *gamma, enum uvc_req_code req_code)
Reads the GAMMA control.
Definition: ctrl-gen.c:1722
uvc_error_t uvc_get_pantilt_abs(uvc_device_handle_t *devh, int32_t *pan, int32_t *tilt, enum uvc_req_code req_code)
Reads the PANTILT_ABSOLUTE control.
Definition: ctrl-gen.c:749
uvc_error_t uvc_set_gamma(uvc_device_handle_t *devh, uint16_t gamma)
Sets the GAMMA control.
Definition: ctrl-gen.c:1749
uvc_error_t uvc_set_iris_abs(uvc_device_handle_t *devh, uint16_t iris)
Sets the IRIS_ABSOLUTE control.
Definition: ctrl-gen.c:551
uvc_error_t uvc_get_ae_mode(uvc_device_handle_t *devh, uint8_t *mode, enum uvc_req_code req_code)
Reads camera's auto-exposure mode.
Definition: ctrl-gen.c:70
uvc_error_t uvc_set_pantilt_abs(uvc_device_handle_t *devh, int32_t pan, int32_t tilt)
Sets the PANTILT_ABSOLUTE control.
Definition: ctrl-gen.c:778
uvc_error_t uvc_set_pantilt_rel(uvc_device_handle_t *devh, int8_t pan_rel, uint8_t pan_speed, int8_t tilt_rel, uint8_t tilt_speed)
Sets the PANTILT_RELATIVE control.
Definition: ctrl-gen.c:842
uvc_error_t uvc_get_power_line_frequency(uvc_device_handle_t *devh, uint8_t *power_line_frequency, enum uvc_req_code req_code)
Reads the POWER_LINE_FREQUENCY control.
Definition: ctrl-gen.c:1452
uvc_error_t uvc_find_device(uvc_context_t *ctx, uvc_device_t **dev, int vid, int pid, const char *sn)
Finds a camera identified by vendor, product and/or serial number.
Definition: device.c:128
uvc_error_t uvc_get_device_descriptor(uvc_device_t *dev, uvc_device_descriptor_t **desc)
Get a descriptor that contains the general information about a device.
Definition: device.c:591
void uvc_close(uvc_device_handle_t *devh)
Close a device.
Definition: device.c:1722
void() uvc_status_callback_t(enum uvc_status_class status_class, int event, int selector, enum uvc_status_attribute status_attribute, void *data, size_t data_len, void *user_ptr)
A callback function to accept status updates.
Definition: libuvc.h:419
uvc_error_t uvc_find_devices(uvc_context_t *ctx, uvc_device_t ***devs, int vid, int pid, const char *sn)
Finds all cameras identified by vendor, product and/or serial number.
Definition: device.c:189
uint8_t uvc_get_device_address(uvc_device_t *dev)
Get the number assigned to the device within its bus.
Definition: device.c:262
struct libusb_device_handle * uvc_get_libusb_handle(uvc_device_handle_t *devh)
Get the underlying libusb device handle for an open device.
Definition: device.c:840
void uvc_set_button_callback(uvc_device_handle_t *devh, uvc_button_callback_t cb, void *user_ptr)
Set a callback function to receive button events.
Definition: device.c:1955
uvc_device_t * uvc_get_device(uvc_device_handle_t *devh)
Get the uvc_device_t corresponding to an open device.
Definition: device.c:823
void uvc_set_status_callback(uvc_device_handle_t *devh, uvc_status_callback_t cb, void *user_ptr)
Set a callback function to receive status updates.
Definition: device.c:1940
void() uvc_button_callback_t(int button, int state, void *user_ptr)
A callback function to accept button events.
Definition: libuvc.h:429
void uvc_ref_device(uvc_device_t *dev)
Increment the reference count for a device.
Definition: device.c:938
void uvc_free_device_descriptor(uvc_device_descriptor_t *desc)
Frees a device descriptor created with uvc_get_device_descriptor.
Definition: device.c:651
uvc_error_t uvc_get_device_list(uvc_context_t *ctx, uvc_device_t ***list)
Get a list of the UVC devices attached to the system.
Definition: device.c:679
uint8_t uvc_get_bus_number(uvc_device_t *dev)
Get the number of the bus to which the device is attached.
Definition: device.c:255
void uvc_free_device_list(uvc_device_t **list, uint8_t unref_devices)
Frees a list of device structures created with uvc_get_device_list.
Definition: device.c:798
uvc_error_t uvc_open(uvc_device_t *dev, uvc_device_handle_t **devh)
Open a UVC device.
Definition: device.c:316
const char * uvc_strerror(uvc_error_t err)
Return a string explaining an error in the UVC driver.
Definition: diag.c:88
enum uvc_error uvc_error_t
UVC error types, based on libusb errors.
void uvc_print_diag(uvc_device_handle_t *devh, FILE *stream)
Print camera capabilities and configuration.
Definition: diag.c:143
void uvc_print_stream_ctrl(uvc_stream_ctrl_t *ctrl, FILE *stream)
Print the values in a stream control block.
Definition: diag.c:106
void uvc_perror(uvc_error_t err, const char *msg)
Print a message explaining an error in the UVC driver.
Definition: diag.c:73
uvc_error
UVC error types, based on libusb errors.
Definition: libuvc.h:19
@ UVC_ERROR_PIPE
Pipe error.
Definition: libuvc.h:39
@ UVC_ERROR_NOT_SUPPORTED
Operation not supported.
Definition: libuvc.h:45
@ UVC_ERROR_BUSY
Resource busy.
Definition: libuvc.h:33
@ UVC_ERROR_OTHER
Undefined error.
Definition: libuvc.h:53
@ UVC_ERROR_INTERRUPTED
System call interrupted.
Definition: libuvc.h:41
@ UVC_ERROR_OVERFLOW
Overflow.
Definition: libuvc.h:37
@ UVC_ERROR_CALLBACK_EXISTS
Resource has a callback (can't use polling and async)
Definition: libuvc.h:51
@ UVC_ERROR_NO_DEVICE
No such device.
Definition: libuvc.h:29
@ UVC_ERROR_IO
Input/output error.
Definition: libuvc.h:23
@ UVC_ERROR_INVALID_DEVICE
Device is not UVC-compliant.
Definition: libuvc.h:47
@ UVC_ERROR_INVALID_MODE
Mode not supported.
Definition: libuvc.h:49
@ UVC_ERROR_INVALID_PARAM
Invalid parameter.
Definition: libuvc.h:25
@ UVC_SUCCESS
Success (no error)
Definition: libuvc.h:21
@ UVC_ERROR_TIMEOUT
Operation timed out.
Definition: libuvc.h:35
@ UVC_ERROR_NO_MEM
Insufficient memory.
Definition: libuvc.h:43
@ UVC_ERROR_NOT_FOUND
Entity not found.
Definition: libuvc.h:31
@ UVC_ERROR_ACCESS
Access denied.
Definition: libuvc.h:27
uvc_error_t uvc_mjpeg2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert an MJPEG frame to RGB.
Definition: frame-mjpeg.c:180
uvc_error_t uvc_mjpeg2gray(uvc_frame_t *in, uvc_frame_t *out)
Convert an MJPEG frame to GRAY8.
Definition: frame-mjpeg.c:205
uvc_error_t uvc_yuyv2y(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to Y (GRAY8)
Definition: frame.c:265
uvc_error_t uvc_any2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame to RGB.
Definition: frame.c:441
uvc_error_t uvc_yuyv2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to RGB.
Definition: frame.c:174
uvc_error_t uvc_yuyv2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to BGR.
Definition: frame.c:225
uvc_error_t uvc_uyvy2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from UYVY to RGB.
Definition: frame.c:355
void uvc_free_frame(uvc_frame_t *frame)
Free a frame structure.
Definition: frame.c:92
uvc_error_t uvc_yuyv2uv(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to UV (GRAY8)
Definition: frame.c:305
uvc_error_t uvc_uyvy2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from UYVY to BGR.
Definition: frame.c:405
uvc_error_t uvc_any2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame to BGR.
Definition: frame.c:464
uvc_frame_t * uvc_allocate_frame(size_t data_bytes)
Allocate a frame structure.
Definition: frame.c:64
uvc_error_t uvc_duplicate_frame(uvc_frame_t *in, uvc_frame_t *out)
Duplicate a frame, preserving color format.
Definition: frame.c:114
uvc_error_t uvc_init(uvc_context_t **ctx, struct libusb_context *usb_ctx)
Initializes the UVC context.
Definition: init.c:104
void uvc_exit(uvc_context_t *ctx)
Closes the UVC context, shutting down any active cameras.
Definition: init.c:138
uvc_error_t uvc_stream_stop(uvc_stream_handle_t *strmh)
Stop stream.
Definition: stream.c:1492
void() uvc_frame_callback_t(struct uvc_frame *frame, void *user_ptr)
A callback function to handle incoming assembled UVC frames.
Definition: libuvc.h:493
void uvc_stream_close(uvc_stream_handle_t *strmh)
Close stream.
Definition: stream.c:1542
uvc_error_t uvc_start_streaming(uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_frame_callback_t *cb, void *user_ptr, uint8_t flags)
Begin streaming video from the camera into the callback function.
Definition: stream.c:931
uvc_error_t uvc_stream_start_iso(uvc_stream_handle_t *strmh, uvc_frame_callback_t *cb, void *user_ptr)
Begin streaming video from the stream into the callback function.
Definition: stream.c:1283
struct uvc_stream_ctrl uvc_stream_ctrl_t
Streaming mode, includes all information needed to select stream.
uvc_error_t uvc_get_still_ctrl_format_size(uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_still_ctrl_t *still_ctrl, int width, int height)
Get a negotiated still control block for some common parameters.
Definition: stream.c:549
void uvc_stop_streaming(uvc_device_handle_t *devh)
Stop streaming video.
Definition: stream.c:1477
uvc_frame_format
Color coding of stream, transport-independent.
Definition: libuvc.h:59
uvc_error_t uvc_stream_start(uvc_stream_handle_t *strmh, uvc_frame_callback_t *cb, void *user_ptr, uint8_t flags)
Begin streaming video from the stream into the callback function.
Definition: stream.c:1075
uvc_error_t uvc_stream_open_ctrl(uvc_device_handle_t *devh, uvc_stream_handle_t **strmh, uvc_stream_ctrl_t *ctrl)
Open a new video stream.
Definition: stream.c:1005
uvc_error_t uvc_start_iso_streaming(uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_frame_callback_t *cb, void *user_ptr)
Begin streaming video from the camera into the callback function.
Definition: stream.c:967
uvc_error_t uvc_stream_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl)
Reconfigure stream with a new stream format.
Definition: stream.c:392
uvc_error_t uvc_trigger_still(uvc_device_handle_t *devh, uvc_still_ctrl_t *still_ctrl)
Initiate a method 2 (in stream) still capture.
Definition: stream.c:346
uvc_error_t uvc_get_stream_ctrl_format_size(uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, enum uvc_frame_format format, int width, int height, int fps)
Get a negotiated streaming control block for some common parameters.
Definition: stream.c:470
struct uvc_frame uvc_frame_t
An image frame received from the UVC device.
uvc_error_t uvc_stream_get_frame(uvc_stream_handle_t *strmh, uvc_frame_t **frame, int32_t timeout_us)
Poll for a frame.
Definition: stream.c:1397
@ UVC_FRAME_FORMAT_RGB
24-bit RGB
Definition: libuvc.h:71
@ UVC_FRAME_FORMAT_COUNT
Number of formats understood.
Definition: libuvc.h:91
@ UVC_FRAME_FORMAT_P010
YUV: P010.
Definition: libuvc.h:89
@ UVC_FRAME_FORMAT_GRAY8
Greyscale images.
Definition: libuvc.h:77
@ UVC_FRAME_FORMAT_ANY
Any supported format.
Definition: libuvc.h:62
@ UVC_FRAME_FORMAT_NV12
YUV420: NV12.
Definition: libuvc.h:87
@ UVC_FRAME_FORMAT_MJPEG
Motion-JPEG (or JPEG) encoded images.
Definition: libuvc.h:74
@ UVC_FRAME_FORMAT_YUYV
YUYV/YUV2/YUV422: YUV encoding with one luminance value per pixel and one UV (chrominance) pair for e...
Definition: libuvc.h:68
Structure representing a UVC device descriptor.
Definition: libuvc.h:437
uint16_t idProduct
Product ID.
Definition: libuvc.h:441
const char * manufacturer
Device-reported manufacturer name (or null)
Definition: libuvc.h:447
const char * serialNumber
Serial number (null if unavailable)
Definition: libuvc.h:445
uint16_t idVendor
Vendor ID.
Definition: libuvc.h:439
uint16_t bcdUVC
UVC compliance level, e.g.
Definition: libuvc.h:443
const char * product
Device-reporter product name (or null)
Definition: libuvc.h:449
Custom processing or camera-control functions.
Definition: libuvc.h:393
uint8_t guidExtensionCode[16]
GUID identifying the extension unit.
Definition: libuvc.h:398
uint8_t bUnitID
Index of the extension unit within the device.
Definition: libuvc.h:396
uint64_t bmControls
Bitmap of available controls (manufacturer-dependent)
Definition: libuvc.h:400
Frame descriptor.
Definition: libuvc.h:157
uint16_t wWidth
Image width.
Definition: libuvc.h:166
uint32_t * intervals
Available frame rates, zero-terminated (in 100ns units)
Definition: libuvc.h:188
uint8_t bFrameIndex
Index of the frame within the list of specs available for this format.
Definition: libuvc.h:163
uint16_t wHeight
Image height.
Definition: libuvc.h:168
uint32_t dwBytesPerLine
number of bytes per line
Definition: libuvc.h:186
uint32_t dwDefaultFrameInterval
Default frame interval (in 100ns units)
Definition: libuvc.h:176
enum uvc_vs_desc_subtype bDescriptorSubtype
Type of frame, such as JPEG frame or uncompressed frme.
Definition: libuvc.h:161
uint32_t dwMaxBitRate
Bitrate of corresponding stream at maximal frame rate.
Definition: libuvc.h:172
uint8_t bFrameIntervalType
Frame intervals.
Definition: libuvc.h:184
uint32_t dwMaxVideoFrameBufferSize
Maximum number of bytes for a video frame.
Definition: libuvc.h:174
uint32_t dwMinFrameInterval
Minimum frame interval for continuous mode (100ns units)
Definition: libuvc.h:178
uint32_t dwMinBitRate
Bitrate of corresponding stream at minimal frame rate.
Definition: libuvc.h:170
uint32_t dwFrameIntervalStep
Granularity of frame interval range for continuous mode (100ns)
Definition: libuvc.h:182
uint32_t dwMaxFrameInterval
Maximum frame interval for continuous mode (100ns units)
Definition: libuvc.h:180
An image frame received from the UVC device.
Definition: libuvc.h:455
enum uvc_frame_format frame_format
Pixel data format.
Definition: libuvc.h:465
size_t data_bytes
Size of image data buffer.
Definition: libuvc.h:459
uint32_t width
Width of image in pixels.
Definition: libuvc.h:461
uint8_t library_owns_data
Is the data buffer owned by the library? If 1, the data buffer can be arbitrarily reallocated by fram...
Definition: libuvc.h:483
uint32_t height
Height of image in pixels.
Definition: libuvc.h:463
uint32_t sequence
Frame number (may skip, but is strictly monotonically increasing)
Definition: libuvc.h:469
void * metadata
Metadata for this frame if available.
Definition: libuvc.h:485
size_t step
Number of bytes per horizontal line (undefined for compressed format)
Definition: libuvc.h:467
struct timeval capture_time
Estimate of system time when the device started capturing the image.
Definition: libuvc.h:471
void * data
Image data for this frame.
Definition: libuvc.h:457
uvc_device_handle_t * source
Handle on the device that produced the image.
Definition: libuvc.h:476
struct timespec capture_time_finished
Estimate of system time when the device finished receiving the image.
Definition: libuvc.h:473
size_t metadata_bytes
Size of metadata buffer.
Definition: libuvc.h:487
Represents post-capture processing functions.
Definition: libuvc.h:375
uint8_t bUnitID
Index of the processing unit within the device.
Definition: libuvc.h:378
uint64_t bmControls
Processing controls (meaning of bits given in {uvc_pu_ctrl_selector})
Definition: libuvc.h:382
uint8_t bSourceID
Index of the terminal from which the device accepts images.
Definition: libuvc.h:380
Represents selector unit to connect other units.
Definition: libuvc.h:386
uint8_t bUnitID
Index of the selector unit within the device.
Definition: libuvc.h:389
Streaming mode, includes all information needed to select stream.
Definition: libuvc.h:498