diff options
author | Andrew Knight <andrew.knight@digia.com> | 2014-12-05 10:26:32 +0200 |
---|---|---|
committer | Andrew Knight <andrew.knight@theqtcompany.com> | 2014-12-11 16:48:54 +0100 |
commit | 1027215920ded41b0e381b0ab740fb8a75c66a62 (patch) | |
tree | f476b98abd0855f4bd06be548d081e2251990642 | |
parent | 791febc1d3bfc1ec39f4379214ec5fb473ddaeb5 (diff) | |
download | qtmultimedia-1027215920ded41b0e381b0ab740fb8a75c66a62.tar.gz |
winrt: Fix encoding properties
These should match the capture mode. Additionally, there was a semantic
error preventing the encoding properties from being properly selected.
This fixes a bug in which the viewfinder was receiving frames too large
for display as an OpenGL texture.
Task-number: QTBUG-41065
Change-Id: Ia82c8f44bba1692a219edc5f9d78fc76c3d8a4ba
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
-rw-r--r-- | src/plugins/winrt/qwinrtcameracontrol.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/winrt/qwinrtcameracontrol.cpp b/src/plugins/winrt/qwinrtcameracontrol.cpp index f4e57b438..3c51de5a4 100644 --- a/src/plugins/winrt/qwinrtcameracontrol.cpp +++ b/src/plugins/winrt/qwinrtcameracontrol.cpp @@ -711,7 +711,20 @@ HRESULT QWinRTCameraControl::initialize() hr = videoDeviceController.As(&deviceController); Q_ASSERT_SUCCEEDED(hr); ComPtr<IVectorView<IMediaEncodingProperties *>> encodingPropertiesList; - hr = deviceController->GetAvailableMediaStreamProperties(MediaStreamType_Photo, &encodingPropertiesList); + MediaStreamType mediaStreamType; + switch (d->captureMode) { + default: + case QCamera::CaptureViewfinder: + mediaStreamType = MediaStreamType_VideoPreview; + break; + case QCamera::CaptureStillImage: + mediaStreamType = MediaStreamType_Photo; + break; + case QCamera::CaptureVideo: + mediaStreamType = MediaStreamType_VideoRecord; + break; + } + hr = deviceController->GetAvailableMediaStreamProperties(mediaStreamType, &encodingPropertiesList); Q_ASSERT_SUCCEEDED(hr); d->size = QSize(); @@ -724,12 +737,12 @@ HRESULT QWinRTCameraControl::initialize() hr = encodingPropertiesList->GetAt(i, &properties); Q_ASSERT_SUCCEEDED(hr); ComPtr<IVideoEncodingProperties> videoProperties; - hr = properties.As(&videoEncodingProperties); + hr = properties.As(&videoProperties); Q_ASSERT_SUCCEEDED(hr); UINT32 width, height; - hr = videoEncodingProperties->get_Width(&width); + hr = videoProperties->get_Width(&width); Q_ASSERT_SUCCEEDED(hr); - hr = videoEncodingProperties->get_Height(&height); + hr = videoProperties->get_Height(&height); Q_ASSERT_SUCCEEDED(hr); // Choose the highest-quality format if (int(width * height) > d->size.width() * d->size.height()) { |