diff options
author | Liang Qi <liang.qi@qt.io> | 2016-06-29 16:11:26 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-06-30 07:33:04 +0200 |
commit | 27681cba4695355f2a0a6b01b85c429186d11a34 (patch) | |
tree | f11df2ec52d983b552f2e1b673e0845bc7e3ef05 /src/plugins/winrt | |
parent | f7a93757c709e8b2902bc4707752edb8649d009c (diff) | |
parent | bc53bb7913bbf68519508a0ab76c513335b3e5bb (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Blacklisted a few functions in tst_QAudioInput.
Conflicts:
.qmake.conf
src/plugins/avfoundation/camera/avfcameracontrol.mm
src/plugins/avfoundation/camera/avfcameraservice.h
src/plugins/avfoundation/camera/avfcameraservice.mm
src/plugins/avfoundation/camera/avfcamerasession.h
src/plugins/avfoundation/camera/avfcamerasession.mm
src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.h
src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
src/plugins/avfoundation/camera/avfimagecapturecontrol.mm
src/plugins/avfoundation/camera/avfimageencodercontrol.mm
src/plugins/avfoundation/camera/avfmediarecordercontrol.h
src/plugins/avfoundation/camera/avfmediarecordercontrol.mm
tests/auto/integration/qaudioinput/BLACKLIST
Task-number: QTBUG-54459
Task-number: QTBUG-49736
Change-Id: I3a1fe8cef50b44d5c2785aaf4cf69fe3f16728e6
Diffstat (limited to 'src/plugins/winrt')
-rw-r--r-- | src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp | 11 | ||||
-rw-r--r-- | src/plugins/winrt/qwinrtcameracontrol.cpp | 90 |
2 files changed, 61 insertions, 40 deletions
diff --git a/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp b/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp index 7dd2e6557..f109dc4cb 100644 --- a/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp +++ b/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp @@ -38,6 +38,7 @@ #include <QtCore/qfunctions_winrt.h> #include <QtCore/QGlobalStatic> +#include <QtCore/QLoggingCategory> #include <QtCore/QMetaMethod> #include <QtCore/QPointer> #include <QtGui/QOpenGLContext> @@ -58,6 +59,8 @@ using namespace Microsoft::WRL; QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcMMVideoRender, "qt.mm.videorender") + #define BREAK_IF_FAILED(msg) RETURN_IF_FAILED(msg, break) #define CONTINUE_IF_FAILED(msg) RETURN_IF_FAILED(msg, continue) @@ -66,6 +69,7 @@ struct QWinRTVideoRendererControlGlobal { QWinRTVideoRendererControlGlobal() { + qCDebug(lcMMVideoRender) << __FUNCTION__; HRESULT hr; D3D_FEATURE_LEVEL featureLevels[] = @@ -202,6 +206,7 @@ ID3D11Device *QWinRTAbstractVideoRendererControl::d3dDevice() // This is required so that subclasses can stop the render thread before deletion void QWinRTAbstractVideoRendererControl::shutdown() { + qCDebug(lcMMVideoRender) << __FUNCTION__; Q_D(QWinRTAbstractVideoRendererControl); if (d->renderThread.isRunning()) { d->renderThread.requestInterruption(); @@ -212,6 +217,7 @@ void QWinRTAbstractVideoRendererControl::shutdown() QWinRTAbstractVideoRendererControl::QWinRTAbstractVideoRendererControl(const QSize &size, QObject *parent) : QVideoRendererControl(parent), d_ptr(new QWinRTAbstractVideoRendererControlPrivate) { + qCDebug(lcMMVideoRender) << __FUNCTION__; Q_D(QWinRTAbstractVideoRendererControl); d->format = QVideoSurfaceFormat(size, QVideoFrame::Format_BGRA32, @@ -232,6 +238,7 @@ QWinRTAbstractVideoRendererControl::QWinRTAbstractVideoRendererControl(const QSi QWinRTAbstractVideoRendererControl::~QWinRTAbstractVideoRendererControl() { + qCDebug(lcMMVideoRender) << __FUNCTION__; Q_D(QWinRTAbstractVideoRendererControl); CriticalSectionLocker locker(&d->mutex); shutdown(); @@ -253,6 +260,7 @@ void QWinRTAbstractVideoRendererControl::setSurface(QAbstractVideoSurface *surfa void QWinRTAbstractVideoRendererControl::syncAndRender() { + qCDebug(lcMMVideoRender) << __FUNCTION__; Q_D(QWinRTAbstractVideoRendererControl); QThread *currentThread = QThread::currentThread(); @@ -334,6 +342,7 @@ void QWinRTAbstractVideoRendererControl::setScanLineDirection(QVideoSurfaceForma void QWinRTAbstractVideoRendererControl::setActive(bool active) { + qCDebug(lcMMVideoRender) << __FUNCTION__ << active; Q_D(QWinRTAbstractVideoRendererControl); if (d->active == active) @@ -351,7 +360,7 @@ void QWinRTAbstractVideoRendererControl::setActive(bool active) return; } - d->renderThread.requestInterruption(); + shutdown(); if (d->surface && d->surface->isActive()) d->surface->stop(); } diff --git a/src/plugins/winrt/qwinrtcameracontrol.cpp b/src/plugins/winrt/qwinrtcameracontrol.cpp index 856549438..390364eb8 100644 --- a/src/plugins/winrt/qwinrtcameracontrol.cpp +++ b/src/plugins/winrt/qwinrtcameracontrol.cpp @@ -1124,46 +1124,54 @@ bool QWinRTCameraControl::setFocus(QCameraFocus::FocusModes modes) if (d->status == QCamera::UnloadedStatus) return false; - ComPtr<IFocusSettings> focusSettings; - ComPtr<IInspectable> focusSettingsObject; - HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Media_Devices_FocusSettings).Get(), &focusSettingsObject); - Q_ASSERT_SUCCEEDED(hr); - hr = focusSettingsObject.As(&focusSettings); - Q_ASSERT_SUCCEEDED(hr); - FocusMode mode; - if (modes.testFlag(QCameraFocus::ContinuousFocus)) { - mode = FocusMode_Continuous; - } else if (modes.testFlag(QCameraFocus::AutoFocus) - || modes.testFlag(QCameraFocus::MacroFocus) - || modes.testFlag(QCameraFocus::InfinityFocus)) { - // The Macro and infinity focus modes are only supported in auto focus mode on WinRT. - // QML camera focus doesn't support combined focus flags settings. In the case of macro - // and infinity Focus modes, the auto focus setting is applied. - mode = FocusMode_Single; - } else { - emit error(QCamera::NotSupportedFeatureError, QStringLiteral("Unsupported camera focus modes.")); - return false; - } - hr = focusSettings->put_Mode(mode); - Q_ASSERT_SUCCEEDED(hr); - AutoFocusRange range = AutoFocusRange_Normal; - if (modes.testFlag(QCameraFocus::MacroFocus)) - range = AutoFocusRange_Macro; - else if (modes.testFlag(QCameraFocus::InfinityFocus)) - range = AutoFocusRange_FullRange; - hr = focusSettings->put_AutoFocusRange(range); - Q_ASSERT_SUCCEEDED(hr); - hr = focusSettings->put_WaitForFocus(true); - Q_ASSERT_SUCCEEDED(hr); - hr = focusSettings->put_DisableDriverFallback(false); - Q_ASSERT_SUCCEEDED(hr); + bool result = false; + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([modes, &result, d, this]() { + ComPtr<IFocusSettings> focusSettings; + ComPtr<IInspectable> focusSettingsObject; + HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Media_Devices_FocusSettings).Get(), &focusSettingsObject); + Q_ASSERT_SUCCEEDED(hr); + hr = focusSettingsObject.As(&focusSettings); + Q_ASSERT_SUCCEEDED(hr); + FocusMode mode; + if (modes.testFlag(QCameraFocus::ContinuousFocus)) { + mode = FocusMode_Continuous; + } else if (modes.testFlag(QCameraFocus::AutoFocus) + || modes.testFlag(QCameraFocus::MacroFocus) + || modes.testFlag(QCameraFocus::InfinityFocus)) { + // The Macro and infinity focus modes are only supported in auto focus mode on WinRT. + // QML camera focus doesn't support combined focus flags settings. In the case of macro + // and infinity Focus modes, the auto focus setting is applied. + mode = FocusMode_Single; + } else { + emit error(QCamera::NotSupportedFeatureError, QStringLiteral("Unsupported camera focus modes.")); + result = false; + return S_OK; + } + hr = focusSettings->put_Mode(mode); + Q_ASSERT_SUCCEEDED(hr); + AutoFocusRange range = AutoFocusRange_Normal; + if (modes.testFlag(QCameraFocus::MacroFocus)) + range = AutoFocusRange_Macro; + else if (modes.testFlag(QCameraFocus::InfinityFocus)) + range = AutoFocusRange_FullRange; + hr = focusSettings->put_AutoFocusRange(range); + Q_ASSERT_SUCCEEDED(hr); + hr = focusSettings->put_WaitForFocus(true); + Q_ASSERT_SUCCEEDED(hr); + hr = focusSettings->put_DisableDriverFallback(false); + Q_ASSERT_SUCCEEDED(hr); - ComPtr<IFocusControl2> focusControl2; - hr = d->focusControl.As(&focusControl2); + ComPtr<IFocusControl2> focusControl2; + hr = d->focusControl.As(&focusControl2); + Q_ASSERT_SUCCEEDED(hr); + hr = focusControl2->Configure(focusSettings.Get()); + result = SUCCEEDED(hr); + RETURN_OK_IF_FAILED("Failed to configure camera focus control"); + return S_OK; + }); Q_ASSERT_SUCCEEDED(hr); - hr = focusControl2->Configure(focusSettings.Get()); - RETURN_FALSE_IF_FAILED("Failed to configure camera focus control"); - return true; + Q_UNUSED(hr); // Silence release build + return result; } bool QWinRTCameraControl::setFocusPoint(const QPointF &focusPoint) @@ -1227,7 +1235,11 @@ bool QWinRTCameraControl::focus() if (!d->focusControl || status == AsyncStatus::Started) return false; - hr = d->focusControl->FocusAsync(&d->focusOperation); + QEventDispatcherWinRT::runOnXamlThread([&d, &hr]() { + hr = d->focusControl->FocusAsync(&d->focusOperation); + Q_ASSERT_SUCCEEDED(hr); + return S_OK; + }); const long errorCode = HRESULT_CODE(hr); if (errorCode == ERROR_OPERATION_IN_PROGRESS || errorCode == ERROR_WRITE_PROTECT) { |