[PATCH v1] apps: qcam: Simplify `PixelFormat` search

Barnabás Pőcze barnabas.pocze at ideasonboard.com
Mon Mar 3 20:33:39 CET 2025


Since `PixelFormat` has `operator==()`, `std::find()` can be used
directly, so do that to simplify.

Signed-off-by: Barnabás Pőcze <barnabas.pocze at ideasonboard.com>
---
 src/apps/qcam/main_window.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
index 3880a846e..d2ccbd231 100644
--- a/src/apps/qcam/main_window.cpp
+++ b/src/apps/qcam/main_window.cpp
@@ -386,10 +386,7 @@ int MainWindow::startCapture()
 	/* Use a format supported by the viewfinder if available. */
 	std::vector<PixelFormat> formats = vfConfig.formats().pixelformats();
 	for (const PixelFormat &format : viewfinder_->nativeFormats()) {
-		auto match = std::find_if(formats.begin(), formats.end(),
-					  [&](const PixelFormat &f) {
-						  return f == format;
-					  });
+		auto match = std::find(formats.begin(), formats.end(), format);
 		if (match != formats.end()) {
 			vfConfig.pixelFormat = format;
 			break;
-- 
2.48.1



More information about the libcamera-devel mailing list