libuvc
libuvc.h
1#ifndef LIBUVC_H
2#define LIBUVC_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdio.h> // FILE
9#include <stdint.h>
10#include <sys/time.h>
11#include <libuvc/libuvc_config.h>
12
13struct libusb_context;
14struct libusb_device_handle;
15
19typedef enum uvc_error {
53 UVC_ERROR_OTHER = -99
55
60 UVC_FRAME_FORMAT_UNKNOWN = 0,
63 UVC_FRAME_FORMAT_UNCOMPRESSED,
64 UVC_FRAME_FORMAT_COMPRESSED,
69 UVC_FRAME_FORMAT_UYVY,
72 UVC_FRAME_FORMAT_BGR,
77 UVC_FRAME_FORMAT_GRAY16,
78 /* Raw colour mosaic images */
79 UVC_FRAME_FORMAT_BY8,
80 UVC_FRAME_FORMAT_BA81,
81 UVC_FRAME_FORMAT_SGRBG8,
82 UVC_FRAME_FORMAT_SGBRG8,
83 UVC_FRAME_FORMAT_SRGGB8,
84 UVC_FRAME_FORMAT_SBGGR8,
87};
88
89/* UVC_COLOR_FORMAT_* have been replaced with UVC_FRAME_FORMAT_*. Please use
90 * UVC_FRAME_FORMAT_* instead of using these. */
91#define UVC_COLOR_FORMAT_UNKNOWN UVC_FRAME_FORMAT_UNKNOWN
92#define UVC_COLOR_FORMAT_UNCOMPRESSED UVC_FRAME_FORMAT_UNCOMPRESSED
93#define UVC_COLOR_FORMAT_COMPRESSED UVC_FRAME_FORMAT_COMPRESSED
94#define UVC_COLOR_FORMAT_YUYV UVC_FRAME_FORMAT_YUYV
95#define UVC_COLOR_FORMAT_UYVY UVC_FRAME_FORMAT_UYVY
96#define UVC_COLOR_FORMAT_RGB UVC_FRAME_FORMAT_RGB
97#define UVC_COLOR_FORMAT_BGR UVC_FRAME_FORMAT_BGR
98#define UVC_COLOR_FORMAT_MJPEG UVC_FRAME_FORMAT_MJPEG
99#define UVC_COLOR_FORMAT_GRAY8 UVC_FRAME_FORMAT_GRAY8
100#define UVC_COLOR_FORMAT_GRAY16 UVC_FRAME_FORMAT_GRAY16
101
103enum uvc_vs_desc_subtype {
104 UVC_VS_UNDEFINED = 0x00,
105 UVC_VS_INPUT_HEADER = 0x01,
106 UVC_VS_OUTPUT_HEADER = 0x02,
107 UVC_VS_STILL_IMAGE_FRAME = 0x03,
108 UVC_VS_FORMAT_UNCOMPRESSED = 0x04,
109 UVC_VS_FRAME_UNCOMPRESSED = 0x05,
110 UVC_VS_FORMAT_MJPEG = 0x06,
111 UVC_VS_FRAME_MJPEG = 0x07,
112 UVC_VS_FORMAT_MPEG2TS = 0x0a,
113 UVC_VS_FORMAT_DV = 0x0c,
114 UVC_VS_COLORFORMAT = 0x0d,
115 UVC_VS_FORMAT_FRAME_BASED = 0x10,
116 UVC_VS_FRAME_FRAME_BASED = 0x11,
117 UVC_VS_FORMAT_STREAM_BASED = 0x12
118};
119
120struct uvc_format_desc;
121struct uvc_frame_desc;
122
129typedef struct uvc_frame_desc {
130 struct uvc_format_desc *parent;
131 struct uvc_frame_desc *prev, *next;
133 enum uvc_vs_desc_subtype bDescriptorSubtype;
135 uint8_t bFrameIndex;
136 uint8_t bmCapabilities;
138 uint16_t wWidth;
140 uint16_t wHeight;
142 uint32_t dwMinBitRate;
144 uint32_t dwMaxBitRate;
160 uint32_t *intervals;
162
168typedef struct uvc_format_desc {
169 struct uvc_streaming_interface *parent;
170 struct uvc_format_desc *prev, *next;
172 enum uvc_vs_desc_subtype bDescriptorSubtype;
175 uint8_t bNumFrameDescriptors;
177 union {
178 uint8_t guidFormat[16];
179 uint8_t fourccFormat[4];
180 };
182 union {
186 uint8_t bmFlags;
187 };
190 uint8_t bAspectRatioX;
191 uint8_t bAspectRatioY;
192 uint8_t bmInterlaceFlags;
193 uint8_t bCopyProtect;
194 uint8_t bVariableSize;
198
200enum uvc_req_code {
201 UVC_RC_UNDEFINED = 0x00,
202 UVC_SET_CUR = 0x01,
203 UVC_GET_CUR = 0x81,
204 UVC_GET_MIN = 0x82,
205 UVC_GET_MAX = 0x83,
206 UVC_GET_RES = 0x84,
207 UVC_GET_LEN = 0x85,
208 UVC_GET_INFO = 0x86,
209 UVC_GET_DEF = 0x87
210};
211
212enum uvc_device_power_mode {
213 UVC_VC_VIDEO_POWER_MODE_FULL = 0x000b,
214 UVC_VC_VIDEO_POWER_MODE_DEVICE_DEPENDENT = 0x001b,
215};
216
218enum uvc_ct_ctrl_selector {
219 UVC_CT_CONTROL_UNDEFINED = 0x00,
220 UVC_CT_SCANNING_MODE_CONTROL = 0x01,
221 UVC_CT_AE_MODE_CONTROL = 0x02,
222 UVC_CT_AE_PRIORITY_CONTROL = 0x03,
223 UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL = 0x04,
224 UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL = 0x05,
225 UVC_CT_FOCUS_ABSOLUTE_CONTROL = 0x06,
226 UVC_CT_FOCUS_RELATIVE_CONTROL = 0x07,
227 UVC_CT_FOCUS_AUTO_CONTROL = 0x08,
228 UVC_CT_IRIS_ABSOLUTE_CONTROL = 0x09,
229 UVC_CT_IRIS_RELATIVE_CONTROL = 0x0a,
230 UVC_CT_ZOOM_ABSOLUTE_CONTROL = 0x0b,
231 UVC_CT_ZOOM_RELATIVE_CONTROL = 0x0c,
232 UVC_CT_PANTILT_ABSOLUTE_CONTROL = 0x0d,
233 UVC_CT_PANTILT_RELATIVE_CONTROL = 0x0e,
234 UVC_CT_ROLL_ABSOLUTE_CONTROL = 0x0f,
235 UVC_CT_ROLL_RELATIVE_CONTROL = 0x10,
236 UVC_CT_PRIVACY_CONTROL = 0x11,
237 UVC_CT_FOCUS_SIMPLE_CONTROL = 0x12,
238 UVC_CT_DIGITAL_WINDOW_CONTROL = 0x13,
239 UVC_CT_REGION_OF_INTEREST_CONTROL = 0x14
240};
241
243enum uvc_pu_ctrl_selector {
244 UVC_PU_CONTROL_UNDEFINED = 0x00,
245 UVC_PU_BACKLIGHT_COMPENSATION_CONTROL = 0x01,
246 UVC_PU_BRIGHTNESS_CONTROL = 0x02,
247 UVC_PU_CONTRAST_CONTROL = 0x03,
248 UVC_PU_GAIN_CONTROL = 0x04,
249 UVC_PU_POWER_LINE_FREQUENCY_CONTROL = 0x05,
250 UVC_PU_HUE_CONTROL = 0x06,
251 UVC_PU_SATURATION_CONTROL = 0x07,
252 UVC_PU_SHARPNESS_CONTROL = 0x08,
253 UVC_PU_GAMMA_CONTROL = 0x09,
254 UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL = 0x0a,
255 UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL = 0x0b,
256 UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL = 0x0c,
257 UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL = 0x0d,
258 UVC_PU_DIGITAL_MULTIPLIER_CONTROL = 0x0e,
259 UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL = 0x0f,
260 UVC_PU_HUE_AUTO_CONTROL = 0x10,
261 UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL = 0x11,
262 UVC_PU_ANALOG_LOCK_STATUS_CONTROL = 0x12,
263 UVC_PU_CONTRAST_AUTO_CONTROL = 0x13
264};
265
267enum uvc_term_type {
268 UVC_TT_VENDOR_SPECIFIC = 0x0100,
269 UVC_TT_STREAMING = 0x0101
270};
271
273enum uvc_it_type {
274 UVC_ITT_VENDOR_SPECIFIC = 0x0200,
275 UVC_ITT_CAMERA = 0x0201,
276 UVC_ITT_MEDIA_TRANSPORT_INPUT = 0x0202
277};
278
280enum uvc_ot_type {
281 UVC_OTT_VENDOR_SPECIFIC = 0x0300,
282 UVC_OTT_DISPLAY = 0x0301,
283 UVC_OTT_MEDIA_TRANSPORT_OUTPUT = 0x0302
284};
285
287enum uvc_et_type {
288 UVC_EXTERNAL_VENDOR_SPECIFIC = 0x0400,
289 UVC_COMPOSITE_CONNECTOR = 0x0401,
290 UVC_SVIDEO_CONNECTOR = 0x0402,
291 UVC_COMPONENT_CONNECTOR = 0x0403
292};
293
300struct uvc_context;
301typedef struct uvc_context uvc_context_t;
302
307struct uvc_device;
308typedef struct uvc_device uvc_device_t;
309
315struct uvc_device_handle;
316typedef struct uvc_device_handle uvc_device_handle_t;
317
323struct uvc_stream_handle;
324typedef struct uvc_stream_handle uvc_stream_handle_t;
325
327typedef struct uvc_input_terminal {
328 struct uvc_input_terminal *prev, *next;
330 uint8_t bTerminalID;
332 enum uvc_it_type wTerminalType;
333 uint16_t wObjectiveFocalLengthMin;
334 uint16_t wObjectiveFocalLengthMax;
335 uint16_t wOcularFocalLength;
337 uint64_t bmControls;
339
340typedef struct uvc_output_terminal {
341 struct uvc_output_terminal *prev, *next;
343} uvc_output_terminal_t;
344
346typedef struct uvc_processing_unit {
347 struct uvc_processing_unit *prev, *next;
349 uint8_t bUnitID;
351 uint8_t bSourceID;
353 uint64_t bmControls;
355
357typedef struct uvc_selector_unit {
358 struct uvc_selector_unit *prev, *next;
360 uint8_t bUnitID;
362
364typedef struct uvc_extension_unit {
365 struct uvc_extension_unit *prev, *next;
367 uint8_t bUnitID;
369 uint8_t guidExtensionCode[16];
371 uint64_t bmControls;
373
374enum uvc_status_class {
375 UVC_STATUS_CLASS_CONTROL = 0x10,
376 UVC_STATUS_CLASS_CONTROL_CAMERA = 0x11,
377 UVC_STATUS_CLASS_CONTROL_PROCESSING = 0x12,
378};
379
380enum uvc_status_attribute {
381 UVC_STATUS_ATTRIBUTE_VALUE_CHANGE = 0x00,
382 UVC_STATUS_ATTRIBUTE_INFO_CHANGE = 0x01,
383 UVC_STATUS_ATTRIBUTE_FAILURE_CHANGE = 0x02,
384 UVC_STATUS_ATTRIBUTE_UNKNOWN = 0xff
385};
386
390typedef void(uvc_status_callback_t)(enum uvc_status_class status_class,
391 int event,
392 int selector,
393 enum uvc_status_attribute status_attribute,
394 void *data, size_t data_len,
395 void *user_ptr);
396
400typedef void(uvc_button_callback_t)(int button,
401 int state,
402 void *user_ptr);
403
408typedef struct uvc_device_descriptor {
410 uint16_t idVendor;
412 uint16_t idProduct;
414 uint16_t bcdUVC;
416 const char *serialNumber;
418 const char *manufacturer;
420 const char *product;
422
426typedef struct uvc_frame {
428 void *data;
432 uint32_t width;
434 uint32_t height;
438 size_t step;
440 uint32_t sequence;
442 struct timeval capture_time;
445 uvc_device_handle_t *source;
454
458typedef void(uvc_frame_callback_t)(struct uvc_frame *frame, void *user_ptr);
459
463typedef struct uvc_stream_ctrl {
464 uint16_t bmHint;
465 uint8_t bFormatIndex;
466 uint8_t bFrameIndex;
467 uint32_t dwFrameInterval;
468 uint16_t wKeyFrameRate;
469 uint16_t wPFrameRate;
470 uint16_t wCompQuality;
471 uint16_t wCompWindowSize;
472 uint16_t wDelay;
473 uint32_t dwMaxVideoFrameSize;
474 uint32_t dwMaxPayloadTransferSize;
475 uint32_t dwClockFrequency;
476 uint8_t bmFramingInfo;
477 uint8_t bPreferredVersion;
478 uint8_t bMinVersion;
479 uint8_t bMaxVersion;
480 uint8_t bInterfaceNumber;
482
483uvc_error_t uvc_init(uvc_context_t **ctx, struct libusb_context *usb_ctx);
484void uvc_exit(uvc_context_t *ctx);
485
487 uvc_context_t *ctx,
488 uvc_device_t ***list);
489void uvc_free_device_list(uvc_device_t **list, uint8_t unref_devices);
490
492 uvc_device_t *dev,
496
497uint8_t uvc_get_bus_number(uvc_device_t *dev);
498uint8_t uvc_get_device_address(uvc_device_t *dev);
499
501 uvc_context_t *ctx,
502 uvc_device_t **dev,
503 int vid, int pid, const char *sn);
504
506 uvc_context_t *ctx,
507 uvc_device_t ***devs,
508 int vid, int pid, const char *sn);
509
511 uvc_device_t *dev,
512 uvc_device_handle_t **devh);
513void uvc_close(uvc_device_handle_t *devh);
514
515uvc_device_t *uvc_get_device(uvc_device_handle_t *devh);
516struct libusb_device_handle *uvc_get_libusb_handle(uvc_device_handle_t *devh);
517
518void uvc_ref_device(uvc_device_t *dev);
519void uvc_unref_device(uvc_device_t *dev);
520
521void uvc_set_status_callback(uvc_device_handle_t *devh,
523 void *user_ptr);
524
525void uvc_set_button_callback(uvc_device_handle_t *devh,
527 void *user_ptr);
528
529const uvc_input_terminal_t *uvc_get_camera_terminal(uvc_device_handle_t *devh);
530const uvc_input_terminal_t *uvc_get_input_terminals(uvc_device_handle_t *devh);
531const uvc_output_terminal_t *uvc_get_output_terminals(uvc_device_handle_t *devh);
532const uvc_selector_unit_t *uvc_get_selector_units(uvc_device_handle_t *devh);
533const uvc_processing_unit_t *uvc_get_processing_units(uvc_device_handle_t *devh);
534const uvc_extension_unit_t *uvc_get_extension_units(uvc_device_handle_t *devh);
535
537 uvc_device_handle_t *devh,
538 uvc_stream_ctrl_t *ctrl,
539 enum uvc_frame_format format,
540 int width, int height,
541 int fps
542 );
543
544const uvc_format_desc_t *uvc_get_format_descs(uvc_device_handle_t* );
545
546uvc_error_t uvc_probe_stream_ctrl(
547 uvc_device_handle_t *devh,
548 uvc_stream_ctrl_t *ctrl);
549
551 uvc_device_handle_t *devh,
552 uvc_stream_ctrl_t *ctrl,
554 void *user_ptr,
555 uint8_t flags);
556
558 uvc_device_handle_t *devh,
559 uvc_stream_ctrl_t *ctrl,
561 void *user_ptr);
562
563void uvc_stop_streaming(uvc_device_handle_t *devh);
564
565uvc_error_t uvc_stream_open_ctrl(uvc_device_handle_t *devh, uvc_stream_handle_t **strmh, uvc_stream_ctrl_t *ctrl);
566uvc_error_t uvc_stream_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl);
567uvc_error_t uvc_stream_start(uvc_stream_handle_t *strmh,
569 void *user_ptr,
570 uint8_t flags);
571uvc_error_t uvc_stream_start_iso(uvc_stream_handle_t *strmh,
573 void *user_ptr);
575 uvc_stream_handle_t *strmh,
576 uvc_frame_t **frame,
577 int32_t timeout_us
578);
579uvc_error_t uvc_stream_stop(uvc_stream_handle_t *strmh);
580void uvc_stream_close(uvc_stream_handle_t *strmh);
581
582int uvc_get_ctrl_len(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl);
583int uvc_get_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len, enum uvc_req_code req_code);
584int uvc_set_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len);
585
586uvc_error_t uvc_get_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode *mode, enum uvc_req_code req_code);
587uvc_error_t uvc_set_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode mode);
588
589/* AUTO-GENERATED control accessors! Update them with the output of `ctrl-gen.py decl`. */
590uvc_error_t uvc_get_scanning_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code);
591uvc_error_t uvc_set_scanning_mode(uvc_device_handle_t *devh, uint8_t mode);
592
593uvc_error_t uvc_get_ae_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code);
594uvc_error_t uvc_set_ae_mode(uvc_device_handle_t *devh, uint8_t mode);
595
596uvc_error_t uvc_get_ae_priority(uvc_device_handle_t *devh, uint8_t* priority, enum uvc_req_code req_code);
597uvc_error_t uvc_set_ae_priority(uvc_device_handle_t *devh, uint8_t priority);
598
599uvc_error_t uvc_get_exposure_abs(uvc_device_handle_t *devh, uint32_t* time, enum uvc_req_code req_code);
600uvc_error_t uvc_set_exposure_abs(uvc_device_handle_t *devh, uint32_t time);
601
602uvc_error_t uvc_get_exposure_rel(uvc_device_handle_t *devh, int8_t* step, enum uvc_req_code req_code);
603uvc_error_t uvc_set_exposure_rel(uvc_device_handle_t *devh, int8_t step);
604
605uvc_error_t uvc_get_focus_abs(uvc_device_handle_t *devh, uint16_t* focus, enum uvc_req_code req_code);
606uvc_error_t uvc_set_focus_abs(uvc_device_handle_t *devh, uint16_t focus);
607
608uvc_error_t uvc_get_focus_rel(uvc_device_handle_t *devh, int8_t* focus_rel, uint8_t* speed, enum uvc_req_code req_code);
609uvc_error_t uvc_set_focus_rel(uvc_device_handle_t *devh, int8_t focus_rel, uint8_t speed);
610
611uvc_error_t uvc_get_focus_simple_range(uvc_device_handle_t *devh, uint8_t* focus, enum uvc_req_code req_code);
612uvc_error_t uvc_set_focus_simple_range(uvc_device_handle_t *devh, uint8_t focus);
613
614uvc_error_t uvc_get_focus_auto(uvc_device_handle_t *devh, uint8_t* state, enum uvc_req_code req_code);
615uvc_error_t uvc_set_focus_auto(uvc_device_handle_t *devh, uint8_t state);
616
617uvc_error_t uvc_get_iris_abs(uvc_device_handle_t *devh, uint16_t* iris, enum uvc_req_code req_code);
618uvc_error_t uvc_set_iris_abs(uvc_device_handle_t *devh, uint16_t iris);
619
620uvc_error_t uvc_get_iris_rel(uvc_device_handle_t *devh, uint8_t* iris_rel, enum uvc_req_code req_code);
621uvc_error_t uvc_set_iris_rel(uvc_device_handle_t *devh, uint8_t iris_rel);
622
623uvc_error_t uvc_get_zoom_abs(uvc_device_handle_t *devh, uint16_t* focal_length, enum uvc_req_code req_code);
624uvc_error_t uvc_set_zoom_abs(uvc_device_handle_t *devh, uint16_t focal_length);
625
626uvc_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);
627uvc_error_t uvc_set_zoom_rel(uvc_device_handle_t *devh, int8_t zoom_rel, uint8_t digital_zoom, uint8_t speed);
628
629uvc_error_t uvc_get_pantilt_abs(uvc_device_handle_t *devh, int32_t* pan, int32_t* tilt, enum uvc_req_code req_code);
630uvc_error_t uvc_set_pantilt_abs(uvc_device_handle_t *devh, int32_t pan, int32_t tilt);
631
632uvc_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);
633uvc_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);
634
635uvc_error_t uvc_get_roll_abs(uvc_device_handle_t *devh, int16_t* roll, enum uvc_req_code req_code);
636uvc_error_t uvc_set_roll_abs(uvc_device_handle_t *devh, int16_t roll);
637
638uvc_error_t uvc_get_roll_rel(uvc_device_handle_t *devh, int8_t* roll_rel, uint8_t* speed, enum uvc_req_code req_code);
639uvc_error_t uvc_set_roll_rel(uvc_device_handle_t *devh, int8_t roll_rel, uint8_t speed);
640
641uvc_error_t uvc_get_privacy(uvc_device_handle_t *devh, uint8_t* privacy, enum uvc_req_code req_code);
642uvc_error_t uvc_set_privacy(uvc_device_handle_t *devh, uint8_t privacy);
643
644uvc_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);
645uvc_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);
646
647uvc_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);
648uvc_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);
649
650uvc_error_t uvc_get_backlight_compensation(uvc_device_handle_t *devh, uint16_t* backlight_compensation, enum uvc_req_code req_code);
651uvc_error_t uvc_set_backlight_compensation(uvc_device_handle_t *devh, uint16_t backlight_compensation);
652
653uvc_error_t uvc_get_brightness(uvc_device_handle_t *devh, int16_t* brightness, enum uvc_req_code req_code);
654uvc_error_t uvc_set_brightness(uvc_device_handle_t *devh, int16_t brightness);
655
656uvc_error_t uvc_get_contrast(uvc_device_handle_t *devh, uint16_t* contrast, enum uvc_req_code req_code);
657uvc_error_t uvc_set_contrast(uvc_device_handle_t *devh, uint16_t contrast);
658
659uvc_error_t uvc_get_contrast_auto(uvc_device_handle_t *devh, uint8_t* contrast_auto, enum uvc_req_code req_code);
660uvc_error_t uvc_set_contrast_auto(uvc_device_handle_t *devh, uint8_t contrast_auto);
661
662uvc_error_t uvc_get_gain(uvc_device_handle_t *devh, uint16_t* gain, enum uvc_req_code req_code);
663uvc_error_t uvc_set_gain(uvc_device_handle_t *devh, uint16_t gain);
664
665uvc_error_t uvc_get_power_line_frequency(uvc_device_handle_t *devh, uint8_t* power_line_frequency, enum uvc_req_code req_code);
666uvc_error_t uvc_set_power_line_frequency(uvc_device_handle_t *devh, uint8_t power_line_frequency);
667
668uvc_error_t uvc_get_hue(uvc_device_handle_t *devh, int16_t* hue, enum uvc_req_code req_code);
669uvc_error_t uvc_set_hue(uvc_device_handle_t *devh, int16_t hue);
670
671uvc_error_t uvc_get_hue_auto(uvc_device_handle_t *devh, uint8_t* hue_auto, enum uvc_req_code req_code);
672uvc_error_t uvc_set_hue_auto(uvc_device_handle_t *devh, uint8_t hue_auto);
673
674uvc_error_t uvc_get_saturation(uvc_device_handle_t *devh, uint16_t* saturation, enum uvc_req_code req_code);
675uvc_error_t uvc_set_saturation(uvc_device_handle_t *devh, uint16_t saturation);
676
677uvc_error_t uvc_get_sharpness(uvc_device_handle_t *devh, uint16_t* sharpness, enum uvc_req_code req_code);
678uvc_error_t uvc_set_sharpness(uvc_device_handle_t *devh, uint16_t sharpness);
679
680uvc_error_t uvc_get_gamma(uvc_device_handle_t *devh, uint16_t* gamma, enum uvc_req_code req_code);
681uvc_error_t uvc_set_gamma(uvc_device_handle_t *devh, uint16_t gamma);
682
683uvc_error_t uvc_get_white_balance_temperature(uvc_device_handle_t *devh, uint16_t* temperature, enum uvc_req_code req_code);
684uvc_error_t uvc_set_white_balance_temperature(uvc_device_handle_t *devh, uint16_t temperature);
685
686uvc_error_t uvc_get_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t* temperature_auto, enum uvc_req_code req_code);
687uvc_error_t uvc_set_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t temperature_auto);
688
689uvc_error_t uvc_get_white_balance_component(uvc_device_handle_t *devh, uint16_t* blue, uint16_t* red, enum uvc_req_code req_code);
690uvc_error_t uvc_set_white_balance_component(uvc_device_handle_t *devh, uint16_t blue, uint16_t red);
691
692uvc_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);
693uvc_error_t uvc_set_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t white_balance_component_auto);
694
695uvc_error_t uvc_get_digital_multiplier(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code);
696uvc_error_t uvc_set_digital_multiplier(uvc_device_handle_t *devh, uint16_t multiplier_step);
697
698uvc_error_t uvc_get_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code);
699uvc_error_t uvc_set_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t multiplier_step);
700
701uvc_error_t uvc_get_analog_video_standard(uvc_device_handle_t *devh, uint8_t* video_standard, enum uvc_req_code req_code);
702uvc_error_t uvc_set_analog_video_standard(uvc_device_handle_t *devh, uint8_t video_standard);
703
704uvc_error_t uvc_get_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t* status, enum uvc_req_code req_code);
705uvc_error_t uvc_set_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t status);
706
707uvc_error_t uvc_get_input_select(uvc_device_handle_t *devh, uint8_t* selector, enum uvc_req_code req_code);
708uvc_error_t uvc_set_input_select(uvc_device_handle_t *devh, uint8_t selector);
709/* end AUTO-GENERATED control accessors */
710
711void uvc_perror(uvc_error_t err, const char *msg);
712const char* uvc_strerror(uvc_error_t err);
713void uvc_print_diag(uvc_device_handle_t *devh, FILE *stream);
714void uvc_print_stream_ctrl(uvc_stream_ctrl_t *ctrl, FILE *stream);
715
716uvc_frame_t *uvc_allocate_frame(size_t data_bytes);
717void uvc_free_frame(uvc_frame_t *frame);
718
720
724
728
731
732#ifdef LIBUVC_HAS_JPEG
734#endif
735
736#ifdef __cplusplus
737}
738#endif
739
740#endif // !def(LIBUVC_H)
741
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:473
uvc_device_t * uvc_get_device(uvc_device_handle_t *devh)
Get the uvc_device_t corresponding to an open device.
Definition: device.c:705
void uvc_close(uvc_device_handle_t *devh)
Close a device.
Definition: device.c:1537
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:390
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
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:1770
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:1755
void() uvc_button_callback_t(int button, int state, void *user_ptr)
A callback function to accept button events.
Definition: libuvc.h:400
void uvc_ref_device(uvc_device_t *dev)
Increment the reference count for a device.
Definition: device.c:820
void uvc_free_device_descriptor(uvc_device_descriptor_t *desc)
Frees a device descriptor created with uvc_get_device_descriptor.
Definition: device.c:533
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:561
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:722
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:680
uvc_error_t uvc_open(uvc_device_t *dev, uvc_device_handle_t **devh)
Open a UVC device.
Definition: device.c:273
enum uvc_error uvc_error_t
UVC error types, based on libusb errors.
const char * uvc_strerror(uvc_error_t err)
Return a string explaining an error in the UVC driver.
Definition: diag.c:88
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:131
uvc_error_t uvc_yuyv2y(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to Y (GRAY8)
Definition: frame.c:247
uvc_error_t uvc_any2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame to RGB.
Definition: frame.c:419
uvc_error_t uvc_yuyv2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to RGB.
Definition: frame.c:158
uvc_error_t uvc_yuyv2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to BGR.
Definition: frame.c:208
uvc_error_t uvc_uyvy2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from UYVY to RGB.
Definition: frame.c:335
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:286
uvc_frame_t * uvc_allocate_frame(size_t data_bytes)
Allocate a frame structure.
Definition: frame.c:64
uvc_error_t uvc_uyvy2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from UYVY to BGR.
Definition: frame.c:384
uvc_error_t uvc_any2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame to BGR.
Definition: frame.c:438
uvc_error_t uvc_duplicate_frame(uvc_frame_t *in, uvc_frame_t *out)
Duplicate a frame, preserving color format.
Definition: frame.c:109
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:1218
void() uvc_frame_callback_t(struct uvc_frame *frame, void *user_ptr)
A callback function to handle incoming assembled UVC frames.
Definition: libuvc.h:458
void uvc_stream_close(uvc_stream_handle_t *strmh)
Close stream.
Definition: stream.c:1271
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:686
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:1024
struct uvc_stream_ctrl uvc_stream_ctrl_t
Streaming mode, includes all information needed to select stream.
void uvc_stop_streaming(uvc_device_handle_t *devh)
Stop streaming video.
Definition: stream.c:1203
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:827
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:760
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:722
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:281
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:359
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:1120
@ UVC_FRAME_FORMAT_RGB
24-bit RGB
Definition: libuvc.h:71
@ UVC_FRAME_FORMAT_COUNT
Number of formats understood.
Definition: libuvc.h:86
@ UVC_FRAME_FORMAT_GRAY8
Greyscale images.
Definition: libuvc.h:76
@ UVC_FRAME_FORMAT_ANY
Any supported format.
Definition: libuvc.h:62
@ 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:408
uint16_t idProduct
Product ID.
Definition: libuvc.h:412
const char * manufacturer
Device-reported manufacturer name (or null)
Definition: libuvc.h:418
const char * serialNumber
Serial number (null if unavailable)
Definition: libuvc.h:416
uint16_t idVendor
Vendor ID.
Definition: libuvc.h:410
uint16_t bcdUVC
UVC compliance level, e.g.
Definition: libuvc.h:414
const char * product
Device-reporter product name (or null)
Definition: libuvc.h:420
Custom processing or camera-control functions.
Definition: libuvc.h:364
uint8_t guidExtensionCode[16]
GUID identifying the extension unit.
Definition: libuvc.h:369
uint8_t bUnitID
Index of the extension unit within the device.
Definition: libuvc.h:367
uint64_t bmControls
Bitmap of available controls (manufacturer-dependent)
Definition: libuvc.h:371
Format descriptor.
Definition: libuvc.h:168
struct uvc_frame_desc * frame_descs
Available frame specifications for this format.
Definition: libuvc.h:196
uint8_t bmFlags
Flags for JPEG stream.
Definition: libuvc.h:186
uint8_t bFormatIndex
Identifier of this format within the VS interface's format list.
Definition: libuvc.h:174
enum uvc_vs_desc_subtype bDescriptorSubtype
Type of image stream, such as JPEG or uncompressed.
Definition: libuvc.h:172
uint8_t bBitsPerPixel
BPP for uncompressed stream.
Definition: libuvc.h:184
uint8_t bDefaultFrameIndex
Default {uvc_frame_desc} to choose given this format.
Definition: libuvc.h:189
Frame descriptor.
Definition: libuvc.h:129
uint16_t wWidth
Image width.
Definition: libuvc.h:138
uint32_t * intervals
Available frame rates, zero-terminated (in 100ns units)
Definition: libuvc.h:160
uint8_t bFrameIndex
Index of the frame within the list of specs available for this format.
Definition: libuvc.h:135
uint16_t wHeight
Image height.
Definition: libuvc.h:140
uint32_t dwBytesPerLine
number of bytes per line
Definition: libuvc.h:158
uint32_t dwDefaultFrameInterval
Default frame interval (in 100ns units)
Definition: libuvc.h:148
enum uvc_vs_desc_subtype bDescriptorSubtype
Type of frame, such as JPEG frame or uncompressed frme.
Definition: libuvc.h:133
uint32_t dwMaxBitRate
Bitrate of corresponding stream at maximal frame rate.
Definition: libuvc.h:144
uint8_t bFrameIntervalType
Frame intervals.
Definition: libuvc.h:156
uint32_t dwMaxVideoFrameBufferSize
Maximum number of bytes for a video frame.
Definition: libuvc.h:146
uint32_t dwMinFrameInterval
Minimum frame interval for continuous mode (100ns units)
Definition: libuvc.h:150
uint32_t dwMinBitRate
Bitrate of corresponding stream at minimal frame rate.
Definition: libuvc.h:142
uint32_t dwFrameIntervalStep
Granularity of frame interval range for continuous mode (100ns)
Definition: libuvc.h:154
uint32_t dwMaxFrameInterval
Maximum frame interval for continuous mode (100ns units)
Definition: libuvc.h:152
An image frame received from the UVC device.
Definition: libuvc.h:426
enum uvc_frame_format frame_format
Pixel data format.
Definition: libuvc.h:436
size_t data_bytes
Size of image data buffer.
Definition: libuvc.h:430
uint32_t width
Width of image in pixels.
Definition: libuvc.h:432
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:452
uint32_t height
Height of image in pixels.
Definition: libuvc.h:434
uint32_t sequence
Frame number (may skip, but is strictly monotonically increasing)
Definition: libuvc.h:440
size_t step
Number of bytes per horizontal line (undefined for compressed format)
Definition: libuvc.h:438
struct timeval capture_time
Estimate of system time when the device started capturing the image.
Definition: libuvc.h:442
void * data
Image data for this frame.
Definition: libuvc.h:428
uvc_device_handle_t * source
Handle on the device that produced the image.
Definition: libuvc.h:445
Representation of the interface that brings data into the UVC device.
Definition: libuvc.h:327
uint8_t bTerminalID
Index of the terminal within the device.
Definition: libuvc.h:330
uint64_t bmControls
Camera controls (meaning of bits given in {uvc_ct_ctrl_selector})
Definition: libuvc.h:337
enum uvc_it_type wTerminalType
Type of terminal (e.g., camera)
Definition: libuvc.h:332
Represents post-capture processing functions.
Definition: libuvc.h:346
uint8_t bUnitID
Index of the processing unit within the device.
Definition: libuvc.h:349
uint64_t bmControls
Processing controls (meaning of bits given in {uvc_pu_ctrl_selector})
Definition: libuvc.h:353
uint8_t bSourceID
Index of the terminal from which the device accepts images.
Definition: libuvc.h:351
Represents selector unit to connect other units.
Definition: libuvc.h:357
uint8_t bUnitID
Index of the selector unit within the device.
Definition: libuvc.h:360
Streaming mode, includes all information needed to select stream.
Definition: libuvc.h:463