diff options
-rw-r--r-- | src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.h | 1 | ||||
-rw-r--r-- | src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.mm | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.h b/src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.h index 28188e274..2f499f0ab 100644 --- a/src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.h +++ b/src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.h @@ -69,6 +69,7 @@ private: QString m_activeInput; bool m_dirty; + QString m_defaultDevice; QStringList m_devices; QMap<QString, QString> m_deviceDescriptions; }; diff --git a/src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.mm b/src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.mm index 4a2f068f5..51a4eb4e6 100644 --- a/src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.mm +++ b/src/plugins/avfoundation/camera/avfaudioinputselectorcontrol.mm @@ -60,8 +60,11 @@ AVFAudioInputSelectorControl::AVFAudioInputSelectorControl(AVFCameraService *ser QString::fromUtf8([[device localizedName] UTF8String])); } - if (m_devices.size() > 0) - m_activeInput = m_devices.first(); + AVCaptureDevice *defaultDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio]; + if (defaultDevice) { + m_defaultDevice = QString::fromUtf8([defaultDevice.uniqueID UTF8String]); + m_activeInput = m_defaultDevice; + } } AVFAudioInputSelectorControl::~AVFAudioInputSelectorControl() @@ -80,7 +83,7 @@ QString AVFAudioInputSelectorControl::inputDescription(const QString &name) cons QString AVFAudioInputSelectorControl::defaultInput() const { - return m_devices.size() > 0 ? m_devices.first() : QString(); + return m_defaultDevice; } QString AVFAudioInputSelectorControl::activeInput() const |