From 7ea64b53ad42be73be71fd35721aa97bdb5f6331 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 8 Jul 2024 18:10:01 +0200 Subject: [PATCH] Qt: Fix camera id and format when default is selected --- rpcs3/rpcs3qt/qt_camera_handler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpcs3/rpcs3qt/qt_camera_handler.cpp b/rpcs3/rpcs3qt/qt_camera_handler.cpp index f522cbf315..00b18f8885 100644 --- a/rpcs3/rpcs3qt/qt_camera_handler.cpp +++ b/rpcs3/rpcs3qt/qt_camera_handler.cpp @@ -298,13 +298,16 @@ void qt_camera_handler::update_camera_settings() // Update camera if possible. We can only do this if it is already loaded. if (m_camera && m_camera->isAvailable()) { + // Get camera id. Use camera id of Qt default if the "Default" camera is selected. + const std::string camera_id = (m_camera_id == g_cfg.io.camera_id.def) ? QMediaDevices::defaultVideoInput().id().toStdString() : m_camera_id; + // Load selected settings from config file bool success = false; - cfg_camera::camera_setting cfg_setting = g_cfg_camera.get_camera_setting(m_camera_id, success); + cfg_camera::camera_setting cfg_setting = g_cfg_camera.get_camera_setting(camera_id, success); if (success) { - camera_log.notice("Found config entry for camera \"%s\"", m_camera_id); + camera_log.notice("Found config entry for camera \"%s\" (m_camera_id='%s')", camera_id, m_camera_id); // List all available settings and choose the proper value if possible. const double epsilon = 0.001;