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
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,
75 UVC_FRAME_FORMAT_H264,
78 UVC_FRAME_FORMAT_GRAY16,
79 /* Raw colour mosaic images */
80 UVC_FRAME_FORMAT_BY8,
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};
97
98/* UVC_COLOR_FORMAT_* have been replaced with UVC_FRAME_FORMAT_*. Please use
99 * UVC_FRAME_FORMAT_* instead of using these. */
100#define UVC_COLOR_FORMAT_UNKNOWN UVC_FRAME_FORMAT_UNKNOWN
101#define UVC_COLOR_FORMAT_UNCOMPRESSED UVC_FRAME_FORMAT_UNCOMPRESSED
102#define UVC_COLOR_FORMAT_COMPRESSED UVC_FRAME_FORMAT_COMPRESSED
103#define UVC_COLOR_FORMAT_YUYV UVC_FRAME_FORMAT_YUYV
104#define UVC_COLOR_FORMAT_UYVY UVC_FRAME_FORMAT_UYVY
105#define UVC_COLOR_FORMAT_RGB UVC_FRAME_FORMAT_RGB
106#define UVC_COLOR_FORMAT_BGR UVC_FRAME_FORMAT_BGR
107#define UVC_COLOR_FORMAT_MJPEG UVC_FRAME_FORMAT_MJPEG
108#define UVC_COLOR_FORMAT_GRAY8 UVC_FRAME_FORMAT_GRAY8
109#define UVC_COLOR_FORMAT_GRAY16 UVC_FRAME_FORMAT_GRAY16
110#define UVC_COLOR_FORMAT_NV12 UVC_FRAME_FORMAT_NV12
111
113enum uvc_vs_desc_subtype {
114 UVC_VS_UNDEFINED = 0x00,
115 UVC_VS_INPUT_HEADER = 0x01,
116 UVC_VS_OUTPUT_HEADER = 0x02,
117 UVC_VS_STILL_IMAGE_FRAME = 0x03,
118 UVC_VS_FORMAT_UNCOMPRESSED = 0x04,
119 UVC_VS_FRAME_UNCOMPRESSED = 0x05,
120 UVC_VS_FORMAT_MJPEG = 0x06,
121 UVC_VS_FRAME_MJPEG = 0x07,
122 UVC_VS_FORMAT_MPEG2TS = 0x0a,
123 UVC_VS_FORMAT_DV = 0x0c,
124 UVC_VS_COLORFORMAT = 0x0d,
125 UVC_VS_FORMAT_FRAME_BASED = 0x10,
126 UVC_VS_FRAME_FRAME_BASED = 0x11,
127 UVC_VS_FORMAT_STREAM_BASED = 0x12
128};
129
130struct uvc_format_desc;
131struct uvc_frame_desc;
132
133typedef struct uvc_still_frame_res {
134 struct uvc_still_frame_res *prev, *next;
135 uint8_t bResolutionIndex;
137 uint16_t wWidth;
139 uint16_t wHeight;
140} uvc_still_frame_res_t;
141
142typedef struct uvc_still_frame_desc {
143 struct uvc_format_desc *parent;
144 struct uvc_still_frame_desc *prev, *next;
146 enum uvc_vs_desc_subtype bDescriptorSubtype;
148 uint8_t bEndPointAddress;
149 uvc_still_frame_res_t* imageSizePatterns;
150 uint8_t bNumCompressionPattern;
151 /* indication of compression level, the higher, the more compression is applied to image */
152 uint8_t* bCompression;
153} uvc_still_frame_desc_t;
154
161typedef struct uvc_frame_desc {
162 struct uvc_format_desc *parent;
163 struct uvc_frame_desc *prev, *next;
165 enum uvc_vs_desc_subtype bDescriptorSubtype;
167 uint8_t bFrameIndex;
168 uint8_t bmCapabilities;
170 uint16_t wWidth;
172 uint16_t wHeight;
174 uint32_t dwMinBitRate;
176 uint32_t dwMaxBitRate;
192 uint32_t *intervals;
193} uvc_frame_desc_t;
194
200typedef struct uvc_format_desc {
201 struct uvc_streaming_interface *parent;
202 struct uvc_format_desc *prev, *next;
204 enum uvc_vs_desc_subtype bDescriptorSubtype;
207 uint8_t bNumFrameDescriptors;
209 union {
210 uint8_t guidFormat[16];
211 uint8_t fourccFormat[4];
212 };
214 union {
218 uint8_t bmFlags;
219 };
222 uint8_t bAspectRatioX;
223 uint8_t bAspectRatioY;
224 uint8_t bmInterlaceFlags;
225 uint8_t bCopyProtect;
226 uint8_t bVariableSize;
229 struct uvc_still_frame_desc *still_frame_desc;
230} uvc_format_desc_t;
231
233enum uvc_req_code {
234 UVC_RC_UNDEFINED = 0x00,
235 UVC_SET_CUR = 0x01,
236 UVC_GET_CUR = 0x81,
237 UVC_GET_MIN = 0x82,
238 UVC_GET_MAX = 0x83,
239 UVC_GET_RES = 0x84,
240 UVC_GET_LEN = 0x85,
241 UVC_GET_INFO = 0x86,
242 UVC_GET_DEF = 0x87
243};
244
246enum uvc_device_power_mode {
247 UVC_VC_VIDEO_POWER_MODE_FULL = 0x00,
248 UVC_VC_VIDEO_POWER_MODE_DEVICE_DEPENDENT = 0x01,
249};
250
253enum uvc_device_power_mode_bitmap {
255 UVC_VC_VIDEO_POWER_MODE_MASK = 0x0f,
257 UVC_VC_VIDEO_POWER_MODE_DEVICE_DEPENDENT_SUPPORTED = 0x10,
259 UVC_VC_VIDEO_POWER_SOURCE_USB = 0x20,
261 UVC_VC_VIDEO_POWER_SOURCE_BATTERY = 0x40,
263 UVC_VC_VIDEO_POWER_SOURCE_AC = 0x80,
264};
265
267enum uvc_ct_ctrl_selector {
268 UVC_CT_CONTROL_UNDEFINED = 0x00,
269 UVC_CT_SCANNING_MODE_CONTROL = 0x01,
270 UVC_CT_AE_MODE_CONTROL = 0x02,
271 UVC_CT_AE_PRIORITY_CONTROL = 0x03,
272 UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL = 0x04,
273 UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL = 0x05,
274 UVC_CT_FOCUS_ABSOLUTE_CONTROL = 0x06,
275 UVC_CT_FOCUS_RELATIVE_CONTROL = 0x07,
276 UVC_CT_FOCUS_AUTO_CONTROL = 0x08,
277 UVC_CT_IRIS_ABSOLUTE_CONTROL = 0x09,
278 UVC_CT_IRIS_RELATIVE_CONTROL = 0x0a,
279 UVC_CT_ZOOM_ABSOLUTE_CONTROL = 0x0b,
280 UVC_CT_ZOOM_RELATIVE_CONTROL = 0x0c,
281 UVC_CT_PANTILT_ABSOLUTE_CONTROL = 0x0d,
282 UVC_CT_PANTILT_RELATIVE_CONTROL = 0x0e,
283 UVC_CT_ROLL_ABSOLUTE_CONTROL = 0x0f,
284 UVC_CT_ROLL_RELATIVE_CONTROL = 0x10,
285 UVC_CT_PRIVACY_CONTROL = 0x11,
286 UVC_CT_FOCUS_SIMPLE_CONTROL = 0x12,
287 UVC_CT_DIGITAL_WINDOW_CONTROL = 0x13,
288 UVC_CT_REGION_OF_INTEREST_CONTROL = 0x14
289};
290
292enum uvc_pu_ctrl_selector {
293 UVC_PU_CONTROL_UNDEFINED = 0x00,
294 UVC_PU_BACKLIGHT_COMPENSATION_CONTROL = 0x01,
295 UVC_PU_BRIGHTNESS_CONTROL = 0x02,
296 UVC_PU_CONTRAST_CONTROL = 0x03,
297 UVC_PU_GAIN_CONTROL = 0x04,
298 UVC_PU_POWER_LINE_FREQUENCY_CONTROL = 0x05,
299 UVC_PU_HUE_CONTROL = 0x06,
300 UVC_PU_SATURATION_CONTROL = 0x07,
301 UVC_PU_SHARPNESS_CONTROL = 0x08,
302 UVC_PU_GAMMA_CONTROL = 0x09,
303 UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL = 0x0a,
304 UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL = 0x0b,
305 UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL = 0x0c,
306 UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL = 0x0d,
307 UVC_PU_DIGITAL_MULTIPLIER_CONTROL = 0x0e,
308 UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL = 0x0f,
309 UVC_PU_HUE_AUTO_CONTROL = 0x10,
310 UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL = 0x11,
311 UVC_PU_ANALOG_LOCK_STATUS_CONTROL = 0x12,
312 UVC_PU_CONTRAST_AUTO_CONTROL = 0x13
313};
314
316enum uvc_term_type {
317 UVC_TT_VENDOR_SPECIFIC = 0x0100,
318 UVC_TT_STREAMING = 0x0101
319};
320
322enum uvc_it_type {
323 UVC_ITT_VENDOR_SPECIFIC = 0x0200,
324 UVC_ITT_CAMERA = 0x0201,
325 UVC_ITT_MEDIA_TRANSPORT_INPUT = 0x0202
326};
327
329enum uvc_ot_type {
330 UVC_OTT_VENDOR_SPECIFIC = 0x0300,
331 UVC_OTT_DISPLAY = 0x0301,
332 UVC_OTT_MEDIA_TRANSPORT_OUTPUT = 0x0302
333};
334
336enum uvc_et_type {
337 UVC_EXTERNAL_VENDOR_SPECIFIC = 0x0400,
338 UVC_COMPOSITE_CONNECTOR = 0x0401,
339 UVC_SVIDEO_CONNECTOR = 0x0402,
340 UVC_COMPONENT_CONNECTOR = 0x0403
341};
342
349struct uvc_context;
350typedef struct uvc_context uvc_context_t;
351
356struct uvc_device;
357typedef struct uvc_device uvc_device_t;
358
364struct uvc_device_handle;
365typedef struct uvc_device_handle uvc_device_handle_t;
366
372struct uvc_stream_handle;
373typedef struct uvc_stream_handle uvc_stream_handle_t;
374
376typedef struct uvc_input_terminal {
377 struct uvc_input_terminal *prev, *next;
379 uint8_t bTerminalID;
381 enum uvc_it_type wTerminalType;
382 uint16_t wObjectiveFocalLengthMin;
383 uint16_t wObjectiveFocalLengthMax;
384 uint16_t wOcularFocalLength;
386 uint64_t bmControls;
387} uvc_input_terminal_t;
388
389typedef struct uvc_output_terminal {
390 struct uvc_output_terminal *prev, *next;
392} uvc_output_terminal_t;
393
395typedef struct uvc_processing_unit {
396 struct uvc_processing_unit *prev, *next;
398 uint8_t bUnitID;
400 uint8_t bSourceID;
402 uint64_t bmControls;
403} uvc_processing_unit_t;
404
406typedef struct uvc_selector_unit {
407 struct uvc_selector_unit *prev, *next;
409 uint8_t bUnitID;
410} uvc_selector_unit_t;
411
413typedef struct uvc_extension_unit {
414 struct uvc_extension_unit *prev, *next;
416 uint8_t bUnitID;
418 uint8_t guidExtensionCode[16];
420 uint64_t bmControls;
421} uvc_extension_unit_t;
422
423enum uvc_status_class {
424 UVC_STATUS_CLASS_CONTROL = 0x10,
425 UVC_STATUS_CLASS_CONTROL_CAMERA = 0x11,
426 UVC_STATUS_CLASS_CONTROL_PROCESSING = 0x12,
427};
428
429enum uvc_status_attribute {
430 UVC_STATUS_ATTRIBUTE_VALUE_CHANGE = 0x00,
431 UVC_STATUS_ATTRIBUTE_INFO_CHANGE = 0x01,
432 UVC_STATUS_ATTRIBUTE_FAILURE_CHANGE = 0x02,
433 UVC_STATUS_ATTRIBUTE_MIN_CHANGE = 0x03,
434 UVC_STATUS_ATTRIBUTE_MAX_CHANGE = 0x04,
436 UVC_STATUS_ATTRIBUTE_UNKNOWN = 0xff
437};
438
442typedef void(uvc_status_callback_t)(enum uvc_status_class status_class,
443 int event,
444 int selector,
445 enum uvc_status_attribute status_attribute,
446 void *data, size_t data_len,
447 void *user_ptr);
448
452typedef void(uvc_button_callback_t)(int button,
453 int state,
454 void *user_ptr);
455
460typedef struct uvc_device_descriptor {
462 uint16_t idVendor;
464 uint16_t idProduct;
468 uint16_t reserved;
470 const char *serialNumber;
472 const char *manufacturer;
474 const char *product;
475} uvc_device_descriptor_t;
476
480typedef struct uvc_frame {
482 void *data;
486 uint32_t width;
488 uint32_t height;
492 size_t step;
494 uint32_t sequence;
496 struct timeval capture_time;
498 struct timespec capture_time_finished;
501 uvc_device_handle_t *source;
510 void *metadata;
514
518typedef void(uvc_frame_callback_t)(struct uvc_frame *frame, void *user_ptr);
519
523typedef struct uvc_stream_ctrl {
524 uint16_t bmHint;
525 uint8_t bFormatIndex;
526 uint8_t bFrameIndex;
527 uint32_t dwFrameInterval;
528 uint16_t wKeyFrameRate;
529 uint16_t wPFrameRate;
530 uint16_t wCompQuality;
531 uint16_t wCompWindowSize;
532 uint16_t wDelay;
533 uint32_t dwMaxVideoFrameSize;
534 uint32_t dwMaxPayloadTransferSize;
535 uint32_t dwClockFrequency;
536 uint8_t bmFramingInfo;
537 uint8_t bPreferredVersion;
538 uint8_t bMinVersion;
539 uint8_t bMaxVersion;
540 uint8_t bInterfaceNumber;
542
543typedef struct uvc_still_ctrl {
544 /* Video format index from a format descriptor */
545 uint8_t bFormatIndex;
546 /* Video frame index from a frame descriptor */
547 uint8_t bFrameIndex;
548 /* Compression index from a frame descriptor */
549 uint8_t bCompressionIndex;
550 /* Maximum still image size in bytes. */
551 uint32_t dwMaxVideoFrameSize;
552 /* Maximum number of byte per payload*/
553 uint32_t dwMaxPayloadTransferSize;
554 uint8_t bInterfaceNumber;
555} uvc_still_ctrl_t;
556
557uvc_error_t uvc_init(uvc_context_t **ctx, struct libusb_context *usb_ctx);
558void uvc_exit(uvc_context_t *ctx);
559
561 uvc_context_t *ctx,
562 uvc_device_t ***list);
563void uvc_free_device_list(uvc_device_t **list, uint8_t unref_devices);
564
566 uvc_device_t *dev,
567 uvc_device_descriptor_t **desc);
569 uvc_device_descriptor_t *desc);
570
571uint8_t uvc_get_bus_number(uvc_device_t *dev);
572uint8_t uvc_get_device_address(uvc_device_t *dev);
573
575 uvc_context_t *ctx,
576 uvc_device_t **dev,
577 int vid, int pid, const char *sn);
578
580 uvc_context_t *ctx,
581 uvc_device_t ***devs,
582 int vid, int pid, const char *sn);
583
584#if LIBUSB_API_VERSION >= 0x01000107
585uvc_error_t uvc_wrap(
586 int sys_dev,
587 uvc_context_t *context,
588 uvc_device_handle_t **devh);
589#endif
590
592 uvc_device_t *dev,
593 uvc_device_handle_t **devh);
594void uvc_close(uvc_device_handle_t *devh);
595
596uvc_device_t *uvc_get_device(uvc_device_handle_t *devh);
597struct libusb_device_handle *uvc_get_libusb_handle(uvc_device_handle_t *devh);
598
599void uvc_ref_device(uvc_device_t *dev);
600void uvc_unref_device(uvc_device_t *dev);
601
602void uvc_set_status_callback(uvc_device_handle_t *devh,
604 void *user_ptr);
605
606void uvc_set_button_callback(uvc_device_handle_t *devh,
608 void *user_ptr);
609
610const uvc_input_terminal_t *uvc_get_camera_terminal(uvc_device_handle_t *devh);
611const uvc_input_terminal_t *uvc_get_input_terminals(uvc_device_handle_t *devh);
612const uvc_output_terminal_t *uvc_get_output_terminals(uvc_device_handle_t *devh);
613const uvc_selector_unit_t *uvc_get_selector_units(uvc_device_handle_t *devh);
614const uvc_processing_unit_t *uvc_get_processing_units(uvc_device_handle_t *devh);
615const uvc_extension_unit_t *uvc_get_extension_units(uvc_device_handle_t *devh);
616uint16_t uvc_get_spec_version(uvc_device_handle_t *devh);
617
619 uvc_device_handle_t *devh,
620 uvc_stream_ctrl_t *ctrl,
621 enum uvc_frame_format format,
622 int width, int height,
623 int fps
624 );
625
627 uvc_device_handle_t *devh,
628 uvc_stream_ctrl_t *ctrl,
629 uvc_still_ctrl_t *still_ctrl,
630 int width, int height);
631
633 uvc_device_handle_t *devh,
634 uvc_still_ctrl_t *still_ctrl);
635
636const uvc_format_desc_t *uvc_get_format_descs(uvc_device_handle_t* );
637
638enum uvc_frame_format uvc_frame_format_for_guid(uint8_t guid[16]);
639
640uvc_error_t uvc_probe_stream_ctrl(
641 uvc_device_handle_t *devh,
642 uvc_stream_ctrl_t *ctrl);
643
644uvc_error_t uvc_probe_still_ctrl(
645 uvc_device_handle_t *devh,
646 uvc_still_ctrl_t *still_ctrl);
647
649 uvc_device_handle_t *devh,
650 uvc_stream_ctrl_t *ctrl,
652 void *user_ptr,
653 uint8_t flags);
654
656 uvc_device_handle_t *devh,
657 uvc_stream_ctrl_t *ctrl,
659 void *user_ptr);
660
661void uvc_stop_streaming(uvc_device_handle_t *devh);
662
663uvc_error_t uvc_stream_open_ctrl(uvc_device_handle_t *devh, uvc_stream_handle_t **strmh, uvc_stream_ctrl_t *ctrl);
664uvc_error_t uvc_stream_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl);
665uvc_error_t uvc_stream_get_current_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl);
666uvc_error_t uvc_stream_start(uvc_stream_handle_t *strmh,
668 void *user_ptr,
669 uint8_t flags);
670uvc_error_t uvc_stream_start_iso(uvc_stream_handle_t *strmh,
672 void *user_ptr);
674 uvc_stream_handle_t *strmh,
675 uvc_frame_t **frame,
676 int32_t timeout_us
677);
678uvc_error_t uvc_stream_stop(uvc_stream_handle_t *strmh);
679void uvc_stream_close(uvc_stream_handle_t *strmh);
680
681int uvc_get_ctrl_len(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl);
682int uvc_get_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len, enum uvc_req_code req_code);
683int uvc_set_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len);
684
685uvc_error_t uvc_get_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode *mode, enum uvc_req_code req_code);
686uvc_error_t uvc_get_power_mode_bitmap(uvc_device_handle_t *devh, uint8_t *bitmap, enum uvc_req_code req_code);
687uvc_error_t uvc_set_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode mode);
688
689/* AUTO-GENERATED control accessors! Update them with the output of `ctrl-gen.py decl`. */
690uvc_error_t uvc_get_scanning_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code);
691uvc_error_t uvc_set_scanning_mode(uvc_device_handle_t *devh, uint8_t mode);
692
693uvc_error_t uvc_get_ae_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code);
694uvc_error_t uvc_set_ae_mode(uvc_device_handle_t *devh, uint8_t mode);
695
696uvc_error_t uvc_get_ae_priority(uvc_device_handle_t *devh, uint8_t* priority, enum uvc_req_code req_code);
697uvc_error_t uvc_set_ae_priority(uvc_device_handle_t *devh, uint8_t priority);
698
699uvc_error_t uvc_get_exposure_abs(uvc_device_handle_t *devh, uint32_t* time, enum uvc_req_code req_code);
700uvc_error_t uvc_set_exposure_abs(uvc_device_handle_t *devh, uint32_t time);
701
702uvc_error_t uvc_get_exposure_rel(uvc_device_handle_t *devh, int8_t* step, enum uvc_req_code req_code);
703uvc_error_t uvc_set_exposure_rel(uvc_device_handle_t *devh, int8_t step);
704
705uvc_error_t uvc_get_focus_abs(uvc_device_handle_t *devh, uint16_t* focus, enum uvc_req_code req_code);
706uvc_error_t uvc_set_focus_abs(uvc_device_handle_t *devh, uint16_t focus);
707
708uvc_error_t uvc_get_focus_rel(uvc_device_handle_t *devh, int8_t* focus_rel, uint8_t* speed, enum uvc_req_code req_code);
709uvc_error_t uvc_set_focus_rel(uvc_device_handle_t *devh, int8_t focus_rel, uint8_t speed);
710
711uvc_error_t uvc_get_focus_simple_range(uvc_device_handle_t *devh, uint8_t* focus, enum uvc_req_code req_code);
712uvc_error_t uvc_set_focus_simple_range(uvc_device_handle_t *devh, uint8_t focus);
713
714uvc_error_t uvc_get_focus_auto(uvc_device_handle_t *devh, uint8_t* state, enum uvc_req_code req_code);
715uvc_error_t uvc_set_focus_auto(uvc_device_handle_t *devh, uint8_t state);
716
717uvc_error_t uvc_get_iris_abs(uvc_device_handle_t *devh, uint16_t* iris, enum uvc_req_code req_code);
718uvc_error_t uvc_set_iris_abs(uvc_device_handle_t *devh, uint16_t iris);
719
720uvc_error_t uvc_get_iris_rel(uvc_device_handle_t *devh, uint8_t* iris_rel, enum uvc_req_code req_code);
721uvc_error_t uvc_set_iris_rel(uvc_device_handle_t *devh, uint8_t iris_rel);
722
723uvc_error_t uvc_get_zoom_abs(uvc_device_handle_t *devh, uint16_t* focal_length, enum uvc_req_code req_code);
724uvc_error_t uvc_set_zoom_abs(uvc_device_handle_t *devh, uint16_t focal_length);
725
726uvc_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);
727uvc_error_t uvc_set_zoom_rel(uvc_device_handle_t *devh, int8_t zoom_rel, uint8_t digital_zoom, uint8_t speed);
728
729uvc_error_t uvc_get_pantilt_abs(uvc_device_handle_t *devh, int32_t* pan, int32_t* tilt, enum uvc_req_code req_code);
730uvc_error_t uvc_set_pantilt_abs(uvc_device_handle_t *devh, int32_t pan, int32_t tilt);
731
732uvc_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);
733uvc_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);
734
735uvc_error_t uvc_get_roll_abs(uvc_device_handle_t *devh, int16_t* roll, enum uvc_req_code req_code);
736uvc_error_t uvc_set_roll_abs(uvc_device_handle_t *devh, int16_t roll);
737
738uvc_error_t uvc_get_roll_rel(uvc_device_handle_t *devh, int8_t* roll_rel, uint8_t* speed, enum uvc_req_code req_code);
739uvc_error_t uvc_set_roll_rel(uvc_device_handle_t *devh, int8_t roll_rel, uint8_t speed);
740
741uvc_error_t uvc_get_privacy(uvc_device_handle_t *devh, uint8_t* privacy, enum uvc_req_code req_code);
742uvc_error_t uvc_set_privacy(uvc_device_handle_t *devh, uint8_t privacy);
743
744uvc_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);
745uvc_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);
746
747uvc_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);
748uvc_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);
749
750uvc_error_t uvc_get_backlight_compensation(uvc_device_handle_t *devh, uint16_t* backlight_compensation, enum uvc_req_code req_code);
751uvc_error_t uvc_set_backlight_compensation(uvc_device_handle_t *devh, uint16_t backlight_compensation);
752
753uvc_error_t uvc_get_brightness(uvc_device_handle_t *devh, int16_t* brightness, enum uvc_req_code req_code);
754uvc_error_t uvc_set_brightness(uvc_device_handle_t *devh, int16_t brightness);
755
756uvc_error_t uvc_get_contrast(uvc_device_handle_t *devh, uint16_t* contrast, enum uvc_req_code req_code);
757uvc_error_t uvc_set_contrast(uvc_device_handle_t *devh, uint16_t contrast);
758
759uvc_error_t uvc_get_contrast_auto(uvc_device_handle_t *devh, uint8_t* contrast_auto, enum uvc_req_code req_code);
760uvc_error_t uvc_set_contrast_auto(uvc_device_handle_t *devh, uint8_t contrast_auto);
761
762uvc_error_t uvc_get_gain(uvc_device_handle_t *devh, uint16_t* gain, enum uvc_req_code req_code);
763uvc_error_t uvc_set_gain(uvc_device_handle_t *devh, uint16_t gain);
764
765uvc_error_t uvc_get_power_line_frequency(uvc_device_handle_t *devh, uint8_t* power_line_frequency, enum uvc_req_code req_code);
766uvc_error_t uvc_set_power_line_frequency(uvc_device_handle_t *devh, uint8_t power_line_frequency);
767
768uvc_error_t uvc_get_hue(uvc_device_handle_t *devh, int16_t* hue, enum uvc_req_code req_code);
769uvc_error_t uvc_set_hue(uvc_device_handle_t *devh, int16_t hue);
770
771uvc_error_t uvc_get_hue_auto(uvc_device_handle_t *devh, uint8_t* hue_auto, enum uvc_req_code req_code);
772uvc_error_t uvc_set_hue_auto(uvc_device_handle_t *devh, uint8_t hue_auto);
773
774uvc_error_t uvc_get_saturation(uvc_device_handle_t *devh, uint16_t* saturation, enum uvc_req_code req_code);
775uvc_error_t uvc_set_saturation(uvc_device_handle_t *devh, uint16_t saturation);
776
777uvc_error_t uvc_get_sharpness(uvc_device_handle_t *devh, uint16_t* sharpness, enum uvc_req_code req_code);
778uvc_error_t uvc_set_sharpness(uvc_device_handle_t *devh, uint16_t sharpness);
779
780uvc_error_t uvc_get_gamma(uvc_device_handle_t *devh, uint16_t* gamma, enum uvc_req_code req_code);
781uvc_error_t uvc_set_gamma(uvc_device_handle_t *devh, uint16_t gamma);
782
783uvc_error_t uvc_get_white_balance_temperature(uvc_device_handle_t *devh, uint16_t* temperature, enum uvc_req_code req_code);
784uvc_error_t uvc_set_white_balance_temperature(uvc_device_handle_t *devh, uint16_t temperature);
785
786uvc_error_t uvc_get_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t* temperature_auto, enum uvc_req_code req_code);
787uvc_error_t uvc_set_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t temperature_auto);
788
789uvc_error_t uvc_get_white_balance_component(uvc_device_handle_t *devh, uint16_t* blue, uint16_t* red, enum uvc_req_code req_code);
790uvc_error_t uvc_set_white_balance_component(uvc_device_handle_t *devh, uint16_t blue, uint16_t red);
791
792uvc_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);
793uvc_error_t uvc_set_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t white_balance_component_auto);
794
795uvc_error_t uvc_get_digital_multiplier(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code);
796uvc_error_t uvc_set_digital_multiplier(uvc_device_handle_t *devh, uint16_t multiplier_step);
797
798uvc_error_t uvc_get_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code);
799uvc_error_t uvc_set_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t multiplier_step);
800
801uvc_error_t uvc_get_analog_video_standard(uvc_device_handle_t *devh, uint8_t* video_standard, enum uvc_req_code req_code);
802uvc_error_t uvc_set_analog_video_standard(uvc_device_handle_t *devh, uint8_t video_standard);
803
804uvc_error_t uvc_get_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t* status, enum uvc_req_code req_code);
805uvc_error_t uvc_set_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t status);
806
807uvc_error_t uvc_get_input_select(uvc_device_handle_t *devh, uint8_t* selector, enum uvc_req_code req_code);
808uvc_error_t uvc_set_input_select(uvc_device_handle_t *devh, uint8_t selector);
809/* end AUTO-GENERATED control accessors */
810
811void uvc_perror(uvc_error_t err, const char *msg);
812const char* uvc_strerror(uvc_error_t err);
813void uvc_print_diag(uvc_device_handle_t *devh, FILE *stream);
814void uvc_print_stream_ctrl(uvc_stream_ctrl_t *ctrl, FILE *stream);
815
816uvc_frame_t *uvc_allocate_frame(size_t data_bytes);
817void uvc_free_frame(uvc_frame_t *frame);
818
820
824
828
831
832#ifdef LIBUVC_HAS_JPEG
836#endif
837
838#ifdef __cplusplus
839}
840#endif
841
842#endif // !def(LIBUVC_H)
843
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:1137
uvc_error_t uvc_set_privacy(uvc_device_handle_t *devh, uint8_t privacy)
Sets the PRIVACY control.
Definition ctrl-gen.c:1203
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:1532
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:525
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:2511
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:493
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:623
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:1241
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:2381
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:1987
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:1325
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:92
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:2543
uvc_error_t uvc_set_roll_abs(uvc_device_handle_t *devh, int16_t roll)
Sets the ROLL_ABSOLUTE control.
Definition ctrl-gen.c:1069
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:294
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:1662
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:1889
uvc_error_t uvc_set_gain(uvc_device_handle_t *devh, uint16_t gain)
Sets the GAIN control.
Definition ctrl-gen.c:1694
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:1792
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:2248
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:2478
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:963
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:359
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:1759
uvc_error_t uvc_set_brightness(uvc_device_handle_t *devh, int16_t brightness)
Sets the BRIGHTNESS control.
Definition ctrl-gen.c:1499
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:425
uvc_error_t uvc_set_contrast(uvc_device_handle_t *devh, uint16_t contrast)
Sets the CONTRAST control.
Definition ctrl-gen.c:1564
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:688
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:1037
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:2348
uvc_error_t uvc_set_exposure_abs(uvc_device_handle_t *devh, uint32_t time)
Sets the absolute exposure time.
Definition ctrl-gen.c:261
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:820
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:753
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:1857
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:2214
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:1103
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:2608
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:720
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:2149
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:1365
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:1922
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:1171
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:155
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:459
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:2316
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:2117
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:856
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:1467
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:2413
uvc_error_t uvc_set_hue(uvc_device_handle_t *devh, int16_t hue)
Sets the HUE control.
Definition ctrl-gen.c:1824
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:121
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:190
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:1402
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:2446
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:115
uvc_error_t uvc_set_focus_auto(uvc_device_handle_t *devh, uint8_t state)
Sets the FOCUS_AUTO control.
Definition ctrl-gen.c:590
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:785
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:1283
uvc_error_t uvc_set_sharpness(uvc_device_handle_t *devh, uint16_t sharpness)
Sets the SHARPNESS control.
Definition ctrl-gen.c:2019
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:1434
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:2641
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:1629
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:225
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:391
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:2282
uvc_error_t uvc_set_input_select(uvc_device_handle_t *devh, uint8_t selector)
Sets the INPUT_SELECT control.
Definition ctrl-gen.c:2673
uvc_error_t uvc_set_scanning_mode(uvc_device_handle_t *devh, uint8_t mode)
Sets the SCANNING_MODE control.
Definition ctrl-gen.c:46
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:2182
uvc_error_t uvc_set_saturation(uvc_device_handle_t *devh, uint16_t saturation)
Sets the SATURATION control.
Definition ctrl-gen.c:1954
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:326
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:2576
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:1597
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:558
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:2052
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:892
uvc_error_t uvc_set_gamma(uvc_device_handle_t *devh, uint16_t gamma)
Sets the GAMMA control.
Definition ctrl-gen.c:2084
uvc_error_t uvc_set_iris_abs(uvc_device_handle_t *devh, uint16_t iris)
Sets the IRIS_ABSOLUTE control.
Definition ctrl-gen.c:655
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:81
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:926
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:1001
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:1727
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:120
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:442
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:600
uvc_device_t * uvc_get_device(uvc_device_handle_t *devh)
Get the uvc_device_t corresponding to an open device.
Definition device.c:833
void uvc_close(uvc_device_handle_t *devh)
Close a device.
Definition device.c:1953
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:184
uint8_t uvc_get_device_address(uvc_device_t *dev)
Get the number assigned to the device within its bus.
Definition device.c:258
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:2201
void uvc_button_callback_t(int button, int state, void *user_ptr)
A callback function to accept button events.
Definition libuvc.h:452
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:2186
void uvc_ref_device(uvc_device_t *dev)
Increment the reference count for a device.
Definition device.c:965
void uvc_free_device_descriptor(uvc_device_descriptor_t *desc)
Frees a device descriptor created with uvc_get_device_descriptor.
Definition device.c:661
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:689
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:850
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:251
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:808
uvc_error_t uvc_open(uvc_device_t *dev, uvc_device_handle_t **devh)
Open a UVC device.
Definition device.c:312
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:230
uvc_error_t uvc_mjpeg2gray(uvc_frame_t *in, uvc_frame_t *out)
Convert an MJPEG frame to GRAY8.
Definition frame-mjpeg.c:255
uvc_error_t uvc_yuyv2y(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to Y (GRAY8).
Definition frame.c:290
uvc_error_t uvc_any2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame to RGB.
Definition frame.c:498
uvc_error_t uvc_yuyv2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to RGB.
Definition frame.c:172
uvc_error_t uvc_yuyv2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to BGR.
Definition frame.c:239
uvc_error_t uvc_uyvy2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from UYVY to RGB.
Definition frame.c:390
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:335
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:451
uvc_error_t uvc_mjpeg2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert an MJPEG frame to BGR.
Definition frame-mjpeg.c:205
uvc_error_t uvc_any2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame to BGR.
Definition frame.c:521
uvc_error_t uvc_duplicate_frame(uvc_frame_t *in, uvc_frame_t *out)
Duplicate a frame, preserving color format.
Definition frame.c:112
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:1589
void uvc_stream_close(uvc_stream_handle_t *strmh)
Close stream.
Definition stream.c:1639
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:1008
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:1377
struct uvc_stream_ctrl uvc_stream_ctrl_t
Streaming mode, includes all information needed to select stream.
uvc_error_t uvc_stream_get_current_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl)
Gets current stream control block.
Definition stream.c:455
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:606
void uvc_stop_streaming(uvc_device_handle_t *devh)
Stop streaming video.
Definition stream.c:1574
void uvc_frame_callback_t(struct uvc_frame *frame, void *user_ptr)
A callback function to handle incoming assembled UVC frames.
Definition libuvc.h:518
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:1152
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:1082
enum uvc_frame_format uvc_frame_format_for_guid(uint8_t guid[16])
Look up the frame format matching a UVC format GUID.
Definition stream.c:209
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:1044
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:429
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:383
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:522
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:1494
@ UVC_FRAME_FORMAT_RGB
24-bit RGB
Definition libuvc.h:71
@ UVC_FRAME_FORMAT_COUNT
Number of formats understood.
Definition libuvc.h:95
@ UVC_FRAME_FORMAT_P010
YUV: P010.
Definition libuvc.h:89
@ UVC_FRAME_FORMAT_I420
YUV420: I420 (planar Y, U, V).
Definition libuvc.h:91
@ 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_NV21
YUV420: NV21.
Definition libuvc.h:93
@ 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:460
uint16_t reserved
Reserved; was bcdUVC, which was never populated (always read 0).
Definition libuvc.h:468
uint16_t idProduct
Product ID.
Definition libuvc.h:464
const char * manufacturer
Device-reported manufacturer name (or null).
Definition libuvc.h:472
const char * serialNumber
Serial number (null if unavailable).
Definition libuvc.h:470
uint16_t idVendor
Vendor ID.
Definition libuvc.h:462
const char * product
Device-reporter product name (or null).
Definition libuvc.h:474
Custom processing or camera-control functions.
Definition libuvc.h:413
uint8_t guidExtensionCode[16]
GUID identifying the extension unit.
Definition libuvc.h:418
uint8_t bUnitID
Index of the extension unit within the device.
Definition libuvc.h:416
uint64_t bmControls
Bitmap of available controls (manufacturer-dependent).
Definition libuvc.h:420
Format descriptor.
Definition libuvc.h:200
struct uvc_frame_desc * frame_descs
Available frame specifications for this format.
Definition libuvc.h:228
uint8_t bmFlags
Flags for JPEG stream.
Definition libuvc.h:218
uint8_t bFormatIndex
Identifier of this format within the VS interface's format list.
Definition libuvc.h:206
enum uvc_vs_desc_subtype bDescriptorSubtype
Type of image stream, such as JPEG or uncompressed.
Definition libuvc.h:204
uint8_t bBitsPerPixel
BPP for uncompressed stream.
Definition libuvc.h:216
uint8_t bDefaultFrameIndex
Default {uvc_frame_desc} to choose given this format.
Definition libuvc.h:221
Frame descriptor.
Definition libuvc.h:161
uint16_t wWidth
Image width.
Definition libuvc.h:170
uint32_t * intervals
Available frame rates, zero-terminated (in 100ns units).
Definition libuvc.h:192
uint8_t bFrameIndex
Index of the frame within the list of specs available for this format.
Definition libuvc.h:167
uint16_t wHeight
Image height.
Definition libuvc.h:172
uint32_t dwBytesPerLine
number of bytes per line
Definition libuvc.h:190
uint32_t dwDefaultFrameInterval
Default frame interval (in 100ns units).
Definition libuvc.h:180
enum uvc_vs_desc_subtype bDescriptorSubtype
Type of frame, such as JPEG frame or uncompressed frme.
Definition libuvc.h:165
uint32_t dwMaxBitRate
Bitrate of corresponding stream at maximal frame rate.
Definition libuvc.h:176
uint8_t bFrameIntervalType
Frame intervals.
Definition libuvc.h:188
uint32_t dwMaxVideoFrameBufferSize
Maximum number of bytes for a video frame.
Definition libuvc.h:178
uint32_t dwMinFrameInterval
Minimum frame interval for continuous mode (100ns units).
Definition libuvc.h:182
uint32_t dwMinBitRate
Bitrate of corresponding stream at minimal frame rate.
Definition libuvc.h:174
uint32_t dwFrameIntervalStep
Granularity of frame interval range for continuous mode (100ns).
Definition libuvc.h:186
uint32_t dwMaxFrameInterval
Maximum frame interval for continuous mode (100ns units).
Definition libuvc.h:184
An image frame received from the UVC device.
Definition libuvc.h:480
enum uvc_frame_format frame_format
Pixel data format.
Definition libuvc.h:490
size_t data_bytes
Size of image data buffer.
Definition libuvc.h:484
uint32_t width
Width of image in pixels.
Definition libuvc.h:486
uint8_t library_owns_data
Is the data buffer owned by the library?
Definition libuvc.h:508
uint32_t height
Height of image in pixels.
Definition libuvc.h:488
uint32_t sequence
Frame number (may skip, but is strictly monotonically increasing).
Definition libuvc.h:494
void * metadata
Metadata for this frame if available.
Definition libuvc.h:510
size_t step
Number of bytes per horizontal line (undefined for compressed format).
Definition libuvc.h:492
struct timeval capture_time
Estimate of system time when the device started capturing the image.
Definition libuvc.h:496
void * data
Image data for this frame.
Definition libuvc.h:482
uvc_device_handle_t * source
Handle on the device that produced the image.
Definition libuvc.h:501
struct timespec capture_time_finished
Estimate of system time when the device finished receiving the image.
Definition libuvc.h:498
size_t metadata_bytes
Size of metadata buffer.
Definition libuvc.h:512
Representation of the interface that brings data into the UVC device.
Definition libuvc.h:376
uint8_t bTerminalID
Index of the terminal within the device.
Definition libuvc.h:379
uint64_t bmControls
Camera controls (meaning of bits given in {uvc_ct_ctrl_selector}).
Definition libuvc.h:386
enum uvc_it_type wTerminalType
Type of terminal (e.g., camera).
Definition libuvc.h:381
Represents post-capture processing functions.
Definition libuvc.h:395
uint8_t bUnitID
Index of the processing unit within the device.
Definition libuvc.h:398
uint64_t bmControls
Processing controls (meaning of bits given in {uvc_pu_ctrl_selector}).
Definition libuvc.h:402
uint8_t bSourceID
Index of the terminal from which the device accepts images.
Definition libuvc.h:400
Represents selector unit to connect other units.
Definition libuvc.h:406
uint8_t bUnitID
Index of the selector unit within the device.
Definition libuvc.h:409
Streaming mode, includes all information needed to select stream.
Definition libuvc.h:523