8#ifndef META_OCEAN_SYSTEM_USB_VIDEO_VS_DESCRIPTOR_H
9#define META_OCEAN_SYSTEM_USB_VIDEO_VS_DESCRIPTOR_H
79 template <
typename TDescriptor>
1095template <
typename TDescriptor>
1098 if (frameRates !=
nullptr)
1100 frameRates->clear();
1103 if (!descriptor.isValid())
1110 if (descriptor.bFrameIntervalType_ == 0u)
1116 if (descriptor.dwFrameIntervalStep_ == 0u)
1120 result.emplace_back(descriptor.dwMinFrameInterval_);
1122 if (descriptor.dwMaxFrameInterval_ != descriptor.dwMinFrameInterval_)
1124 result.emplace_back(descriptor.dwMaxFrameInterval_);
1132 constexpr uint64_t maximalFrameIntervals = 1024ull;
1134 const uint64_t range = uint64_t(descriptor.dwMaxFrameInterval_) - uint64_t(descriptor.dwMinFrameInterval_);
1135 const uint64_t numberFrameIntervals = range / uint64_t(descriptor.dwFrameIntervalStep_) + 1ull;
1137 if (numberFrameIntervals > maximalFrameIntervals)
1139 Log::warning() <<
"VSDescriptor: The device announces " << numberFrameIntervals <<
" continuous frame intervals, only the boundaries are used";
1141 result.emplace_back(descriptor.dwMinFrameInterval_);
1143 if (descriptor.dwMaxFrameInterval_ != descriptor.dwMinFrameInterval_)
1145 result.emplace_back(descriptor.dwMaxFrameInterval_);
1152 for (uint64_t frameInterval = descriptor.dwMinFrameInterval_; frameInterval <= uint64_t(descriptor.dwMaxFrameInterval_); frameInterval += descriptor.dwFrameIntervalStep_)
1154 result.emplace_back(
Index32(frameInterval));
1163 result = descriptor.dwFrameInterval_;
1166 if (frameRates !=
nullptr)
1168 frameRates->reserve(result.size());
1170 for (
const uint32_t frameInterval : result)
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.
uint8_t bColorPrimaries_
This defines the color primaries and the reference white.
Definition VSDescriptor.h:811
VSColorMatchingDescriptor(const void *buffer, const size_t size)
Creates a new color matching descriptor from memory.
uint8_t bDescriptorSubtype_
VS_COLORFORMAT descriptor subtype.
Definition VSDescriptor.h:797
uint8_t bTransferCharacteristics_
This field defines the optoelectronic transfer characteristic of the source picture also called the g...
Definition VSDescriptor.h:825
VSColorMatchingDescriptor()=default
Default constructor creating an invalid descriptor.
uint8_t bMatrixCoefficients_
Matrix used to compute luma and chroma values from the color primaries.
Definition VSDescriptor.h:837
std::string toString() const
Returns the content of this descriptor as string.
uint8_t bLength_
Size of this descriptor in bytes, 6.
Definition VSDescriptor.h:791
bool isValid() const
Returns whether this object holds valid descriptor information.
uint8_t bDescriptorType_
CS_INTERFACE descriptor type.
Definition VSDescriptor.h:794
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
uint8_t bFrameIntervalType_
Indicates how the frame interval can be programmed: 0: Continuous frame interval 1....
Definition VSDescriptor.h:716
uint32_t dwBytesPerLine_
Specifies the number of bytes per line of video for packed fixed frame size formats,...
Definition VSDescriptor.h:722
uint16_t wHeight_
Height of decoded bitmap frame in pixels.
Definition VSDescriptor.h:704
uint8_t bFrameIndex_
Index of this frame descriptor.
Definition VSDescriptor.h:695
Indices32 frameIntervals(std::vector< double > *frameRates=nullptr) const
Returns the frame intervals of this descriptor.
uint32_t dwMinBitRate_
Specifies the minimum bit rate at the longest frame interval in units of bps at which the data can be...
Definition VSDescriptor.h:707
uint32_t dwDefaultFrameInterval_
Specifies the frame interval the device would like to indicate for use as a default....
Definition VSDescriptor.h:713
uint32_t dwMaxBitRate_
Specifies the maximum bit rate at the shortest frame interval in units of bps at which the data can b...
Definition VSDescriptor.h:710
VSFrameBasedFrameDescriptor(const void *buffer, const size_t size)
Creates a new frame descriptor from memory.
uint8_t bDescriptorType_
CS_INTERFACE descriptor type.
Definition VSDescriptor.h:687
Indices32 dwFrameInterval_
For discrete Frame Intervals First entry: Shortest frame interval supported (at highest frame rate),...
Definition VSDescriptor.h:739
uint8_t bmCapabilities_
D0: Still image supported Specifies whether still images are supported at this frame setting.
Definition VSDescriptor.h:698
VSFrameBasedFrameDescriptor()=default
Default constructor creating an invalid descriptor.
friend class Descriptor
Definition VSDescriptor.h:646
uint32_t dwMinFrameInterval_
Shortest frame interval supported (at highest frame rate), in 100 ns units.
Definition VSDescriptor.h:725
uint8_t bDescriptorSubtype_
VS_FRAME_FRAME_BASED descriptor subtype.
Definition VSDescriptor.h:690
uint32_t dwMaxFrameInterval_
Longest frame interval supported (at lowest frame rate), in 100 ns units.
Definition VSDescriptor.h:728
uint16_t wWidth_
Width of decoded bitmap frame in pixels.
Definition VSDescriptor.h:701
uint32_t dwFrameIntervalStep_
Indicates granularity of frame interval range, in 100 ns units.
Definition VSDescriptor.h:731
std::string toString() const
Returns the content of this descriptor as string.
uint8_t bLength_
Size of this descriptor in bytes when bFrameIntervalType is 0: 38 Size of this descriptor in bytes wh...
Definition VSDescriptor.h:684
bool isValid() const
Returns whether this object holds valid descriptor information.
uint32_t dwMaxFrameInterval_
For continuous Frame Intervals: Longest frame interval supported (at lowest frame rate),...
Definition VSDescriptor.h:1078
VSMJPEGVideoFrameDescriptor()=default
Default constructor creating an invalid descriptor.
uint8_t bDescriptorSubtype_
VS_FRAME_MJPEG Descriptor subtype.
Definition VSDescriptor.h:1019
std::string toString() const
Returns the content of this descriptor as string.
uint8_t bFrameIntervalType_
Indicates how the frame interval can be programmed: 0: Continuous frame interval 1....
Definition VSDescriptor.h:1066
uint32_t dwMinBitRate_
Specifies the minimum bit rate at default compression quality and longest frame interval in Units of ...
Definition VSDescriptor.h:1043
uint32_t dwMaxBitRate_
Specifies the maximum bit rate at default compression quality and shortest frame interval in Units of...
Definition VSDescriptor.h:1046
uint32_t dwMinFrameInterval_
For continuous Frame Intervals: Shortest frame interval supported (at highest frame rate),...
Definition VSDescriptor.h:1072
friend class Descriptor
Definition VSDescriptor.h:972
uint16_t wHeight_
Height of decoded bitmap frame in pixels.
Definition VSDescriptor.h:1040
uint8_t bDescriptorType_
CS_INTERFACE Descriptor type.
Definition VSDescriptor.h:1016
uint8_t bmCapabilities_
D0: Still image supported Specifies whether still images are supported at this frame setting.
Definition VSDescriptor.h:1034
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.
uint16_t wWidth_
Width of decoded bitmap frame in pixels.
Definition VSDescriptor.h:1037
uint32_t dwDefaultFrameInterval_
Specifies the frame interval the device would like to indicate for use as a default....
Definition VSDescriptor.h:1059
uint8_t bLength_
Size of this descriptor in bytes when bFrameIntervalType is 0: 38.
Definition VSDescriptor.h:1013
uint32_t dwFrameIntervalStep_
For continuous Frame Intervals: Indicates granularity of frame interval range, in 100 ns units.
Definition VSDescriptor.h:1084
uint32_t dwMaxVideoFrameBufferSize_
Use of this field has been deprecated.
Definition VSDescriptor.h:1056
uint8_t bFrameIndex_
Index of this Frame Descriptor.
Definition VSDescriptor.h:1024
Indices32 dwFrameInterval_
For discrete Frame Intervals First entry: Shortest frame interval supported (at highest frame rate),...
Definition VSDescriptor.h:1092
uint8_t bFrameIndex_
Index of this frame descriptor.
Definition VSDescriptor.h:404
std::string toString() const
Returns the content of this descriptor as string.
uint8_t bDescriptorType_
CS_INTERFACE descriptor type.
Definition VSDescriptor.h:396
uint32_t dwDefaultFrameInterval_
Number Specifies the frame interval the device would like to indicate for use as a default....
Definition VSDescriptor.h:436
VSUncompressedVideoFrameDescriptor()=default
Default constructor creating an invalid descriptor.
uint32_t dwMaxBitRate_
Specifies the maximum bit rate at the shortest frame interval in units of bps at which the data can b...
Definition VSDescriptor.h:424
uint32_t dwMinBitRate_
Specifies the minimum bit rate at the longest frame interval in units of bps at which the data can be...
Definition VSDescriptor.h:421
uint8_t bDescriptorSubtype_
VS_FRAME_UNCOMPRESSED descriptor subtype.
Definition VSDescriptor.h:399
Indices32 dwFrameInterval_
For discrete Frame Intervals First entry: Shortest frame interval supported (at highest frame rate),...
Definition VSDescriptor.h:465
friend class Descriptor
Definition VSDescriptor.h:352
bool isValid() const
Returns whether this object holds valid descriptor information.
uint16_t wWidth_
Number Height of decoded bitmap frame in pixels.
Definition VSDescriptor.h:415
uint8_t bLength_
Size of this descriptor in bytes when bFrameIntervalType is 0: 38 Size of this descriptor in bytes wh...
Definition VSDescriptor.h:393
Indices32 frameIntervals(std::vector< double > *frameRates=nullptr) const
Returns the frame intervals of this descriptor.
uint32_t dwMinFrameInterval_
For continuous Frame Intervals: Shortest frame interval supported (at highest frame rate),...
Definition VSDescriptor.h:445
uint8_t bmCapabilities_
D0: Still image supported Specifies whether still images are supported at this frame setting.
Definition VSDescriptor.h:412
uint32_t dwMaxFrameInterval_
For continuous Frame Intervals: Longest frame interval supported (at lowest frame rate),...
Definition VSDescriptor.h:451
uint32_t dwMaxVideoFrameBufferSize_
Use of this field has been deprecated.
Definition VSDescriptor.h:433
uint32_t dwFrameIntervalStep_
For continuous Frame Intervals: Indicates granularity of frame interval range, in 100 ns units.
Definition VSDescriptor.h:457
VSUncompressedVideoFrameDescriptor(const uint8_t *buffer, const size_t size)
Creates a new frame descriptor from memory.
uint8_t bFrameIntervalType_
Indicates how the frame interval can be programmed: 0: Continuous frame interval 1....
Definition VSDescriptor.h:439
uint16_t wHeight_
Number Height of decoded bitmap frame in pixels.
Definition VSDescriptor.h:418
uint32_t Index32
Definition of a 32 bit index value.
Definition Base.h:84
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition Base.h:96
Namespace of the System library USB Video.
Definition VCDescriptor.h:25
Namespace of the System library USB.
Definition system/usb/android/Android.h:20
Namespace of the System library.
Definition system/Memory.h:19
The namespace covering the entire Ocean framework.
Definition Accessor.h:15