summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2022-08-23 06:54:48 +0200
committerGitHub <noreply@github.com>2022-08-23 06:54:48 +0200
commitdb2335e2f8bad8090b4dfd77d1e6d33297f590df (patch)
tree3da094c3ec6ff3d161f4bcc9cfc2d5c734a84aaa /src
parentMerge pull request #8801 from german77/small (diff)
downloadyuzu-db2335e2f8bad8090b4dfd77d1e6d33297f590df.tar
yuzu-db2335e2f8bad8090b4dfd77d1e6d33297f590df.tar.gz
yuzu-db2335e2f8bad8090b4dfd77d1e6d33297f590df.tar.bz2
yuzu-db2335e2f8bad8090b4dfd77d1e6d33297f590df.tar.lz
yuzu-db2335e2f8bad8090b4dfd77d1e6d33297f590df.tar.xz
yuzu-db2335e2f8bad8090b4dfd77d1e6d33297f590df.tar.zst
yuzu-db2335e2f8bad8090b4dfd77d1e6d33297f590df.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/bootmanager.cpp20
-rw-r--r--src/yuzu/configuration/configure_camera.cpp20
2 files changed, 38 insertions, 2 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index c262d0a2b..d3fbdb09d 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -815,6 +815,12 @@ void GRenderWindow::InitializeCamera() {
if (Settings::values.ir_sensor_device.GetValue() == cameraInfo.deviceName().toStdString() ||
Settings::values.ir_sensor_device.GetValue() == "Auto") {
camera = std::make_unique<QCamera>(cameraInfo);
+ if (!camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder) &&
+ !camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
+ LOG_ERROR(Frontend,
+ "Camera doesn't support CaptureViewfinder or CaptureStillImage");
+ continue;
+ }
camera_found = true;
break;
}
@@ -825,10 +831,22 @@ void GRenderWindow::InitializeCamera() {
}
camera_capture = std::make_unique<QCameraImageCapture>(camera.get());
+
+ if (!camera_capture->isCaptureDestinationSupported(
+ QCameraImageCapture::CaptureDestination::CaptureToBuffer)) {
+ LOG_ERROR(Frontend, "Camera doesn't support saving to buffer");
+ return;
+ }
+
+ camera_capture->setCaptureDestination(QCameraImageCapture::CaptureDestination::CaptureToBuffer);
connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this,
&GRenderWindow::OnCameraCapture);
camera->unload();
- camera->setCaptureMode(QCamera::CaptureViewfinder);
+ if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder)) {
+ camera->setCaptureMode(QCamera::CaptureViewfinder);
+ } else if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
+ camera->setCaptureMode(QCamera::CaptureStillImage);
+ }
camera->load();
camera->start();
diff --git a/src/yuzu/configuration/configure_camera.cpp b/src/yuzu/configuration/configure_camera.cpp
index 73cdcf3f2..2a61de2a1 100644
--- a/src/yuzu/configuration/configure_camera.cpp
+++ b/src/yuzu/configuration/configure_camera.cpp
@@ -42,6 +42,12 @@ void ConfigureCamera::PreviewCamera() {
LOG_INFO(Frontend, "Selected Camera {} {}", cameraInfo.description().toStdString(),
cameraInfo.deviceName().toStdString());
camera = std::make_unique<QCamera>(cameraInfo);
+ if (!camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder) &&
+ !camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
+ LOG_ERROR(Frontend,
+ "Camera doesn't support CaptureViewfinder or CaptureStillImage");
+ continue;
+ }
camera_found = true;
break;
}
@@ -57,10 +63,22 @@ void ConfigureCamera::PreviewCamera() {
}
camera_capture = std::make_unique<QCameraImageCapture>(camera.get());
+
+ if (!camera_capture->isCaptureDestinationSupported(
+ QCameraImageCapture::CaptureDestination::CaptureToBuffer)) {
+ LOG_ERROR(Frontend, "Camera doesn't support saving to buffer");
+ return;
+ }
+
+ camera_capture->setCaptureDestination(QCameraImageCapture::CaptureDestination::CaptureToBuffer);
connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this,
&ConfigureCamera::DisplayCapturedFrame);
camera->unload();
- camera->setCaptureMode(QCamera::CaptureViewfinder);
+ if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder)) {
+ camera->setCaptureMode(QCamera::CaptureViewfinder);
+ } else if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
+ camera->setCaptureMode(QCamera::CaptureStillImage);
+ }
camera->load();
camera->start();