[PATCH v1] apps: qcam: Simplify `PixelFormat` search
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Mar 3 21:59:19 CET 2025
Hi Barnabás,
Thank you for the patch.
On Mon, Mar 03, 2025 at 08:33:39PM +0100, Barnabás Pőcze wrote:
> 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>
Reviewed-by: Laurent Pinchart <laurent.pinchart 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;
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list