Ocean
Loading...
Searching...
No Matches
VSDescriptor.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_SYSTEM_USB_VIDEO_VS_DESCRIPTOR_H
9#define META_OCEAN_SYSTEM_USB_VIDEO_VS_DESCRIPTOR_H
10
12
13#include "ocean/base/Frame.h"
15
17
18namespace Ocean
19{
20
21namespace System
22{
23
24namespace USB
25{
26
27namespace Video
28{
29
30/**
31 * This class implements the base class for all video streaming descriptors.
32 *
33 * @see http://www.cajunbot.com/wiki/images/8/85/USB_Video_Class_1.1.pdf
34 * @ingroup systemusbvideo
35 */
37{
38 public:
39
40 /**
41 * Definition of individual video streaming interfaces types.
42 * Video Class-Specific VS Interface Descriptor Subtypes.
43 */
45 {
46 /// Undefined descriptor.
47 VS_UNDEFINED = 0x00u,
48 /// The Input Header descriptor is used for VS interfaces that contain an IN endpoint for streaming video data.
50 /// The Output Header descriptor for VS interfaces that contain an OUT endpoint for streaming video data.
52 /// Descriptor for still images.
54 /// Format descriptor for uncompressed streams.
56 /// Image descriptor for uncompressed stream.
58 /// Format descriptor for MJPEG streams.
60 /// Image descriptor for MJPEG stream.
62 /// Color format descriptor for any stream.
64 /// Format descriptor for frame-based streams.
66 /// Image descriptor for frame-based stream.
68 };
69
70 protected:
71
72 /**
73 * Returns the frame intervals of a given descriptor.
74 * @param descriptor The descriptor from which the intervals will be extracted
75 * @param frameRates Optional resulting vector holding the individual frame rates, one for each interval
76 * @return The descriptor's frame intervals, in 100ns
77 * @tparam TDescriptor The type of the descriptor
78 */
79 template <typename TDescriptor>
80 static Indices32 frameIntervals(const TDescriptor& descriptor, std::vector<double>* frameRates = nullptr);
81};
82
83/**
84 * Input Header Descriptor (VS_INPUT_HEADER).
85 *
86 * The Input Header descriptor is used for VS interfaces that contain an IN endpoint for streaming video data.
87 * It provides information on the number of different format descriptors that will follow it, as well as the total size of all class-specific descriptors in alternate setting zero of this interface.
88 *
89 * @see http://www.cajunbot.com/wiki/images/8/85/USB_Video_Class_1.1.pdf
90 * @ingroup systemusbvideo
91 */
92class OCEAN_SYSTEM_USB_VIDEO_EXPORT VSInputHeaderDescriptor : public VSDescriptor
93{
94 friend class Descriptor;
95
96 public:
97
98 /**
99 * Default constructor creating an invalid descriptor.
100 */
102
103 /**
104 * Creates a new input header descriptor from memory.
105 * @param buffer The memory buffer in which the descriptor is located, must be valid
106 * @param size The size of the buffer, in bytes, with range [13, infinity)
107 */
108 VSInputHeaderDescriptor(const void* buffer, const size_t size);
109
110 /**
111 * Returns the endpoint address of this descriptor.
112 * @return The descriptor's endpoint address
113 */
114 inline uint8_t endpointAddress() const;
115
116 /**
117 * Returns the content of this descriptor as string.
118 * @return The string representation of this descriptor
119 */
120 std::string toString() const;
121
122 /**
123 * Returns whether this object holds valid descriptor information.
124 * @return True, if so
125 */
126 bool isValid() const;
127
128 protected:
129
130 /// Size of this descriptor, in bytes.
131 uint8_t bLength_ = 0u;
132
133 /// CS_INTERFACE descriptor type.
134 uint8_t bDescriptorType_ = 0u;
135
136 /// VS_INPUT_HEADER descriptor subtype.
137 uint8_t bDescriptorSubtype_ = 0u;
138
139 public:
140
141 /// Number of video payload format descriptors following for this interface (excluding video frame descriptors): p.
142 uint8_t bNumFormats_ = 0u;
143
144 /// Total number of bytes returned for the class-specific VideoStreaming interface descriptors including this header descriptor.
145 uint16_t wTotalLength_ = 0u;
146
147 /**
148 * The address of the isochronous or bulk endpoint used for video data.
149 * The address is encoded as follows:
150 * D7: Direction
151 * 1 = IN endpoint
152 * D6..4: Reserved, set to zero.
153 * D3..0: The endpoint number, determined by the designer.
154 */
155 uint8_t bEndpointAddress_ = 0u;
156
157 /**
158 * Indicates the capabilities of this VideoStreaming interface:
159 * D0: Dynamic Format Change supported
160 * D7..1: Reserved, set to zero.
161 */
162 uint8_t bmInfo_ = 0u;
163
164 /// The terminal ID of the Output Terminal to which the video endpoint of this interface is connected.
165 uint8_t bTerminalLink_ = 0u;
166
167 /**
168 * Method of still image capture supported as described in section 2.4.2.4, "Still Image Capture":
169 * 0: None (Host software will not support any form of still image capture)
170 * 1: Method 1
171 * 2: Method 2
172 * 3: Method 3
173 */
174 uint8_t bStillCaptureMethod_ = 0u;
175
176 /**
177 * Specifies if hardware triggering is supported through this interface
178 * 0: Not supported
179 * 1: Supported
180 */
181 uint8_t bTriggerSupport_= 0u;
182
183 /**
184 * Specifies how the host software shall respond to a hardware trigger interrupt event from this interface. This is ignored if the bTriggerSupport field is zero.
185 * 0: Initiate still image capture
186 * 1: General purpose button event. Host driver will notify client application of button press and button release events
187 */
188 uint8_t bTriggerUsage_ = 0u;
189
190 /**
191 * Size of each bmaControls(x) field, in bytes: n
192 */
193 uint8_t bControlSize_ = 0u;
194
195 /**
196 * 'bNumFormats' entries of control bitmaps
197 *
198 * For bits D3..0, a bit set to 1 indicates that the named field is supported by the Video Probe and Commit Control when bFormatIndex is 1:
199 * D0: wKeyFrameRate
200 * D1: wPFrameRate
201 * D2: wCompQuality
202 * D3: wCompWindowSize
203 * For bits D5..4, a bit set to 1 indicates that the named control is supported by the device when bFormatIndex is 1:
204 * D4: Generate Key Frame
205 * D5: Update Frame Segment
206 * D6..(n*8-1): Reserved, set to zero
207 */
208 std::vector<std::vector<uint8_t>> bmaControls_;
209};
210
211/**
212 * UncompressedVideoFormatDescriptor (VS_FORMAT_UNCOMPRESSED)
213 *
214 * The Uncompressed Video Format descriptor defines the characteristics of a specific video stream.
215 * It is used for formats that carry uncompressed video information, including all YUV variants.
216 *
217 * A Terminal corresponding to a USB IN or OUT endpoint, and the interface it belongs to, supports one or more format definitions.
218 * To select a particular format, host software sends control requests to the corresponding interface.
219 *
220 * The bFormatIndex field contains the one-based index of this format descriptor, and is used by requests from the host to set and get the current video format.
221 *
222 * The guidFormat field uniquely identifies the video data format that shall be used when communicating with this interface at the corresponding format index.
223 * For a video source function, the host software will deploy the corresponding video format decoder (if necessary) based on the format specified in this field.
224 *
225 * The bAspectRatioX and bAspectRatioY fields specify the X and Y dimensions of the picture aspect ratio respectively for video field (interlaced) data.
226 * For example, bAspectRatioX will be 16 and bAspectRatioY will be 9 for a 16:9 display.
227 *
228 * An Uncompressed Video Format Descriptor is followed by one or more Uncompressed Video Frame Descriptor(s);
229 * each Video Frame Descriptor conveys information specific to a frame size supported for the format.
230 *
231 * http://www.cajunbot.com/wiki/images/8/88/USB_Video_Payload_Uncompressed_1.1.pdf
232 * @ingroup systemusbvideo
233 */
234class OCEAN_SYSTEM_USB_VIDEO_EXPORT VSUncompressedVideoFormatDescriptor : public VSDescriptor
235{
236 public:
237
238 /**
239 * Default constructor creating an invalid descriptor.
240 */
242
243 /**
244 * Creates a new format descriptor from memory.
245 * @param buffer The memory buffer in which the descriptor is located, must be valid
246 * @param size The size of the buffer, in bytes, must be 27
247 */
248 VSUncompressedVideoFormatDescriptor(const void* buffer, const size_t size);
249
250 /**
251 * Returns the pixel format of this descriptor.
252 * @return The descriptor's pixel format, FORMAT_UNDEFINED if unknown
253 */
254 inline FrameType::PixelFormat pixelFormat() const;
255
256 /**
257 * Returns the content of this descriptor as string.
258 * @return The string representation of this descriptor
259 */
260 std::string toString() const;
261
262 /**
263 * Returns whether this object holds valid descriptor information.
264 * @return True, if so
265 */
266 bool isValid() const;
267
268 /**
269 * Translates a GUID to the corresponding pixel format.
270 * @param guidFormat The GUID to translate, must be valid
271 * @return The corresponding pixel format, FORMAT_UNDEFINED if unknown
272 */
273 static FrameType::PixelFormat translatePixelFormat(const uint8_t guidFormat[16]);
274
275 protected:
276
277 /// Size of this descriptor in byte: 27
278 uint8_t bLength_ = 0u;
279
280 /// CS_INTERFACE descriptor type
281 uint8_t bDescriptorType_ = 0u;
282
283 /// VS_FORMAT_UNCOMPRESSED descriptor subtype
284 uint8_t bDescriptorSubtype_ = 0u;
285
286 public:
287
288 /// Index of this format descriptor (stating with 1)
289 uint8_t bFormatIndex_ = 0u;
290
291 /// Number of frame descriptors following
292 uint8_t bNumFrameDescriptors_ = 0u;
293
294 /// GUID Globally Unique Identifier used to identify stream-encoding format
295 uint8_t guidFormat_[16] = {};
296
297 /// Number of bits per pixel used to specify color in the decoded video frame
298 uint8_t bBitsPerPixel_ = 0u;
299
300 /// Optimum Frame Index (used to select resolution) for this stream
301 uint8_t bDefaultFrameIndex_ = 0u;
302
303 /// The X dimension of the picture aspect ratio
304 uint8_t bAspectRatioX_ = 0u;
305
306 /// The Y dimension of the picture aspect ratio
307 uint8_t bAspectRatioY_ = 0u;
308
309 /**
310 * Specifies interlace information.
311 * If the scanning mode control in the Camera Terminal is supported for this stream, this field shall reflect the field format used in interlaced mode.
312 * (Top field in PAL is field 1, top field in NTSC is field 2.):
313 * D0: Interlaced stream or variable. 1 = Yes
314 * D1: Fields per frame. 0= 2 fields, 1 = 1 field
315 * D2: Field 1 first. 1 = Yes
316 * D3: Reserved
317 * D5..4: Field pattern
318 * 00 = Field 1 only
319 * 01 = Field 2 only
320 * 10 = Regular pattern of fields 1 and 2
321 * 11 = Random pattern of fields 1 and 2
322 * D7..6: Reserved. Do not use.
323 */
324 uint8_t bmInterlaceFlags_ = 0u;
325
326 /// Boolean Specifies whether duplication of the video stream is restricted: 0: No restrictions 1: Restrict duplication
327 uint8_t bCopyProtect_ = 0u;
328};
329
330/**
331 * Uncompressed Frame Descriptor (VS_FRAME_UNCOMPRESSED).
332 *
333 * Uncompressed Video Frame descriptors (or Frame descriptors for short) are used to describe the decoded video and still-image frame dimensions and other frame-specific characteristics supported by a particular stream.
334 * One or more Frame descriptors follow the Uncompressed Video Format descriptor they correspond to.
335 * The Frame descriptor is also used to determine the range of frame intervals supported for the frame size specified.
336 *
337 * The Uncompressed Video Frame descriptor is used only for video formats for which the Uncompressed Video Format descriptor applies (see section 3.1.1, "Uncompressed Video Format Descriptor").
338 *
339 * The bFrameIndex field contains the one-based index of this frame descriptor, and is used by requests from the host to set and get the current frame index for the format in use.
340 * This index is one-based for each corresponding format descriptor supported by the device.
341 *
342 * The range of frame intervals supported can be either a continuous range or a discrete set of values.
343 * For a continuous range, dwMinFrameInterval, dwMaxFrameInterval and dwFrameIntervalStep indicate the limits and granularity of the range.
344 * For discrete values, the dwFrameInterval(x) fields indicate the range of frame intervals (and therefore frame rates) supported at this frame size.
345 * The frame interval is the average display time of a single decoded video frame in 100ns units.
346 *
347 * http://www.cajunbot.com/wiki/images/8/88/USB_Video_Payload_Uncompressed_1.1.pdf
348 * @ingroup systemusbvideo
349 */
350class OCEAN_SYSTEM_USB_VIDEO_EXPORT VSUncompressedVideoFrameDescriptor : public VSDescriptor
351{
352 friend class Descriptor;
353
354 public:
355
356 /**
357 * Default constructor creating an invalid descriptor.
358 */
360
361 /**
362 * Creates a new frame descriptor from memory.
363 * @param buffer The memory buffer in which the descriptor is located, must be valid
364 * @param size The size of the buffer, in bytes, with range [27, infinity)
365 */
366 VSUncompressedVideoFrameDescriptor(const uint8_t* buffer, const size_t size);
367
368 /**
369 * Returns the frame intervals of this descriptor.
370 * @param frameRates Optional resulting vector holding the individual frame rates, one for each interval
371 * @return The descriptor's frame intervals, in 100ns
372 */
373 Indices32 frameIntervals(std::vector<double>* frameRates = nullptr) const;
374
375 /**
376 * Returns the content of this descriptor as string.
377 * @return The string representation of this descriptor
378 */
379 std::string toString() const;
380
381 /**
382 * Returns whether this object holds valid descriptor information.
383 * @return True, if so
384 */
385 bool isValid() const;
386
387 private:
388
389 /**
390 * Size of this descriptor in bytes when bFrameIntervalType is 0: 38
391 * Size of this descriptor in bytes when bFrameIntervalType > 0: 26+(4*n)
392 */
393 uint8_t bLength_ = 0u;
394
395 /// CS_INTERFACE descriptor type
396 uint8_t bDescriptorType_ = 0u;
397
398 /// VS_FRAME_UNCOMPRESSED descriptor subtype
399 uint8_t bDescriptorSubtype_ = 0u;
400
401 public:
402
403 /// Index of this frame descriptor.
404 uint8_t bFrameIndex_ = 0u;
405
406 /**
407 * D0: Still image supported Specifies whether still images are supported at this frame setting.
408 * This is only applicable for VS interfaces with an IN video endpoint using Still Image Capture Method 1, and should be set to 0 in all other cases.
409 *
410 * D1: Fixed frame-rate Specifies whether the device provides a fixed frame rate on a stream associated with this frame descriptor.
411 */
412 uint8_t bmCapabilities_ = 0u;
413
414 /// Number Height of decoded bitmap frame in pixels
415 uint16_t wWidth_ = 0u;
416
417 /// Number Height of decoded bitmap frame in pixels
418 uint16_t wHeight_ = 0u;
419
420 /// Specifies the minimum bit rate at the longest frame interval in units of bps at which the data can be transmitted.
421 uint32_t dwMinBitRate_ = 0u;
422
423 /// Specifies the maximum bit rate at the shortest frame interval in units of bps at which the data can be transmitted.
424 uint32_t dwMaxBitRate_ = 0u;
425
426 /**
427 * Use of this field has been deprecated.
428 *
429 * Specifies the maximum number of bytes that the compressor will produce for a video frame or still image.
430 * The dwMaxVideoFrameSize field of the Video Probe and Commit control replaces this descriptor field.
431 * A value for this field shall be chosen for compatibility with host software that implements an earlier version of this specification.
432 */
433 uint32_t dwMaxVideoFrameBufferSize_ = 0u;
434
435 /// Number Specifies the frame interval the device would like to indicate for use as a default. This must be a valid frame interval described in the fields below.
436 uint32_t dwDefaultFrameInterval_ = 0u;
437
438 /// Indicates how the frame interval can be programmed: 0: Continuous frame interval 1..255: The number of discrete frame intervals supported (n)
439 uint8_t bFrameIntervalType_ = 0u;
440
441 /**
442 * For continuous Frame Intervals:
443 * Shortest frame interval supported (at highest frame rate), in 100 ns units.
444 */
445 uint32_t dwMinFrameInterval_ = 0u;
446
447 /**
448 * For continuous Frame Intervals:
449 * Longest frame interval supported (at lowest frame rate), in 100 ns units
450 */
451 uint32_t dwMaxFrameInterval_ = 0u;
452
453 /**
454 * For continuous Frame Intervals:
455 * Indicates granularity of frame interval range, in 100 ns units.
456 */
457 uint32_t dwFrameIntervalStep_ = 0u;
458
459 /**
460 * For discrete Frame Intervals
461 * First entry: Shortest frame interval supported (at highest frame rate), in 100 ns units.
462 * ...
463 * Last entry: Longest frame interval supported (at lowest frame rate), in 100 ns units.
464 */
466};
467
468/**
469 * Frame Based Payload Video Format Descriptor (VS_FORMAT_FRAME_BASED).
470 *
471 * The Frame Based Payload Video Format descriptor defines the characteristics of a specific video stream.
472 * It is used for formats that carry Frame Based Payload video information.
473 *
474 * A Terminal corresponding to a USB IN or OUT endpoint, and the interface it belongs to, supports one or more format definitions.
475 * To select a particular format, host software sends control requests to the corresponding interface.
476 *
477 * The bFormatIndex field contains the one-based index of this format descriptor, and is used by requests from the host to set and get the current video format.
478 *
479 * The guidFormat field uniquely identifies the video data format that shall be used when communicating with this interface at the corresponding format index.
480 * For a video source function, the host software will deploy the corresponding video format decoder (if necessary) based on the format specified in this field.
481 *
482 * The bAspectRatioX and bAspectRatioY fields specify the X and Y dimensions of the picture aspect ratio, respectively.
483 * For example, bAspectRatioX will be 16 and bAspectRatioY will be 9 for a 16:9 display.
484 *
485 * A Frame Based Payload Video Format Descriptor is followed by one or more Frame Based Payload Video Frame Descriptor(s);
486 * each Video Frame Descriptor conveys information specific to a frame size supported for the format.
487 *
488 * http://cajunbot.com/wiki/images/3/3a/USB_Video_Payload_Frame_Based_1.1.pdf
489 * @ingroup systemusbvideo
490 */
491class OCEAN_SYSTEM_USB_VIDEO_EXPORT VSFrameBasedVideoFormatDescriptor : public VSDescriptor
492{
493 public:
494
495 /**
496 * Definition of individual encoding formats.
497 */
498 enum EncodingFormat : uint32_t
499 {
500 /// Invalid encoding format.
501 EF_INVALID = 0u,
502 /// The encoding is using H.264
504 /// The encoding is using H.265
505 EF_H265
506 };
507
508 public:
509
510 /**
511 * Default constructor creating an invalid descriptor.
512 */
514
515 /**
516 * Creates a new format descriptor from memory.
517 * @param buffer The memory buffer in which the descriptor is located, must be valid
518 * @param size The size of the buffer, in bytes, must be 28
519 */
520 VSFrameBasedVideoFormatDescriptor(const void* buffer, const size_t size);
521
522 /**
523 * Returns the content of this descriptor as string.
524 * @return The string representation of this descriptor
525 */
526 std::string toString() const;
527
528 /**
529 * Returns the encoding format of this descriptor.
530 * @return The encoding format, EF_INVALID if unknown
531 */
532 inline EncodingFormat encodingFormat() const;
533
534 /**
535 * Returns whether this object holds valid descriptor information.
536 * @return True, if so
537 */
538 bool isValid() const;
539
540 /**
541 * Translates a GUID to the corresponding encoding format.
542 * @param guidFormat The GUID to translate, must be valid
543 * @return The encoding format, EF_INVALID if unknown
544 */
545 static EncodingFormat translateEncodingFormat(const uint8_t guidFormat[16]);
546
547 /**
548 * Translates an encoding format to a string.
549 * @param encodingFormat The encoding format to translate
550 * @return The string representation of the encoding format, 'Invalid' if unknown
551 */
552 static std::string translateEncodingFormat(const EncodingFormat encodingFormat);
553
554 protected:
555
556 /// Size of this descriptor in bytes: 28.
557 uint8_t bLength_ = 0u;
558
559 /// CS_INTERFACE descriptor type.
560 uint8_t bDescriptorType_ = 0u;
561
562 /// VS_FORMAT_FRAME_BASED descriptor subtype.
563 uint8_t bDescriptorSubtype_ = 0u;
564
565 public:
566
567 /// Index of this format descriptor.
568 uint8_t bFormatIndex_ = 0u;
569
570 /// Number of frame descriptors following that correspond to this format.
571 uint8_t bNumFrameDescriptors_ = 0u;
572
573 /// Globally Unique Identifier used to identify stream-encoding format.
574 uint8_t guidFormat_[16] = {};
575
576 /// Number of bits per pixel used to specify color in the decoded video frame. May be zero if not applicable.
577 uint8_t bBitsPerPixel_ = 0u;
578
579 /// Optimum Frame Index (used to select resolution) for this stream.
580 uint8_t bDefaultFrameIndex_ = 0u;
581
582 /// The X dimension of the picture aspect ratio.
583 uint8_t bAspectRatioX_ = 0u;
584
585 /// The Y dimension of the picture aspect ratio.
586 uint8_t bAspectRatioY_ = 0u;
587
588 /**
589 * Specifies interlace information.
590 * If the scanning mode control in the Camera Terminal is supported for this stream, this field shall reflect the field format used in interlaced mode.
591 * (Top field in PAL is field 1, top field in NTSC is field 2.):
592 * D0: Interlaced stream or variable. 1 = Yes
593 * D1: Fields per frame. 0= 2 fields, 1 = 1 field
594 * D2: Field 1 first. 1 = Yes
595 * D3: Reserved
596 * D5..4: Field pattern
597 * 00 = Field 1 only
598 * 01 = Field 2 only
599 * 10 = Regular pattern of fields 1 and 2
600 * 11 = Random pattern of fields 1 and 2
601 * D7..6: Reserved. Do not use.
602 */
603 uint8_t bmInterlaceFlags_ = 0u;
604
605 /**
606 * Specifies whether duplication of the video stream is restricted:
607 * FALSE (0): No restrictions
608 * TRUE (1): Restrict duplication
609 */
610 uint8_t bCopyProtect_ = 0u;
611
612 /**
613 * Specifies whether the data within the frame is of variable length from frame to frame.
614 * TRUE (1): Variable Size
615 * FALSE (0): Fixed Size
616 * If bVariableSize is TRUE (1), then dwBytesPerLine (below) must be set to zero (0).
617 */
618 uint8_t bVariableSize_ = 0u;
619};
620
621/**
622 * Frame Based Payload Frame Descriptor (VS_FRAME_FRAME_BASED).
623 *
624 * Frame Based Payload Video Frame descriptors (or Frame descriptors for short) are used to
625 * describe the decoded video and still-image frame dimensions and other frame-specific
626 * characteristics supported by a particular stream. One or more Frame descriptors follow the
627 * Frame Based Payload Video Format descriptor they correspond to. The Frame descriptor is also
628 * used to determine the range of frame intervals supported for the frame size specified.
629 *
630 * The bFrameIndex field contains the one-based index of this frame descriptor, and is used by
631 * requests from the host to set and get the current frame index for the format in use. This index is
632 * one-based for each corresponding format descriptor supported by the device.
633 *
634 * The range of frame intervals supported can be either a continuous range or a discrete set of
635 * values. For a continuous range, dwMinFrameInterval, dwMaxFrameInterval and
636 * dwFrameIntervalStep indicate the limits and granularity of the range. For discrete values, the
637 * dwFrameInterval(x) fields indicate the range of frame intervals (and therefore frame rates)
638 * supported at this frame size. The frame interval is the average display time of a single decoded
639 * video frame in 100ns units.
640 *
641 * http://cajunbot.com/wiki/images/3/3a/USB_Video_Payload_Frame_Based_1.1.pdf
642 * @ingroup systemusbvideo
643 */
644class OCEAN_SYSTEM_USB_VIDEO_EXPORT VSFrameBasedFrameDescriptor : public VSDescriptor
645{
646 friend class Descriptor;
647
648 public:
649
650 /**
651 * Default constructor creating an invalid descriptor.
652 */
654
655 /**
656 * Creates a new frame descriptor from memory.
657 * @param buffer The memory buffer in which the descriptor is located, must be valid
658 * @param size The size of the buffer, in bytes, must be 27
659 */
660 VSFrameBasedFrameDescriptor(const void* buffer, const size_t size);
661
662 /**
663 * Returns the frame intervals of this descriptor.
664 * @param frameRates Optional resulting vector holding the individual frame rates, one for each interval
665 * @return The descriptor's frame intervals, in 100ns
666 */
667 Indices32 frameIntervals(std::vector<double>* frameRates = nullptr) const;
668
669 /**
670 * Returns the content of this descriptor as string.
671 * @return The string representation of this descriptor
672 */
673 std::string toString() const;
674
675 /**
676 * Returns whether this object holds valid descriptor information.
677 * @return True, if so
678 */
679 bool isValid() const;
680
681 private:
682
683 /// Size of this descriptor in bytes when bFrameIntervalType is 0: 38 Size of this descriptor in bytes when bFrameIntervalType > 0: 26+(4*n)
684 uint8_t bLength_ = 0u;
685
686 /// CS_INTERFACE descriptor type
687 uint8_t bDescriptorType_ = 0u;
688
689 /// VS_FRAME_FRAME_BASED descriptor subtype
690 uint8_t bDescriptorSubtype_ = 0u;
691
692 public:
693
694 /// Index of this frame descriptor
695 uint8_t bFrameIndex_ = 0u;
696
697 /// D0: Still image supported Specifies whether still images are supported at this frame setting.
698 uint8_t bmCapabilities_ = 0u;
699
700 /// Width of decoded bitmap frame in pixels
701 uint16_t wWidth_ = 0u;
702
703 /// Height of decoded bitmap frame in pixels
704 uint16_t wHeight_ = 0u;
705
706 /// Specifies the minimum bit rate at the longest frame interval in units of bps at which the data can be transmitted.
707 uint32_t dwMinBitRate_ = 0u;
708
709 /// Specifies the maximum bit rate at the shortest frame interval in units of bps at which the data can be transmitted.
710 uint32_t dwMaxBitRate_ = 0u;
711
712 /// Specifies the frame interval the device would like to indicate for use as a default. This must be a valid frame interval described in the fields below.
713 uint32_t dwDefaultFrameInterval_ = 0u;
714
715 /// Indicates how the frame interval can be programmed: 0: Continuous frame interval 1..255: The number of discrete frame intervals supported (n)
716 uint8_t bFrameIntervalType_ = 0u;
717
718 /**
719 * Specifies the number of bytes per line of video for packed fixed frame size formats, allowing the receiver to perform stride alignment of the video.
720 * If the bVariableSize value (above) is TRUE (1), or if the format does not permit such alignment, this value shall be set to zero (0).
721 */
722 uint32_t dwBytesPerLine_ = 0u;
723
724 /// Shortest frame interval supported (at highest frame rate), in 100 ns units.
725 uint32_t dwMinFrameInterval_ = 0u;
726
727 /// Longest frame interval supported (at lowest frame rate), in 100 ns units.
728 uint32_t dwMaxFrameInterval_ = 0u;
729
730 /// Indicates granularity of frame interval range, in 100 ns units.
731 uint32_t dwFrameIntervalStep_ = 0u;
732
733 /**
734 * For discrete Frame Intervals
735 * First entry: Shortest frame interval supported (at highest frame rate), in 100 ns units.
736 * ...
737 * Last entry: Longest frame interval supported (at lowest frame rate), in 100 ns units.
738 */
740};
741
742
743/**
744 * Color Matching Descriptor (VS_COLORFORMAT).
745 *
746 * The Color Matching descriptor is an optional descriptor used to describe the color profile of the video data in an unambiguous way.
747 * Only one instance is allowed for a given format and if present, the Color Matching descriptor shall be placed following the Video and Still Image Frame descriptors for that format.
748 *
749 * For example, this descriptor would be used with Uncompressed Video, MJPEG and MPEG-1 formats.
750 * It would not be used in the case MPEG-2, DV or MPEG-4 because the information is already available implicitly (DV) or explicitly (MPEG-2, MPEG-4).
751 * If a format requires this descriptor, the corresponding payload specification must enforce this requirement.
752 * In the absence of this descriptor, or in the case of “Unspecified” values within the descriptor, color matching defaults will be assumed.
753 * The color matching defaults are compliant with sRGB since the BT.709 transfer function and the sRGB transfer function are very similar.
754 *
755 * The viewing conditions and monitor setup are implicitly based on sRGB and the device should compensate for them (D50 ambient white, dim viewing or 64 lux ambient illuminance, 2.2 gamma reference CRT, etc).
756 *
757 * http://www.cajunbot.com/wiki/images/8/85/USB_Video_Class_1.1.pdf
758 * @ingroup systemusbvideo
759 */
760class OCEAN_SYSTEM_USB_VIDEO_EXPORT VSColorMatchingDescriptor : public VSDescriptor
761{
762 public:
763
764 /**
765 * Default constructor creating an invalid descriptor.
766 */
768
769 /**
770 * Creates a new color matching descriptor from memory.
771 * @param buffer The memory buffer in which the descriptor is located, must be valid
772 * @param size The size of the buffer, in bytes, must be 6
773 */
774 VSColorMatchingDescriptor(const void* buffer, const size_t size);
775
776 /**
777 * Returns the content of this descriptor as string.
778 * @return The string representation of this descriptor
779 */
780 std::string toString() const;
781
782 /**
783 * Returns whether this object holds valid descriptor information.
784 * @return True, if so
785 */
786 bool isValid() const;
787
788 private:
789
790 /// Size of this descriptor in bytes, 6.
791 uint8_t bLength_ = 0u;
792
793 /// CS_INTERFACE descriptor type
794 uint8_t bDescriptorType_ = 0u;
795
796 /// VS_COLORFORMAT descriptor subtype
797 uint8_t bDescriptorSubtype_ = 0u;
798
799 public:
800
801 /**
802 * This defines the color primaries and the reference white.
803 * 0: Unspecified (Image characteristics unknown)
804 * 1: BT.709, sRGB (default)
805 * 2: BT.470-2 (M)
806 * 3: BT.470-2 (B, G)
807 * 4: SMPTE 170M
808 * 5: SMPTE 240M
809 * 6-255: Reserved
810 */
811 uint8_t bColorPrimaries_ = 0u;
812
813 /**
814 * This field defines the optoelectronic transfer characteristic of the source picture also called the gamma function.
815 * 0: Unspecified (Image characteristics unknown)
816 * 1: BT.709 (default)
817 * 2: BT.470-2 M
818 * 3: BT.470-2 B, G
819 * 4: SMPTE 170M
820 * 5: SMPTE 240M
821 * 6: Linear (V = Lc)
822 * 7: sRGB (very similar to BT.709)
823 * 8-255: Reserved
824 */
825 uint8_t bTransferCharacteristics_ = 0u;
826
827 /**
828 * Matrix used to compute luma and chroma values from the color primaries.
829 * 0: Unspecified (Image characteristics unknown)
830 * 1: BT. 709
831 * 2: FCC
832 * 3: BT.470-2 B, G
833 * 4: SMPTE 170M (BT.601, default)
834 * 5: SMPTE 240M
835 * 6-255: Reserved
836 */
837 uint8_t bMatrixCoefficients_ = 0u;
838};
839
840/**
841 * MJPEG Video Format Descriptor (VS_FORMAT_MJPEG).
842 *
843 * The MJPEG Video Format Descriptor defines the characteristics of a specific video stream.
844 * It is used for formats that carry MJPEG video information, including all YUV/RGB variants.
845 * A Terminal corresponding to a USB IN or OUT endpoint, and the interface it belongs to, supports one or more format definitions.
846 * To select a particular format, host software sends control requests to the corresponding interface.
847 *
848 * The bFormatIndex field contains the one-based index of this format Descriptor, and is used by requests from the host to set and get the current video format.
849 * The bDescriptorSubtype field uniquely identifies the video data format that should be used when communicating with this interface at the corresponding format index.
850 * For a video source function, the host software will deploy the corresponding video format decoder (if necessary) based on the format specified in this field.
851 *
852 * The bAspectRatioX and bAspectRatioY fields specify the X and Y dimensions respectively of the picture aspect ratio for video field (interlaced) data.
853 * For example, bAspectRatioX will be 16 and bAspectRatioY will be 9 for a 16:9 display.
854 *
855 * The bmFlags field holds information about the video data stream characteristics.
856 * FixedSizeSamples indicates whether all video samples are the same size.
857 * A MJPEG Video Format Descriptor is followed by one or more MJPEG Video Frame Descriptor(s);
858 * each Video Frame Descriptor conveys information specific to a frame size supported for the format.
859 *
860 * @see http://www.cajunbot.com/wiki/images/7/71/USB_Video_Payload_MJPEG_1.1.pdf.
861 * @ingroup systemusbvideo
862 */
863class OCEAN_SYSTEM_USB_VIDEO_EXPORT VSMJPEGVideoFormatDescriptor : public VSDescriptor
864{
865 public:
866
867 /**
868 * Default constructor creating an invalid descriptor.
869 */
871
872 /**
873 * Creates a new format descriptor from memory.
874 * @param buffer The memory buffer in which the descriptor is located, must be valid
875 * @param size The size of the buffer, in bytes, must be 11
876 */
877 VSMJPEGVideoFormatDescriptor(const void* buffer, const size_t size);
878
879 /**
880 * Returns the content of this descriptor as string.
881 * @return The string representation of this descriptor
882 */
883 std::string toString() const;
884
885 /**
886 * Returns whether this object holds valid descriptor information.
887 * @return True, if so
888 */
889 bool isValid() const;
890
891 protected:
892
893 /// Size of this Descriptor, in bytes: 11.
894 uint8_t bLength_ = 0u;
895
896 /// CS_INTERFACE Descriptor type.
897 uint8_t bDescriptorType_ = 0u;
898
899 /// VS_FORMAT_MJPEG Descriptor subtype.
900 uint8_t bDescriptorSubtype_ = 0u;
901
902 public:
903
904 /// Index of this Format Descriptor.
905 uint8_t bFormatIndex_ = 0u;
906
907 /// Number of Frame Descriptors following that correspond to this format.
908 uint8_t bNumFrameDescriptors_ = 0u;
909
910 /**
911 * Specifies characteristics of this format
912 * D0: FixedSizeSamples. 1 = Yes
913 * All other bits are reserved for future use and shall be reset to zero.
914 */
915 uint8_t bmFlags_ = 0u;
916
917 /// Optimum Frame Index (used to select resolution) for this stream.
918 uint8_t bDefaultFrameIndex_ = 0u;
919
920 /// The X dimension of the picture aspect ratio.
921 uint8_t bAspectRatioX_ = 0u;
922
923 /// The Y dimension of the picture aspect ratio.
924 uint8_t bAspectRatioY_ = 0u;
925
926 /**
927 * Specifies interlace information. If the scanning mode control in the Camera Terminal is supported for this stream, this field should reflect the field format used in interlaced mode.
928 * (Top field in PAL is field 1, top field in NTSC is field 2.):
929 * D0: Interlaced stream or variable. 1 = Yes
930 * D1: Fields per frame. 0= 2 fields, 1 = 1 field
931 * D2: Field 1 first. 1 = Yes
932 * D3: Reserved
933 * D5..4: Field pattern
934 * 00 = Field 1 only
935 * 01 = Field 2 only
936 * 10 = Regular pattern of fields 1 and 2
937 * 11 = Random pattern of fields 1 and 2
938 * D7..6: Reserved. Do not use.
939 */
940 uint8_t bmInterlaceFlags_ = 0u;
941
942 /**
943 * Specifies if duplication of the video stream should be restricted:
944 * 0: No restrictions
945 * 1: Restrict duplication
946 */
947 uint8_t bCopyProtect_ = 0u;
948};
949
950/**
951 * MJPEG Video Frame Descriptors (VS_FRAME_MJPEG).
952 *
953 * MJPEG Video Frame Descriptors (or simply Frame Descriptors) are used to describe the decoded video and still image frame dimensions, and other frame-specific characteristics supported by a particular stream.
954 * One or more Frame Descriptors follow the MJPEG Video Format Descriptor they correspond to.
955 * The Frame Descriptor is also used to determine the range of frame intervals that are supported for the specified frame size.
956 *
957 * The MJPEG Video Frame Descriptor is used only for video formats for which the MJPEG Video Format Descriptor applies (see section 3.1.1, "MJPEG Video Format Descriptor").
958 *
959 * The bFrameIndex field contains the one-based index of this Frame Descriptor, and is used by requests from the host to set and get the current frame index for the format in use.
960 * This index is one-based for each corresponding Format Descriptor supported by the device.
961 *
962 * The range of frame intervals supported can be either a continuous range or a discrete set of values.
963 * For a continuous range, dwMinFrameInterval, dwMaxFrameInterval and dwFrameIntervalStep indicate the limits and granularity of the range.
964 * For discrete values, the dwFrameInterval(x) fields indicate the range of frame intervals (and therefore frame rates) supported at this frame size.
965 * The frame interval is the average display time of a single decoded video frame in 100ns Units.
966 *
967 * @see http://www.cajunbot.com/wiki/images/7/71/USB_Video_Payload_MJPEG_1.1.pdf
968 * @ingroup systemusbvideo
969 */
970class OCEAN_SYSTEM_USB_VIDEO_EXPORT VSMJPEGVideoFrameDescriptor : public VSDescriptor
971{
972 friend class Descriptor;
973
974 public:
975
976 /**
977 * Default constructor creating an invalid descriptor.
978 */
980
981 /**
982 * Creates a new frame descriptor from memory.
983 * @param buffer The memory buffer in which the descriptor is located, must be valid
984 * @param size The size of the buffer, in bytes, with range [27, infinity)
985 */
986 VSMJPEGVideoFrameDescriptor(const void* buffer, const size_t size);
987
988 /**
989 * Returns the frame intervals of this descriptor.
990 * @param frameRates Optional resulting vector holding the individual frame rates, one for each interval
991 * @return The descriptor's frame intervals, in 100ns
992 */
993 Indices32 frameIntervals(std::vector<double>* frameRates = nullptr) const;
994
995 /**
996 * Returns the content of this descriptor as string.
997 * @return The string representation of this descriptor
998 */
999 std::string toString() const;
1000
1001 /**
1002 * Returns whether this object holds valid descriptor information.
1003 * @return True, if so
1004 */
1005 bool isValid() const;
1006
1007 protected:
1008
1009 /**
1010 * Size of this descriptor in bytes when bFrameIntervalType is 0: 38.
1011 * Size of this descriptor in bytes when bFrameIntervalType > 0: 26+(4*n).
1012 */
1013 uint8_t bLength_ = 0u;
1014
1015 /// CS_INTERFACE Descriptor type.
1016 uint8_t bDescriptorType_ = 0u;
1017
1018 /// VS_FRAME_MJPEG Descriptor subtype.
1019 uint8_t bDescriptorSubtype_ = 0u;
1020
1021 public:
1022
1023 /// Index of this Frame Descriptor.
1024 uint8_t bFrameIndex_ = 0u;
1025
1026 /**
1027 * D0: Still image supported Specifies whether still images are supported at this frame setting.
1028 * This is only applicable for VS interfaces with an IN video endpoint using Still Image Capture Method 1, and should be set to 0 in all other cases.
1029 *
1030 * D1: Fixed frame-rate Specifies whether the device provides a fixed frame rate on a stream associated with this frame descriptor. Set to 1 if fixed rate is enabled; otherwise, set to 0.
1031 *
1032 * D7..2: Reserved, set to 0.
1033 */
1034 uint8_t bmCapabilities_ = 0u;
1035
1036 /// Width of decoded bitmap frame in pixels.
1037 uint16_t wWidth_ = 0u;
1038
1039 /// Height of decoded bitmap frame in pixels.
1040 uint16_t wHeight_ = 0u;
1041
1042 /// Specifies the minimum bit rate at default compression quality and longest frame interval in Units of bps at which the data can be transmitted.
1043 uint32_t dwMinBitRate_ = 0u;
1044
1045 /// Specifies the maximum bit rate at default compression quality and shortest frame interval in Units of bps at which the data can be transmitted.
1046 uint32_t dwMaxBitRate_ = 0u;
1047
1048 /**
1049 * Use of this field has been deprecated.
1050 *
1051 * Specifies the maximum number of bytes for a video (or still image) frame the compressor will produce.
1052 *
1053 * The dwMaxVideoFrameSize field of the Video Probe and Commit control replaces this descriptor field.
1054 * A value for this field shall be chosen for compatibility with host software that implements an earlier version of this specification.
1055 */
1056 uint32_t dwMaxVideoFrameBufferSize_ = 0u;
1057
1058 /// Specifies the frame interval the device would like to indicate for use as a default. This must be a valid frame interval described in the fields below.
1059 uint32_t dwDefaultFrameInterval_ = 0u;
1060
1061 /**
1062 * Indicates how the frame interval can be programmed:
1063 * 0: Continuous frame interval
1064 * 1..255: The number of discrete frame intervals supported (n)
1065 */
1066 uint8_t bFrameIntervalType_ = 0u;
1067
1068 /**
1069 * For continuous Frame Intervals:
1070 * Shortest frame interval supported (at highest frame rate), in 100 ns units.
1071 */
1072 uint32_t dwMinFrameInterval_ = 0u;
1073
1074 /**
1075 * For continuous Frame Intervals:
1076 * Longest frame interval supported (at lowest frame rate), in 100 ns units
1077 */
1078 uint32_t dwMaxFrameInterval_ = 0u;
1079
1080 /**
1081 * For continuous Frame Intervals:
1082 * Indicates granularity of frame interval range, in 100 ns units.
1083 */
1084 uint32_t dwFrameIntervalStep_ = 0u;
1085
1086 /**
1087 * For discrete Frame Intervals
1088 * First entry: Shortest frame interval supported (at highest frame rate), in 100 ns units.
1089 * ...
1090 * Last entry: Longest frame interval supported (at lowest frame rate), in 100 ns units.
1091 */
1093};
1094
1095template <typename TDescriptor>
1096Indices32 VSDescriptor::frameIntervals(const TDescriptor& descriptor, std::vector<double>* frameRates)
1097{
1098 if (frameRates != nullptr)
1099 {
1100 frameRates->clear();
1101 }
1102
1103 if (!descriptor.isValid())
1104 {
1105 return Indices32();
1106 }
1107
1108 Indices32 result;
1109
1110 if (descriptor.bFrameIntervalType_ == 0u)
1111 {
1112 // continuous frame intervals mode
1113
1114 result.reserve(16);
1115
1116 if (descriptor.dwFrameIntervalStep_ == 0u)
1117 {
1118 // the device does not provide a step, so the range defines the boundaries only
1119
1120 result.emplace_back(descriptor.dwMinFrameInterval_);
1121
1122 if (descriptor.dwMaxFrameInterval_ != descriptor.dwMinFrameInterval_)
1123 {
1124 result.emplace_back(descriptor.dwMaxFrameInterval_);
1125 }
1126 }
1127 else
1128 {
1129 // a device is free to announce a range and a step which imply an absurd number of intervals, e.g. the entire 32 bit range in steps of one
1130 // the descriptor is only checked for its length, so the count has to be bounded here or the vector grows until the allocation fails
1131
1132 constexpr uint64_t maximalFrameIntervals = 1024ull;
1133
1134 const uint64_t range = uint64_t(descriptor.dwMaxFrameInterval_) - uint64_t(descriptor.dwMinFrameInterval_);
1135 const uint64_t numberFrameIntervals = range / uint64_t(descriptor.dwFrameIntervalStep_) + 1ull;
1136
1137 if (numberFrameIntervals > maximalFrameIntervals)
1138 {
1139 Log::warning() << "VSDescriptor: The device announces " << numberFrameIntervals << " continuous frame intervals, only the boundaries are used";
1140
1141 result.emplace_back(descriptor.dwMinFrameInterval_);
1142
1143 if (descriptor.dwMaxFrameInterval_ != descriptor.dwMinFrameInterval_)
1144 {
1145 result.emplace_back(descriptor.dwMaxFrameInterval_);
1146 }
1147 }
1148 else
1149 {
1150 // the accumulator is 64 bit, so that the last step cannot wrap back into the range
1151
1152 for (uint64_t frameInterval = descriptor.dwMinFrameInterval_; frameInterval <= uint64_t(descriptor.dwMaxFrameInterval_); frameInterval += descriptor.dwFrameIntervalStep_)
1153 {
1154 result.emplace_back(Index32(frameInterval));
1155 }
1156 }
1157 }
1158 }
1159 else
1160 {
1161 // discrete frame intervals mode
1162
1163 result = descriptor.dwFrameInterval_;
1164 }
1165
1166 if (frameRates != nullptr)
1167 {
1168 frameRates->reserve(result.size());
1169
1170 for (const uint32_t frameInterval : result)
1171 {
1172 frameRates->emplace_back(interval2frequency(frameInterval));
1173 }
1174 }
1175
1176 return result;
1177}
1178
1180{
1181 ocean_assert(isValid());
1182
1183 /*
1184 * The address is encoded as follows:
1185 * D7: Direction
1186 * 1 = IN endpoint
1187 * D6..4: Reserved, set to zero.
1188 * D3..0: The endpoint number, determined by the designer.
1189 */
1190 return bEndpointAddress_ & 0x8Fu;
1191}
1192
1194{
1195 ocean_assert(isValid());
1196 if (!isValid())
1197 {
1199 }
1200
1202}
1203
1205{
1206 ocean_assert(isValid());
1207 if (!isValid())
1208 {
1209 return EF_INVALID;
1210 }
1211
1213}
1214
1215}
1216
1217}
1218
1219}
1220
1221}
1222
1223#endif // META_OCEAN_SYSTEM_USB_VIDEO_VS_DESCRIPTOR_H
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition Frame.h:183
@ FORMAT_UNDEFINED
Undefined pixel format.
Definition Frame.h:187
static MessageObject warning()
Returns the message for warning messages.
Definition Messenger.h:1090
This class implements the base class for all interface descriptors.
Definition system/usb/Descriptor.h:29
static double interval2frequency(const uint32_t timeInterval)
Converts a time interval (in 100ns) to frequency in Hz.
Color Matching Descriptor (VS_COLORFORMAT).
Definition VSDescriptor.h:761
VSColorMatchingDescriptor(const void *buffer, const size_t size)
Creates a new color matching descriptor from memory.
VSColorMatchingDescriptor()=default
Default constructor creating an invalid descriptor.
std::string toString() const
Returns the content of this descriptor as string.
bool isValid() const
Returns whether this object holds valid descriptor information.
This class implements the base class for all video streaming descriptors.
Definition VSDescriptor.h:37
VideoStreamingInterfaceTypes
Definition of individual video streaming interfaces types.
Definition VSDescriptor.h:45
@ VS_FRAME_MJPEG
Image descriptor for MJPEG stream.
Definition VSDescriptor.h:61
@ VS_STILL_FRAME
Descriptor for still images.
Definition VSDescriptor.h:53
@ VS_COLORFORMAT
Color format descriptor for any stream.
Definition VSDescriptor.h:63
@ VS_FORMAT_FRAME_BASED
Format descriptor for frame-based streams.
Definition VSDescriptor.h:65
@ VS_OUTPUT_HEADER
The Output Header descriptor for VS interfaces that contain an OUT endpoint for streaming video data.
Definition VSDescriptor.h:51
@ VS_INPUT_HEADER
The Input Header descriptor is used for VS interfaces that contain an IN endpoint for streaming video...
Definition VSDescriptor.h:49
@ VS_FORMAT_UNCOMPRESSED
Format descriptor for uncompressed streams.
Definition VSDescriptor.h:55
@ VS_UNDEFINED
Undefined descriptor.
Definition VSDescriptor.h:47
@ VS_FRAME_FRAME_BASED
Image descriptor for frame-based stream.
Definition VSDescriptor.h:67
@ VS_FRAME_UNCOMPRESSED
Image descriptor for uncompressed stream.
Definition VSDescriptor.h:57
@ VS_FORMAT_MJPEG
Format descriptor for MJPEG streams.
Definition VSDescriptor.h:59
static Indices32 frameIntervals(const TDescriptor &descriptor, std::vector< double > *frameRates=nullptr)
Returns the frame intervals of a given descriptor.
Definition VSDescriptor.h:1096
Frame Based Payload Frame Descriptor (VS_FRAME_FRAME_BASED).
Definition VSDescriptor.h:645
Indices32 frameIntervals(std::vector< double > *frameRates=nullptr) const
Returns the frame intervals of this descriptor.
VSFrameBasedFrameDescriptor(const void *buffer, const size_t size)
Creates a new frame descriptor from memory.
Indices32 dwFrameInterval_
For discrete Frame Intervals First entry: Shortest frame interval supported (at highest frame rate),...
Definition VSDescriptor.h:739
VSFrameBasedFrameDescriptor()=default
Default constructor creating an invalid descriptor.
std::string toString() const
Returns the content of this descriptor as string.
bool isValid() const
Returns whether this object holds valid descriptor information.
Frame Based Payload Video Format Descriptor (VS_FORMAT_FRAME_BASED).
Definition VSDescriptor.h:492
std::string toString() const
Returns the content of this descriptor as string.
uint8_t guidFormat_[16]
Globally Unique Identifier used to identify stream-encoding format.
Definition VSDescriptor.h:574
static std::string translateEncodingFormat(const EncodingFormat encodingFormat)
Translates an encoding format to a string.
static EncodingFormat translateEncodingFormat(const uint8_t guidFormat[16])
Translates a GUID to the corresponding encoding format.
VSFrameBasedVideoFormatDescriptor()=default
Default constructor creating an invalid descriptor.
bool isValid() const
Returns whether this object holds valid descriptor information.
VSFrameBasedVideoFormatDescriptor(const void *buffer, const size_t size)
Creates a new format descriptor from memory.
EncodingFormat
Definition of individual encoding formats.
Definition VSDescriptor.h:499
@ EF_INVALID
Invalid encoding format.
Definition VSDescriptor.h:501
@ EF_H264
The encoding is using H.264.
Definition VSDescriptor.h:503
EncodingFormat encodingFormat() const
Returns the encoding format of this descriptor.
Definition VSDescriptor.h:1204
Input Header Descriptor (VS_INPUT_HEADER).
Definition VSDescriptor.h:93
VSInputHeaderDescriptor(const void *buffer, const size_t size)
Creates a new input header descriptor from memory.
VSInputHeaderDescriptor()=default
Default constructor creating an invalid descriptor.
std::vector< std::vector< uint8_t > > bmaControls_
'bNumFormats' entries of control bitmaps
Definition VSDescriptor.h:208
uint8_t endpointAddress() const
Returns the endpoint address of this descriptor.
Definition VSDescriptor.h:1179
std::string toString() const
Returns the content of this descriptor as string.
uint8_t bEndpointAddress_
The address of the isochronous or bulk endpoint used for video data.
Definition VSDescriptor.h:155
bool isValid() const
Returns whether this object holds valid descriptor information.
MJPEG Video Format Descriptor (VS_FORMAT_MJPEG).
Definition VSDescriptor.h:864
bool isValid() const
Returns whether this object holds valid descriptor information.
std::string toString() const
Returns the content of this descriptor as string.
VSMJPEGVideoFormatDescriptor()=default
Default constructor creating an invalid descriptor.
VSMJPEGVideoFormatDescriptor(const void *buffer, const size_t size)
Creates a new format descriptor from memory.
MJPEG Video Frame Descriptors (VS_FRAME_MJPEG).
Definition VSDescriptor.h:971
VSMJPEGVideoFrameDescriptor()=default
Default constructor creating an invalid descriptor.
std::string toString() const
Returns the content of this descriptor as string.
Indices32 frameIntervals(std::vector< double > *frameRates=nullptr) const
Returns the frame intervals of this descriptor.
bool isValid() const
Returns whether this object holds valid descriptor information.
VSMJPEGVideoFrameDescriptor(const void *buffer, const size_t size)
Creates a new frame descriptor from memory.
Indices32 dwFrameInterval_
For discrete Frame Intervals First entry: Shortest frame interval supported (at highest frame rate),...
Definition VSDescriptor.h:1092
UncompressedVideoFormatDescriptor (VS_FORMAT_UNCOMPRESSED)
Definition VSDescriptor.h:235
bool isValid() const
Returns whether this object holds valid descriptor information.
VSUncompressedVideoFormatDescriptor()=default
Default constructor creating an invalid descriptor.
VSUncompressedVideoFormatDescriptor(const void *buffer, const size_t size)
Creates a new format descriptor from memory.
static FrameType::PixelFormat translatePixelFormat(const uint8_t guidFormat[16])
Translates a GUID to the corresponding pixel format.
FrameType::PixelFormat pixelFormat() const
Returns the pixel format of this descriptor.
Definition VSDescriptor.h:1193
uint8_t guidFormat_[16]
GUID Globally Unique Identifier used to identify stream-encoding format.
Definition VSDescriptor.h:295
std::string toString() const
Returns the content of this descriptor as string.
Uncompressed Frame Descriptor (VS_FRAME_UNCOMPRESSED).
Definition VSDescriptor.h:351
std::string toString() const
Returns the content of this descriptor as string.
VSUncompressedVideoFrameDescriptor()=default
Default constructor creating an invalid descriptor.
Indices32 dwFrameInterval_
For discrete Frame Intervals First entry: Shortest frame interval supported (at highest frame rate),...
Definition VSDescriptor.h:465
bool isValid() const
Returns whether this object holds valid descriptor information.
Indices32 frameIntervals(std::vector< double > *frameRates=nullptr) const
Returns the frame intervals of this descriptor.
VSUncompressedVideoFrameDescriptor(const uint8_t *buffer, const size_t size)
Creates a new frame descriptor from memory.
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition Base.h:96
uint32_t Index32
Definition of a 32 bit index value.
Definition Base.h:84
The namespace covering the entire Ocean framework.
Definition Accessor.h:15