uvc-types.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "types.h"
7 
8 #include <vector>
9 #include <unordered_map>
10 
12 #define B_TO_BYTE(p) ((int8_t)(p)[0])
13 
15 #define SW_TO_SHORT(p) ((uint8_t)(p)[0] | \
16  ((int8_t)(p)[1] << 8))
17 
19 #define DW_TO_INT(p) ((uint8_t)(p)[0] | \
20  ((uint8_t)(p)[1] << 8) | \
21  ((uint8_t)(p)[2] << 16) | \
22  ((int8_t)(p)[3] << 24))
23 
25 #define QW_TO_QUAD(p) (((uint64_t)(p)[0]) | \
26  (((uint64_t)(p)[1]) << 8) | \
27  (((uint64_t)(p)[2]) << 16) | \
28  (((uint64_t)(p)[3]) << 24) | \
29  (((uint64_t)(p)[4]) << 32) | \
30  (((uint64_t)(p)[5]) << 40) | \
31  (((uint64_t)(p)[6]) << 48) | \
32  (((int64_t)(p)[7]) << 56))
33 
34 
36 #define SHORT_TO_SW(s, p) \
37  (p)[0] = (uint8_t)(s); \
38  (p)[1] = (uint8_t)((s) >> 8);
39 
41 #define INT_TO_DW(i, p) \
42  (p)[0] = (uint8_t)(i); \
43  (p)[1] = (uint8_t)((i) >> 8); \
44  (p)[2] = (uint8_t)((i) >> 16); \
45  (p)[3] = (uint8_t)((i) >> 24);
46 
48 #define QUAD_TO_QW(i, p) \
49  (p)[0] = (uint8_t)(i); \
50  (p)[1] = (uint8_t)((i) >> 8); \
51  (p)[2] = (uint8_t)((i) >> 16); \
52  (p)[3] = (uint8_t)((i) >> 24); \
53  (p)[4] = (uint8_t)((i) >> 32); \
54  (p)[5] = (uint8_t)((i) >> 40); \
55  (p)[6] = (uint8_t)((i) >> 48); \
56  (p)[7] = (uint8_t)((i) >> 56); \
57 
58 // convert to standard fourcc codes
59 const std::unordered_map<uint32_t, uint32_t> fourcc_map = {
60  { 0x59382020, 0x47524559 }, /* 'GREY' from 'Y8 ' */
61  { 0x52573130, 0x70524141 }, /* 'pRAA' from 'RW10'.*/
62  { 0x32000000, 0x47524559 }, /* 'GREY' from 'L8 ' */
63  { 0x50000000, 0x5a313620 }, /* 'Z16' from 'D16 ' */
64  { 0x52415738, 0x47524559 }, /* 'GREY' from 'RAW8' */
65  { 0x52573136, 0x42595232 } /* 'RW16' from 'BYR2' */
66 };
67 
91 };
92 
96  UVC_VC_HEADER = 0x01,
102 };
103 
120 };
121 
125  UVC_SET_CUR = 0x01,
126  UVC_GET_CUR = 0x81,
127  UVC_GET_MIN = 0x82,
128  UVC_GET_MAX = 0x83,
129  UVC_GET_RES = 0x84,
130  UVC_GET_LEN = 0x85,
131  UVC_GET_INFO = 0x86,
132  UVC_GET_DEF = 0x87,
135 };
136 
142 };
143 
167 };
168 
191 };
192 
197 };
198 
202  UVC_ITT_CAMERA = 0x0201,
204 };
205 
209  UVC_OTT_DISPLAY = 0x0301,
211 };
212 
219 };
220 
225 };
226 
232 };
233 
245 };
246 
247 typedef struct uvc_device_descriptor {
255  const char *serialNumber;
257  const char *manufacturer;
259  const char *product;
261 
262 typedef struct uvc_input_terminal {
266  enum uvc_it_type wTerminalType;
273 
274 
276 typedef struct uvc_processing_unit {
284 
286 typedef struct uvc_selector_unit {
290 
292 typedef struct uvc_extension_unit {
296  uint8_t guidExtensionCode[16];
300 
301 typedef struct uvc_stream_ctrl {
326 
327 typedef struct uvc_format {
338 } uvc_format_t;
339 
340 typedef struct uvc_frame_desc {
369  std::vector<uint32_t> intervals;
371 
377 typedef struct uvc_format_desc {
379  enum uvc_vs_desc_subtype bDescriptorSubtype;
384  union {
385  uint8_t guidFormat[16];
386  uint8_t fourccFormat[4];
387  };
389  union {
394  };
403  std::vector<uvc_frame_desc_t> frame_descs;
405 
406 template <typename T>
407 T as(const std::vector<uint8_t>& data, size_t index)
408 {
409  T rv = 0;
410  for(int i = 0; i < sizeof(T); i++)
411  {
412  rv += data[index + i] << (i*8);
413  }
414  return rv;
415 }
416 
418 
420 
423 
424  // We don't want the frames to be overwritten at any point
425  // (deallocate resets item to "default" that we want to avoid)
426  backend_frame(const backend_frame &other) {}
427 
429 
430  backend_frame &operator=(const backend_frame &other) { return *this; }
431 
432  std::vector<uint8_t> pixels;
434  backend_frames_archive *owner; // Keep pointer to owner for light-deleter
435 };
436 
438 
439 // Unique_ptr is used as the simplest RAII, with static deleter
440 typedef std::unique_ptr<backend_frame, cleanup_ptr> backend_frame_ptr;
uint16_t wOcularFocalLength
Definition: uvc-types.h:269
uint8_t bBitDepthLuma
Definition: uvc-types.h:320
uint16_t wObjectiveFocalLengthMin
Definition: uvc-types.h:267
struct uvc_format uvc_format_t
std::unique_ptr< backend_frame, cleanup_ptr > backend_frame_ptr
Definition: uvc-types.h:440
backend_frame & operator=(const backend_frame &other)
Definition: uvc-types.h:430
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
uint64_t bmLayoutPerStream
Definition: uvc-types.h:324
const char * manufacturer
Definition: uvc-types.h:257
uint16_t wWidth
Definition: uvc-types.h:347
struct uvc_processing_unit uvc_processing_unit_t
uint16_t wHeight
Definition: uvc-types.h:349
const char * serialNumber
Definition: uvc-types.h:255
uvc_vs_desc_subtype
Definition: uvc-types.h:105
uvc_pu_ctrl_selector
Definition: uvc-types.h:170
std::vector< uint8_t > pixels
Definition: uvc-types.h:432
uint32_t fourcc
Definition: uvc-types.h:333
uint8_t bMaxVersion
Definition: uvc-types.h:317
backend_frame(const backend_frame &other)
Definition: uvc-types.h:426
T as(const std::vector< uint8_t > &data, size_t index)
Definition: uvc-types.h:407
uvc_vc_ctrl_selector
Definition: uvc-types.h:138
const char * product
Definition: uvc-types.h:259
uvc_vc_desc_subtype
Definition: uvc-types.h:94
unsigned short uint16_t
Definition: stdint.h:79
uvc_ct_ctrl_selector
Definition: uvc-types.h:145
unsigned char uint8_t
Definition: stdint.h:78
uint32_t dwMinBitRate
Definition: uvc-types.h:351
struct uvc_device_descriptor uvc_device_descriptor_t
uint32_t width
Definition: uvc-types.h:329
struct uvc_selector_unit uvc_selector_unit_t
backend_frame(backend_frame &&other)
Definition: uvc-types.h:428
uint32_t dwFrameIntervalStep
Definition: uvc-types.h:363
uint16_t wObjectiveFocalLengthMax
Definition: uvc-types.h:268
GLuint index
uint32_t dwMaxVideoFrameBufferSize
Definition: uvc-types.h:355
uint8_t bInterfaceNumber
Definition: uvc-types.h:318
uint8_t bFrameIntervalType
Definition: uvc-types.h:365
uvc_ot_type
Definition: uvc-types.h:207
uvc_req_code
Definition: uvc-types.h:123
uint8_t bBitsPerPixel
Definition: uvc-types.h:391
uint32_t dwMaxPayloadTransferSize
Definition: uvc-types.h:312
uint32_t dwFrameInterval
Definition: uvc-types.h:305
struct uvc_stream_ctrl uvc_stream_ctrl_t
uint8_t bFormatIndex
Definition: uvc-types.h:381
uint32_t dwMaxBitRate
Definition: uvc-types.h:353
unsigned int uint32_t
Definition: stdint.h:80
uint8_t bDefaultFrameIndex
Definition: uvc-types.h:396
uvc_vs_ctrl_selector
Definition: uvc-types.h:234
const std::unordered_map< uint32_t, uint32_t > fourcc_map
Definition: uvc-types.h:59
uint32_t dwClockFrequency
Definition: uvc-types.h:313
uint8_t interfaceNumber
Definition: uvc-types.h:337
uint8_t bAspectRatioY
Definition: uvc-types.h:398
uint8_t bUsage
Definition: uvc-types.h:319
uint16_t bmHint
Definition: uvc-types.h:302
unsigned __int64 uint64_t
Definition: stdint.h:90
uint8_t bmFramingInfo
Definition: uvc-types.h:314
uint16_t wKeyFrameRate
Definition: uvc-types.h:306
uint8_t bCopyProtect
Definition: uvc-types.h:400
uvc_vs_desc_subtype bDescriptorSubtype
Definition: uvc-types.h:342
backend_frames_archive * owner
Definition: uvc-types.h:434
uint64_t bmControls
Definition: uvc-types.h:298
uint64_t bmControls
Definition: uvc-types.h:282
uint16_t wCompWindowSize
Definition: uvc-types.h:309
uint8_t bmCapabilities
Definition: uvc-types.h:345
uint16_t wPFrameRate
Definition: uvc-types.h:307
struct uvc_input_terminal uvc_input_terminal_t
uint32_t dwBytesPerLine
Definition: uvc-types.h:367
uint8_t bAspectRatioX
Definition: uvc-types.h:397
uvc_frame_format
Definition: uvc-types.h:71
uint32_t dwMaxVideoFrameSize
Definition: uvc-types.h:311
uint16_t bmRateControlModes
Definition: uvc-types.h:323
uvc_status_attribute
Definition: uvc-types.h:227
uint8_t bFrameIndex
Definition: uvc-types.h:344
uint16_t wDelay
Definition: uvc-types.h:310
uvc_it_type
Definition: uvc-types.h:200
struct uvc_extension_unit uvc_extension_unit_t
uint64_t bmControls
Definition: uvc-types.h:271
uint8_t bFrameIndex
Definition: uvc-types.h:304
uint8_t bNumFrameDescriptors
Definition: uvc-types.h:382
uint8_t bmSettings
Definition: uvc-types.h:321
uint8_t bmFlags
Definition: uvc-types.h:393
struct uvc_format_desc uvc_format_desc_t
librealsense::platform::frame_object fo
Definition: uvc-types.h:433
uint32_t fps
Definition: uvc-types.h:335
uint8_t bMaxNumberOfRefFramesPlus1
Definition: uvc-types.h:322
int i
uvc_term_type
Definition: uvc-types.h:194
uint32_t dwMinFrameInterval
Definition: uvc-types.h:359
uvc_status_class
Definition: uvc-types.h:221
uint16_t wCompQuality
Definition: uvc-types.h:308
uint8_t bmInterlaceFlags
Definition: uvc-types.h:399
uint8_t bMinVersion
Definition: uvc-types.h:316
single_consumer_queue< backend_frame_ptr > backend_frames_queue
Definition: uvc-types.h:441
uvc_et_type
Definition: uvc-types.h:214
void(* cleanup_ptr)(backend_frame *)
Definition: uvc-types.h:437
uint8_t bPreferredVersion
Definition: uvc-types.h:315
uint32_t height
Definition: uvc-types.h:331
uint8_t bFormatIndex
Definition: uvc-types.h:303
uint32_t dwMaxFrameInterval
Definition: uvc-types.h:361
uint32_t dwDefaultFrameInterval
Definition: uvc-types.h:357
Definition: parser.hpp:150
uint8_t bVariableSize
Definition: uvc-types.h:401
std::vector< uvc_frame_desc_t > frame_descs
Definition: uvc-types.h:403
struct uvc_frame_desc uvc_frame_desc_t
uint8_t bTerminalID
Definition: uvc-types.h:264
librealsense::small_heap< backend_frame, 10 > backend_frames_archive
Definition: uvc-types.h:417
std::vector< uint32_t > intervals
Definition: uvc-types.h:369


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:13