[{"id":1080,"web_url":"https://patchwork.libcamera.org/comment/1080/","msgid":"<20190321084248.GD4615@pendragon.ideasonboard.com>","date":"2019-03-21T08:42:48","subject":"Re: [libcamera-devel] [PATCH v4 01/31] libcamera: formats: Add\n\ttoString() methods","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 Wed, Mar 20, 2019 at 05:30:25PM +0100, Jacopo Mondi wrote:\n> Add toString() helpers to pretty print out a V4L2Device or V4L2Subdevice\n> format.\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/v4l2_device.h    |  2 ++\n>  src/libcamera/include/v4l2_subdevice.h |  2 ++\n>  src/libcamera/v4l2_device.cpp          | 18 ++++++++++++++++++\n>  src/libcamera/v4l2_subdevice.cpp       | 18 ++++++++++++++++++\n>  4 files changed, 40 insertions(+)\n> \n> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> index 5c379fac66dc..258deee8d461 100644\n> --- a/src/libcamera/include/v4l2_device.h\n> +++ b/src/libcamera/include/v4l2_device.h\n> @@ -100,6 +100,8 @@ public:\n>  \t\tuint32_t bpl;\n>  \t} planes[3];\n>  \tunsigned int planesCount;\n> +\n> +\tconst std::string toString() const;\n>  };\n>  \n>  class V4L2Device : protected Loggable\n> diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> index 1cc0fab73103..700e66bcddac 100644\n> --- a/src/libcamera/include/v4l2_subdevice.h\n> +++ b/src/libcamera/include/v4l2_subdevice.h\n> @@ -21,6 +21,8 @@ struct V4L2SubdeviceFormat {\n>  \tuint32_t mbus_code;\n>  \tuint32_t width;\n>  \tuint32_t height;\n> +\n> +\tconst std::string toString() const;\n>  };\n>  \n>  class V4L2Subdevice : protected Loggable\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 889c63b3fb63..97dc05288806 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -6,6 +6,8 @@\n>   */\n>  \n>  #include <fcntl.h>\n> +#include <iomanip>\n> +#include <sstream>\n>  #include <string.h>\n>  #include <sys/ioctl.h>\n>  #include <sys/mman.h>\n> @@ -223,6 +225,22 @@ LOG_DEFINE_CATEGORY(V4L2)\n>   * \\brief The number of valid data planes\n>   */\n>  \n> +/**\n> + * \\brief Assemble and return a string describing the format\n> + *\n> + * \\return A string describing the V4L2DeviceFormat\n> + */\n> +const std::string V4L2DeviceFormat::toString() const\n> +{\n> +\tstd::stringstream ss;\n> +\n> +\tss.fill(0);\n> +\tss << width << \"x\" << height << \"- 0x\" << std::hex\n\nPlease either put a space on each side of the -, or no space at all.\n\n> +\t   << std::setw(8) << fourcc;\n> +\n> +\treturn ss.str();\n> +}\n> +\n>  /**\n>   * \\class V4L2Device\n>   * \\brief V4L2Device object and API\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 5f58904bf9e6..11d22da25728 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -6,6 +6,8 @@\n>   */\n>  \n>  #include <fcntl.h>\n> +#include <iomanip>\n> +#include <sstream>\n>  #include <string.h>\n>  #include <sys/ioctl.h>\n>  #include <unistd.h>\n> @@ -69,6 +71,22 @@ LOG_DEFINE_CATEGORY(V4L2Subdev)\n>   * \\brief The image height in pixels\n>   */\n>  \n> +/**\n> + * \\brief Assemble and return a string describing the format\n> + *\n> + * \\return A string describing the V4L2SubdeviceFormat\n> + */\n> +const std::string V4L2SubdeviceFormat::toString() const\n> +{\n> +\tstd::stringstream ss;\n> +\n> +\tss.fill(0);\n> +\tss << width << \"x\" << height << \"- 0x\" << std::hex\n\nSame here.\n\nWith this fixed,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t   << std::setw(4) << mbus_code;\n> +\n> +\treturn ss.str();\n> +}\n> +\n>  /**\n>   * \\class V4L2Subdevice\n>   * \\brief A V4L2 subdevice as exposed by the Linux kernel","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 ACFFC600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Mar 2019 09:43:00 +0100 (CET)","from pendragon.ideasonboard.com (30.net042126252.t-com.ne.jp\n\t[42.126.252.30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6511723A;\n\tThu, 21 Mar 2019 09:42:59 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1553157780;\n\tbh=kWVj7UcmWrWWwnhex9LPzL/+tdAb/+b89lQgcfWNlas=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Pz4QULB1JX1vUYJwbHgtoEzb4R7eq5bA5UtiRDQRxXWeG7AdwNCMOhYtOdRMG+sqr\n\tV+SyCw7iBFx43WjHydeFScf+CIh3QUGS6mbtWRScx7x4oAczZcT2phUgreDQXSTBxF\n\tQ/fBqvcVl63gsBOhocAwoqxcutTtbCPBQUXLngtw=","Date":"Thu, 21 Mar 2019 10:42:48 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190321084248.GD4615@pendragon.ideasonboard.com>","References":"<20190320163055.22056-1-jacopo@jmondi.org>\n\t<20190320163055.22056-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190320163055.22056-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 01/31] libcamera: formats: Add\n\ttoString() methods","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":"Thu, 21 Mar 2019 08:43:00 -0000"}},{"id":1094,"web_url":"https://patchwork.libcamera.org/comment/1094/","msgid":"<20190321103442.buih23tpmworjqav@uno.localdomain>","date":"2019-03-21T10:34:42","subject":"Re: [libcamera-devel] [PATCH v4 01/31] libcamera: formats: Add\n\ttoString() methods","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Thu, Mar 21, 2019 at 10:42:48AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Wed, Mar 20, 2019 at 05:30:25PM +0100, Jacopo Mondi wrote:\n> > Add toString() helpers to pretty print out a V4L2Device or V4L2Subdevice\n> > format.\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/include/v4l2_device.h    |  2 ++\n> >  src/libcamera/include/v4l2_subdevice.h |  2 ++\n> >  src/libcamera/v4l2_device.cpp          | 18 ++++++++++++++++++\n> >  src/libcamera/v4l2_subdevice.cpp       | 18 ++++++++++++++++++\n> >  4 files changed, 40 insertions(+)\n> >\n> > diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> > index 5c379fac66dc..258deee8d461 100644\n> > --- a/src/libcamera/include/v4l2_device.h\n> > +++ b/src/libcamera/include/v4l2_device.h\n> > @@ -100,6 +100,8 @@ public:\n> >  \t\tuint32_t bpl;\n> >  \t} planes[3];\n> >  \tunsigned int planesCount;\n> > +\n> > +\tconst std::string toString() const;\n> >  };\n> >\n> >  class V4L2Device : protected Loggable\n> > diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> > index 1cc0fab73103..700e66bcddac 100644\n> > --- a/src/libcamera/include/v4l2_subdevice.h\n> > +++ b/src/libcamera/include/v4l2_subdevice.h\n> > @@ -21,6 +21,8 @@ struct V4L2SubdeviceFormat {\n> >  \tuint32_t mbus_code;\n> >  \tuint32_t width;\n> >  \tuint32_t height;\n> > +\n> > +\tconst std::string toString() const;\n> >  };\n> >\n> >  class V4L2Subdevice : protected Loggable\n> > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > index 889c63b3fb63..97dc05288806 100644\n> > --- a/src/libcamera/v4l2_device.cpp\n> > +++ b/src/libcamera/v4l2_device.cpp\n> > @@ -6,6 +6,8 @@\n> >   */\n> >\n> >  #include <fcntl.h>\n> > +#include <iomanip>\n> > +#include <sstream>\n> >  #include <string.h>\n> >  #include <sys/ioctl.h>\n> >  #include <sys/mman.h>\n> > @@ -223,6 +225,22 @@ LOG_DEFINE_CATEGORY(V4L2)\n> >   * \\brief The number of valid data planes\n> >   */\n> >\n> > +/**\n> > + * \\brief Assemble and return a string describing the format\n> > + *\n> > + * \\return A string describing the V4L2DeviceFormat\n> > + */\n> > +const std::string V4L2DeviceFormat::toString() const\n> > +{\n> > +\tstd::stringstream ss;\n> > +\n> > +\tss.fill(0);\n> > +\tss << width << \"x\" << height << \"- 0x\" << std::hex\n>\n> Please either put a space on each side of the -, or no space at all.\n\nI didn't get this, I thought we just wanted to standardize on a single\nformat between devices and subdevices.\n\nI'll remove spaces from here and in all ther places in the series\n\nThanks\n  j\n>\n> > +\t   << std::setw(8) << fourcc;\n> > +\n> > +\treturn ss.str();\n> > +}\n> > +\n> >  /**\n> >   * \\class V4L2Device\n> >   * \\brief V4L2Device object and API\n> > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> > index 5f58904bf9e6..11d22da25728 100644\n> > --- a/src/libcamera/v4l2_subdevice.cpp\n> > +++ b/src/libcamera/v4l2_subdevice.cpp\n> > @@ -6,6 +6,8 @@\n> >   */\n> >\n> >  #include <fcntl.h>\n> > +#include <iomanip>\n> > +#include <sstream>\n> >  #include <string.h>\n> >  #include <sys/ioctl.h>\n> >  #include <unistd.h>\n> > @@ -69,6 +71,22 @@ LOG_DEFINE_CATEGORY(V4L2Subdev)\n> >   * \\brief The image height in pixels\n> >   */\n> >\n> > +/**\n> > + * \\brief Assemble and return a string describing the format\n> > + *\n> > + * \\return A string describing the V4L2SubdeviceFormat\n> > + */\n> > +const std::string V4L2SubdeviceFormat::toString() const\n> > +{\n> > +\tstd::stringstream ss;\n> > +\n> > +\tss.fill(0);\n> > +\tss << width << \"x\" << height << \"- 0x\" << std::hex\n>\n> Same here.\n>\n> With this fixed,\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> > +\t   << std::setw(4) << mbus_code;\n> > +\n> > +\treturn ss.str();\n> > +}\n> > +\n> >  /**\n> >   * \\class V4L2Subdevice\n> >   * \\brief A V4L2 subdevice as exposed by the Linux kernel\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7AEF8600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Mar 2019 11:34:08 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id CFF7120000C;\n\tThu, 21 Mar 2019 10:34:07 +0000 (UTC)"],"Date":"Thu, 21 Mar 2019 11:34:42 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190321103442.buih23tpmworjqav@uno.localdomain>","References":"<20190320163055.22056-1-jacopo@jmondi.org>\n\t<20190320163055.22056-2-jacopo@jmondi.org>\n\t<20190321084248.GD4615@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"xojszjq2ex23jhvk\"","Content-Disposition":"inline","In-Reply-To":"<20190321084248.GD4615@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v4 01/31] libcamera: formats: Add\n\ttoString() methods","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":"Thu, 21 Mar 2019 10:34:08 -0000"}}]