[{"id":5079,"web_url":"https://patchwork.libcamera.org/comment/5079/","msgid":"<20200605233139.GS26752@pendragon.ideasonboard.com>","date":"2020-06-05T23:31:39","subject":"Re: [libcamera-devel] [PATCH 4/5] libcamera: v4l2_device: Add\n\tformatsMap typedef","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 Fri, May 29, 2020 at 01:03:34PM +0200, Jacopo Mondi wrote:\n> Provide a type definition in the V4L2VideoDevice and V4L2Subdevice\n> classes to shorten the ImageFormatsMap<V4L2PixelFormat> and\n> ImageFormatsMap<uint32_t> spcialization names.\n> \n> The new types reads as V4L2VideoDevice::formatsMap and\n> V4L2Subdevice::formatsMap respectively.\n\nThat should be FormatsMap (or actually even Formats).\n\nI would split this in two, with the V4L2VideoDevice part squashed with\n2/5, as otherwise you essentially update the same code twice, oncee to\nmove from an explicit std::map to ImageFormats<V4L2PixelFormat>, and a\nsecond time to move from ImageFormats<V4L2PixelFormat> to\nV4L2VideoDevice::FormatsMap. The V4L2Subdevice part could then be moved\nafter patch 1/5 and before patch 2/5.\n\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  include/libcamera/internal/camera_sensor.h         |  6 ++----\n>  include/libcamera/internal/v4l2_subdevice.h        |  4 +++-\n>  include/libcamera/internal/v4l2_videodevice.h      |  4 +++-\n>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 11 ++++++-----\n>  src/libcamera/pipeline/simple/simple.cpp           |  2 +-\n>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       |  2 +-\n>  src/libcamera/v4l2_subdevice.cpp                   |  9 +++++++--\n>  src/libcamera/v4l2_videodevice.cpp                 |  9 +++++++--\n>  test/v4l2_subdevice/list_formats.cpp               |  2 +-\n>  9 files changed, 31 insertions(+), 18 deletions(-)\n> \n> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\n> index 52eedb9ef880..1353edb1da28 100644\n> --- a/include/libcamera/internal/camera_sensor.h\n> +++ b/include/libcamera/internal/camera_sensor.h\n> @@ -16,13 +16,11 @@\n>  \n>  #include \"libcamera/internal/formats.h\"\n>  #include \"libcamera/internal/log.h\"\n> +#include \"libcamera/internal/v4l2_subdevice.h\"\n>  \n>  namespace libcamera {\n>  \n>  class MediaEntity;\n> -class V4L2Subdevice;\n> -\n> -struct V4L2SubdeviceFormat;\n>  \n>  struct CameraSensorInfo {\n>  \tstd::string model;\n> @@ -75,7 +73,7 @@ private:\n>  \n>  \tstd::string model_;\n>  \n> -\tImageFormatsMap<uint32_t> formats_;\n> +\tV4L2Subdevice::formatsMap formats_;\n>  \tSize resolution_;\n>  \tstd::vector<unsigned int> mbusCodes_;\n>  \tstd::vector<Size> sizes_;\n> diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\n> index c9aa3428f93c..06f10d7b4c5d 100644\n> --- a/include/libcamera/internal/v4l2_subdevice.h\n> +++ b/include/libcamera/internal/v4l2_subdevice.h\n> @@ -32,6 +32,8 @@ struct V4L2SubdeviceFormat {\n>  class V4L2Subdevice : public V4L2Device\n>  {\n>  public:\n> +\tusing formatsMap = ImageFormatsMap<uint32_t>;\n> +\n>  \tenum Whence {\n>  \t\tActiveFormat,\n>  \t\tTryFormat,\n> @@ -51,7 +53,7 @@ public:\n>  \tint setSelection(unsigned int pad, unsigned int target,\n>  \t\t\t Rectangle *rect);\n>  \n> -\tImageFormatsMap<uint32_t> formats(unsigned int pad);\n> +\tformatsMap formats(unsigned int pad);\n>  \n>  \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n>  \t\t      Whence whence = ActiveFormat);\n> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> index 02d101db0b2b..9632ad71b988 100644\n> --- a/include/libcamera/internal/v4l2_videodevice.h\n> +++ b/include/libcamera/internal/v4l2_videodevice.h\n> @@ -168,6 +168,8 @@ public:\n>  class V4L2VideoDevice : public V4L2Device\n>  {\n>  public:\n> +\tusing formatsMap = ImageFormatsMap<V4L2PixelFormat>;\n> +\n>  \texplicit V4L2VideoDevice(const std::string &deviceNode);\n>  \texplicit V4L2VideoDevice(const MediaEntity *entity);\n>  \tV4L2VideoDevice(const V4L2VideoDevice &) = delete;\n> @@ -187,7 +189,7 @@ public:\n>  \n>  \tint getFormat(V4L2DeviceFormat *format);\n>  \tint setFormat(V4L2DeviceFormat *format);\n> -\tImageFormatsMap<V4L2PixelFormat> formats(uint32_t code = 0);\n> +\tformatsMap formats(uint32_t code = 0);\n>  \n>  \tint setSelection(unsigned int target, Rectangle *rect);\n>  \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index e0132113b072..7dd579090ec6 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -65,7 +65,7 @@ double scoreFormat(double desired, double actual)\n>  \treturn score;\n>  }\n>  \n> -V4L2DeviceFormat findBestMode(ImageFormatsMap<V4L2PixelFormat> &formatsMap, const Size &req)\n> +V4L2DeviceFormat findBestMode(V4L2VideoDevice::formatsMap &formatsMap, const Size &req)\n>  {\n>  \tdouble bestScore = 9e9, score;\n>  \tV4L2DeviceFormat bestMode = {};\n> @@ -424,7 +424,8 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n>  \t\t\t * Calculate the best sensor mode we can use based on\n>  \t\t\t * the user request.\n>  \t\t\t */\n> -\t\t\tImageFormatsMap<V4L2PixelFormat> fmts = data_->unicam_[Unicam::Image].dev()->formats();\n> +\t\t\tV4L2VideoDevice::formatsMap fmts =\n> +\t\t\t\tdata_->unicam_[Unicam::Image].dev()->formats();\n>  \t\t\tV4L2DeviceFormat sensorFormat = findBestMode(fmts, cfg.size);\n>  \t\t\tPixelFormat sensorPixFormat = sensorFormat.fourcc.toPixelFormat();\n>  \t\t\tif (cfg.size != sensorFormat.size ||\n> @@ -478,7 +479,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n>  \t\t *\n>  \t\t */\n>  \t\tPixelFormat &cfgPixFmt = config_.at(outSize[i].first).pixelFormat;\n> -\t\tImageFormatsMap<V4L2PixelFormat> fmts;\n> +\t\tV4L2VideoDevice::formatsMap fmts;\n>  \n>  \t\tif (i == maxIndex)\n>  \t\t\tfmts = data_->isp_[Isp::Output0].dev()->formats();\n> @@ -515,7 +516,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n>  \tRPiCameraData *data = cameraData(camera);\n>  \tCameraConfiguration *config = new RPiCameraConfiguration(data);\n>  \tV4L2DeviceFormat sensorFormat;\n> -\tImageFormatsMap<V4L2PixelFormat> fmts;\n> +\tV4L2VideoDevice::formatsMap fmts;\n>  \n>  \tif (roles.empty())\n>  \t\treturn config;\n> @@ -602,7 +603,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \t}\n>  \n>  \t/* First calculate the best sensor mode we can use based on the user request. */\n> -\tImageFormatsMap<V4L2PixelFormat> fmts = data->unicam_[Unicam::Image].dev()->formats();\n> +\tV4L2VideoDevice::formatsMap fmts = data->unicam_[Unicam::Image].dev()->formats();\n>  \tV4L2DeviceFormat sensorFormat = findBestMode(fmts, rawStream ? sensorSize : maxSize);\n>  \n>  \t/*\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 62906b560d6a..feaa2854f037 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -275,7 +275,7 @@ int SimpleCameraData::init()\n>  \t\t\treturn ret;\n>  \t\t}\n>  \n> -\t\tImageFormatsMap<V4L2PixelFormat> videoFormats = video_->formats(format.mbus_code);\n> +\t\tV4L2VideoDevice::formatsMap videoFormats = video_->formats(format.mbus_code);\n>  \n>  \t\tLOG(SimplePipeline, Debug)\n>  \t\t\t<< \"Adding configuration for \" << format.size.toString()\n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index e1b1ae32b821..6250186e9390 100644\n> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> @@ -159,7 +159,7 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera,\n>  \tif (roles.empty())\n>  \t\treturn config;\n>  \n> -\tImageFormatsMap<V4L2PixelFormat> v4l2Formats = data->video_->formats();\n> +\tV4L2VideoDevice::formatsMap v4l2Formats = data->video_->formats();\n>  \tstd::map<PixelFormat, std::vector<SizeRange>> deviceFormats;\n>  \tstd::transform(v4l2Formats.begin(), v4l2Formats.end(),\n>  \t\t       std::inserter(deviceFormats, deviceFormats.begin()),\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 80db4cda82bb..0dd8e8686967 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -197,6 +197,11 @@ uint8_t V4L2SubdeviceFormat::bitsPerPixel() const\n>   * any device left open will be closed, and any resources released.\n>   */\n>  \n> +/**\n> + * \\typedef V4L2Subdevice::formatsMap\n> + * \\brief Map of media bus codes to associated image sizes\n> + */\n> +\n>  /**\n>   * \\enum V4L2Subdevice::Whence\n>   * \\brief Specify the type of format for getFormat() and setFormat() operations\n> @@ -320,9 +325,9 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n>   *\n>   * \\return A list of the supported device formats\n>   */\n> -ImageFormatsMap<uint32_t> V4L2Subdevice::formats(unsigned int pad)\n> +V4L2Subdevice::formatsMap V4L2Subdevice::formats(unsigned int pad)\n>  {\n> -\tImageFormatsMap<uint32_t> formats;\n> +\tformatsMap formats;\n>  \n>  \tif (pad >= entity_->pads().size()) {\n>  \t\tLOG(V4L2, Error) << \"Invalid pad: \" << pad;\n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index b264915cb73a..6d48018396c3 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -461,6 +461,11 @@ const std::string V4L2DeviceFormat::toString() const\n>   * \\context This class is \\threadbound.\n>   */\n>  \n> +/**\n> + * \\typedef V4L2VideoDevice::formatsMap\n> + * \\brief Map of V4l2PixelFormat to associated image sizes\n> + */\n> +\n>  /**\n>   * \\brief Construct a V4L2VideoDevice\n>   * \\param[in] deviceNode The file-system path to the video device node\n> @@ -925,9 +930,9 @@ int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format)\n>   *\n>   * \\return A list of the supported video device formats\n>   */\n> -ImageFormatsMap<V4L2PixelFormat> V4L2VideoDevice::formats(uint32_t code)\n> +V4L2VideoDevice::formatsMap V4L2VideoDevice::formats(uint32_t code)\n>  {\n> -\tImageFormatsMap<V4L2PixelFormat> formats;\n> +\tformatsMap formats;\n>  \n>  \tfor (V4L2PixelFormat pixelFormat : enumPixelformats(code)) {\n>  \t\tstd::vector<SizeRange> sizes = enumSizes(pixelFormat);\n> diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp\n> index adcf5606c961..a32f5c833c28 100644\n> --- a/test/v4l2_subdevice/list_formats.cpp\n> +++ b/test/v4l2_subdevice/list_formats.cpp\n> @@ -48,7 +48,7 @@ void ListFormatsTest::printFormats(unsigned int pad,\n>  int ListFormatsTest::run()\n>  {\n>  \t/* List all formats available on existing \"Scaler\" pads. */\n> -\tImageFormatsMap<uint32_t> formats;\n> +\tV4L2Subdevice::formatsMap formats;\n>  \n>  \tformats = scaler_->formats(0);\n>  \tif (formats.isEmpty()) {","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 8E668600F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  6 Jun 2020 01:32:00 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9D79727C;\n\tSat,  6 Jun 2020 01:31:59 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"fPHZi19K\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591399920;\n\tbh=T148N7SHw2iY5kHnWxbQlLB3sCGGAyX2S4k1pXpHJ08=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fPHZi19KEvdXqETTkmfDuO/Zfi7er7oDwLv9WuMcGChFKDMh1yU1Jobfbor7LeFmg\n\tKxLMn6Vy+sd3LzDriThmGkjSqKPX8+16uOot+c6q10WCYmhKc55wjuT9uWiSZt2bh2\n\t1zwalkasfAuTXjaw9FlcHrQE6PUoYDeSPqywqd7Y=","Date":"Sat, 6 Jun 2020 02:31:39 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200605233139.GS26752@pendragon.ideasonboard.com>","References":"<20200529110335.620503-1-jacopo@jmondi.org>\n\t<20200529110335.620503-5-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200529110335.620503-5-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 4/5] libcamera: v4l2_device: Add\n\tformatsMap typedef","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>","X-List-Received-Date":"Fri, 05 Jun 2020 23:32:00 -0000"}},{"id":5121,"web_url":"https://patchwork.libcamera.org/comment/5121/","msgid":"<20200608080258.7yuo5oexavn24ylh@uno.localdomain>","date":"2020-06-08T08:02:58","subject":"Re: [libcamera-devel] [PATCH 4/5] libcamera: v4l2_device: Add\n\tformatsMap typedef","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Sat, Jun 06, 2020 at 02:31:39AM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Fri, May 29, 2020 at 01:03:34PM +0200, Jacopo Mondi wrote:\n> > Provide a type definition in the V4L2VideoDevice and V4L2Subdevice\n> > classes to shorten the ImageFormatsMap<V4L2PixelFormat> and\n> > ImageFormatsMap<uint32_t> spcialization names.\n> >\n> > The new types reads as V4L2VideoDevice::formatsMap and\n> > V4L2Subdevice::formatsMap respectively.\n>\n> That should be FormatsMap (or actually even Formats).\n\nI'm still not satisfied with any name we tried for this construct. But\nshorting it down to ::Format is better.\n\n>\n> I would split this in two, with the V4L2VideoDevice part squashed with\n> 2/5, as otherwise you essentially update the same code twice, oncee to\n> move from an explicit std::map to ImageFormats<V4L2PixelFormat>, and a\n> second time to move from ImageFormats<V4L2PixelFormat> to\n> V4L2VideoDevice::FormatsMap. The V4L2Subdevice part could then be moved\n> after patch 1/5 and before patch 2/5.\n\nThis was intentional to ease review, but I can squash them and provide\ntypenames when moving users of V4L2VideoDevice from std::map to\nImageFormat\n\nThanks\n  j\n\n>\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  include/libcamera/internal/camera_sensor.h         |  6 ++----\n> >  include/libcamera/internal/v4l2_subdevice.h        |  4 +++-\n> >  include/libcamera/internal/v4l2_videodevice.h      |  4 +++-\n> >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 11 ++++++-----\n> >  src/libcamera/pipeline/simple/simple.cpp           |  2 +-\n> >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       |  2 +-\n> >  src/libcamera/v4l2_subdevice.cpp                   |  9 +++++++--\n> >  src/libcamera/v4l2_videodevice.cpp                 |  9 +++++++--\n> >  test/v4l2_subdevice/list_formats.cpp               |  2 +-\n> >  9 files changed, 31 insertions(+), 18 deletions(-)\n> >\n> > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\n> > index 52eedb9ef880..1353edb1da28 100644\n> > --- a/include/libcamera/internal/camera_sensor.h\n> > +++ b/include/libcamera/internal/camera_sensor.h\n> > @@ -16,13 +16,11 @@\n> >\n> >  #include \"libcamera/internal/formats.h\"\n> >  #include \"libcamera/internal/log.h\"\n> > +#include \"libcamera/internal/v4l2_subdevice.h\"\n> >\n> >  namespace libcamera {\n> >\n> >  class MediaEntity;\n> > -class V4L2Subdevice;\n> > -\n> > -struct V4L2SubdeviceFormat;\n> >\n> >  struct CameraSensorInfo {\n> >  \tstd::string model;\n> > @@ -75,7 +73,7 @@ private:\n> >\n> >  \tstd::string model_;\n> >\n> > -\tImageFormatsMap<uint32_t> formats_;\n> > +\tV4L2Subdevice::formatsMap formats_;\n> >  \tSize resolution_;\n> >  \tstd::vector<unsigned int> mbusCodes_;\n> >  \tstd::vector<Size> sizes_;\n> > diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\n> > index c9aa3428f93c..06f10d7b4c5d 100644\n> > --- a/include/libcamera/internal/v4l2_subdevice.h\n> > +++ b/include/libcamera/internal/v4l2_subdevice.h\n> > @@ -32,6 +32,8 @@ struct V4L2SubdeviceFormat {\n> >  class V4L2Subdevice : public V4L2Device\n> >  {\n> >  public:\n> > +\tusing formatsMap = ImageFormatsMap<uint32_t>;\n> > +\n> >  \tenum Whence {\n> >  \t\tActiveFormat,\n> >  \t\tTryFormat,\n> > @@ -51,7 +53,7 @@ public:\n> >  \tint setSelection(unsigned int pad, unsigned int target,\n> >  \t\t\t Rectangle *rect);\n> >\n> > -\tImageFormatsMap<uint32_t> formats(unsigned int pad);\n> > +\tformatsMap formats(unsigned int pad);\n> >\n> >  \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n> >  \t\t      Whence whence = ActiveFormat);\n> > diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> > index 02d101db0b2b..9632ad71b988 100644\n> > --- a/include/libcamera/internal/v4l2_videodevice.h\n> > +++ b/include/libcamera/internal/v4l2_videodevice.h\n> > @@ -168,6 +168,8 @@ public:\n> >  class V4L2VideoDevice : public V4L2Device\n> >  {\n> >  public:\n> > +\tusing formatsMap = ImageFormatsMap<V4L2PixelFormat>;\n> > +\n> >  \texplicit V4L2VideoDevice(const std::string &deviceNode);\n> >  \texplicit V4L2VideoDevice(const MediaEntity *entity);\n> >  \tV4L2VideoDevice(const V4L2VideoDevice &) = delete;\n> > @@ -187,7 +189,7 @@ public:\n> >\n> >  \tint getFormat(V4L2DeviceFormat *format);\n> >  \tint setFormat(V4L2DeviceFormat *format);\n> > -\tImageFormatsMap<V4L2PixelFormat> formats(uint32_t code = 0);\n> > +\tformatsMap formats(uint32_t code = 0);\n> >\n> >  \tint setSelection(unsigned int target, Rectangle *rect);\n> >\n> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > index e0132113b072..7dd579090ec6 100644\n> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > @@ -65,7 +65,7 @@ double scoreFormat(double desired, double actual)\n> >  \treturn score;\n> >  }\n> >\n> > -V4L2DeviceFormat findBestMode(ImageFormatsMap<V4L2PixelFormat> &formatsMap, const Size &req)\n> > +V4L2DeviceFormat findBestMode(V4L2VideoDevice::formatsMap &formatsMap, const Size &req)\n> >  {\n> >  \tdouble bestScore = 9e9, score;\n> >  \tV4L2DeviceFormat bestMode = {};\n> > @@ -424,7 +424,8 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n> >  \t\t\t * Calculate the best sensor mode we can use based on\n> >  \t\t\t * the user request.\n> >  \t\t\t */\n> > -\t\t\tImageFormatsMap<V4L2PixelFormat> fmts = data_->unicam_[Unicam::Image].dev()->formats();\n> > +\t\t\tV4L2VideoDevice::formatsMap fmts =\n> > +\t\t\t\tdata_->unicam_[Unicam::Image].dev()->formats();\n> >  \t\t\tV4L2DeviceFormat sensorFormat = findBestMode(fmts, cfg.size);\n> >  \t\t\tPixelFormat sensorPixFormat = sensorFormat.fourcc.toPixelFormat();\n> >  \t\t\tif (cfg.size != sensorFormat.size ||\n> > @@ -478,7 +479,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n> >  \t\t *\n> >  \t\t */\n> >  \t\tPixelFormat &cfgPixFmt = config_.at(outSize[i].first).pixelFormat;\n> > -\t\tImageFormatsMap<V4L2PixelFormat> fmts;\n> > +\t\tV4L2VideoDevice::formatsMap fmts;\n> >\n> >  \t\tif (i == maxIndex)\n> >  \t\t\tfmts = data_->isp_[Isp::Output0].dev()->formats();\n> > @@ -515,7 +516,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n> >  \tRPiCameraData *data = cameraData(camera);\n> >  \tCameraConfiguration *config = new RPiCameraConfiguration(data);\n> >  \tV4L2DeviceFormat sensorFormat;\n> > -\tImageFormatsMap<V4L2PixelFormat> fmts;\n> > +\tV4L2VideoDevice::formatsMap fmts;\n> >\n> >  \tif (roles.empty())\n> >  \t\treturn config;\n> > @@ -602,7 +603,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n> >  \t}\n> >\n> >  \t/* First calculate the best sensor mode we can use based on the user request. */\n> > -\tImageFormatsMap<V4L2PixelFormat> fmts = data->unicam_[Unicam::Image].dev()->formats();\n> > +\tV4L2VideoDevice::formatsMap fmts = data->unicam_[Unicam::Image].dev()->formats();\n> >  \tV4L2DeviceFormat sensorFormat = findBestMode(fmts, rawStream ? sensorSize : maxSize);\n> >\n> >  \t/*\n> > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> > index 62906b560d6a..feaa2854f037 100644\n> > --- a/src/libcamera/pipeline/simple/simple.cpp\n> > +++ b/src/libcamera/pipeline/simple/simple.cpp\n> > @@ -275,7 +275,7 @@ int SimpleCameraData::init()\n> >  \t\t\treturn ret;\n> >  \t\t}\n> >\n> > -\t\tImageFormatsMap<V4L2PixelFormat> videoFormats = video_->formats(format.mbus_code);\n> > +\t\tV4L2VideoDevice::formatsMap videoFormats = video_->formats(format.mbus_code);\n> >\n> >  \t\tLOG(SimplePipeline, Debug)\n> >  \t\t\t<< \"Adding configuration for \" << format.size.toString()\n> > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > index e1b1ae32b821..6250186e9390 100644\n> > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > @@ -159,7 +159,7 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera,\n> >  \tif (roles.empty())\n> >  \t\treturn config;\n> >\n> > -\tImageFormatsMap<V4L2PixelFormat> v4l2Formats = data->video_->formats();\n> > +\tV4L2VideoDevice::formatsMap v4l2Formats = data->video_->formats();\n> >  \tstd::map<PixelFormat, std::vector<SizeRange>> deviceFormats;\n> >  \tstd::transform(v4l2Formats.begin(), v4l2Formats.end(),\n> >  \t\t       std::inserter(deviceFormats, deviceFormats.begin()),\n> > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> > index 80db4cda82bb..0dd8e8686967 100644\n> > --- a/src/libcamera/v4l2_subdevice.cpp\n> > +++ b/src/libcamera/v4l2_subdevice.cpp\n> > @@ -197,6 +197,11 @@ uint8_t V4L2SubdeviceFormat::bitsPerPixel() const\n> >   * any device left open will be closed, and any resources released.\n> >   */\n> >\n> > +/**\n> > + * \\typedef V4L2Subdevice::formatsMap\n> > + * \\brief Map of media bus codes to associated image sizes\n> > + */\n> > +\n> >  /**\n> >   * \\enum V4L2Subdevice::Whence\n> >   * \\brief Specify the type of format for getFormat() and setFormat() operations\n> > @@ -320,9 +325,9 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n> >   *\n> >   * \\return A list of the supported device formats\n> >   */\n> > -ImageFormatsMap<uint32_t> V4L2Subdevice::formats(unsigned int pad)\n> > +V4L2Subdevice::formatsMap V4L2Subdevice::formats(unsigned int pad)\n> >  {\n> > -\tImageFormatsMap<uint32_t> formats;\n> > +\tformatsMap formats;\n> >\n> >  \tif (pad >= entity_->pads().size()) {\n> >  \t\tLOG(V4L2, Error) << \"Invalid pad: \" << pad;\n> > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> > index b264915cb73a..6d48018396c3 100644\n> > --- a/src/libcamera/v4l2_videodevice.cpp\n> > +++ b/src/libcamera/v4l2_videodevice.cpp\n> > @@ -461,6 +461,11 @@ const std::string V4L2DeviceFormat::toString() const\n> >   * \\context This class is \\threadbound.\n> >   */\n> >\n> > +/**\n> > + * \\typedef V4L2VideoDevice::formatsMap\n> > + * \\brief Map of V4l2PixelFormat to associated image sizes\n> > + */\n> > +\n> >  /**\n> >   * \\brief Construct a V4L2VideoDevice\n> >   * \\param[in] deviceNode The file-system path to the video device node\n> > @@ -925,9 +930,9 @@ int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format)\n> >   *\n> >   * \\return A list of the supported video device formats\n> >   */\n> > -ImageFormatsMap<V4L2PixelFormat> V4L2VideoDevice::formats(uint32_t code)\n> > +V4L2VideoDevice::formatsMap V4L2VideoDevice::formats(uint32_t code)\n> >  {\n> > -\tImageFormatsMap<V4L2PixelFormat> formats;\n> > +\tformatsMap formats;\n> >\n> >  \tfor (V4L2PixelFormat pixelFormat : enumPixelformats(code)) {\n> >  \t\tstd::vector<SizeRange> sizes = enumSizes(pixelFormat);\n> > diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp\n> > index adcf5606c961..a32f5c833c28 100644\n> > --- a/test/v4l2_subdevice/list_formats.cpp\n> > +++ b/test/v4l2_subdevice/list_formats.cpp\n> > @@ -48,7 +48,7 @@ void ListFormatsTest::printFormats(unsigned int pad,\n> >  int ListFormatsTest::run()\n> >  {\n> >  \t/* List all formats available on existing \"Scaler\" pads. */\n> > -\tImageFormatsMap<uint32_t> formats;\n> > +\tV4L2Subdevice::formatsMap formats;\n> >\n> >  \tformats = scaler_->formats(0);\n> >  \tif (formats.isEmpty()) {\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3C7FA603C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Jun 2020 09:59:36 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id D0841100007;\n\tMon,  8 Jun 2020 07:59:33 +0000 (UTC)"],"Date":"Mon, 8 Jun 2020 10:02:58 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200608080258.7yuo5oexavn24ylh@uno.localdomain>","References":"<20200529110335.620503-1-jacopo@jmondi.org>\n\t<20200529110335.620503-5-jacopo@jmondi.org>\n\t<20200605233139.GS26752@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200605233139.GS26752@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 4/5] libcamera: v4l2_device: Add\n\tformatsMap typedef","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>","X-List-Received-Date":"Mon, 08 Jun 2020 07:59:36 -0000"}},{"id":5129,"web_url":"https://patchwork.libcamera.org/comment/5129/","msgid":"<20200608130839.GC5896@pendragon.ideasonboard.com>","date":"2020-06-08T13:08:39","subject":"Re: [libcamera-devel] [PATCH 4/5] libcamera: v4l2_device: Add\n\tformatsMap typedef","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Mon, Jun 08, 2020 at 10:02:58AM +0200, Jacopo Mondi wrote:\n> On Sat, Jun 06, 2020 at 02:31:39AM +0300, Laurent Pinchart wrote:\n> > On Fri, May 29, 2020 at 01:03:34PM +0200, Jacopo Mondi wrote:\n> > > Provide a type definition in the V4L2VideoDevice and V4L2Subdevice\n> > > classes to shorten the ImageFormatsMap<V4L2PixelFormat> and\n> > > ImageFormatsMap<uint32_t> spcialization names.\n> > >\n> > > The new types reads as V4L2VideoDevice::formatsMap and\n> > > V4L2Subdevice::formatsMap respectively.\n> >\n> > That should be FormatsMap (or actually even Formats).\n> \n> I'm still not satisfied with any name we tried for this construct. But\n> shorting it down to ::Format is better.\n\nDo you mean Formats ?\n\n> > I would split this in two, with the V4L2VideoDevice part squashed with\n> > 2/5, as otherwise you essentially update the same code twice, oncee to\n> > move from an explicit std::map to ImageFormats<V4L2PixelFormat>, and a\n> > second time to move from ImageFormats<V4L2PixelFormat> to\n> > V4L2VideoDevice::FormatsMap. The V4L2Subdevice part could then be moved\n> > after patch 1/5 and before patch 2/5.\n> \n> This was intentional to ease review, but I can squash them and provide\n> typenames when moving users of V4L2VideoDevice from std::map to\n> ImageFormat\n\nI think that will actually ease review for me :-) The\nV4L2Subdevice::Formats should of course still be introduced in a\nseparate patch.\n\n> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > > ---\n> > >  include/libcamera/internal/camera_sensor.h         |  6 ++----\n> > >  include/libcamera/internal/v4l2_subdevice.h        |  4 +++-\n> > >  include/libcamera/internal/v4l2_videodevice.h      |  4 +++-\n> > >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 11 ++++++-----\n> > >  src/libcamera/pipeline/simple/simple.cpp           |  2 +-\n> > >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       |  2 +-\n> > >  src/libcamera/v4l2_subdevice.cpp                   |  9 +++++++--\n> > >  src/libcamera/v4l2_videodevice.cpp                 |  9 +++++++--\n> > >  test/v4l2_subdevice/list_formats.cpp               |  2 +-\n> > >  9 files changed, 31 insertions(+), 18 deletions(-)\n> > >\n> > > diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\n> > > index 52eedb9ef880..1353edb1da28 100644\n> > > --- a/include/libcamera/internal/camera_sensor.h\n> > > +++ b/include/libcamera/internal/camera_sensor.h\n> > > @@ -16,13 +16,11 @@\n> > >\n> > >  #include \"libcamera/internal/formats.h\"\n> > >  #include \"libcamera/internal/log.h\"\n> > > +#include \"libcamera/internal/v4l2_subdevice.h\"\n> > >\n> > >  namespace libcamera {\n> > >\n> > >  class MediaEntity;\n> > > -class V4L2Subdevice;\n> > > -\n> > > -struct V4L2SubdeviceFormat;\n> > >\n> > >  struct CameraSensorInfo {\n> > >  \tstd::string model;\n> > > @@ -75,7 +73,7 @@ private:\n> > >\n> > >  \tstd::string model_;\n> > >\n> > > -\tImageFormatsMap<uint32_t> formats_;\n> > > +\tV4L2Subdevice::formatsMap formats_;\n> > >  \tSize resolution_;\n> > >  \tstd::vector<unsigned int> mbusCodes_;\n> > >  \tstd::vector<Size> sizes_;\n> > > diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\n> > > index c9aa3428f93c..06f10d7b4c5d 100644\n> > > --- a/include/libcamera/internal/v4l2_subdevice.h\n> > > +++ b/include/libcamera/internal/v4l2_subdevice.h\n> > > @@ -32,6 +32,8 @@ struct V4L2SubdeviceFormat {\n> > >  class V4L2Subdevice : public V4L2Device\n> > >  {\n> > >  public:\n> > > +\tusing formatsMap = ImageFormatsMap<uint32_t>;\n> > > +\n> > >  \tenum Whence {\n> > >  \t\tActiveFormat,\n> > >  \t\tTryFormat,\n> > > @@ -51,7 +53,7 @@ public:\n> > >  \tint setSelection(unsigned int pad, unsigned int target,\n> > >  \t\t\t Rectangle *rect);\n> > >\n> > > -\tImageFormatsMap<uint32_t> formats(unsigned int pad);\n> > > +\tformatsMap formats(unsigned int pad);\n> > >\n> > >  \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n> > >  \t\t      Whence whence = ActiveFormat);\n> > > diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> > > index 02d101db0b2b..9632ad71b988 100644\n> > > --- a/include/libcamera/internal/v4l2_videodevice.h\n> > > +++ b/include/libcamera/internal/v4l2_videodevice.h\n> > > @@ -168,6 +168,8 @@ public:\n> > >  class V4L2VideoDevice : public V4L2Device\n> > >  {\n> > >  public:\n> > > +\tusing formatsMap = ImageFormatsMap<V4L2PixelFormat>;\n> > > +\n> > >  \texplicit V4L2VideoDevice(const std::string &deviceNode);\n> > >  \texplicit V4L2VideoDevice(const MediaEntity *entity);\n> > >  \tV4L2VideoDevice(const V4L2VideoDevice &) = delete;\n> > > @@ -187,7 +189,7 @@ public:\n> > >\n> > >  \tint getFormat(V4L2DeviceFormat *format);\n> > >  \tint setFormat(V4L2DeviceFormat *format);\n> > > -\tImageFormatsMap<V4L2PixelFormat> formats(uint32_t code = 0);\n> > > +\tformatsMap formats(uint32_t code = 0);\n> > >\n> > >  \tint setSelection(unsigned int target, Rectangle *rect);\n> > >\n> > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > index e0132113b072..7dd579090ec6 100644\n> > > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > @@ -65,7 +65,7 @@ double scoreFormat(double desired, double actual)\n> > >  \treturn score;\n> > >  }\n> > >\n> > > -V4L2DeviceFormat findBestMode(ImageFormatsMap<V4L2PixelFormat> &formatsMap, const Size &req)\n> > > +V4L2DeviceFormat findBestMode(V4L2VideoDevice::formatsMap &formatsMap, const Size &req)\n> > >  {\n> > >  \tdouble bestScore = 9e9, score;\n> > >  \tV4L2DeviceFormat bestMode = {};\n> > > @@ -424,7 +424,8 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n> > >  \t\t\t * Calculate the best sensor mode we can use based on\n> > >  \t\t\t * the user request.\n> > >  \t\t\t */\n> > > -\t\t\tImageFormatsMap<V4L2PixelFormat> fmts = data_->unicam_[Unicam::Image].dev()->formats();\n> > > +\t\t\tV4L2VideoDevice::formatsMap fmts =\n> > > +\t\t\t\tdata_->unicam_[Unicam::Image].dev()->formats();\n> > >  \t\t\tV4L2DeviceFormat sensorFormat = findBestMode(fmts, cfg.size);\n> > >  \t\t\tPixelFormat sensorPixFormat = sensorFormat.fourcc.toPixelFormat();\n> > >  \t\t\tif (cfg.size != sensorFormat.size ||\n> > > @@ -478,7 +479,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n> > >  \t\t *\n> > >  \t\t */\n> > >  \t\tPixelFormat &cfgPixFmt = config_.at(outSize[i].first).pixelFormat;\n> > > -\t\tImageFormatsMap<V4L2PixelFormat> fmts;\n> > > +\t\tV4L2VideoDevice::formatsMap fmts;\n> > >\n> > >  \t\tif (i == maxIndex)\n> > >  \t\t\tfmts = data_->isp_[Isp::Output0].dev()->formats();\n> > > @@ -515,7 +516,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n> > >  \tRPiCameraData *data = cameraData(camera);\n> > >  \tCameraConfiguration *config = new RPiCameraConfiguration(data);\n> > >  \tV4L2DeviceFormat sensorFormat;\n> > > -\tImageFormatsMap<V4L2PixelFormat> fmts;\n> > > +\tV4L2VideoDevice::formatsMap fmts;\n> > >\n> > >  \tif (roles.empty())\n> > >  \t\treturn config;\n> > > @@ -602,7 +603,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n> > >  \t}\n> > >\n> > >  \t/* First calculate the best sensor mode we can use based on the user request. */\n> > > -\tImageFormatsMap<V4L2PixelFormat> fmts = data->unicam_[Unicam::Image].dev()->formats();\n> > > +\tV4L2VideoDevice::formatsMap fmts = data->unicam_[Unicam::Image].dev()->formats();\n> > >  \tV4L2DeviceFormat sensorFormat = findBestMode(fmts, rawStream ? sensorSize : maxSize);\n> > >\n> > >  \t/*\n> > > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> > > index 62906b560d6a..feaa2854f037 100644\n> > > --- a/src/libcamera/pipeline/simple/simple.cpp\n> > > +++ b/src/libcamera/pipeline/simple/simple.cpp\n> > > @@ -275,7 +275,7 @@ int SimpleCameraData::init()\n> > >  \t\t\treturn ret;\n> > >  \t\t}\n> > >\n> > > -\t\tImageFormatsMap<V4L2PixelFormat> videoFormats = video_->formats(format.mbus_code);\n> > > +\t\tV4L2VideoDevice::formatsMap videoFormats = video_->formats(format.mbus_code);\n> > >\n> > >  \t\tLOG(SimplePipeline, Debug)\n> > >  \t\t\t<< \"Adding configuration for \" << format.size.toString()\n> > > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > index e1b1ae32b821..6250186e9390 100644\n> > > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > @@ -159,7 +159,7 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera,\n> > >  \tif (roles.empty())\n> > >  \t\treturn config;\n> > >\n> > > -\tImageFormatsMap<V4L2PixelFormat> v4l2Formats = data->video_->formats();\n> > > +\tV4L2VideoDevice::formatsMap v4l2Formats = data->video_->formats();\n> > >  \tstd::map<PixelFormat, std::vector<SizeRange>> deviceFormats;\n> > >  \tstd::transform(v4l2Formats.begin(), v4l2Formats.end(),\n> > >  \t\t       std::inserter(deviceFormats, deviceFormats.begin()),\n> > > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> > > index 80db4cda82bb..0dd8e8686967 100644\n> > > --- a/src/libcamera/v4l2_subdevice.cpp\n> > > +++ b/src/libcamera/v4l2_subdevice.cpp\n> > > @@ -197,6 +197,11 @@ uint8_t V4L2SubdeviceFormat::bitsPerPixel() const\n> > >   * any device left open will be closed, and any resources released.\n> > >   */\n> > >\n> > > +/**\n> > > + * \\typedef V4L2Subdevice::formatsMap\n> > > + * \\brief Map of media bus codes to associated image sizes\n> > > + */\n> > > +\n> > >  /**\n> > >   * \\enum V4L2Subdevice::Whence\n> > >   * \\brief Specify the type of format for getFormat() and setFormat() operations\n> > > @@ -320,9 +325,9 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n> > >   *\n> > >   * \\return A list of the supported device formats\n> > >   */\n> > > -ImageFormatsMap<uint32_t> V4L2Subdevice::formats(unsigned int pad)\n> > > +V4L2Subdevice::formatsMap V4L2Subdevice::formats(unsigned int pad)\n> > >  {\n> > > -\tImageFormatsMap<uint32_t> formats;\n> > > +\tformatsMap formats;\n> > >\n> > >  \tif (pad >= entity_->pads().size()) {\n> > >  \t\tLOG(V4L2, Error) << \"Invalid pad: \" << pad;\n> > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> > > index b264915cb73a..6d48018396c3 100644\n> > > --- a/src/libcamera/v4l2_videodevice.cpp\n> > > +++ b/src/libcamera/v4l2_videodevice.cpp\n> > > @@ -461,6 +461,11 @@ const std::string V4L2DeviceFormat::toString() const\n> > >   * \\context This class is \\threadbound.\n> > >   */\n> > >\n> > > +/**\n> > > + * \\typedef V4L2VideoDevice::formatsMap\n> > > + * \\brief Map of V4l2PixelFormat to associated image sizes\n> > > + */\n> > > +\n> > >  /**\n> > >   * \\brief Construct a V4L2VideoDevice\n> > >   * \\param[in] deviceNode The file-system path to the video device node\n> > > @@ -925,9 +930,9 @@ int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format)\n> > >   *\n> > >   * \\return A list of the supported video device formats\n> > >   */\n> > > -ImageFormatsMap<V4L2PixelFormat> V4L2VideoDevice::formats(uint32_t code)\n> > > +V4L2VideoDevice::formatsMap V4L2VideoDevice::formats(uint32_t code)\n> > >  {\n> > > -\tImageFormatsMap<V4L2PixelFormat> formats;\n> > > +\tformatsMap formats;\n> > >\n> > >  \tfor (V4L2PixelFormat pixelFormat : enumPixelformats(code)) {\n> > >  \t\tstd::vector<SizeRange> sizes = enumSizes(pixelFormat);\n> > > diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp\n> > > index adcf5606c961..a32f5c833c28 100644\n> > > --- a/test/v4l2_subdevice/list_formats.cpp\n> > > +++ b/test/v4l2_subdevice/list_formats.cpp\n> > > @@ -48,7 +48,7 @@ void ListFormatsTest::printFormats(unsigned int pad,\n> > >  int ListFormatsTest::run()\n> > >  {\n> > >  \t/* List all formats available on existing \"Scaler\" pads. */\n> > > -\tImageFormatsMap<uint32_t> formats;\n> > > +\tV4L2Subdevice::formatsMap formats;\n> > >\n> > >  \tformats = scaler_->formats(0);\n> > >  \tif (formats.isEmpty()) {\n> >\n> > --\n> > Regards,\n> >\n> > Laurent Pinchart","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 47B0761027\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Jun 2020 15:08:59 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A884E2C9;\n\tMon,  8 Jun 2020 15:08:58 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"CU/owSUj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591621738;\n\tbh=0DEA0TiWIhqw2Cd4/CdtbSqvfnB6+iLoz05bSh7Xtgs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=CU/owSUjrqUhYh940jV3aGxVq00msElNWVJlszo4P2BQdbW/OBcSLjrRULckfcPvH\n\thachKmZX6SJ6vkbKupAU8H9yE0y1MH9Pxyi6Ptv7LUWa9tBCs8JUrkYX+rvul5UTeH\n\tUI7gSlz9LUeJsie7BnnfL7zgUZHMlNHGRm1t9TtI=","Date":"Mon, 8 Jun 2020 16:08:39 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200608130839.GC5896@pendragon.ideasonboard.com>","References":"<20200529110335.620503-1-jacopo@jmondi.org>\n\t<20200529110335.620503-5-jacopo@jmondi.org>\n\t<20200605233139.GS26752@pendragon.ideasonboard.com>\n\t<20200608080258.7yuo5oexavn24ylh@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200608080258.7yuo5oexavn24ylh@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 4/5] libcamera: v4l2_device: Add\n\tformatsMap typedef","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>","X-List-Received-Date":"Mon, 08 Jun 2020 13:08:59 -0000"}}]