QCameraFormat Class
The QCameraFormat class describes a video format supported by a camera device. More...
| Header: | #include <QCameraFormat> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia)target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
| qmake: | QT += multimedia |
| In QML: | cameraFormat |
Properties
- maxFrameRate : const float
- minFrameRate : const float
- pixelFormat : const QVideoFrameFormat::PixelFormat
- resolution : const QSize
Public Functions
| QCameraFormat() | |
| QCameraFormat(const QCameraFormat &other) | |
| ~QCameraFormat() | |
| bool | isNull() const |
| float | maxFrameRate() const |
| float | minFrameRate() const |
| QVideoFrameFormat::PixelFormat | pixelFormat() const |
| QSize | resolution() const |
| bool | operator!=(const QCameraFormat &other) const |
| QCameraFormat & | operator=(const QCameraFormat &other) |
| bool | operator==(const QCameraFormat &other) const |
Detailed Description
QCameraFormat represents a certain video format supported by a camera device.
The format is a combination of a pixel format, resolution and a range of frame rates.
QCameraFormat objects can be queried from QCameraDevice to inspect the set of supported video formats.
See also QCameraDevice and QCamera.
Property Documentation
[read-only] maxFrameRate : const float
Returns the highest frame rate defined by this format.
The camera will always try to use the highest frame rate supported by a certain video format.
Access functions:
| float | maxFrameRate() const |
[read-only] minFrameRate : const float
Returns the lowest frame rate defined by this format.
Access functions:
| float | minFrameRate() const |
[read-only] pixelFormat : const QVideoFrameFormat::PixelFormat
Returns the pixel format.
Most commonly this is either QVideoFrameFormat::Format_Jpeg or QVideoFrameFormat::Format_YUYV but other formats could also be supported by the camera.
Note: On Android with the FFmpeg media backend, camera formats are reported as QVideoFrameFormat::Format_YUV420P, but the delivered video frames can be either fully planar YUV420P or semi-planar NV12 or NV21. The memory layout is chosen by the camera implementation of the device, and Android provides no way to query it in advance. Check the pixel format of the received video frames instead.
Access functions:
| QVideoFrameFormat::PixelFormat | pixelFormat() const |
See also QVideoFrameFormat::PixelFormat.
[read-only] resolution : const QSize
Returns the resolution.
Access functions:
| QSize | resolution() const |
Member Function Documentation
[noexcept] QCameraFormat::QCameraFormat()
Constructs a null camera format.
See also isNull().
[noexcept] QCameraFormat::QCameraFormat(const QCameraFormat &other)
Copy constructs a camera format from the other format.
[noexcept] QCameraFormat::~QCameraFormat()
Destructs the camera format object.
[noexcept] bool QCameraFormat::isNull() const
Returns true if this is a default constructed QCameraFormat.
bool QCameraFormat::operator!=(const QCameraFormat &other) const
Returns false if the other format is equal to this camera format, otherwise true.
[noexcept] QCameraFormat &QCameraFormat::operator=(const QCameraFormat &other)
Assign other to this.
bool QCameraFormat::operator==(const QCameraFormat &other) const
Returns true if the other format is equal to this camera format, otherwise false.
Frame rates are compared with a small relative tolerance, since camera devices can report the same frame rate with slightly different floating-point values.