libuvc
libuvc.h
1 #ifndef LIBUVC_H
2 #define LIBUVC_H
3 
4 #ifdef __cplusplus
5 extern "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 
13 struct libusb_context;
14 struct libusb_device_handle;
15 
19 typedef 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,
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,
92 };
93 
94 /* UVC_COLOR_FORMAT_* have been replaced with UVC_FRAME_FORMAT_*. Please use
95  * UVC_FRAME_FORMAT_* instead of using these. */
96 #define UVC_COLOR_FORMAT_UNKNOWN UVC_FRAME_FORMAT_UNKNOWN
97 #define UVC_COLOR_FORMAT_UNCOMPRESSED UVC_FRAME_FORMAT_UNCOMPRESSED
98 #define UVC_COLOR_FORMAT_COMPRESSED UVC_FRAME_FORMAT_COMPRESSED
99 #define UVC_COLOR_FORMAT_YUYV UVC_FRAME_FORMAT_YUYV
100 #define UVC_COLOR_FORMAT_UYVY UVC_FRAME_FORMAT_UYVY
101 #define UVC_COLOR_FORMAT_RGB UVC_FRAME_FORMAT_RGB
102 #define UVC_COLOR_FORMAT_BGR UVC_FRAME_FORMAT_BGR
103 #define UVC_COLOR_FORMAT_MJPEG UVC_FRAME_FORMAT_MJPEG
104 #define UVC_COLOR_FORMAT_GRAY8 UVC_FRAME_FORMAT_GRAY8
105 #define UVC_COLOR_FORMAT_GRAY16 UVC_FRAME_FORMAT_GRAY16
106 #define UVC_COLOR_FORMAT_NV12 UVC_FRAME_FORMAT_NV12
107 
109 enum uvc_vs_desc_subtype {
110  UVC_VS_UNDEFINED = 0x00,
111  UVC_VS_INPUT_HEADER = 0x01,
112  UVC_VS_OUTPUT_HEADER = 0x02,
113  UVC_VS_STILL_IMAGE_FRAME = 0x03,
114  UVC_VS_FORMAT_UNCOMPRESSED = 0x04,
115  UVC_VS_FRAME_UNCOMPRESSED = 0x05,
116  UVC_VS_FORMAT_MJPEG = 0x06,
117  UVC_VS_FRAME_MJPEG = 0x07,
118  UVC_VS_FORMAT_MPEG2TS = 0x0a,
119  UVC_VS_FORMAT_DV = 0x0c,
120  UVC_VS_COLORFORMAT = 0x0d,
121  UVC_VS_FORMAT_FRAME_BASED = 0x10,
122  UVC_VS_FRAME_FRAME_BASED = 0x11,
123  UVC_VS_FORMAT_STREAM_BASED = 0x12
124 };
125 
126 struct uvc_format_desc;
127 struct uvc_frame_desc;
128 
129 typedef struct uvc_still_frame_res {
130  struct uvc_still_frame_res *prev, *next;
131  uint8_t bResolutionIndex;
133  uint16_t wWidth;
135  uint16_t wHeight;
136 } uvc_still_frame_res_t;
137 
138 typedef struct uvc_still_frame_desc {
139  struct uvc_format_desc *parent;
140  struct uvc_still_frame_desc *prev, *next;
142  enum uvc_vs_desc_subtype bDescriptorSubtype;
144  uint8_t bEndPointAddress;
145  uvc_still_frame_res_t* imageSizePatterns;
146  uint8_t bNumCompressionPattern;
147  /* indication of compression level, the higher, the more compression is applied to image */
148  uint8_t* bCompression;
149 } uvc_still_frame_desc_t;
150 
157 typedef struct uvc_frame_desc {
158  struct uvc_format_desc *parent;
159  struct uvc_frame_desc *prev, *next;
161  enum uvc_vs_desc_subtype bDescriptorSubtype;
163  uint8_t bFrameIndex;
164  uint8_t bmCapabilities;
166  uint16_t wWidth;
168  uint16_t wHeight;
170  uint32_t dwMinBitRate;
172  uint32_t dwMaxBitRate;
186  uint32_t dwBytesPerLine;
188  uint32_t *intervals;
190 
196 typedef struct uvc_format_desc {
197  struct uvc_streaming_interface *parent;
198  struct uvc_format_desc *prev, *next;
200  enum uvc_vs_desc_subtype bDescriptorSubtype;
202  uint8_t bFormatIndex;
203  uint8_t bNumFrameDescriptors;
205  union {
206  uint8_t guidFormat[16];
207  uint8_t fourccFormat[4];
208  };
210  union {
212  uint8_t bBitsPerPixel;
214  uint8_t bmFlags;
215  };
218  uint8_t bAspectRatioX;
219  uint8_t bAspectRatioY;
220  uint8_t bmInterlaceFlags;
221  uint8_t bCopyProtect;
222  uint8_t bVariableSize;
225  struct uvc_still_frame_desc *still_frame_desc;
227 
229 enum uvc_req_code {
230  UVC_RC_UNDEFINED = 0x00,
231  UVC_SET_CUR = 0x01,
232  UVC_GET_CUR = 0x81,
233  UVC_GET_MIN = 0x82,
234  UVC_GET_MAX = 0x83,
235  UVC_GET_RES = 0x84,
236  UVC_GET_LEN = 0x85,
237  UVC_GET_INFO = 0x86,
238  UVC_GET_DEF = 0x87
239 };
240 
241 enum uvc_device_power_mode {
242  UVC_VC_VIDEO_POWER_MODE_FULL = 0x000b,
243  UVC_VC_VIDEO_POWER_MODE_DEVICE_DEPENDENT = 0x001b,
244 };
245 
247 enum uvc_ct_ctrl_selector {
248  UVC_CT_CONTROL_UNDEFINED = 0x00,
249  UVC_CT_SCANNING_MODE_CONTROL = 0x01,
250  UVC_CT_AE_MODE_CONTROL = 0x02,
251  UVC_CT_AE_PRIORITY_CONTROL = 0x03,
252  UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL = 0x04,
253  UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL = 0x05,
254  UVC_CT_FOCUS_ABSOLUTE_CONTROL = 0x06,
255  UVC_CT_FOCUS_RELATIVE_CONTROL = 0x07,
256  UVC_CT_FOCUS_AUTO_CONTROL = 0x08,
257  UVC_CT_IRIS_ABSOLUTE_CONTROL = 0x09,
258  UVC_CT_IRIS_RELATIVE_CONTROL = 0x0a,
259  UVC_CT_ZOOM_ABSOLUTE_CONTROL = 0x0b,
260  UVC_CT_ZOOM_RELATIVE_CONTROL = 0x0c,
261  UVC_CT_PANTILT_ABSOLUTE_CONTROL = 0x0d,
262  UVC_CT_PANTILT_RELATIVE_CONTROL = 0x0e,
263  UVC_CT_ROLL_ABSOLUTE_CONTROL = 0x0f,
264  UVC_CT_ROLL_RELATIVE_CONTROL = 0x10,
265  UVC_CT_PRIVACY_CONTROL = 0x11,
266  UVC_CT_FOCUS_SIMPLE_CONTROL = 0x12,
267  UVC_CT_DIGITAL_WINDOW_CONTROL = 0x13,
268  UVC_CT_REGION_OF_INTEREST_CONTROL = 0x14
269 };
270 
272 enum uvc_pu_ctrl_selector {
273  UVC_PU_CONTROL_UNDEFINED = 0x00,
274  UVC_PU_BACKLIGHT_COMPENSATION_CONTROL = 0x01,
275  UVC_PU_BRIGHTNESS_CONTROL = 0x02,
276  UVC_PU_CONTRAST_CONTROL = 0x03,
277  UVC_PU_GAIN_CONTROL = 0x04,
278  UVC_PU_POWER_LINE_FREQUENCY_CONTROL = 0x05,
279  UVC_PU_HUE_CONTROL = 0x06,
280  UVC_PU_SATURATION_CONTROL = 0x07,
281  UVC_PU_SHARPNESS_CONTROL = 0x08,
282  UVC_PU_GAMMA_CONTROL = 0x09,
283  UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL = 0x0a,
284  UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL = 0x0b,
285  UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL = 0x0c,
286  UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL = 0x0d,
287  UVC_PU_DIGITAL_MULTIPLIER_CONTROL = 0x0e,
288  UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL = 0x0f,
289  UVC_PU_HUE_AUTO_CONTROL = 0x10,
290  UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL = 0x11,
291  UVC_PU_ANALOG_LOCK_STATUS_CONTROL = 0x12,
292  UVC_PU_CONTRAST_AUTO_CONTROL = 0x13
293 };
294 
296 enum uvc_term_type {
297  UVC_TT_VENDOR_SPECIFIC = 0x0100,
298  UVC_TT_STREAMING = 0x0101
299 };
300 
302 enum uvc_it_type {
303  UVC_ITT_VENDOR_SPECIFIC = 0x0200,
304  UVC_ITT_CAMERA = 0x0201,
305  UVC_ITT_MEDIA_TRANSPORT_INPUT = 0x0202
306 };
307 
309 enum uvc_ot_type {
310  UVC_OTT_VENDOR_SPECIFIC = 0x0300,
311  UVC_OTT_DISPLAY = 0x0301,
312  UVC_OTT_MEDIA_TRANSPORT_OUTPUT = 0x0302
313 };
314 
316 enum uvc_et_type {
317  UVC_EXTERNAL_VENDOR_SPECIFIC = 0x0400,
318  UVC_COMPOSITE_CONNECTOR = 0x0401,
319  UVC_SVIDEO_CONNECTOR = 0x0402,
320  UVC_COMPONENT_CONNECTOR = 0x0403
321 };
322 
329 struct uvc_context;
330 typedef struct uvc_context uvc_context_t;
331 
336 struct uvc_device;
337 typedef struct uvc_device uvc_device_t;
338 
344 struct uvc_device_handle;
345 typedef struct uvc_device_handle uvc_device_handle_t;
346 
352 struct uvc_stream_handle;
353 typedef struct uvc_stream_handle uvc_stream_handle_t;
354 
356 typedef struct uvc_input_terminal {
357  struct uvc_input_terminal *prev, *next;
359  uint8_t bTerminalID;
361  enum uvc_it_type wTerminalType;
362  uint16_t wObjectiveFocalLengthMin;
363  uint16_t wObjectiveFocalLengthMax;
364  uint16_t wOcularFocalLength;
366  uint64_t bmControls;
368 
369 typedef struct uvc_output_terminal {
370  struct uvc_output_terminal *prev, *next;
372 } uvc_output_terminal_t;
373 
375 typedef struct uvc_processing_unit {
376  struct uvc_processing_unit *prev, *next;
378  uint8_t bUnitID;
380  uint8_t bSourceID;
382  uint64_t bmControls;
384 
386 typedef struct uvc_selector_unit {
387  struct uvc_selector_unit *prev, *next;
389  uint8_t bUnitID;
391 
393 typedef struct uvc_extension_unit {
394  struct uvc_extension_unit *prev, *next;
396  uint8_t bUnitID;
398  uint8_t guidExtensionCode[16];
400  uint64_t bmControls;
402 
403 enum uvc_status_class {
404  UVC_STATUS_CLASS_CONTROL = 0x10,
405  UVC_STATUS_CLASS_CONTROL_CAMERA = 0x11,
406  UVC_STATUS_CLASS_CONTROL_PROCESSING = 0x12,
407 };
408 
409 enum uvc_status_attribute {
410  UVC_STATUS_ATTRIBUTE_VALUE_CHANGE = 0x00,
411  UVC_STATUS_ATTRIBUTE_INFO_CHANGE = 0x01,
412  UVC_STATUS_ATTRIBUTE_FAILURE_CHANGE = 0x02,
413  UVC_STATUS_ATTRIBUTE_UNKNOWN = 0xff
414 };
415 
419 typedef void(uvc_status_callback_t)(enum uvc_status_class status_class,
420  int event,
421  int selector,
422  enum uvc_status_attribute status_attribute,
423  void *data, size_t data_len,
424  void *user_ptr);
425 
429 typedef void(uvc_button_callback_t)(int button,
430  int state,
431  void *user_ptr);
432 
437 typedef struct uvc_device_descriptor {
439  uint16_t idVendor;
441  uint16_t idProduct;
443  uint16_t bcdUVC;
445  const char *serialNumber;
447  const char *manufacturer;
449  const char *product;
451 
455 typedef struct uvc_frame {
457  void *data;
459  size_t data_bytes;
461  uint32_t width;
463  uint32_t height;
467  size_t step;
469  uint32_t sequence;
471  struct timeval capture_time;
473  struct timespec capture_time_finished;
476  uvc_device_handle_t *source;
485  void *metadata;
489 
493 typedef void(uvc_frame_callback_t)(struct uvc_frame *frame, void *user_ptr);
494 
498 typedef struct uvc_stream_ctrl {
499  uint16_t bmHint;
500  uint8_t bFormatIndex;
501  uint8_t bFrameIndex;
502  uint32_t dwFrameInterval;
503  uint16_t wKeyFrameRate;
504  uint16_t wPFrameRate;
505  uint16_t wCompQuality;
506  uint16_t wCompWindowSize;
507  uint16_t wDelay;
508  uint32_t dwMaxVideoFrameSize;
509  uint32_t dwMaxPayloadTransferSize;
510  uint32_t dwClockFrequency;
511  uint8_t bmFramingInfo;
512  uint8_t bPreferredVersion;
513  uint8_t bMinVersion;
514  uint8_t bMaxVersion;
515  uint8_t bInterfaceNumber;
517 
518 typedef struct uvc_still_ctrl {
519  /* Video format index from a format descriptor */
520  uint8_t bFormatIndex;
521  /* Video frame index from a frame descriptor */
522  uint8_t bFrameIndex;
523  /* Compression index from a frame descriptor */
524  uint8_t bCompressionIndex;
525  /* Maximum still image size in bytes. */
526  uint32_t dwMaxVideoFrameSize;
527  /* Maximum number of byte per payload*/
528  uint32_t dwMaxPayloadTransferSize;
529  uint8_t bInterfaceNumber;
530 } uvc_still_ctrl_t;
531 
532 uvc_error_t uvc_init(uvc_context_t **ctx, struct libusb_context *usb_ctx);
533 void uvc_exit(uvc_context_t *ctx);
534 
536  uvc_context_t *ctx,
537  uvc_device_t ***list);
538 void uvc_free_device_list(uvc_device_t **list, uint8_t unref_devices);
539 
541  uvc_device_t *dev,
542  uvc_device_descriptor_t **desc);
545 
546 uint8_t uvc_get_bus_number(uvc_device_t *dev);
547 uint8_t uvc_get_device_address(uvc_device_t *dev);
548 
550  uvc_context_t *ctx,
551  uvc_device_t **dev,
552  int vid, int pid, const char *sn);
553 
555  uvc_context_t *ctx,
556  uvc_device_t ***devs,
557  int vid, int pid, const char *sn);
558 
559 #if LIBUSB_API_VERSION >= 0x01000107
560 uvc_error_t uvc_wrap(
561  int sys_dev,
562  uvc_context_t *context,
563  uvc_device_handle_t **devh);
564 #endif
565 
567  uvc_device_t *dev,
568  uvc_device_handle_t **devh);
569 void uvc_close(uvc_device_handle_t *devh);
570 
571 uvc_device_t *uvc_get_device(uvc_device_handle_t *devh);
572 struct libusb_device_handle *uvc_get_libusb_handle(uvc_device_handle_t *devh);
573 
574 void uvc_ref_device(uvc_device_t *dev);
575 void uvc_unref_device(uvc_device_t *dev);
576 
577 void uvc_set_status_callback(uvc_device_handle_t *devh,
579  void *user_ptr);
580 
581 void uvc_set_button_callback(uvc_device_handle_t *devh,
583  void *user_ptr);
584 
585 const uvc_input_terminal_t *uvc_get_camera_terminal(uvc_device_handle_t *devh);
586 const uvc_input_terminal_t *uvc_get_input_terminals(uvc_device_handle_t *devh);
587 const uvc_output_terminal_t *uvc_get_output_terminals(uvc_device_handle_t *devh);
588 const uvc_selector_unit_t *uvc_get_selector_units(uvc_device_handle_t *devh);
589 const uvc_processing_unit_t *uvc_get_processing_units(uvc_device_handle_t *devh);
590 const uvc_extension_unit_t *uvc_get_extension_units(uvc_device_handle_t *devh);
591 
593  uvc_device_handle_t *devh,
594  uvc_stream_ctrl_t *ctrl,
595  enum uvc_frame_format format,
596  int width, int height,
597  int fps
598  );
599 
601  uvc_device_handle_t *devh,
602  uvc_stream_ctrl_t *ctrl,
603  uvc_still_ctrl_t *still_ctrl,
604  int width, int height);
605 
607  uvc_device_handle_t *devh,
608  uvc_still_ctrl_t *still_ctrl);
609 
610 const uvc_format_desc_t *uvc_get_format_descs(uvc_device_handle_t* );
611 
612 uvc_error_t uvc_probe_stream_ctrl(
613  uvc_device_handle_t *devh,
614  uvc_stream_ctrl_t *ctrl);
615 
616 uvc_error_t uvc_probe_still_ctrl(
617  uvc_device_handle_t *devh,
618  uvc_still_ctrl_t *still_ctrl);
619 
621  uvc_device_handle_t *devh,
622  uvc_stream_ctrl_t *ctrl,
624  void *user_ptr,
625  uint8_t flags);
626 
628  uvc_device_handle_t *devh,
629  uvc_stream_ctrl_t *ctrl,
631  void *user_ptr);
632 
633 void uvc_stop_streaming(uvc_device_handle_t *devh);
634 
635 uvc_error_t uvc_stream_open_ctrl(uvc_device_handle_t *devh, uvc_stream_handle_t **strmh, uvc_stream_ctrl_t *ctrl);
636 uvc_error_t uvc_stream_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl);
637 uvc_error_t uvc_stream_start(uvc_stream_handle_t *strmh,
639  void *user_ptr,
640  uint8_t flags);
641 uvc_error_t uvc_stream_start_iso(uvc_stream_handle_t *strmh,
643  void *user_ptr);
645  uvc_stream_handle_t *strmh,
646  uvc_frame_t **frame,
647  int32_t timeout_us
648 );
649 uvc_error_t uvc_stream_stop(uvc_stream_handle_t *strmh);
650 void uvc_stream_close(uvc_stream_handle_t *strmh);
651 
652 int uvc_get_ctrl_len(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl);
653 int uvc_get_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len, enum uvc_req_code req_code);
654 int uvc_set_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len);
655 
656 uvc_error_t uvc_get_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode *mode, enum uvc_req_code req_code);
657 uvc_error_t uvc_set_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode mode);
658 
659 /* AUTO-GENERATED control accessors! Update them with the output of `ctrl-gen.py decl`. */
660 uvc_error_t uvc_get_scanning_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code);
661 uvc_error_t uvc_set_scanning_mode(uvc_device_handle_t *devh, uint8_t mode);
662 
663 uvc_error_t uvc_get_ae_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code);
664 uvc_error_t uvc_set_ae_mode(uvc_device_handle_t *devh, uint8_t mode);
665 
666 uvc_error_t uvc_get_ae_priority(uvc_device_handle_t *devh, uint8_t* priority, enum uvc_req_code req_code);
667 uvc_error_t uvc_set_ae_priority(uvc_device_handle_t *devh, uint8_t priority);
668 
669 uvc_error_t uvc_get_exposure_abs(uvc_device_handle_t *devh, uint32_t* time, enum uvc_req_code req_code);
670 uvc_error_t uvc_set_exposure_abs(uvc_device_handle_t *devh, uint32_t time);
671 
672 uvc_error_t uvc_get_exposure_rel(uvc_device_handle_t *devh, int8_t* step, enum uvc_req_code req_code);
673 uvc_error_t uvc_set_exposure_rel(uvc_device_handle_t *devh, int8_t step);
674 
675 uvc_error_t uvc_get_focus_abs(uvc_device_handle_t *devh, uint16_t* focus, enum uvc_req_code req_code);
676 uvc_error_t uvc_set_focus_abs(uvc_device_handle_t *devh, uint16_t focus);
677 
678 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);
679 uvc_error_t uvc_set_focus_rel(uvc_device_handle_t *devh, int8_t focus_rel, uint8_t speed);
680 
681 uvc_error_t uvc_get_focus_simple_range(uvc_device_handle_t *devh, uint8_t* focus, enum uvc_req_code req_code);
682 uvc_error_t uvc_set_focus_simple_range(uvc_device_handle_t *devh, uint8_t focus);
683 
684 uvc_error_t uvc_get_focus_auto(uvc_device_handle_t *devh, uint8_t* state, enum uvc_req_code req_code);
685 uvc_error_t uvc_set_focus_auto(uvc_device_handle_t *devh, uint8_t state);
686 
687 uvc_error_t uvc_get_iris_abs(uvc_device_handle_t *devh, uint16_t* iris, enum uvc_req_code req_code);
688 uvc_error_t uvc_set_iris_abs(uvc_device_handle_t *devh, uint16_t iris);
689 
690 uvc_error_t uvc_get_iris_rel(uvc_device_handle_t *devh, uint8_t* iris_rel, enum uvc_req_code req_code);
691 uvc_error_t uvc_set_iris_rel(uvc_device_handle_t *devh, uint8_t iris_rel);
692 
693 uvc_error_t uvc_get_zoom_abs(uvc_device_handle_t *devh, uint16_t* focal_length, enum uvc_req_code req_code);
694 uvc_error_t uvc_set_zoom_abs(uvc_device_handle_t *devh, uint16_t focal_length);
695 
696 uvc_error_t uvc_get_zoom_rel(uvc_device_handle_t *devh, int8_t* zoom_rel, uint8_t* digital_zoom, uint8_t* speed, enum uvc_req_code req_code);
697 uvc_error_t uvc_set_zoom_rel(uvc_device_handle_t *devh, int8_t zoom_rel, uint8_t digital_zoom, uint8_t speed);
698 
699 uvc_error_t uvc_get_pantilt_abs(uvc_device_handle_t *devh, int32_t* pan, int32_t* tilt, enum uvc_req_code req_code);
700 uvc_error_t uvc_set_pantilt_abs(uvc_device_handle_t *devh, int32_t pan, int32_t tilt);
701 
702 uvc_error_t uvc_get_pantilt_rel(uvc_device_handle_t *devh, int8_t* pan_rel, uint8_t* pan_speed, int8_t* tilt_rel, uint8_t* tilt_speed, enum uvc_req_code req_code);
703 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);
704 
705 uvc_error_t uvc_get_roll_abs(uvc_device_handle_t *devh, int16_t* roll, enum uvc_req_code req_code);
706 uvc_error_t uvc_set_roll_abs(uvc_device_handle_t *devh, int16_t roll);
707 
708 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);
709 uvc_error_t uvc_set_roll_rel(uvc_device_handle_t *devh, int8_t roll_rel, uint8_t speed);
710 
711 uvc_error_t uvc_get_privacy(uvc_device_handle_t *devh, uint8_t* privacy, enum uvc_req_code req_code);
712 uvc_error_t uvc_set_privacy(uvc_device_handle_t *devh, uint8_t privacy);
713 
714 uvc_error_t uvc_get_digital_window(uvc_device_handle_t *devh, uint16_t* window_top, uint16_t* window_left, uint16_t* window_bottom, uint16_t* window_right, uint16_t* num_steps, uint16_t* num_steps_units, enum uvc_req_code req_code);
715 uvc_error_t uvc_set_digital_window(uvc_device_handle_t *devh, uint16_t window_top, uint16_t window_left, uint16_t window_bottom, uint16_t window_right, uint16_t num_steps, uint16_t num_steps_units);
716 
717 uvc_error_t uvc_get_digital_roi(uvc_device_handle_t *devh, uint16_t* roi_top, uint16_t* roi_left, uint16_t* roi_bottom, uint16_t* roi_right, uint16_t* auto_controls, enum uvc_req_code req_code);
718 uvc_error_t uvc_set_digital_roi(uvc_device_handle_t *devh, uint16_t roi_top, uint16_t roi_left, uint16_t roi_bottom, uint16_t roi_right, uint16_t auto_controls);
719 
720 uvc_error_t uvc_get_backlight_compensation(uvc_device_handle_t *devh, uint16_t* backlight_compensation, enum uvc_req_code req_code);
721 uvc_error_t uvc_set_backlight_compensation(uvc_device_handle_t *devh, uint16_t backlight_compensation);
722 
723 uvc_error_t uvc_get_brightness(uvc_device_handle_t *devh, int16_t* brightness, enum uvc_req_code req_code);
724 uvc_error_t uvc_set_brightness(uvc_device_handle_t *devh, int16_t brightness);
725 
726 uvc_error_t uvc_get_contrast(uvc_device_handle_t *devh, uint16_t* contrast, enum uvc_req_code req_code);
727 uvc_error_t uvc_set_contrast(uvc_device_handle_t *devh, uint16_t contrast);
728 
729 uvc_error_t uvc_get_contrast_auto(uvc_device_handle_t *devh, uint8_t* contrast_auto, enum uvc_req_code req_code);
730 uvc_error_t uvc_set_contrast_auto(uvc_device_handle_t *devh, uint8_t contrast_auto);
731 
732 uvc_error_t uvc_get_gain(uvc_device_handle_t *devh, uint16_t* gain, enum uvc_req_code req_code);
733 uvc_error_t uvc_set_gain(uvc_device_handle_t *devh, uint16_t gain);
734 
735 uvc_error_t uvc_get_power_line_frequency(uvc_device_handle_t *devh, uint8_t* power_line_frequency, enum uvc_req_code req_code);
736 uvc_error_t uvc_set_power_line_frequency(uvc_device_handle_t *devh, uint8_t power_line_frequency);
737 
738 uvc_error_t uvc_get_hue(uvc_device_handle_t *devh, int16_t* hue, enum uvc_req_code req_code);
739 uvc_error_t uvc_set_hue(uvc_device_handle_t *devh, int16_t hue);
740 
741 uvc_error_t uvc_get_hue_auto(uvc_device_handle_t *devh, uint8_t* hue_auto, enum uvc_req_code req_code);
742 uvc_error_t uvc_set_hue_auto(uvc_device_handle_t *devh, uint8_t hue_auto);
743 
744 uvc_error_t uvc_get_saturation(uvc_device_handle_t *devh, uint16_t* saturation, enum uvc_req_code req_code);
745 uvc_error_t uvc_set_saturation(uvc_device_handle_t *devh, uint16_t saturation);
746 
747 uvc_error_t uvc_get_sharpness(uvc_device_handle_t *devh, uint16_t* sharpness, enum uvc_req_code req_code);
748 uvc_error_t uvc_set_sharpness(uvc_device_handle_t *devh, uint16_t sharpness);
749 
750 uvc_error_t uvc_get_gamma(uvc_device_handle_t *devh, uint16_t* gamma, enum uvc_req_code req_code);
751 uvc_error_t uvc_set_gamma(uvc_device_handle_t *devh, uint16_t gamma);
752 
753 uvc_error_t uvc_get_white_balance_temperature(uvc_device_handle_t *devh, uint16_t* temperature, enum uvc_req_code req_code);
754 uvc_error_t uvc_set_white_balance_temperature(uvc_device_handle_t *devh, uint16_t temperature);
755 
756 uvc_error_t uvc_get_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t* temperature_auto, enum uvc_req_code req_code);
757 uvc_error_t uvc_set_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t temperature_auto);
758 
759 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);
760 uvc_error_t uvc_set_white_balance_component(uvc_device_handle_t *devh, uint16_t blue, uint16_t red);
761 
762 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);
763 uvc_error_t uvc_set_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t white_balance_component_auto);
764 
765 uvc_error_t uvc_get_digital_multiplier(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code);
766 uvc_error_t uvc_set_digital_multiplier(uvc_device_handle_t *devh, uint16_t multiplier_step);
767 
768 uvc_error_t uvc_get_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code);
769 uvc_error_t uvc_set_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t multiplier_step);
770 
771 uvc_error_t uvc_get_analog_video_standard(uvc_device_handle_t *devh, uint8_t* video_standard, enum uvc_req_code req_code);
772 uvc_error_t uvc_set_analog_video_standard(uvc_device_handle_t *devh, uint8_t video_standard);
773 
774 uvc_error_t uvc_get_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t* status, enum uvc_req_code req_code);
775 uvc_error_t uvc_set_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t status);
776 
777 uvc_error_t uvc_get_input_select(uvc_device_handle_t *devh, uint8_t* selector, enum uvc_req_code req_code);
778 uvc_error_t uvc_set_input_select(uvc_device_handle_t *devh, uint8_t selector);
779 /* end AUTO-GENERATED control accessors */
780 
781 void uvc_perror(uvc_error_t err, const char *msg);
782 const char* uvc_strerror(uvc_error_t err);
783 void uvc_print_diag(uvc_device_handle_t *devh, FILE *stream);
784 void uvc_print_stream_ctrl(uvc_stream_ctrl_t *ctrl, FILE *stream);
785 
786 uvc_frame_t *uvc_allocate_frame(size_t data_bytes);
787 void uvc_free_frame(uvc_frame_t *frame);
788 
790 
794 
798 
801 
802 #ifdef LIBUVC_HAS_JPEG
805 #endif
806 
807 #ifdef __cplusplus
808 }
809 #endif
810 
811 #endif // !def(LIBUVC_H)
812 
uvc_error_t uvc_set_roll_rel(uvc_device_handle_t *devh, int8_t roll_rel, uint8_t speed)
Sets the ROLL_RELATIVE control.
Definition: ctrl-gen.c:956
uvc_error_t uvc_set_privacy(uvc_device_handle_t *devh, uint8_t privacy)
Sets the PRIVACY control.
Definition: ctrl-gen.c:1011
uvc_error_t uvc_get_contrast(uvc_device_handle_t *devh, uint16_t *contrast, enum uvc_req_code req_code)
Reads the CONTRAST control.
Definition: ctrl-gen.c:1290
uvc_error_t uvc_set_focus_simple_range(uvc_device_handle_t *devh, uint8_t focus)
Sets the FOCUS_SIMPLE control.
Definition: ctrl-gen.c:443
uvc_error_t uvc_get_analog_video_standard(uvc_device_handle_t *devh, uint8_t *video_standard, enum uvc_req_code req_code)
Reads the ANALOG_VIDEO_STANDARD control.
Definition: ctrl-gen.c:2104
uvc_error_t uvc_get_focus_simple_range(uvc_device_handle_t *devh, uint8_t *focus, enum uvc_req_code req_code)
Reads the FOCUS_SIMPLE control.
Definition: ctrl-gen.c:416
uvc_error_t uvc_get_iris_abs(uvc_device_handle_t *devh, uint16_t *iris, enum uvc_req_code req_code)
Reads the IRIS_ABSOLUTE control.
Definition: ctrl-gen.c:524
uvc_error_t uvc_get_digital_window(uvc_device_handle_t *devh, uint16_t *window_top, uint16_t *window_left, uint16_t *window_bottom, uint16_t *window_right, uint16_t *num_steps, uint16_t *num_steps_units, enum uvc_req_code req_code)
Reads the DIGITAL_WINDOW control.
Definition: ctrl-gen.c:1043
uvc_error_t uvc_get_digital_multiplier(uvc_device_handle_t *devh, uint16_t *multiplier_step, enum uvc_req_code req_code)
Reads the DIGITAL_MULTIPLIER control.
Definition: ctrl-gen.c:1996
uvc_error_t uvc_get_sharpness(uvc_device_handle_t *devh, uint16_t *sharpness, enum uvc_req_code req_code)
Reads the SHARPNESS control.
Definition: ctrl-gen.c:1668
uvc_error_t uvc_get_digital_roi(uvc_device_handle_t *devh, uint16_t *roi_top, uint16_t *roi_left, uint16_t *roi_bottom, uint16_t *roi_right, uint16_t *auto_controls, enum uvc_req_code req_code)
Reads the REGION_OF_INTEREST control.
Definition: ctrl-gen.c:1116
int uvc_get_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len, enum uvc_req_code req_code)
Perform a GET_* request from an extension unit.
Definition: ctrl.c:90
uvc_error_t uvc_set_analog_video_standard(uvc_device_handle_t *devh, uint8_t video_standard)
Sets the ANALOG_VIDEO_STANDARD control.
Definition: ctrl-gen.c:2131
uvc_error_t uvc_set_roll_abs(uvc_device_handle_t *devh, int16_t roll)
Sets the ROLL_ABSOLUTE control.
Definition: ctrl-gen.c:899
uvc_error_t uvc_get_exposure_rel(uvc_device_handle_t *devh, int8_t *step, enum uvc_req_code req_code)
Reads the exposure time relative to the current setting.
Definition: ctrl-gen.c:250
uvc_error_t uvc_get_gain(uvc_device_handle_t *devh, uint16_t *gain, enum uvc_req_code req_code)
Reads the GAIN control.
Definition: ctrl-gen.c:1398
uvc_error_t uvc_set_hue_auto(uvc_device_handle_t *devh, uint8_t hue_auto)
Sets the HUE_AUTO control.
Definition: ctrl-gen.c:1587
uvc_error_t uvc_set_gain(uvc_device_handle_t *devh, uint16_t gain)
Sets the GAIN control.
Definition: ctrl-gen.c:1425
uvc_error_t uvc_get_hue(uvc_device_handle_t *devh, int16_t *hue, enum uvc_req_code req_code)
Reads the HUE control.
Definition: ctrl-gen.c:1506
uvc_error_t uvc_get_white_balance_component(uvc_device_handle_t *devh, uint16_t *blue, uint16_t *red, enum uvc_req_code req_code)
Reads the WHITE_BALANCE_COMPONENT control.
Definition: ctrl-gen.c:1885
uvc_error_t uvc_set_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t multiplier_step)
Sets the DIGITAL_MULTIPLIER_LIMIT control.
Definition: ctrl-gen.c:2077
uvc_error_t uvc_get_pantilt_rel(uvc_device_handle_t *devh, int8_t *pan_rel, uint8_t *pan_speed, int8_t *tilt_rel, uint8_t *tilt_speed, enum uvc_req_code req_code)
Reads the PANTILT_RELATIVE control.
Definition: ctrl-gen.c:809
uvc_error_t uvc_get_focus_abs(uvc_device_handle_t *devh, uint16_t *focus, enum uvc_req_code req_code)
Reads the distance at which an object is optimally focused.
Definition: ctrl-gen.c:304
uvc_error_t uvc_set_power_line_frequency(uvc_device_handle_t *devh, uint8_t power_line_frequency)
Sets the POWER_LINE_FREQUENCY control.
Definition: ctrl-gen.c:1479
uvc_error_t uvc_set_brightness(uvc_device_handle_t *devh, int16_t brightness)
Sets the BRIGHTNESS control.
Definition: ctrl-gen.c:1263
uvc_error_t uvc_get_focus_rel(uvc_device_handle_t *devh, int8_t *focus_rel, uint8_t *speed, enum uvc_req_code req_code)
Reads the FOCUS_RELATIVE control.
Definition: ctrl-gen.c:359
uvc_error_t uvc_set_contrast(uvc_device_handle_t *devh, uint16_t contrast)
Sets the CONTRAST control.
Definition: ctrl-gen.c:1317
uvc_error_t uvc_get_iris_rel(uvc_device_handle_t *devh, uint8_t *iris_rel, enum uvc_req_code req_code)
Reads the IRIS_RELATIVE control.
Definition: ctrl-gen.c:578
uvc_error_t uvc_get_roll_abs(uvc_device_handle_t *devh, int16_t *roll, enum uvc_req_code req_code)
Reads the ROLL_ABSOLUTE control.
Definition: ctrl-gen.c:872
uvc_error_t uvc_set_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t white_balance_component_auto)
Sets the WHITE_BALANCE_COMPONENT_AUTO control.
Definition: ctrl-gen.c:1969
uvc_error_t uvc_set_exposure_abs(uvc_device_handle_t *devh, uint32_t time)
Sets the absolute exposure time.
Definition: ctrl-gen.c:223
uvc_error_t uvc_get_zoom_rel(uvc_device_handle_t *devh, int8_t *zoom_rel, uint8_t *digital_zoom, uint8_t *speed, enum uvc_req_code req_code)
Reads the ZOOM_RELATIVE control.
Definition: ctrl-gen.c:688
uvc_error_t uvc_get_zoom_abs(uvc_device_handle_t *devh, uint16_t *focal_length, enum uvc_req_code req_code)
Reads the ZOOM_ABSOLUTE control.
Definition: ctrl-gen.c:632
uvc_error_t uvc_get_hue_auto(uvc_device_handle_t *devh, uint8_t *hue_auto, enum uvc_req_code req_code)
Reads the HUE_AUTO control.
Definition: ctrl-gen.c:1560
uvc_error_t uvc_set_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t temperature_auto)
Sets the WHITE_BALANCE_TEMPERATURE_AUTO control.
Definition: ctrl-gen.c:1857
uvc_error_t uvc_get_roll_rel(uvc_device_handle_t *devh, int8_t *roll_rel, uint8_t *speed, enum uvc_req_code req_code)
Reads the ROLL_RELATIVE control.
Definition: ctrl-gen.c:927
uvc_error_t uvc_set_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t status)
Sets the ANALOG_LOCK_STATUS control.
Definition: ctrl-gen.c:2185
uvc_error_t uvc_set_iris_rel(uvc_device_handle_t *devh, uint8_t iris_rel)
Sets the IRIS_RELATIVE control.
Definition: ctrl-gen.c:605
uvc_error_t uvc_set_white_balance_temperature(uvc_device_handle_t *devh, uint16_t temperature)
Sets the WHITE_BALANCE_TEMPERATURE control.
Definition: ctrl-gen.c:1803
uvc_error_t uvc_set_digital_roi(uvc_device_handle_t *devh, uint16_t roi_top, uint16_t roi_left, uint16_t roi_bottom, uint16_t roi_right, uint16_t auto_controls)
Sets the REGION_OF_INTEREST control.
Definition: ctrl-gen.c:1151
uvc_error_t uvc_get_saturation(uvc_device_handle_t *devh, uint16_t *saturation, enum uvc_req_code req_code)
Reads the SATURATION control.
Definition: ctrl-gen.c:1614
uvc_error_t uvc_get_privacy(uvc_device_handle_t *devh, uint8_t *privacy, enum uvc_req_code req_code)
Reads the PRIVACY control.
Definition: ctrl-gen.c:984
uvc_error_t uvc_get_ae_priority(uvc_device_handle_t *devh, uint8_t *priority, enum uvc_req_code req_code)
Checks whether the camera may vary the frame rate for exposure control reasons.
Definition: ctrl-gen.c:133
int uvc_get_ctrl_len(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl)
Get the length of a control on a terminal or unit.
Definition: ctrl.c:59
uvc_error_t uvc_set_focus_rel(uvc_device_handle_t *devh, int8_t focus_rel, uint8_t speed)
Sets the FOCUS_RELATIVE control.
Definition: ctrl-gen.c:388
uvc_error_t uvc_get_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t *white_balance_component_auto, enum uvc_req_code req_code)
Reads the WHITE_BALANCE_COMPONENT_AUTO control.
Definition: ctrl-gen.c:1942
uvc_error_t uvc_get_white_balance_temperature(uvc_device_handle_t *devh, uint16_t *temperature, enum uvc_req_code req_code)
Reads the WHITE_BALANCE_TEMPERATURE control.
Definition: ctrl-gen.c:1776
uvc_error_t uvc_set_zoom_rel(uvc_device_handle_t *devh, int8_t zoom_rel, uint8_t digital_zoom, uint8_t speed)
Sets the ZOOM_RELATIVE control.
Definition: ctrl-gen.c:719
uvc_error_t uvc_get_brightness(uvc_device_handle_t *devh, int16_t *brightness, enum uvc_req_code req_code)
Reads the BRIGHTNESS control.
Definition: ctrl-gen.c:1236
uvc_error_t uvc_set_digital_multiplier(uvc_device_handle_t *devh, uint16_t multiplier_step)
Sets the DIGITAL_MULTIPLIER control.
Definition: ctrl-gen.c:2023
uvc_error_t uvc_set_hue(uvc_device_handle_t *devh, int16_t hue)
Sets the HUE control.
Definition: ctrl-gen.c:1533
uvc_error_t uvc_get_scanning_mode(uvc_device_handle_t *devh, uint8_t *mode, enum uvc_req_code req_code)
Reads the SCANNING_MODE control.
Definition: ctrl-gen.c:14
uvc_error_t uvc_set_ae_mode(uvc_device_handle_t *devh, uint8_t mode)
Sets camera's auto-exposure mode.
Definition: ctrl-gen.c:105
uvc_error_t uvc_set_ae_priority(uvc_device_handle_t *devh, uint8_t priority)
Chooses whether the camera may vary the frame rate for exposure control reasons.
Definition: ctrl-gen.c:163
uvc_error_t uvc_get_backlight_compensation(uvc_device_handle_t *devh, uint16_t *backlight_compensation, enum uvc_req_code req_code)
Reads the BACKLIGHT_COMPENSATION control.
Definition: ctrl-gen.c:1182
uvc_error_t uvc_get_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t *multiplier_step, enum uvc_req_code req_code)
Reads the DIGITAL_MULTIPLIER_LIMIT control.
Definition: ctrl-gen.c:2050
int uvc_set_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len)
Perform a SET_CUR request to a terminal or unit.
Definition: ctrl.c:113
uvc_error_t uvc_set_focus_auto(uvc_device_handle_t *devh, uint8_t state)
Sets the FOCUS_AUTO control.
Definition: ctrl-gen.c:497
uvc_error_t uvc_set_zoom_abs(uvc_device_handle_t *devh, uint16_t focal_length)
Sets the ZOOM_ABSOLUTE control.
Definition: ctrl-gen.c:659
uvc_error_t uvc_set_digital_window(uvc_device_handle_t *devh, uint16_t window_top, uint16_t window_left, uint16_t window_bottom, uint16_t window_right, uint16_t num_steps, uint16_t num_steps_units)
Sets the DIGITAL_WINDOW control.
Definition: ctrl-gen.c:1080
uvc_error_t uvc_set_sharpness(uvc_device_handle_t *devh, uint16_t sharpness)
Sets the SHARPNESS control.
Definition: ctrl-gen.c:1695
uvc_error_t uvc_set_backlight_compensation(uvc_device_handle_t *devh, uint16_t backlight_compensation)
Sets the BACKLIGHT_COMPENSATION control.
Definition: ctrl-gen.c:1209
uvc_error_t uvc_get_input_select(uvc_device_handle_t *devh, uint8_t *selector, enum uvc_req_code req_code)
Reads the INPUT_SELECT control.
Definition: ctrl-gen.c:2212
uvc_error_t uvc_set_contrast_auto(uvc_device_handle_t *devh, uint8_t contrast_auto)
Sets the CONTRAST_AUTO control.
Definition: ctrl-gen.c:1371
uvc_error_t uvc_get_exposure_abs(uvc_device_handle_t *devh, uint32_t *time, enum uvc_req_code req_code)
Gets the absolute exposure time.
Definition: ctrl-gen.c:192
uvc_error_t uvc_set_focus_abs(uvc_device_handle_t *devh, uint16_t focus)
Sets the distance at which an object is optimally focused.
Definition: ctrl-gen.c:331
uvc_error_t uvc_set_white_balance_component(uvc_device_handle_t *devh, uint16_t blue, uint16_t red)
Sets the WHITE_BALANCE_COMPONENT control.
Definition: ctrl-gen.c:1914
uvc_error_t uvc_set_input_select(uvc_device_handle_t *devh, uint8_t selector)
Sets the INPUT_SELECT control.
Definition: ctrl-gen.c:2239
uvc_error_t uvc_set_scanning_mode(uvc_device_handle_t *devh, uint8_t mode)
Sets the SCANNING_MODE control.
Definition: ctrl-gen.c:41
uvc_error_t uvc_get_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t *temperature_auto, enum uvc_req_code req_code)
Reads the WHITE_BALANCE_TEMPERATURE_AUTO control.
Definition: ctrl-gen.c:1830
uvc_error_t uvc_set_saturation(uvc_device_handle_t *devh, uint16_t saturation)
Sets the SATURATION control.
Definition: ctrl-gen.c:1641
uvc_error_t uvc_set_exposure_rel(uvc_device_handle_t *devh, int8_t step)
Sets the exposure time relative to the current setting.
Definition: ctrl-gen.c:277
uvc_error_t uvc_get_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t *status, enum uvc_req_code req_code)
Reads the ANALOG_LOCK_STATUS control.
Definition: ctrl-gen.c:2158
uvc_error_t uvc_get_contrast_auto(uvc_device_handle_t *devh, uint8_t *contrast_auto, enum uvc_req_code req_code)
Reads the CONTRAST_AUTO control.
Definition: ctrl-gen.c:1344
uvc_error_t uvc_get_focus_auto(uvc_device_handle_t *devh, uint8_t *state, enum uvc_req_code req_code)
Reads the FOCUS_AUTO control.
Definition: ctrl-gen.c:470
uvc_error_t uvc_get_gamma(uvc_device_handle_t *devh, uint16_t *gamma, enum uvc_req_code req_code)
Reads the GAMMA control.
Definition: ctrl-gen.c:1722
uvc_error_t uvc_get_pantilt_abs(uvc_device_handle_t *devh, int32_t *pan, int32_t *tilt, enum uvc_req_code req_code)
Reads the PANTILT_ABSOLUTE control.
Definition: ctrl-gen.c:749
uvc_error_t uvc_set_gamma(uvc_device_handle_t *devh, uint16_t gamma)
Sets the GAMMA control.
Definition: ctrl-gen.c:1749
uvc_error_t uvc_set_iris_abs(uvc_device_handle_t *devh, uint16_t iris)
Sets the IRIS_ABSOLUTE control.
Definition: ctrl-gen.c:551
uvc_error_t uvc_get_ae_mode(uvc_device_handle_t *devh, uint8_t *mode, enum uvc_req_code req_code)
Reads camera's auto-exposure mode.
Definition: ctrl-gen.c:70
uvc_error_t uvc_set_pantilt_abs(uvc_device_handle_t *devh, int32_t pan, int32_t tilt)
Sets the PANTILT_ABSOLUTE control.
Definition: ctrl-gen.c:778
uvc_error_t uvc_set_pantilt_rel(uvc_device_handle_t *devh, int8_t pan_rel, uint8_t pan_speed, int8_t tilt_rel, uint8_t tilt_speed)
Sets the PANTILT_RELATIVE control.
Definition: ctrl-gen.c:842
uvc_error_t uvc_get_power_line_frequency(uvc_device_handle_t *devh, uint8_t *power_line_frequency, enum uvc_req_code req_code)
Reads the POWER_LINE_FREQUENCY control.
Definition: ctrl-gen.c:1452
uvc_error_t uvc_find_device(uvc_context_t *ctx, uvc_device_t **dev, int vid, int pid, const char *sn)
Finds a camera identified by vendor, product and/or serial number.
Definition: device.c:128
uvc_error_t uvc_get_device_descriptor(uvc_device_t *dev, uvc_device_descriptor_t **desc)
Get a descriptor that contains the general information about a device.
Definition: device.c:591
void uvc_close(uvc_device_handle_t *devh)
Close a device.
Definition: device.c:1722
void() uvc_status_callback_t(enum uvc_status_class status_class, int event, int selector, enum uvc_status_attribute status_attribute, void *data, size_t data_len, void *user_ptr)
A callback function to accept status updates.
Definition: libuvc.h:419
uvc_error_t uvc_find_devices(uvc_context_t *ctx, uvc_device_t ***devs, int vid, int pid, const char *sn)
Finds all cameras identified by vendor, product and/or serial number.
Definition: device.c:189
uint8_t uvc_get_device_address(uvc_device_t *dev)
Get the number assigned to the device within its bus.
Definition: device.c:262
struct libusb_device_handle * uvc_get_libusb_handle(uvc_device_handle_t *devh)
Get the underlying libusb device handle for an open device.
Definition: device.c:840
void uvc_set_button_callback(uvc_device_handle_t *devh, uvc_button_callback_t cb, void *user_ptr)
Set a callback function to receive button events.
Definition: device.c:1955
uvc_device_t * uvc_get_device(uvc_device_handle_t *devh)
Get the uvc_device_t corresponding to an open device.
Definition: device.c:823
void uvc_set_status_callback(uvc_device_handle_t *devh, uvc_status_callback_t cb, void *user_ptr)
Set a callback function to receive status updates.
Definition: device.c:1940
void() uvc_button_callback_t(int button, int state, void *user_ptr)
A callback function to accept button events.
Definition: libuvc.h:429
void uvc_ref_device(uvc_device_t *dev)
Increment the reference count for a device.
Definition: device.c:938
void uvc_free_device_descriptor(uvc_device_descriptor_t *desc)
Frees a device descriptor created with uvc_get_device_descriptor.
Definition: device.c:651
uvc_error_t uvc_get_device_list(uvc_context_t *ctx, uvc_device_t ***list)
Get a list of the UVC devices attached to the system.
Definition: device.c:679
uint8_t uvc_get_bus_number(uvc_device_t *dev)
Get the number of the bus to which the device is attached.
Definition: device.c:255
void uvc_free_device_list(uvc_device_t **list, uint8_t unref_devices)
Frees a list of device structures created with uvc_get_device_list.
Definition: device.c:798
uvc_error_t uvc_open(uvc_device_t *dev, uvc_device_handle_t **devh)
Open a UVC device.
Definition: device.c:316
const char * uvc_strerror(uvc_error_t err)
Return a string explaining an error in the UVC driver.
Definition: diag.c:88
enum uvc_error uvc_error_t
UVC error types, based on libusb errors.
void uvc_print_diag(uvc_device_handle_t *devh, FILE *stream)
Print camera capabilities and configuration.
Definition: diag.c:143
void uvc_print_stream_ctrl(uvc_stream_ctrl_t *ctrl, FILE *stream)
Print the values in a stream control block.
Definition: diag.c:106
void uvc_perror(uvc_error_t err, const char *msg)
Print a message explaining an error in the UVC driver.
Definition: diag.c:73
uvc_error
UVC error types, based on libusb errors.
Definition: libuvc.h:19
@ UVC_ERROR_PIPE
Pipe error.
Definition: libuvc.h:39
@ UVC_ERROR_NOT_SUPPORTED
Operation not supported.
Definition: libuvc.h:45
@ UVC_ERROR_BUSY
Resource busy.
Definition: libuvc.h:33
@ UVC_ERROR_OTHER
Undefined error.
Definition: libuvc.h:53
@ UVC_ERROR_INTERRUPTED
System call interrupted.
Definition: libuvc.h:41
@ UVC_ERROR_OVERFLOW
Overflow.
Definition: libuvc.h:37
@ UVC_ERROR_CALLBACK_EXISTS
Resource has a callback (can't use polling and async)
Definition: libuvc.h:51
@ UVC_ERROR_NO_DEVICE
No such device.
Definition: libuvc.h:29
@ UVC_ERROR_IO
Input/output error.
Definition: libuvc.h:23
@ UVC_ERROR_INVALID_DEVICE
Device is not UVC-compliant.
Definition: libuvc.h:47
@ UVC_ERROR_INVALID_MODE
Mode not supported.
Definition: libuvc.h:49
@ UVC_ERROR_INVALID_PARAM
Invalid parameter.
Definition: libuvc.h:25
@ UVC_SUCCESS
Success (no error)
Definition: libuvc.h:21
@ UVC_ERROR_TIMEOUT
Operation timed out.
Definition: libuvc.h:35
@ UVC_ERROR_NO_MEM
Insufficient memory.
Definition: libuvc.h:43
@ UVC_ERROR_NOT_FOUND
Entity not found.
Definition: libuvc.h:31
@ UVC_ERROR_ACCESS
Access denied.
Definition: libuvc.h:27
uvc_error_t uvc_mjpeg2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert an MJPEG frame to RGB.
Definition: frame-mjpeg.c:180
uvc_error_t uvc_mjpeg2gray(uvc_frame_t *in, uvc_frame_t *out)
Convert an MJPEG frame to GRAY8.
Definition: frame-mjpeg.c:205
uvc_error_t uvc_yuyv2y(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to Y (GRAY8)
Definition: frame.c:265
uvc_error_t uvc_any2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame to RGB.
Definition: frame.c:441
uvc_error_t uvc_yuyv2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to RGB.
Definition: frame.c:174
uvc_error_t uvc_yuyv2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to BGR.
Definition: frame.c:225
uvc_error_t uvc_uyvy2rgb(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from UYVY to RGB.
Definition: frame.c:355
void uvc_free_frame(uvc_frame_t *frame)
Free a frame structure.
Definition: frame.c:92
uvc_error_t uvc_yuyv2uv(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from YUYV to UV (GRAY8)
Definition: frame.c:305
uvc_error_t uvc_uyvy2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame from UYVY to BGR.
Definition: frame.c:405
uvc_error_t uvc_any2bgr(uvc_frame_t *in, uvc_frame_t *out)
Convert a frame to BGR.
Definition: frame.c:464
uvc_frame_t * uvc_allocate_frame(size_t data_bytes)
Allocate a frame structure.
Definition: frame.c:64
uvc_error_t uvc_duplicate_frame(uvc_frame_t *in, uvc_frame_t *out)
Duplicate a frame, preserving color format.
Definition: frame.c:114
uvc_error_t uvc_init(uvc_context_t **ctx, struct libusb_context *usb_ctx)
Initializes the UVC context.
Definition: init.c:104
void uvc_exit(uvc_context_t *ctx)
Closes the UVC context, shutting down any active cameras.
Definition: init.c:138
uvc_error_t uvc_stream_stop(uvc_stream_handle_t *strmh)
Stop stream.
Definition: stream.c:1492
void() uvc_frame_callback_t(struct uvc_frame *frame, void *user_ptr)
A callback function to handle incoming assembled UVC frames.
Definition: libuvc.h:493
void uvc_stream_close(uvc_stream_handle_t *strmh)
Close stream.
Definition: stream.c:1542
uvc_error_t uvc_start_streaming(uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_frame_callback_t *cb, void *user_ptr, uint8_t flags)
Begin streaming video from the camera into the callback function.
Definition: stream.c:931
uvc_error_t uvc_stream_start_iso(uvc_stream_handle_t *strmh, uvc_frame_callback_t *cb, void *user_ptr)
Begin streaming video from the stream into the callback function.
Definition: stream.c:1283
struct uvc_stream_ctrl uvc_stream_ctrl_t
Streaming mode, includes all information needed to select stream.
uvc_error_t uvc_get_still_ctrl_format_size(uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_still_ctrl_t *still_ctrl, int width, int height)
Get a negotiated still control block for some common parameters.
Definition: stream.c:549
void uvc_stop_streaming(uvc_device_handle_t *devh)
Stop streaming video.
Definition: stream.c:1477
uvc_frame_format
Color coding of stream, transport-independent.
Definition: libuvc.h:59
uvc_error_t uvc_stream_start(uvc_stream_handle_t *strmh, uvc_frame_callback_t *cb, void *user_ptr, uint8_t flags)
Begin streaming video from the stream into the callback function.
Definition: stream.c:1075
uvc_error_t uvc_stream_open_ctrl(uvc_device_handle_t *devh, uvc_stream_handle_t **strmh, uvc_stream_ctrl_t *ctrl)
Open a new video stream.
Definition: stream.c:1005
uvc_error_t uvc_start_iso_streaming(uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_frame_callback_t *cb, void *user_ptr)
Begin streaming video from the camera into the callback function.
Definition: stream.c:967
uvc_error_t uvc_stream_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl)
Reconfigure stream with a new stream format.
Definition: stream.c:392
uvc_error_t uvc_trigger_still(uvc_device_handle_t *devh, uvc_still_ctrl_t *still_ctrl)
Initiate a method 2 (in stream) still capture.
Definition: stream.c:346
uvc_error_t uvc_get_stream_ctrl_format_size(uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, enum uvc_frame_format format, int width, int height, int fps)
Get a negotiated streaming control block for some common parameters.
Definition: stream.c:470
struct uvc_frame uvc_frame_t
An image frame received from the UVC device.
uvc_error_t uvc_stream_get_frame(uvc_stream_handle_t *strmh, uvc_frame_t **frame, int32_t timeout_us)
Poll for a frame.
Definition: stream.c:1397
@ UVC_FRAME_FORMAT_RGB
24-bit RGB
Definition: libuvc.h:71
@ UVC_FRAME_FORMAT_COUNT
Number of formats understood.
Definition: libuvc.h:91
@ UVC_FRAME_FORMAT_P010
YUV: P010.
Definition: libuvc.h:89
@ UVC_FRAME_FORMAT_GRAY8
Greyscale images.
Definition: libuvc.h:77
@ UVC_FRAME_FORMAT_ANY
Any supported format.
Definition: libuvc.h:62
@ UVC_FRAME_FORMAT_NV12
YUV420: NV12.
Definition: libuvc.h:87
@ UVC_FRAME_FORMAT_MJPEG
Motion-JPEG (or JPEG) encoded images.
Definition: libuvc.h:74
@ UVC_FRAME_FORMAT_YUYV
YUYV/YUV2/YUV422: YUV encoding with one luminance value per pixel and one UV (chrominance) pair for e...
Definition: libuvc.h:68
Structure representing a UVC device descriptor.
Definition: libuvc.h:437
uint16_t idProduct
Product ID.
Definition: libuvc.h:441
const char * manufacturer
Device-reported manufacturer name (or null)
Definition: libuvc.h:447
const char * serialNumber
Serial number (null if unavailable)
Definition: libuvc.h:445
uint16_t idVendor
Vendor ID.
Definition: libuvc.h:439
uint16_t bcdUVC
UVC compliance level, e.g.
Definition: libuvc.h:443
const char * product
Device-reporter product name (or null)
Definition: libuvc.h:449
Custom processing or camera-control functions.
Definition: libuvc.h:393
uint8_t guidExtensionCode[16]
GUID identifying the extension unit.
Definition: libuvc.h:398
uint8_t bUnitID
Index of the extension unit within the device.
Definition: libuvc.h:396
uint64_t bmControls
Bitmap of available controls (manufacturer-dependent)
Definition: libuvc.h:400
Format descriptor.
Definition: libuvc.h:196
struct uvc_frame_desc * frame_descs
Available frame specifications for this format.
Definition: libuvc.h:224
uint8_t bmFlags
Flags for JPEG stream.
Definition: libuvc.h:214
uint8_t bFormatIndex
Identifier of this format within the VS interface's format list.
Definition: libuvc.h:202
enum uvc_vs_desc_subtype bDescriptorSubtype
Type of image stream, such as JPEG or uncompressed.
Definition: libuvc.h:200
uint8_t bBitsPerPixel
BPP for uncompressed stream.
Definition: libuvc.h:212
uint8_t bDefaultFrameIndex
Default {uvc_frame_desc} to choose given this format.
Definition: libuvc.h:217
Frame descriptor.
Definition: libuvc.h:157
uint16_t wWidth
Image width.
Definition: libuvc.h:166
uint32_t * intervals
Available frame rates, zero-terminated (in 100ns units)
Definition: libuvc.h:188
uint8_t bFrameIndex
Index of the frame within the list of specs available for this format.
Definition: libuvc.h:163
uint16_t wHeight
Image height.
Definition: libuvc.h:168
uint32_t dwBytesPerLine
number of bytes per line
Definition: libuvc.h:186
uint32_t dwDefaultFrameInterval
Default frame interval (in 100ns units)
Definition: libuvc.h:176
enum uvc_vs_desc_subtype bDescriptorSubtype
Type of frame, such as JPEG frame or uncompressed frme.
Definition: libuvc.h:161
uint32_t dwMaxBitRate
Bitrate of corresponding stream at maximal frame rate.
Definition: libuvc.h:172
uint8_t bFrameIntervalType
Frame intervals.
Definition: libuvc.h:184
uint32_t dwMaxVideoFrameBufferSize
Maximum number of bytes for a video frame.
Definition: libuvc.h:174
uint32_t dwMinFrameInterval
Minimum frame interval for continuous mode (100ns units)
Definition: libuvc.h:178
uint32_t dwMinBitRate
Bitrate of corresponding stream at minimal frame rate.
Definition: libuvc.h:170
uint32_t dwFrameIntervalStep
Granularity of frame interval range for continuous mode (100ns)
Definition: libuvc.h:182
uint32_t dwMaxFrameInterval
Maximum frame interval for continuous mode (100ns units)
Definition: libuvc.h:180
An image frame received from the UVC device.
Definition: libuvc.h:455
enum uvc_frame_format frame_format
Pixel data format.
Definition: libuvc.h:465
size_t data_bytes
Size of image data buffer.
Definition: libuvc.h:459
uint32_t width
Width of image in pixels.
Definition: libuvc.h:461
uint8_t library_owns_data
Is the data buffer owned by the library? If 1, the data buffer can be arbitrarily reallocated by fram...
Definition: libuvc.h:483
uint32_t height
Height of image in pixels.
Definition: libuvc.h:463
uint32_t sequence
Frame number (may skip, but is strictly monotonically increasing)
Definition: libuvc.h:469
void * metadata
Metadata for this frame if available.
Definition: libuvc.h:485
size_t step
Number of bytes per horizontal line (undefined for compressed format)
Definition: libuvc.h:467
struct timeval capture_time
Estimate of system time when the device started capturing the image.
Definition: libuvc.h:471
void * data
Image data for this frame.
Definition: libuvc.h:457
uvc_device_handle_t * source
Handle on the device that produced the image.
Definition: libuvc.h:476
struct timespec capture_time_finished
Estimate of system time when the device finished receiving the image.
Definition: libuvc.h:473
size_t metadata_bytes
Size of metadata buffer.
Definition: libuvc.h:487
Representation of the interface that brings data into the UVC device.
Definition: libuvc.h:356
uint8_t bTerminalID
Index of the terminal within the device.
Definition: libuvc.h:359
uint64_t bmControls
Camera controls (meaning of bits given in {uvc_ct_ctrl_selector})
Definition: libuvc.h:366
enum uvc_it_type wTerminalType
Type of terminal (e.g., camera)
Definition: libuvc.h:361
Represents post-capture processing functions.
Definition: libuvc.h:375
uint8_t bUnitID
Index of the processing unit within the device.
Definition: libuvc.h:378
uint64_t bmControls
Processing controls (meaning of bits given in {uvc_pu_ctrl_selector})
Definition: libuvc.h:382
uint8_t bSourceID
Index of the terminal from which the device accepts images.
Definition: libuvc.h:380
Represents selector unit to connect other units.
Definition: libuvc.h:386
uint8_t bUnitID
Index of the selector unit within the device.
Definition: libuvc.h:389
Streaming mode, includes all information needed to select stream.
Definition: libuvc.h:498