summaryrefslogtreecommitdiff
path: root/src/qcam/main_window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcam/main_window.cpp')
-rw-r--r--src/qcam/main_window.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index b13660bc..56573269 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -297,6 +297,19 @@ int MainWindow::startCapture()
}
}
+ /* Use a format supported by the viewfinder if available. */
+ std::vector<PixelFormat> formats = cfg.formats().pixelformats();
+ for (const PixelFormat &format : viewfinder_->nativeFormats()) {
+ auto match = std::find_if(formats.begin(), formats.end(),
+ [&](const PixelFormat &f) {
+ return f == format;
+ });
+ if (match != formats.end()) {
+ cfg.pixelFormat = format;
+ break;
+ }
+ }
+
CameraConfiguration::Status validation = config_->validate();
if (validation == CameraConfiguration::Invalid) {
qWarning() << "Failed to create valid camera configuration";