[{"id":461,"web_url":"https://patchwork.libcamera.org/comment/461/","msgid":"<20190121203248.GE4439@pendragon.ideasonboard.com>","date":"2019-01-21T20:32:48","subject":"Re: [libcamera-devel] [PATCH 1/6] libcamera: v4l2_device: Add\n\tMediaEntity contructor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Jan 21, 2019 at 06:27:00PM +0100, Jacopo Mondi wrote:\n> Construct a V4L2Device from a MediaEntity device node path. While at\n> there mark constructor as explicit to avoid copy-construction.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/include/v4l2_device.h |  4 +++-\n>  src/libcamera/v4l2_device.cpp       | 12 ++++++++++++\n>  2 files changed, 15 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> index 474c05b..c6f3d9a 100644\n> --- a/src/libcamera/include/v4l2_device.h\n> +++ b/src/libcamera/include/v4l2_device.h\n> @@ -32,10 +32,12 @@ struct V4L2Capability final : v4l2_capability {\n>  \tbool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; }\n>  };\n>  \n> +class MediaEntity;\n>  class V4L2Device\n>  {\n>  public:\n> -\tV4L2Device(const std::string &devnode);\n> +\texplicit V4L2Device(const std::string &devnode);\n> +\texplicit V4L2Device(const MediaEntity &entity);\n>  \tV4L2Device(const V4L2Device &) = delete;\n>  \t~V4L2Device();\n>  \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 54b53de..59a1ad9 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -12,6 +12,7 @@\n>  #include <unistd.h>\n>  \n>  #include \"log.h\"\n> +#include \"media_object.h\"\n>  #include \"v4l2_device.h\"\n>  \n>  /**\n> @@ -92,6 +93,17 @@ V4L2Device::V4L2Device(const std::string &devnode)\n>  {\n>  }\n>  \n> +/**\n> + * \\brief Construct a V4L2Device from a MediaEntity\n> + * \\param entity The MediaEntity to build the device from\n> + *\n> + * Construct a V4L2Device from a MediaEntity's device node path.\n> + */\n> +V4L2Device::V4L2Device(const MediaEntity &entity)\n> +\t: V4L2Device(entity.devnode())\n> +{\n> +}\n> +\n>  V4L2Device::~V4L2Device()\n>  {\n>  \tclose();","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A89AA60B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Jan 2019 21:32:48 +0100 (CET)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4489053E;\n\tMon, 21 Jan 2019 21:32:48 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548102768;\n\tbh=lboTRyKHPQz0UxEEzVeSAE2ugvOsA+b5F+A8+KBgTWQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mRw0taKOgrKmbWtSLH3fvehmYGb8+7DA7mw4Vx1zezuJbdW4Hn2dpzd9fKEE871sx\n\t1iwVfB18YvSAHfrgrFnAf5dqeBLZfzcJbnKLU6JPVUUPPYBbVk7EZviWvMTH9ZqR3T\n\tn0nqBRSTk04MiCDFDSLRqf+3wu6eyHSJR/xSaDP4=","Date":"Mon, 21 Jan 2019 22:32:48 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190121203248.GE4439@pendragon.ideasonboard.com>","References":"<20190121172705.19985-1-jacopo@jmondi.org>\n\t<20190121172705.19985-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190121172705.19985-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 1/6] libcamera: v4l2_device: Add\n\tMediaEntity contructor","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 21 Jan 2019 20:32:48 -0000"}},{"id":478,"web_url":"https://patchwork.libcamera.org/comment/478/","msgid":"<20190122112832.GJ6484@bigcity.dyn.berto.se>","date":"2019-01-22T11:28:32","subject":"Re: [libcamera-devel] [PATCH 1/6] libcamera: v4l2_device: Add\n\tMediaEntity contructor","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-01-21 18:27:00 +0100, Jacopo Mondi wrote:\n> Construct a V4L2Device from a MediaEntity device node path. While at\n> there mark constructor as explicit to avoid copy-construction.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/v4l2_device.h |  4 +++-\n>  src/libcamera/v4l2_device.cpp       | 12 ++++++++++++\n>  2 files changed, 15 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> index 474c05b..c6f3d9a 100644\n> --- a/src/libcamera/include/v4l2_device.h\n> +++ b/src/libcamera/include/v4l2_device.h\n> @@ -32,10 +32,12 @@ struct V4L2Capability final : v4l2_capability {\n>  \tbool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; }\n>  };\n>  \n> +class MediaEntity;\n>  class V4L2Device\n>  {\n>  public:\n> -\tV4L2Device(const std::string &devnode);\n> +\texplicit V4L2Device(const std::string &devnode);\n> +\texplicit V4L2Device(const MediaEntity &entity);\n>  \tV4L2Device(const V4L2Device &) = delete;\n>  \t~V4L2Device();\n>  \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 54b53de..59a1ad9 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -12,6 +12,7 @@\n>  #include <unistd.h>\n>  \n>  #include \"log.h\"\n> +#include \"media_object.h\"\n>  #include \"v4l2_device.h\"\n>  \n>  /**\n> @@ -92,6 +93,17 @@ V4L2Device::V4L2Device(const std::string &devnode)\n>  {\n>  }\n>  \n> +/**\n> + * \\brief Construct a V4L2Device from a MediaEntity\n> + * \\param entity The MediaEntity to build the device from\n> + *\n> + * Construct a V4L2Device from a MediaEntity's device node path.\n> + */\n> +V4L2Device::V4L2Device(const MediaEntity &entity)\n> +\t: V4L2Device(entity.devnode())\n> +{\n> +}\n> +\n>  V4L2Device::~V4L2Device()\n>  {\n>  \tclose();\n> -- \n> 2.20.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x141.google.com (mail-lf1-x141.google.com\n\t[IPv6:2a00:1450:4864:20::141])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D93B60B21\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jan 2019 12:28:35 +0100 (CET)","by mail-lf1-x141.google.com with SMTP id l10so17779198lfh.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jan 2019 03:28:35 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tu21-v6sm2852813lju.46.2019.01.22.03.28.32\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 22 Jan 2019 03:28:32 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=9XT/g91qvk0EzDe3NSaBI9u3gpwFXYatwtf4GZUu3uk=;\n\tb=zPimZ6i2Wl3fKJH+fkRFl/rd08DM+sXw8IVl+wEGKYTghsnoxmCClxDTmZzVuz0klQ\n\tfomt/w2P7WlTn32ME7cpAH36JWsMnU6688X9kptsoi5eQpSLSGBZEpY5M5xJHK116df3\n\t49l9ab6LUT/F3Us3Pgk+Wsf5CAlDs45X2YlXYrCNx3vZZKgOGCn9qmDn9S7CJi+3jxMf\n\t3ik+LGNTzPjYSnvjcBmCWJA2OzthYxK5asVm558IitkHxyi3nquAYFcG2rj6ZjNz9uP6\n\tjaGInKkJkJ+6GDiqukIzYYhQ21UDLsIxdcHm2HLHfH9c+R8Mkj2YCgzre8CxOsl2C/S0\n\tJRcA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=9XT/g91qvk0EzDe3NSaBI9u3gpwFXYatwtf4GZUu3uk=;\n\tb=NGHY15T5bugRjyDdEERIVts03txQje+TlpoJQ3wDqNBpb8eSGaN/cMfsHYu/++5xn7\n\tqsNOYpAYGd8Te4/7R1HtBjTKUSAvupNi3Q67aAmjnt46MbXEU371KPX/dmboMkULxIGZ\n\tdLcxOhfM8qN9KMlVdwuL3vqBVrganSVAJkHkoTaFVG9qqMhzCLHQ9d6qyGKI30IOXA1I\n\txl3uWwIjI9ESHlBaomaOWYEzDO4tX2rZMP7HyYEoWhZEQCFvHtcFaUB7b4idbtJV9gAM\n\tWHaiBbtPn03padBG/LTaWDNe8EMIt6+C27k6FoDd8N0YiQeQKmMihyn/j47btlZHT8N3\n\t6QRw==","X-Gm-Message-State":"AJcUukcR/gFSrDA2rhtFoUduFk5vYt4ocBalG841fp0QHewLowQvjJpS\n\tiYGiBhIbLLabdeK9QuDCWtwpXWAvVtA=","X-Google-Smtp-Source":"ALg8bN4XNvjBDmT7vqW1NTZKjXeoRpFaxkbgnOH/efFjnbMCrXVCh2DewfLfmk9ftTwspVG5OCtc1Q==","X-Received":"by 2002:a19:f718:: with SMTP id z24mr6030440lfe.97.1548156513268;\n\tTue, 22 Jan 2019 03:28:33 -0800 (PST)","Date":"Tue, 22 Jan 2019 12:28:32 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190122112832.GJ6484@bigcity.dyn.berto.se>","References":"<20190121172705.19985-1-jacopo@jmondi.org>\n\t<20190121172705.19985-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190121172705.19985-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 1/6] libcamera: v4l2_device: Add\n\tMediaEntity contructor","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 22 Jan 2019 11:28:35 -0000"}}]