summaryrefslogtreecommitdiff
path: root/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/avfoundation/camera/avfcameraserviceplugin.mm')
-rw-r--r--src/plugins/avfoundation/camera/avfcameraserviceplugin.mm18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm b/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm
index 414a84751..99966f09b 100644
--- a/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm
+++ b/src/plugins/avfoundation/camera/avfcameraserviceplugin.mm
@@ -71,18 +71,26 @@ void AVFServicePlugin::release(QMediaService *service)
QByteArray AVFServicePlugin::defaultDevice(const QByteArray &service) const
{
- if (service == Q_MEDIASERVICE_CAMERA)
- return AVFCameraSession::defaultCameraDevice();
+ if (service == Q_MEDIASERVICE_CAMERA) {
+ int i = AVFCameraSession::defaultCameraIndex();
+ if (i != -1)
+ return AVFCameraSession::availableCameraDevices().at(i).deviceId;
+ }
return QByteArray();
}
QList<QByteArray> AVFServicePlugin::devices(const QByteArray &service) const
{
- if (service == Q_MEDIASERVICE_CAMERA)
- return AVFCameraSession::availableCameraDevices();
+ QList<QByteArray> devs;
+
+ if (service == Q_MEDIASERVICE_CAMERA) {
+ const QList<AVFCameraInfo> &cameras = AVFCameraSession::availableCameraDevices();
+ Q_FOREACH (const AVFCameraInfo &info, cameras)
+ devs.append(info.deviceId);
+ }
- return QList<QByteArray>();
+ return devs;
}
QString AVFServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)