apps: qcam: Simplify PixelFormat search

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

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze 2025-02-05 17:58:30 +01:00
parent 314ecb5400
commit bb7f702b48

View file

@ -386,10 +386,7 @@ int MainWindow::startCapture()
/* Use a format supported by the viewfinder if available. */ /* Use a format supported by the viewfinder if available. */
std::vector<PixelFormat> formats = vfConfig.formats().pixelformats(); std::vector<PixelFormat> formats = vfConfig.formats().pixelformats();
for (const PixelFormat &format : viewfinder_->nativeFormats()) { for (const PixelFormat &format : viewfinder_->nativeFormats()) {
auto match = std::find_if(formats.begin(), formats.end(), auto match = std::find(formats.begin(), formats.end(), format);
[&](const PixelFormat &f) {
return f == format;
});
if (match != formats.end()) { if (match != formats.end()) {
vfConfig.pixelFormat = format; vfConfig.pixelFormat = format;
break; break;