{"id":3882,"url":"https://patchwork.libcamera.org/api/patches/3882/?format=json","web_url":"https://patchwork.libcamera.org/patch/3882/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200529110335.620503-6-jacopo@jmondi.org>","date":"2020-05-29T11:03:35","name":"[libcamera-devel,5/5] libcamera: v4l2_device: Rename formats() method","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"3ef0da09168a4ce6d616743d2bbb575874db7479","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3882/mbox/","series":[{"id":938,"url":"https://patchwork.libcamera.org/api/series/938/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=938","date":"2020-05-29T11:03:30","name":"ImageFormats' not dead","version":1,"mbox":"https://patchwork.libcamera.org/series/938/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3882/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3882/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 69543603CF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 May 2020 13:00:33 +0200 (CEST)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id BC7F0E0009;\n\tFri, 29 May 2020 11:00:32 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 29 May 2020 13:03:35 +0200","Message-Id":"<20200529110335.620503-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.26.2","In-Reply-To":"<20200529110335.620503-1-jacopo@jmondi.org>","References":"<20200529110335.620503-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 5/5] libcamera: v4l2_device: Rename\n\tformats() method","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, 29 May 2020 11:00:33 -0000"},"content":"Both the V4L2VideoDevice and V4L2Subdevice classes provide a formats()\nmethods which returns an ImageFormatMap specialization.\n\nThe method name formats() collides with ImageFormatsMap::formats() and\nmakes accessing the map or the list of supported format identifiers\nconfusing.\n\nRename the V4L2VideoDevice and V4L2Subdevice methods to imageFormats(),\nto distinguish the two.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/v4l2_subdevice.h        |  2 +-\n include/libcamera/internal/v4l2_videodevice.h      |  2 +-\n src/libcamera/camera_sensor.cpp                    |  2 +-\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 +++++-----\n src/libcamera/pipeline/simple/simple.cpp           |  2 +-\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       |  2 +-\n src/libcamera/v4l2_subdevice.cpp                   |  2 +-\n src/libcamera/v4l2_videodevice.cpp                 |  2 +-\n test/v4l2_subdevice/list_formats.cpp               |  6 +++---\n 9 files changed, 15 insertions(+), 15 deletions(-)","diff":"diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex 06f10d7b4c5d..2218e90c1da6 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -53,7 +53,7 @@ public:\n \tint setSelection(unsigned int pad, unsigned int target,\n \t\t\t Rectangle *rect);\n \n-\tformatsMap formats(unsigned int pad);\n+\tformatsMap imageFormats(unsigned int pad);\n \n \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n \t\t      Whence whence = ActiveFormat);\ndiff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex 9632ad71b988..2d968797ee86 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -189,7 +189,7 @@ public:\n \n \tint getFormat(V4L2DeviceFormat *format);\n \tint setFormat(V4L2DeviceFormat *format);\n-\tformatsMap formats(uint32_t code = 0);\n+\tformatsMap imageFormats(uint32_t code = 0);\n \n \tint setSelection(unsigned int target, Rectangle *rect);\n \ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex b14b4051dca6..8aafdfe76299 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -244,7 +244,7 @@ int CameraSensor::init()\n \tproperties_.set(properties::Rotation, propertyValue);\n \n \t/* Enumerate, sort and cache media bus codes and sizes. */\n-\tformats_ = subdev_->formats(pad_);\n+\tformats_ = subdev_->imageFormats(pad_);\n \tif (formats_.isEmpty()) {\n \t\tLOG(CameraSensor, Error) << \"No image format found\";\n \t\treturn -EINVAL;\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 7dd579090ec6..a407945819be 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -425,7 +425,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \t\t\t * the user request.\n \t\t\t */\n \t\t\tV4L2VideoDevice::formatsMap fmts =\n-\t\t\t\tdata_->unicam_[Unicam::Image].dev()->formats();\n+\t\t\t\tdata_->unicam_[Unicam::Image].dev()->imageFormats();\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@@ -482,9 +482,9 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \t\tV4L2VideoDevice::formatsMap fmts;\n \n \t\tif (i == maxIndex)\n-\t\t\tfmts = data_->isp_[Isp::Output0].dev()->formats();\n+\t\t\tfmts = data_->isp_[Isp::Output0].dev()->imageFormats();\n \t\telse\n-\t\t\tfmts = data_->isp_[Isp::Output1].dev()->formats();\n+\t\t\tfmts = data_->isp_[Isp::Output1].dev()->imageFormats();\n \n \t\tif (fmts.find(V4L2PixelFormat::fromPixelFormat(cfgPixFmt, false)) == fmts.end()) {\n \t\t\t/* If we cannot find a native format, use a default one. */\n@@ -527,7 +527,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \t\tswitch (role) {\n \t\tcase StreamRole::StillCaptureRaw:\n \t\t\tcfg.size = data->sensor_->resolution();\n-\t\t\tfmts = data->unicam_[Unicam::Image].dev()->formats();\n+\t\t\tfmts = data->unicam_[Unicam::Image].dev()->imageFormats();\n \t\t\tsensorFormat = findBestMode(fmts, cfg.size);\n \t\t\tcfg.pixelFormat = sensorFormat.fourcc.toPixelFormat();\n \t\t\tASSERT(cfg.pixelFormat.isValid());\n@@ -603,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-\tV4L2VideoDevice::formatsMap fmts = data->unicam_[Unicam::Image].dev()->formats();\n+\tV4L2VideoDevice::formatsMap fmts = data->unicam_[Unicam::Image].dev()->imageFormats();\n \tV4L2DeviceFormat sensorFormat = findBestMode(fmts, rawStream ? sensorSize : maxSize);\n \n \t/*\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex feaa2854f037..6857ec75cb1f 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\tV4L2VideoDevice::formatsMap videoFormats = video_->formats(format.mbus_code);\n+\t\tV4L2VideoDevice::formatsMap videoFormats = video_->imageFormats(format.mbus_code);\n \n \t\tLOG(SimplePipeline, Debug)\n \t\t\t<< \"Adding configuration for \" << format.size.toString()\ndiff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 6250186e9390..39c8353a2adf 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-\tV4L2VideoDevice::formatsMap v4l2Formats = data->video_->formats();\n+\tV4L2VideoDevice::formatsMap v4l2Formats = data->video_->imageFormats();\n \tstd::map<PixelFormat, std::vector<SizeRange>> deviceFormats;\n \tstd::transform(v4l2Formats.begin(), v4l2Formats.end(),\n \t\t       std::inserter(deviceFormats, deviceFormats.begin()),\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 0dd8e8686967..24ca6d80b27e 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -325,7 +325,7 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n  *\n  * \\return A list of the supported device formats\n  */\n-V4L2Subdevice::formatsMap V4L2Subdevice::formats(unsigned int pad)\n+V4L2Subdevice::formatsMap V4L2Subdevice::imageFormats(unsigned int pad)\n {\n \tformatsMap formats;\n \ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 6d48018396c3..08cae92978d4 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -930,7 +930,7 @@ int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format)\n  *\n  * \\return A list of the supported video device formats\n  */\n-V4L2VideoDevice::formatsMap V4L2VideoDevice::formats(uint32_t code)\n+V4L2VideoDevice::formatsMap V4L2VideoDevice::imageFormats(uint32_t code)\n {\n \tformatsMap formats;\n \ndiff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp\nindex a32f5c833c28..262362dee3c9 100644\n--- a/test/v4l2_subdevice/list_formats.cpp\n+++ b/test/v4l2_subdevice/list_formats.cpp\n@@ -50,7 +50,7 @@ int ListFormatsTest::run()\n \t/* List all formats available on existing \"Scaler\" pads. */\n \tV4L2Subdevice::formatsMap formats;\n \n-\tformats = scaler_->formats(0);\n+\tformats = scaler_->imageFormats(0);\n \tif (formats.isEmpty()) {\n \t\tcerr << \"Failed to list formats on pad 0 of subdevice \"\n \t\t     << scaler_->entity()->name() << endl;\n@@ -59,7 +59,7 @@ int ListFormatsTest::run()\n \tfor (unsigned int code : formats.formats())\n \t\tprintFormats(0, code, formats.sizes(code));\n \n-\tformats = scaler_->formats(1);\n+\tformats = scaler_->imageFormats(1);\n \tif (formats.isEmpty()) {\n \t\tcerr << \"Failed to list formats on pad 1 of subdevice \"\n \t\t     << scaler_->entity()->name() << endl;\n@@ -69,7 +69,7 @@ int ListFormatsTest::run()\n \t\tprintFormats(1, code, formats.sizes(code));\n \n \t/* List format on a non-existing pad, format vector shall be empty. */\n-\tformats = scaler_->formats(2);\n+\tformats = scaler_->imageFormats(2);\n \tif (!formats.isEmpty()) {\n \t\tcerr << \"Listing formats on non-existing pad 2 of subdevice \"\n \t\t     << scaler_->entity()->name()\n","prefixes":["libcamera-devel","5/5"]}