From patchwork Wed May 29 07:02:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 20115 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 E1D85BD87C for ; Wed, 29 May 2024 07:03:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 65AE7634BD; Wed, 29 May 2024 09:03:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="EncZOuB3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C672634BE for ; Wed, 29 May 2024 09:03:04 +0200 (CEST) Received: from fedora.local (unknown [IPv6:2409:4055:4e99:4251:f523:b915:4362:f847]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 946382D5D; Wed, 29 May 2024 09:02:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1716966181; bh=RWwnWz+aNHrtgnqVwGUQbiLxRyM3BSP6i+LIIC52WoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EncZOuB3i01zJQtBb8ji3SyfActrIXvdQffOat+SyutKx1DqOl1FFwT0qZ25BjoEf ZEOI33zMDsc+h/hHRUOxd+gjxEfV9MBsF/FwxpXZ9V5RlYPyP8dkfT2waNt9TLONz5 CRwfuz/H9PSt844gljRdfXJT4aOdTm4HduPWiYVA= From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Andrey Konovalov , Umang Jain Subject: [PATCH v2 3/4] converter: converter_v4l2_m2m: Rename private Stream class Date: Wed, 29 May 2024 12:32:47 +0530 Message-ID: <20240529070248.12186-4-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240529070248.12186-1-umang.jain@ideasonboard.com> References: <20240529070248.12186-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 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" Rename the private Stream class from V4L2M2MConverter::Stream to V4L2M2MConverter::V4L2M2MStream. This is done to improve readability of the code when we drop the handling of stream by indexes in a subsequent patch. Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham --- .../internal/converter/converter_v4l2_m2m.h | 6 ++-- .../converter/converter_v4l2_m2m.cpp | 34 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index 1126050c..0da62290 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -57,10 +57,10 @@ public: const std::map &outputs); private: - class Stream : protected Loggable + class V4L2M2MStream : protected Loggable { public: - Stream(V4L2M2MConverter *converter, unsigned int index); + V4L2M2MStream(V4L2M2MConverter *converter, unsigned int index); bool isValid() const { return m2m_ != nullptr; } @@ -91,7 +91,7 @@ private: std::unique_ptr m2m_; - std::vector streams_; + std::vector streams_; std::map queue_; }; diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp index 27a50e34..6309a0c0 100644 --- a/src/libcamera/converter/converter_v4l2_m2m.cpp +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp @@ -32,24 +32,24 @@ namespace libcamera { LOG_DECLARE_CATEGORY(Converter) /* ----------------------------------------------------------------------------- - * V4L2M2MConverter::Stream + * V4L2M2MConverter::V4L2M2MStream */ -V4L2M2MConverter::Stream::Stream(V4L2M2MConverter *converter, unsigned int index) +V4L2M2MConverter::V4L2M2MStream::V4L2M2MStream(V4L2M2MConverter *converter, unsigned int index) : converter_(converter), index_(index) { m2m_ = std::make_unique(converter->deviceNode()); - m2m_->output()->bufferReady.connect(this, &Stream::outputBufferReady); - m2m_->capture()->bufferReady.connect(this, &Stream::captureBufferReady); + m2m_->output()->bufferReady.connect(this, &V4L2M2MStream::outputBufferReady); + m2m_->capture()->bufferReady.connect(this, &V4L2M2MStream::captureBufferReady); int ret = m2m_->open(); if (ret < 0) m2m_.reset(); } -int V4L2M2MConverter::Stream::configure(const StreamConfiguration &inputCfg, - const StreamConfiguration &outputCfg) +int V4L2M2MConverter::V4L2M2MStream::configure(const StreamConfiguration &inputCfg, + const StreamConfiguration &outputCfg) { V4L2PixelFormat videoFormat = m2m_->output()->toV4L2PixelFormat(inputCfg.pixelFormat); @@ -101,13 +101,13 @@ int V4L2M2MConverter::Stream::configure(const StreamConfiguration &inputCfg, return 0; } -int V4L2M2MConverter::Stream::exportBuffers(unsigned int count, - std::vector> *buffers) +int V4L2M2MConverter::V4L2M2MStream::exportBuffers(unsigned int count, + std::vector> *buffers) { return m2m_->capture()->exportBuffers(count, buffers); } -int V4L2M2MConverter::Stream::start() +int V4L2M2MConverter::V4L2M2MStream::start() { int ret = m2m_->output()->importBuffers(inputBufferCount_); if (ret < 0) @@ -134,7 +134,7 @@ int V4L2M2MConverter::Stream::start() return 0; } -void V4L2M2MConverter::Stream::stop() +void V4L2M2MConverter::V4L2M2MStream::stop() { m2m_->capture()->streamOff(); m2m_->output()->streamOff(); @@ -142,7 +142,7 @@ void V4L2M2MConverter::Stream::stop() m2m_->output()->releaseBuffers(); } -int V4L2M2MConverter::Stream::queueBuffers(FrameBuffer *input, FrameBuffer *output) +int V4L2M2MConverter::V4L2M2MStream::queueBuffers(FrameBuffer *input, FrameBuffer *output) { int ret = m2m_->output()->queueBuffer(input); if (ret < 0) @@ -155,12 +155,12 @@ int V4L2M2MConverter::Stream::queueBuffers(FrameBuffer *input, FrameBuffer *outp return 0; } -std::string V4L2M2MConverter::Stream::logPrefix() const +std::string V4L2M2MConverter::V4L2M2MStream::logPrefix() const { return "stream" + std::to_string(index_); } -void V4L2M2MConverter::Stream::outputBufferReady(FrameBuffer *buffer) +void V4L2M2MConverter::V4L2M2MStream::outputBufferReady(FrameBuffer *buffer) { auto it = converter_->queue_.find(buffer); if (it == converter_->queue_.end()) @@ -172,7 +172,7 @@ void V4L2M2MConverter::Stream::outputBufferReady(FrameBuffer *buffer) } } -void V4L2M2MConverter::Stream::captureBufferReady(FrameBuffer *buffer) +void V4L2M2MConverter::V4L2M2MStream::captureBufferReady(FrameBuffer *buffer) { converter_->outputBufferReady.emit(buffer); } @@ -336,7 +336,7 @@ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg, streams_.reserve(outputCfgs.size()); for (unsigned int i = 0; i < outputCfgs.size(); ++i) { - Stream &stream = streams_.emplace_back(this, i); + V4L2M2MStream &stream = streams_.emplace_back(this, i); if (!stream.isValid()) { LOG(Converter, Error) @@ -377,7 +377,7 @@ int V4L2M2MConverter::start() { int ret; - for (Stream &stream : streams_) { + for (V4L2M2MStream &stream : streams_) { ret = stream.start(); if (ret < 0) { stop(); @@ -393,7 +393,7 @@ int V4L2M2MConverter::start() */ void V4L2M2MConverter::stop() { - for (Stream &stream : utils::reverse(streams_)) + for (V4L2M2MStream &stream : utils::reverse(streams_)) stream.stop(); }