From patchwork Fri May 29 11:03:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 3882 Return-Path: Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 69543603CF for ; Fri, 29 May 2020 13:00:33 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id BC7F0E0009; Fri, 29 May 2020 11:00:32 +0000 (UTC) From: Jacopo Mondi 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 Subject: [libcamera-devel] [PATCH 5/5] libcamera: v4l2_device: Rename formats() method X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2020 11:00:33 -0000 Both the V4L2VideoDevice and V4L2Subdevice classes provide a formats() methods which returns an ImageFormatMap specialization. The method name formats() collides with ImageFormatsMap::formats() and makes accessing the map or the list of supported format identifiers confusing. Rename the V4L2VideoDevice and V4L2Subdevice methods to imageFormats(), to distinguish the two. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/internal/v4l2_subdevice.h | 2 +- include/libcamera/internal/v4l2_videodevice.h | 2 +- src/libcamera/camera_sensor.cpp | 2 +- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 +++++----- src/libcamera/pipeline/simple/simple.cpp | 2 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +- src/libcamera/v4l2_subdevice.cpp | 2 +- src/libcamera/v4l2_videodevice.cpp | 2 +- test/v4l2_subdevice/list_formats.cpp | 6 +++--- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h index 06f10d7b4c5d..2218e90c1da6 100644 --- a/include/libcamera/internal/v4l2_subdevice.h +++ b/include/libcamera/internal/v4l2_subdevice.h @@ -53,7 +53,7 @@ public: int setSelection(unsigned int pad, unsigned int target, Rectangle *rect); - formatsMap formats(unsigned int pad); + formatsMap imageFormats(unsigned int pad); int getFormat(unsigned int pad, V4L2SubdeviceFormat *format, Whence whence = ActiveFormat); diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index 9632ad71b988..2d968797ee86 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -189,7 +189,7 @@ public: int getFormat(V4L2DeviceFormat *format); int setFormat(V4L2DeviceFormat *format); - formatsMap formats(uint32_t code = 0); + formatsMap imageFormats(uint32_t code = 0); int setSelection(unsigned int target, Rectangle *rect); diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index b14b4051dca6..8aafdfe76299 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -244,7 +244,7 @@ int CameraSensor::init() properties_.set(properties::Rotation, propertyValue); /* Enumerate, sort and cache media bus codes and sizes. */ - formats_ = subdev_->formats(pad_); + formats_ = subdev_->imageFormats(pad_); if (formats_.isEmpty()) { LOG(CameraSensor, Error) << "No image format found"; return -EINVAL; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 7dd579090ec6..a407945819be 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -425,7 +425,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() * the user request. */ V4L2VideoDevice::formatsMap fmts = - data_->unicam_[Unicam::Image].dev()->formats(); + data_->unicam_[Unicam::Image].dev()->imageFormats(); V4L2DeviceFormat sensorFormat = findBestMode(fmts, cfg.size); PixelFormat sensorPixFormat = sensorFormat.fourcc.toPixelFormat(); if (cfg.size != sensorFormat.size || @@ -482,9 +482,9 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() V4L2VideoDevice::formatsMap fmts; if (i == maxIndex) - fmts = data_->isp_[Isp::Output0].dev()->formats(); + fmts = data_->isp_[Isp::Output0].dev()->imageFormats(); else - fmts = data_->isp_[Isp::Output1].dev()->formats(); + fmts = data_->isp_[Isp::Output1].dev()->imageFormats(); if (fmts.find(V4L2PixelFormat::fromPixelFormat(cfgPixFmt, false)) == fmts.end()) { /* If we cannot find a native format, use a default one. */ @@ -527,7 +527,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, switch (role) { case StreamRole::StillCaptureRaw: cfg.size = data->sensor_->resolution(); - fmts = data->unicam_[Unicam::Image].dev()->formats(); + fmts = data->unicam_[Unicam::Image].dev()->imageFormats(); sensorFormat = findBestMode(fmts, cfg.size); cfg.pixelFormat = sensorFormat.fourcc.toPixelFormat(); ASSERT(cfg.pixelFormat.isValid()); @@ -603,7 +603,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) } /* First calculate the best sensor mode we can use based on the user request. */ - V4L2VideoDevice::formatsMap fmts = data->unicam_[Unicam::Image].dev()->formats(); + V4L2VideoDevice::formatsMap fmts = data->unicam_[Unicam::Image].dev()->imageFormats(); V4L2DeviceFormat sensorFormat = findBestMode(fmts, rawStream ? sensorSize : maxSize); /* diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index feaa2854f037..6857ec75cb1f 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -275,7 +275,7 @@ int SimpleCameraData::init() return ret; } - V4L2VideoDevice::formatsMap videoFormats = video_->formats(format.mbus_code); + V4L2VideoDevice::formatsMap videoFormats = video_->imageFormats(format.mbus_code); LOG(SimplePipeline, Debug) << "Adding configuration for " << format.size.toString() diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 6250186e9390..39c8353a2adf 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -159,7 +159,7 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera, if (roles.empty()) return config; - V4L2VideoDevice::formatsMap v4l2Formats = data->video_->formats(); + V4L2VideoDevice::formatsMap v4l2Formats = data->video_->imageFormats(); std::map> deviceFormats; std::transform(v4l2Formats.begin(), v4l2Formats.end(), std::inserter(deviceFormats, deviceFormats.begin()), diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 0dd8e8686967..24ca6d80b27e 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -325,7 +325,7 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target, * * \return A list of the supported device formats */ -V4L2Subdevice::formatsMap V4L2Subdevice::formats(unsigned int pad) +V4L2Subdevice::formatsMap V4L2Subdevice::imageFormats(unsigned int pad) { formatsMap formats; diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 6d48018396c3..08cae92978d4 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -930,7 +930,7 @@ int V4L2VideoDevice::setFormatSingleplane(V4L2DeviceFormat *format) * * \return A list of the supported video device formats */ -V4L2VideoDevice::formatsMap V4L2VideoDevice::formats(uint32_t code) +V4L2VideoDevice::formatsMap V4L2VideoDevice::imageFormats(uint32_t code) { formatsMap formats; diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp index a32f5c833c28..262362dee3c9 100644 --- a/test/v4l2_subdevice/list_formats.cpp +++ b/test/v4l2_subdevice/list_formats.cpp @@ -50,7 +50,7 @@ int ListFormatsTest::run() /* List all formats available on existing "Scaler" pads. */ V4L2Subdevice::formatsMap formats; - formats = scaler_->formats(0); + formats = scaler_->imageFormats(0); if (formats.isEmpty()) { cerr << "Failed to list formats on pad 0 of subdevice " << scaler_->entity()->name() << endl; @@ -59,7 +59,7 @@ int ListFormatsTest::run() for (unsigned int code : formats.formats()) printFormats(0, code, formats.sizes(code)); - formats = scaler_->formats(1); + formats = scaler_->imageFormats(1); if (formats.isEmpty()) { cerr << "Failed to list formats on pad 1 of subdevice " << scaler_->entity()->name() << endl; @@ -69,7 +69,7 @@ int ListFormatsTest::run() printFormats(1, code, formats.sizes(code)); /* List format on a non-existing pad, format vector shall be empty. */ - formats = scaler_->formats(2); + formats = scaler_->imageFormats(2); if (!formats.isEmpty()) { cerr << "Listing formats on non-existing pad 2 of subdevice " << scaler_->entity()->name()