From patchwork Tue Mar 26 08:38:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 800 Return-Path: Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B0E961113 for ; Tue, 26 Mar 2019 09:38:33 +0100 (CET) Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id ADE6B240005; Tue, 26 Mar 2019 08:38:32 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Mar 2019 09:38:48 +0100 Message-Id: <20190326083902.26121-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326083902.26121-1-jacopo@jmondi.org> References: <20190326083902.26121-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 05/19] libcamera: v4l2_subdevice: Rename deviceName() method 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: Tue, 26 Mar 2019 08:38:33 -0000 Rename the 'deviceName()' method to 'entityName()' as it actually returns the name of the entity backing the v4l2 subdevice. While at it, make the names getter methods return a const reference instead of returning by copy. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/include/v4l2_subdevice.h | 4 ++-- src/libcamera/v4l2_subdevice.cpp | 4 ++-- test/v4l2_subdevice/list_formats.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h index 3ecf08514898..f42cccabda94 100644 --- a/src/libcamera/include/v4l2_subdevice.h +++ b/src/libcamera/include/v4l2_subdevice.h @@ -37,8 +37,8 @@ public: bool isOpen() const; void close(); - std::string deviceNode() const { return entity_->deviceNode(); } - std::string deviceName() const { return entity_->name(); } + const std::string &deviceNode() const { return entity_->deviceNode(); } + const std::string &entityName() const { return entity_->name(); } int setCrop(unsigned int pad, Rectangle *rect); int setCompose(unsigned int pad, Rectangle *rect); diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 8260e6ebce0e..10925f9fe497 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -166,7 +166,7 @@ void V4L2Subdevice::close() */ /** - * \fn V4L2Subdevice::deviceName() + * \fn V4L2Subdevice::entityName() * \brief Retrieve the name of the media entity associated with the subdevice * * \return The name of the media entity the subdevice is associated to @@ -315,7 +315,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format) std::string V4L2Subdevice::logPrefix() const { - return "'" + deviceName() + "'"; + return "'" + entityName() + "'"; } int V4L2Subdevice::enumPadSizes(unsigned int pad,unsigned int code, diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp index bf8597797d4b..db486554b7b5 100644 --- a/test/v4l2_subdevice/list_formats.cpp +++ b/test/v4l2_subdevice/list_formats.cpp @@ -51,7 +51,7 @@ int ListFormatsTest::run() formats = scaler_->formats(0); if (formats.empty()) { cerr << "Failed to list formats on pad 0 of subdevice " - << scaler_->deviceName() << endl; + << scaler_->entityName() << endl; return TestFail; } for (auto it = formats.begin(); it != formats.end(); ++it) @@ -60,7 +60,7 @@ int ListFormatsTest::run() formats = scaler_->formats(1); if (formats.empty()) { cerr << "Failed to list formats on pad 1 of subdevice " - << scaler_->deviceName() << endl; + << scaler_->entityName() << endl; return TestFail; } for (auto it = formats.begin(); it != formats.end(); ++it) @@ -70,7 +70,7 @@ int ListFormatsTest::run() formats = scaler_->formats(2); if (!formats.empty()) { cerr << "Listing formats on non-existing pad 2 of subdevice " - << scaler_->deviceName() + << scaler_->entityName() << " should return an empty format list" << endl; return TestFail; }