New QCameraInfo class.
The class allows to get the list of available cameras on the system as well as getting some static information about them such as their unique ID, display name, physical position and sensor orientation. This makes QCamera::availableDevices() and QCamera::deviceDescription() obsolete. This patch contains the API, documentation and auto-tests but not the actual implementation by each backend (except for retrieving the default camera device). [ChangeLog][QtMultimedia] Added new QCameraInfo class [ChangeLog][QtMultimedia] QCamera: availableDevices() and deviceDescription() are deprecated, use QCameraInfo instead Change-Id: I64fd65729ab26a789468979ed5444ee90bb82cd0 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
d964388b38
commit
b28ee24628
@@ -50,11 +50,17 @@ AVFVideoDeviceControl::AVFVideoDeviceControl(AVFCameraService *service, QObject
|
||||
, m_service(service)
|
||||
, m_selectedDevice(0)
|
||||
, m_dirty(true)
|
||||
, m_defaultDevice(0)
|
||||
{
|
||||
AVCaptureDevice *defaultDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
|
||||
NSArray *videoDevices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
|
||||
int i = 0;
|
||||
for (AVCaptureDevice *device in videoDevices) {
|
||||
m_devices << QString::fromUtf8([[device uniqueID] UTF8String]);
|
||||
m_deviceDescriptions << QString::fromUtf8([[device localizedName] UTF8String]);
|
||||
if (defaultDevice && [[device uniqueID] isEqualToString:[defaultDevice uniqueID]])
|
||||
m_defaultDevice = i;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +85,7 @@ QString AVFVideoDeviceControl::deviceDescription(int index) const
|
||||
|
||||
int AVFVideoDeviceControl::defaultDevice() const
|
||||
{
|
||||
return 0;
|
||||
return m_defaultDevice;
|
||||
}
|
||||
|
||||
int AVFVideoDeviceControl::selectedDevice() const
|
||||
|
||||
Reference in New Issue
Block a user