From patchwork Wed Feb 6 06:08:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 533 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DA08161047 for ; Wed, 6 Feb 2019 07:08:27 +0100 (CET) Received: from pendragon.ideasonboard.com (d51A4137F.access.telenet.be [81.164.19.127]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 865C22D9 for ; Wed, 6 Feb 2019 07:08:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1549433307; bh=uPiFFS2vvE9G9XTdMsPnGoZdY/fhrPgCLtxrFCH/fBo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HMLSff5Cbtrg+8dc92xy49Qyl4/bHksRbqWqvSjfIY2QbYVNsi7H/vp9ACXCoSKWQ RkuRCoG6RqlJ9KSD/vRV0RLUsVtSjgtc2YtCjUFMoTWJJAt+IR3WWhlBd6I7EhfRYJ ZMa4P4rGrMelOcfbOdOZq3FNYsiQieEO+xFdEIao= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 6 Feb 2019 08:08:09 +0200 Message-Id: <20190206060818.13907-19-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190206060818.13907-1-laurent.pinchart@ideasonboard.com> References: <20190206060818.13907-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 18/27] libcamera: camera: Cache the stream configuration in the stream object X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2019 06:08:29 -0000 From: Niklas Söderlund The API towards the application and pipeline handler can be simplified if the camera caches which streams have been selected and their respective configuration. Signed-off-by: Niklas Söderlund Signed-off-by: Jacopo Mondi Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart --- include/libcamera/camera.h | 1 + src/libcamera/camera.cpp | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index 36bf1cbb215b..1c0ee07c2a22 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -55,6 +55,7 @@ private: std::shared_ptr pipe_; std::string name_; std::vector streams_; + std::vector activeStreams_; bool acquired_; bool disconnected_; diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 62291d2c9e6c..3f7b805b09a2 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -253,7 +253,20 @@ int Camera::configureStreams(std::map &config) return -EINVAL; } - return pipe_->configureStreams(this, config); + ret = pipe_->configureStreams(this, config); + if (ret) + return ret; + + activeStreams_.clear(); + for (auto const &iter : config) { + Stream *stream = iter.first; + const StreamConfiguration &cfg = iter.second; + + stream->configuration_ = cfg; + activeStreams_.push_back(stream); + } + + return 0; } int Camera::exclusiveAccess()