summaryrefslogtreecommitdiffstats
path: root/src/plugins/winrt/qwinrtcameracontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/winrt/qwinrtcameracontrol.cpp')
-rw-r--r--src/plugins/winrt/qwinrtcameracontrol.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/plugins/winrt/qwinrtcameracontrol.cpp b/src/plugins/winrt/qwinrtcameracontrol.cpp
index effddafe3..e2d5fa67d 100644
--- a/src/plugins/winrt/qwinrtcameracontrol.cpp
+++ b/src/plugins/winrt/qwinrtcameracontrol.cpp
@@ -101,15 +101,30 @@ HRESULT getMediaStreamResolutions(IMediaDeviceController *device,
ComPtr<IMediaEncodingProperties> properties;
hr = (*propertiesList)->GetAt(index, &properties);
Q_ASSERT_SUCCEEDED(hr);
- ComPtr<IVideoEncodingProperties> videoProperties;
- hr = properties.As(&videoProperties);
- Q_ASSERT_SUCCEEDED(hr);
- UINT32 width, height;
- hr = videoProperties->get_Width(&width);
- Q_ASSERT_SUCCEEDED(hr);
- hr = videoProperties->get_Height(&height);
- Q_ASSERT_SUCCEEDED(hr);
- resolutions->append(QSize(width, height));
+ if (type == MediaStreamType_VideoRecord || type == MediaStreamType_VideoPreview) {
+ ComPtr<IVideoEncodingProperties> videoProperties;
+ hr = properties.As(&videoProperties);
+ Q_ASSERT_SUCCEEDED(hr);
+ UINT32 width, height;
+ hr = videoProperties->get_Width(&width);
+ Q_ASSERT_SUCCEEDED(hr);
+ hr = videoProperties->get_Height(&height);
+ Q_ASSERT_SUCCEEDED(hr);
+ resolutions->append(QSize(width, height));
+ } else if (type == MediaStreamType_Photo) {
+ ComPtr<IImageEncodingProperties> imageProperties;
+ hr = properties.As(&imageProperties);
+ // Asking for Photo also returns video resolutions in addition
+ // We skip those, as we are only interested in image Type
+ if (FAILED(hr) || !imageProperties)
+ continue;
+ UINT32 width, height;
+ hr = imageProperties->get_Width(&width);
+ Q_ASSERT_SUCCEEDED(hr);
+ hr = imageProperties->get_Height(&height);
+ Q_ASSERT_SUCCEEDED(hr);
+ resolutions->append(QSize(width, height));
+ }
}
return resolutions->isEmpty() ? MF_E_INVALID_FORMAT : hr;
}