From patchwork Wed Feb 6 06:08:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 529 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DF08961031 for ; Wed, 6 Feb 2019 07:08:26 +0100 (CET) Received: from pendragon.ideasonboard.com (d51A4137F.access.telenet.be [81.164.19.127]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5C5BE2D8 for ; Wed, 6 Feb 2019 07:08:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1549433306; bh=jgbIrKU/oRcUzCL3uuRTA+xd+WvGgv6wQGZZkBzYs7A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TyBOVN25Fd3HZs2XAQoaNbHTCcDQEybGgYErUvaiXQMkwEijE06VEapfzmh8x1/dU ac9nGrQsyqd1SN5Q8T2+mXRd4lQwws8DqlPssjKW/NUwb7OEhfYI9h5zXR8417mRhl vy0LHhTuxqx1hho2eWixHIDdh0zcpfHGH8CqrrDg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 6 Feb 2019 08:08:05 +0200 Message-Id: <20190206060818.13907-15-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 14/27] libcamera: stream: Add stream configuration to 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 Add a cache of the active stream configuration to the stream object. This cache is to be updated from the Camera object and can be accessed read only from both the application and pipeline handlers. Signed-off-by: Niklas Söderlund Signed-off-by: Jacopo Mondi Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart --- include/libcamera/stream.h | 20 ++++++++---- src/libcamera/stream.cpp | 62 +++++++++++++++++++++----------------- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 111f2c933efa..3e8e83a2ff24 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -11,23 +11,31 @@ namespace libcamera { +class Camera; + +struct StreamConfiguration { + unsigned int width; + unsigned int height; + unsigned int pixelFormat; + + unsigned int bufferCount; +}; + class Stream final { public: Stream(); BufferPool &bufferPool() { return bufferPool_; } + const StreamConfiguration &configuration() const { return configuration_; } private: + friend Camera; + BufferPool bufferPool_; + StreamConfiguration configuration_; }; -struct StreamConfiguration { - unsigned int width; - unsigned int height; - unsigned int pixelFormat; - unsigned int bufferCount; -}; } /* namespace libcamera */ diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index b6238946a8d5..c4943c91b2e6 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -29,6 +29,37 @@ namespace libcamera { +/** + * \struct StreamConfiguration + * \brief Configuration parameters for a stream + * + * The StreamConfiguration structure models all information which can be + * configured for a single video stream. + */ + +/** + * \var StreamConfiguration::width + * \brief Stream width in pixels + */ + +/** + * \var StreamConfiguration::height + * \brief Stream height in pixels + */ + +/** + * \var StreamConfiguration::pixelFormat + * \brief Stream pixel format + * + * This is a little endian four character code representation of the pixel + * format described in V4L2 using the V4L2_PIX_FMT_* definitions. + */ + +/** + * \var StreamConfiguration::bufferCount + * \brief Requested number of buffers to allocate for the stream + */ + /** * \class Stream * \brief Video stream for a camera @@ -66,34 +97,9 @@ Stream::Stream() */ /** - * \struct StreamConfiguration - * \brief Configuration parameters for a stream - * - * The StreamConfiguration structure models all information which can be - * configured for a single video stream. - */ - -/** - * \var StreamConfiguration::width - * \brief Stream width in pixels - */ - -/** - * \var StreamConfiguration::height - * \brief Stream height in pixels - */ - -/** - * \var StreamConfiguration::pixelFormat - * \brief Stream pixel format - * - * This is a little endian four character code representation of the pixel - * format described in V4L2 using the V4L2_PIX_FMT_* definitions. - */ - -/** - * \var StreamConfiguration::bufferCount - * \brief Requested number of buffers to allocate for the stream + * \fn Stream::configuration() + * \brief Retrieve the active configuration of the stream + * \return The active configuration of the stream */ } /* namespace libcamera */