From 21bdc03908369098d144b3b6143fb6fb5192bc1d Mon Sep 17 00:00:00 2001 From: Valentin Vanelslande Date: Fri, 21 Sep 2018 18:28:46 -0500 Subject: [PATCH 1/3] Force camera pixel format to RGB565 on Linux --- src/citra_qt/camera/qt_multimedia_camera.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/citra_qt/camera/qt_multimedia_camera.cpp b/src/citra_qt/camera/qt_multimedia_camera.cpp index e18508c24a..dabccac94f 100644 --- a/src/citra_qt/camera/qt_multimedia_camera.cpp +++ b/src/citra_qt/camera/qt_multimedia_camera.cpp @@ -172,6 +172,9 @@ void QtMultimediaCameraHandler::CreateCamera(const std::string& camera_name) { } settings.setMinimumFrameRate(30); settings.setMaximumFrameRate(30); +#ifdef __linux__ + settings.setPixelFormat(QVideoFrame::PixelFormat::Format_RGB565); +#endif camera->setViewfinder(&camera_surface); camera->load(); } From 19ef115f50710c0cd9708d69dfcc66ac77d77125 Mon Sep 17 00:00:00 2001 From: Valentin Vanelslande Date: Fri, 5 Oct 2018 07:22:26 -0500 Subject: [PATCH 2/3] Address comment --- src/citra_qt/camera/qt_multimedia_camera.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/citra_qt/camera/qt_multimedia_camera.cpp b/src/citra_qt/camera/qt_multimedia_camera.cpp index dabccac94f..5c0b73f2b3 100644 --- a/src/citra_qt/camera/qt_multimedia_camera.cpp +++ b/src/citra_qt/camera/qt_multimedia_camera.cpp @@ -172,9 +172,12 @@ void QtMultimediaCameraHandler::CreateCamera(const std::string& camera_name) { } settings.setMinimumFrameRate(30); settings.setMaximumFrameRate(30); -#ifdef __linux__ - settings.setPixelFormat(QVideoFrame::PixelFormat::Format_RGB565); -#endif + if (camera->supportedViewfinderPixelFormats().isEmpty()) { + // The gstreamer plugin (used on linux systems) returns an empty list on querying supported + // viewfinder pixel formats, and will not work without expliciting setting it to some value, + // so we are defaulting to RGB565 here which should be fairly widely supported. + settings.setPixelFormat(QVideoFrame::PixelFormat::Format_RGB565); + } camera->setViewfinder(&camera_surface); camera->load(); } From 53afb1cc2d6888a3732f13ef2d5838b28ff80994 Mon Sep 17 00:00:00 2001 From: Valentin Vanelslande Date: Fri, 5 Oct 2018 09:27:16 -0500 Subject: [PATCH 3/3] Move if --- src/citra_qt/camera/qt_multimedia_camera.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/camera/qt_multimedia_camera.cpp b/src/citra_qt/camera/qt_multimedia_camera.cpp index 5c0b73f2b3..1c9d07f76e 100644 --- a/src/citra_qt/camera/qt_multimedia_camera.cpp +++ b/src/citra_qt/camera/qt_multimedia_camera.cpp @@ -172,14 +172,14 @@ void QtMultimediaCameraHandler::CreateCamera(const std::string& camera_name) { } settings.setMinimumFrameRate(30); settings.setMaximumFrameRate(30); + camera->setViewfinder(&camera_surface); + camera->load(); if (camera->supportedViewfinderPixelFormats().isEmpty()) { // The gstreamer plugin (used on linux systems) returns an empty list on querying supported // viewfinder pixel formats, and will not work without expliciting setting it to some value, // so we are defaulting to RGB565 here which should be fairly widely supported. settings.setPixelFormat(QVideoFrame::PixelFormat::Format_RGB565); } - camera->setViewfinder(&camera_surface); - camera->load(); } void QtMultimediaCameraHandler::StopCamera() {