From patchwork Mon Dec 30 12:04:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2451 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3AAE86046B for ; Mon, 30 Dec 2019 13:05:50 +0100 (CET) X-Halon-ID: b7b22477-2afc-11ea-a00b-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2fd0.dip0.t-ipconnect.de [79.202.47.208]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id b7b22477-2afc-11ea-a00b-005056917a89; Mon, 30 Dec 2019 13:05:49 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 30 Dec 2019 13:04:46 +0100 Message-Id: <20191230120510.938333-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191230120510.938333-1-niklas.soderlund@ragnatech.se> References: <20191230120510.938333-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 01/25] libcamera: buffer: Add FrameMetadata container for metadata information 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: , X-List-Received-Date: Mon, 30 Dec 2019 12:05:50 -0000 With the introduction of FrameBuffer objects, the metadata information related to captured frames will not be stored directly in the frame buffer object. Add a new FrameMetadata class to hold this information. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- * Changes since v1: - Rename BufferInfo to FrameMetadata - Rename prefix for BufferInfo::Status s/Buffer/Frame/ - Make FrameMetadata a struct with public data members instead of a class with accessors methods. - Dropped FrameMetadata::update() - Documentation updates --- include/libcamera/buffer.h | 17 +++++++++++ src/libcamera/buffer.cpp | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 80602124f24be4a0..0b95e41a2dd205b2 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -16,6 +16,23 @@ namespace libcamera { class Request; class Stream; +struct FrameMetadata { + enum Status { + FrameSuccess, + FrameError, + FrameCancelled, + }; + + struct Plane { + unsigned int bytesused; + }; + + Status status; + unsigned int sequence; + uint64_t timestamp; + std::vector planes; +}; + class Plane final { public: diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp index 960eeb8f7d193ddd..7673b96f29728a24 100644 --- a/src/libcamera/buffer.cpp +++ b/src/libcamera/buffer.cpp @@ -23,6 +23,68 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Buffer) +/** + * \struct FrameMetadata + * \brief Metadata related to a captured frame + * + * The FrameMetadata structure stores all metadata related to a captured frame, + * as stored in a FrameBuffer, such as capture status, timestamp or memory size. + */ + +/** + * \enum FrameMetadata::Status + * \brief Define the frame completion status + * \var FrameMetadata::FrameSuccess + * The frame has been captured with success and contains valid data and metadata + * \var FrameMetadata::FrameError + * The frame has been captured with an error and doesn't contain valid metadata + * \var FrameMetadata::FrameCancelled + * The frame has been cancelled and doesn't contain valid metadata + */ + +/** + * \struct FrameMetadata::Plane + * \brief Per-plane frame metadata + * + * Frames are stored in memory in one or multiple planes. The FrameInfo::Plane + * structure stores per-plane metadata for each plane. + */ + +/** + * \var FrameMetadata::Plane::bytesused + * \brief Number of bytes occupied by the data in the plane + */ + +/** + * \var FrameMetadata::status + * \brief Status of the frame + * + * Values in the container are only valid when the status is + * FrameMetadata::FrameSuccess. + */ + +/** + * \var FrameMetadata::sequence + * \brief Frame sequence number + * + * The sequence number is a monotonically increasing number assigned to the + * buffer processed by the stream. Gaps in the sequence numbers indicate + * dropped frames. + */ + +/** + * \var FrameMetadata::timestamp + * \brief Time when the frame was captured + * + * The timestamp is expressed as a number of nanoseconds relative to the system + * clock since an unspecified time point. + */ + +/** + * \var FrameMetadata::planes + * \brief Array holding plane specific metadata + */ + /** * \class Plane * \brief A memory region to store a single plane of a frame