Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
The QCameraDevice class provides general information about camera devices. More...
#include <qcameradevice.h>
Public Types | |
enum | Position { UnspecifiedPosition , BackFace , FrontFace } |
This enum specifies the physical position of the camera on the system hardware. More... | |
Public Member Functions | |
QCameraDevice () | |
Describes a camera device. | |
QCameraDevice (const QCameraDevice &other) | |
Constructs a copy of other. | |
QCameraDevice & | operator= (const QCameraDevice &other) |
Sets the QCameraDevice object to be equal to other. | |
~QCameraDevice () | |
Destroys the QCameraDevice. | |
bool | operator== (const QCameraDevice &other) const |
Returns true if this QCameraDevice is equal to other. | |
bool | operator!= (const QCameraDevice &other) const |
Returns true if this QCameraDevice is different from other. | |
bool | isNull () const |
Returns true if this QCameraDevice is null or invalid. | |
QByteArray | id () const |
QString | description () const |
bool | isDefault () const |
Position | position () const |
QList< QSize > | photoResolutions () const |
Returns a list of resolutions that the camera can use to capture still images. | |
QList< QCameraFormat > | videoFormats () const |
QtVideo::Rotation | correctionAngle () const |
Properties | |
QByteArray | id |
\qmlproperty string QtMultimedia::cameraDevice::id | |
QString | description |
\qmlproperty string QtMultimedia::cameraDevice::description | |
bool | isDefault |
\qmlproperty bool QtMultimedia::cameraDevice::isDefault | |
Position | position |
\qmlproperty enumeration QtMultimedia::cameraDevice::position | |
QList< QCameraFormat > | videoFormats |
\qmlproperty CameraFormat QtMultimedia::cameraDevice::videoFormats | |
QtVideo::Rotation | correctionAngle |
Friends | |
class | QCameraDevicePrivate |
The QCameraDevice class provides general information about camera devices.
\inmodule QtMultimedia
QCameraDevice represents a physical camera device and its properties.
You can discover what cameras are available on a system using the availableCameras() and defaultCamera() functions. These are contained within QtMultimedia::MediaDevices.
This example prints the name of all available cameras:
A QCameraDevice can be used to construct a QCamera. The following example instantiates a QCamera whose camera device is named {mycamera}
:
You can also use QCameraDevice to get general information about a camera device such as description and physical position on the system.
Definition at line 45 of file qcameradevice.h.
This enum specifies the physical position of the camera on the system hardware.
\value UnspecifiedPosition The camera position is unspecified or unknown. \value BackFace The camera is on the back face of the system hardware. For example on a mobile device, it means it is on the opposite side to that of the screen. \value FrontFace The camera is on the front face of the system hardware. For example on a mobile device, it means it is on the same side as that of the screen.
Enumerator | |
---|---|
UnspecifiedPosition | |
BackFace | |
FrontFace |
Definition at line 74 of file qcameradevice.h.
|
default |
Describes a camera device.
\qmlvaluetype cameraDevice \ingroup qmlvaluetypes \inqmlmodule QtMultimedia \since 6.2
! \instantiates QCameraDevice
The cameraDevice value type describes the properties of a camera device that is connected to the system.
The list of camera devices can be queried from the \l{MediaDevices} type. To select a certain camera device set it as the device on \l{Camera}.
\qml CaptureSession { camera: Camera { cameraDevice: mediaDevices.defaultVideoInput } } MediaDevices { id: mediaDevices } \endqml
Constructs a null camera device
|
default |
Constructs a copy of other.
|
default |
Destroys the QCameraDevice.
QtVideo::Rotation QCameraDevice::correctionAngle | ( | ) | const |
Definition at line 350 of file qcameradevice.cpp.
References QtVideo::None, and QCameraDevicePrivate::orientation.
QString QCameraDevice::description | ( | ) | const |
Definition at line 370 of file qcameradevice.cpp.
References QCameraDevicePrivate::description.
QByteArray QCameraDevice::id | ( | ) | const |
Definition at line 302 of file qcameradevice.cpp.
References QCameraDevicePrivate::id, and QByteArray().
bool QCameraDevice::isDefault | ( | ) | const |
Definition at line 318 of file qcameradevice.cpp.
References QCameraDevicePrivate::isDefault.
bool QCameraDevice::isNull | ( | ) | const |
Returns true if this QCameraDevice is null or invalid.
Definition at line 282 of file qcameradevice.cpp.
Referenced by QCameraPrivate::init(), QWindowsImageCapture::isReadyForCapture(), AVFCamera::setActive(), QAVFCameraBase::setActive(), AVFCameraSession::setActive(), QV4L2Camera::setActive(), QWindowsCamera::setActive(), QGstreamerCamera::setActive(), and AVFCameraSession::updateVideoInput().
|
inline |
Returns true if this QCameraDevice is different from other.
Definition at line 96 of file qcameradevice.h.
References operator==(), and other().
|
default |
Sets the QCameraDevice object to be equal to other.
bool QCameraDevice::operator== | ( | const QCameraDevice & | other | ) | const |
Returns true if this QCameraDevice is equal to other.
Definition at line 266 of file qcameradevice.cpp.
References QCameraDevicePrivate::description, QCameraDevicePrivate::id, other(), and QCameraDevicePrivate::position.
Referenced by operator!=().
Returns a list of resolutions that the camera can use to capture still images.
Definition at line 419 of file qcameradevice.cpp.
References QCameraDevicePrivate::photoResolutions.
QCameraDevice::Position QCameraDevice::position | ( | ) | const |
Definition at line 408 of file qcameradevice.cpp.
References QCameraDevicePrivate::position, and UnspecifiedPosition.
QList< QCameraFormat > QCameraDevice::videoFormats | ( | ) | const |
Definition at line 435 of file qcameradevice.cpp.
References QCameraDevicePrivate::videoFormats.
|
friend |
Definition at line 91 of file qcameradevice.h.
|
read |
Returns the rotation angle needed to compensate for the physical camera rotation of the camera compared to its native orientation. In other words, the property represents the clockwise angle through which the output image needs to be rotated to be upright on the device screen in its native orientation. Since correctionAngle is relative to the native orientation, this value does not change with altering the device orientation (portrait/landscape). The correction angle may be non-zero mostly on Android, where native and camera orientations are defined by the manufacturer.
Example with 90 degrees correctionAngle
Returns the rotation angle needed to compensate for the physical camera rotation of the camera compared to its native orientation. In other words, the property represents the clockwise angle through which the output image needs to be rotated to be upright on the device screen in its native orientation. Since correctionAngle is relative to the native orientation, this value does not change with altering the device orientation (portrait/landscape). The correction angle may be non-zero mostly on Android, where native and camera orientations are defined by the manufacturer.
Example with 90 degrees correctionAngle
Definition at line 53 of file qcameradevice.h.
|
read |
\qmlproperty string QtMultimedia::cameraDevice::description
Holds a human readable name of the camera.
Use this string to present the device to the user.
Returns the human-readable description of the camera.
Use this string to present the device to the user.
Definition at line 49 of file qcameradevice.h.
Referenced by QAndroidCamera::onCameraError(), and QAndroidCamera::onCaptureSessionFailed().
|
read |
\qmlproperty string QtMultimedia::cameraDevice::id
Holds he device id of the camera
This is a unique ID to identify the camera and may not be human-readable.
Returns the device id of the camera
This is a unique ID to identify the camera and may not be human-readable.
Definition at line 48 of file qcameradevice.h.
Referenced by QAVFCameraBase::device(), QWindowsMediaDeviceSession::setActive(), and QWasmCamera::setCamera().
|
read |
\qmlproperty bool QtMultimedia::cameraDevice::isDefault
Is true if this is the default camera device.
Returns true if this is the default camera device.
Definition at line 50 of file qcameradevice.h.
|
read |
\qmlproperty enumeration QtMultimedia::cameraDevice::position
Returns the physical position of the camera on the hardware system.
The returned value can be one of the following:
\value cameraDevice.UnspecifiedPosition The camera position is unspecified or unknown. \value cameraDevice.BackFace The camera is on the back face of the system hardware. For example on a mobile device, it means it is on the opposite side to that of the screen. \value cameraDevice.FrontFace The camera is on the front face of the system hardware. For example on a mobile device, it means it is on the same side as that of the screen.
Returns the physical position of the camera on the hardware system.
Definition at line 51 of file qcameradevice.h.
Referenced by camera_info(), QAndroidCamera::frameAvailable(), and overview_viewfinder_orientation().
|
read |
\qmlproperty CameraFormat QtMultimedia::cameraDevice::videoFormats
Holds the video formats supported by the camera.
Returns the video formats supported by the camera.
Definition at line 52 of file qcameradevice.h.
Referenced by AVFCamera::setCameraFormat(), QAVFCameraBase::setCameraFormat(), QV4L2Camera::setCameraFormat(), and QGstreamerCamera::setCameraFormat().