[{"id":22834,"web_url":"https://patchwork.libcamera.org/comment/22834/","msgid":"<165165456138.4076486.5960035237769725985@Monstersaurus>","date":"2022-05-04T08:56:01","subject":"Re: [libcamera-devel] [PATCH 2/5] libcamera: Add operator<<() for\n\tpixel format classes","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart via libcamera-devel (2022-04-29 22:23:45)\n> Implement the stream output operator<<() for the PixelFormat and\n> V4L2PixelFormat classes to simplify printing them.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/v4l2_pixelformat.h |  3 +++\n>  include/libcamera/pixel_format.h              |  3 +++\n>  src/libcamera/pixel_format.cpp                | 12 ++++++++++++\n>  src/libcamera/v4l2_pixelformat.cpp            | 13 +++++++++++++\n>  4 files changed, 31 insertions(+)\n> \n> diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h\n> index 886d534d8c91..fb2d5d0b93df 100644\n> --- a/include/libcamera/internal/v4l2_pixelformat.h\n> +++ b/include/libcamera/internal/v4l2_pixelformat.h\n> @@ -8,6 +8,7 @@\n>  \n>  #pragma once\n>  \n> +#include <ostream>\n>  #include <stdint.h>\n>  #include <string>\n>  \n> @@ -50,4 +51,6 @@ private:\n>         uint32_t fourcc_;\n>  };\n>  \n> +std::ostream &operator<<(std::ostream &out, const V4L2PixelFormat &f);\n> +\n>  } /* namespace libcamera */\n> diff --git a/include/libcamera/pixel_format.h b/include/libcamera/pixel_format.h\n> index a9d7c03de851..d49c5f784118 100644\n> --- a/include/libcamera/pixel_format.h\n> +++ b/include/libcamera/pixel_format.h\n> @@ -7,6 +7,7 @@\n>  \n>  #pragma once\n>  \n> +#include <ostream>\n>  #include <set>\n>  #include <stdint.h>\n>  #include <string>\n> @@ -45,4 +46,6 @@ private:\n>         uint64_t modifier_;\n>  };\n>  \n> +std::ostream &operator<<(std::ostream &out, const PixelFormat &f);\n> +\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/pixel_format.cpp b/src/libcamera/pixel_format.cpp\n> index 997aeb8a9290..80c22072b072 100644\n> --- a/src/libcamera/pixel_format.cpp\n> +++ b/src/libcamera/pixel_format.cpp\n> @@ -140,4 +140,16 @@ PixelFormat PixelFormat::fromString(const std::string &name)\n>         return PixelFormatInfo::info(name).format;\n>  }\n>  \n> +/**\n> + * \\brief Insert a text representation of a PixelFormat into an output stream\n> + * \\param[in] out The output stream\n> + * \\param[in] f The PixelFormat\n> + * \\return The output stream \\a out\n> + */\n> +std::ostream &operator<<(std::ostream &out, const PixelFormat &f)\n> +{\n> +       out << f.toString();\n> +       return out;\n> +}\n> +\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\n> index 0e0da3f0df07..1dd93baa7a64 100644\n> --- a/src/libcamera/v4l2_pixelformat.cpp\n> +++ b/src/libcamera/v4l2_pixelformat.cpp\n> @@ -316,4 +316,17 @@ V4L2PixelFormat V4L2PixelFormat::fromPixelFormat(const PixelFormat &pixelFormat,\n>         return multiplanar ? info.v4l2Formats.multi : info.v4l2Formats.single;\n>  }\n>  \n> +/**\n> + * \\brief Insert a text representation of a V4L2PixelFormat into an output\n> + * stream\n> + * \\param[in] out The output stream\n> + * \\param[in] f The V4L2PixelFormat\n> + * \\return The output stream \\a out\n> + */\n> +std::ostream &operator<<(std::ostream &out, const V4L2PixelFormat &f)\n> +{\n> +       out << f.toString();\n> +       return out;\n> +}\n> +\n>  } /* namespace libcamera */\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1143EC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 May 2022 08:56:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD69965644;\n\tWed,  4 May 2022 10:56:05 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E12AD604A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 May 2022 10:56:03 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9E73EE5;\n\tWed,  4 May 2022 10:56:03 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651654565;\n\tbh=lmCEOU3lvMJww0SMNAC115wH7rUhrCF+6mr2mSdI7cM=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=bcwCIlS6EUezpJYFZYzmT0/tdOwxX3xe6pEk5KHa+p4mRbCjWKZAHEyn0cf4qLott\n\tDFJrAOTi2///1EWOVlWk4Gihsfb28bW/8jAPbBXN7MNY4v+abgqI2bBD4kqPUKTmK7\n\tmXjD5+8SKstND3bbmubo64vIF02CPsgStscLIu+UH0dSL3B59UH6QhPR9TkFMpqBQ9\n\t10Gr5qtvK/LLc0bEiBCJlJkQ4bJBQo4qtXADvountG28SMGI+QEKYgHnRLlAcoX6+Y\n\t0Si27sNWhT3pw4cUVCpDgILxtRYU5115RizT646zwX3fTxXx4qlZbPdyIShXf4zQQO\n\tPj2EJv76jvnAQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1651654563;\n\tbh=lmCEOU3lvMJww0SMNAC115wH7rUhrCF+6mr2mSdI7cM=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=QHoIWWzCXlGf6SBMcq8Bw8ElUSqMAcx4NGxa4rWd0Zd21nHGjgOAFvJlVtvrlxN4y\n\tX7M+BUB56VERN5bP1SyVV0NucT6X+ex3O3OVZ5C6rCXzR8YWe+Dsz3drGwaWBpQURp\n\t1Gg59EAaH7/qS+xyPWBa1A2NNzOxCxU7k+aIp/ws="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"QHoIWWzC\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220429212348.18063-3-laurent.pinchart@ideasonboard.com>","References":"<20220429212348.18063-1-laurent.pinchart@ideasonboard.com>\n\t<20220429212348.18063-3-laurent.pinchart@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 04 May 2022 09:56:01 +0100","Message-ID":"<165165456138.4076486.5960035237769725985@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH 2/5] libcamera: Add operator<<() for\n\tpixel format classes","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]