From patchwork Wed Jul 8 13:44:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 8681 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 662D8BD792 for ; Wed, 8 Jul 2020 13:44:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 326F961130; Wed, 8 Jul 2020 15:44:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rEOXAr2L"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A8A4610B2 for ; Wed, 8 Jul 2020 15:44:56 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3FFFB543; Wed, 8 Jul 2020 15:44:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594215895; bh=JDAJxfXLGtJPbEVjdYdSlJVDeaNsQrWH2gcz/01jXk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rEOXAr2LCzKlS4OGBh41Sd/yzw+FlAt6stwqnDsbUNpgVOw7PVRFO3JyhuQyR8gNe vIzEfMJujeSZIktmpHc2KImG2jgTzJhmivNolN8/C2MhCfkQhcUSydBS9Ys5cpqsMR wJdorjTFQ9llHAaDq72mAM592zJG7HoZCgQy5Poc= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Jul 2020 22:44:08 +0900 Message-Id: <20200708134417.67747-13-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200708134417.67747-1-paul.elder@ideasonboard.com> References: <20200708134417.67747-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 12/21] libcamera: pipeline: raspberrypi: Filter out unsupported formats X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Unsupported formats should not be added to the configuration when generating the configuration. Filter them out. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- Cosmetic change in v4 No change in v3 --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index cbb6f1c..1822ac9 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -569,13 +569,11 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, /* Translate the V4L2PixelFormat to PixelFormat. */ std::map> deviceFormats; - std::transform(fmts.begin(), fmts.end(), std::inserter(deviceFormats, deviceFormats.end()), - [&](const decltype(fmts)::value_type &format) { - return decltype(deviceFormats)::value_type{ - format.first.toPixelFormat(), - format.second - }; - }); + for (const auto &format : fmts) { + PixelFormat pixelFormat = format.first.toPixelFormat(); + if (pixelFormat.isValid()) + deviceFormats[pixelFormat] = format.second; + } /* Add the stream format based on the device node used for the use case. */ StreamFormats formats(deviceFormats);