From patchwork Tue Jul 21 13:55:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 8905 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1BDBDBDB1B for ; Tue, 21 Jul 2020 13:55:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5341F60926; Tue, 21 Jul 2020 15:55:56 +0200 (CEST) Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6AB7560554 for ; Tue, 21 Jul 2020 15:55:55 +0200 (CEST) X-Halon-ID: bddf759a-cb59-11ea-86ee-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id bddf759a-cb59-11ea-86ee-0050569116f7; Tue, 21 Jul 2020 15:54:48 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 21 Jul 2020 15:55:39 +0200 Message-Id: <20200721135541.2931205-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200721135541.2931205-1-niklas.soderlund@ragnatech.se> References: <20200721135541.2931205-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/3] libcamera: v4l2_subdevice: Replace ImageFormats with a map 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Replace the V4L2Subdevice usage of the ImageFormats class with a std::map and the utils::map_keys() helper. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- * Changes since RFC - Fix spelling in commit message. - Prevent double lookup in CameraSensor::getFormat(). - Preserve error message in V4L2Subdevice::formats(). --- include/libcamera/internal/camera_sensor.h | 6 ++---- include/libcamera/internal/v4l2_subdevice.h | 4 +++- src/libcamera/camera_sensor.cpp | 13 +++++++------ src/libcamera/v4l2_subdevice.cpp | 12 +++++++++--- test/v4l2_subdevice/list_formats.cpp | 16 ++++++++-------- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 7f07413f95602881..06c8292ca30129de 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -16,13 +16,11 @@ #include "libcamera/internal/formats.h" #include "libcamera/internal/log.h" +#include "libcamera/internal/v4l2_subdevice.h" namespace libcamera { class MediaEntity; -class V4L2Subdevice; - -struct V4L2SubdeviceFormat; struct CameraSensorInfo { std::string model; @@ -75,7 +73,7 @@ private: std::string model_; - ImageFormats formats_; + V4L2Subdevice::Formats formats_; Size resolution_; std::vector mbusCodes_; std::vector sizes_; diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h index a3ecf123f640dd54..02ee3e914a8b1d92 100644 --- a/include/libcamera/internal/v4l2_subdevice.h +++ b/include/libcamera/internal/v4l2_subdevice.h @@ -32,6 +32,8 @@ struct V4L2SubdeviceFormat { class V4L2Subdevice : public V4L2Device { public: + using Formats = std::map>; + enum Whence { ActiveFormat, TryFormat, @@ -51,7 +53,7 @@ public: int setSelection(unsigned int pad, unsigned int target, Rectangle *rect); - ImageFormats formats(unsigned int pad); + Formats formats(unsigned int pad); int getFormat(unsigned int pad, V4L2SubdeviceFormat *format, Whence whence = ActiveFormat); diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 6e93cc51155ba678..350f49accad99c7b 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -18,7 +18,6 @@ #include "libcamera/internal/formats.h" #include "libcamera/internal/utils.h" -#include "libcamera/internal/v4l2_subdevice.h" /** * \file camera_sensor.h @@ -245,15 +244,15 @@ int CameraSensor::init() /* Enumerate, sort and cache media bus codes and sizes. */ formats_ = subdev_->formats(pad_); - if (formats_.isEmpty()) { + if (formats_.empty()) { LOG(CameraSensor, Error) << "No image format found"; return -EINVAL; } - mbusCodes_ = formats_.formats(); + mbusCodes_ = utils::map_keys(formats_); std::sort(mbusCodes_.begin(), mbusCodes_.end()); - for (const auto &format : formats_.data()) { + for (const auto &format : formats_) { const std::vector &ranges = format.second; std::transform(ranges.begin(), ranges.end(), std::back_inserter(sizes_), [](const SizeRange &range) { return range.max; }); @@ -359,9 +358,11 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector &mbu uint32_t bestCode = 0; for (unsigned int code : mbusCodes) { - const std::vector &ranges = formats_.sizes(code); + const auto formats = formats_.find(code); + if (formats == formats_.end()) + continue; - for (const SizeRange &range : ranges) { + for (const SizeRange &range : formats->second) { const Size &sz = range.max; if (sz.width < size.width || sz.height < size.height) diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 32c6c7acc11a6a3f..85d00c246f5e5ee9 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -217,6 +217,11 @@ uint8_t V4L2SubdeviceFormat::bitsPerPixel() const * any device left open will be closed, and any resources released. */ +/** + * \typedef V4L2Subdevice::Formats + * \brief A map of supported media bus formats to frame sizes + */ + /** * \enum V4L2Subdevice::Whence * \brief Specify the type of format for getFormat() and setFormat() operations @@ -340,9 +345,9 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target, * * \return A list of the supported device formats */ -ImageFormats V4L2Subdevice::formats(unsigned int pad) +V4L2Subdevice::Formats V4L2Subdevice::formats(unsigned int pad) { - ImageFormats formats; + Formats formats; if (pad >= entity_->pads().size()) { LOG(V4L2, Error) << "Invalid pad: " << pad; @@ -354,7 +359,8 @@ ImageFormats V4L2Subdevice::formats(unsigned int pad) if (sizes.empty()) return {}; - if (formats.addFormat(code, sizes)) { + const auto inserted = formats.insert({ code, sizes }); + if (!inserted.second) { LOG(V4L2, Error) << "Could not add sizes for media bus code " << code << " on pad " << pad; diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp index a55af1100d9ab498..a6044c044036acd4 100644 --- a/test/v4l2_subdevice/list_formats.cpp +++ b/test/v4l2_subdevice/list_formats.cpp @@ -47,29 +47,29 @@ void ListFormatsTest::printFormats(unsigned int pad, int ListFormatsTest::run() { /* List all formats available on existing "Scaler" pads. */ - ImageFormats formats; + V4L2Subdevice::Formats formats; formats = scaler_->formats(0); - if (formats.isEmpty()) { + if (formats.empty()) { cerr << "Failed to list formats on pad 0 of subdevice " << scaler_->entity()->name() << endl; return TestFail; } - for (unsigned int code : formats.formats()) - printFormats(0, code, formats.sizes(code)); + for (unsigned int code : utils::map_keys(formats)) + printFormats(0, code, formats[code]); formats = scaler_->formats(1); - if (formats.isEmpty()) { + if (formats.empty()) { cerr << "Failed to list formats on pad 1 of subdevice " << scaler_->entity()->name() << endl; return TestFail; } - for (unsigned int code : formats.formats()) - printFormats(1, code, formats.sizes(code)); + for (unsigned int code : utils::map_keys(formats)) + printFormats(1, code, formats[code]); /* List format on a non-existing pad, format vector shall be empty. */ formats = scaler_->formats(2); - if (!formats.isEmpty()) { + if (!formats.empty()) { cerr << "Listing formats on non-existing pad 2 of subdevice " << scaler_->entity()->name() << " should return an empty format list" << endl; From patchwork Tue Jul 21 13:55:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 8906 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4163BBDB1B for ; Tue, 21 Jul 2020 13:55:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1C3396090F; Tue, 21 Jul 2020 15:55:59 +0200 (CEST) Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 11E2460738 for ; Tue, 21 Jul 2020 15:55:56 +0200 (CEST) X-Halon-ID: be78e11d-cb59-11ea-86ee-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id be78e11d-cb59-11ea-86ee-0050569116f7; Tue, 21 Jul 2020 15:54:49 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 21 Jul 2020 15:55:40 +0200 Message-Id: <20200721135541.2931205-3-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200721135541.2931205-1-niklas.soderlund@ragnatech.se> References: <20200721135541.2931205-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/3] libcamera: formats: Remove ImageFormats 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The ImageFormats helper class is not used anymore and can be removed. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- include/libcamera/internal/formats.h | 14 ----- src/libcamera/formats.cpp | 88 ---------------------------- 2 files changed, 102 deletions(-) diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h index cad41ad864a41b62..0bb15104429489aa 100644 --- a/include/libcamera/internal/formats.h +++ b/include/libcamera/internal/formats.h @@ -19,20 +19,6 @@ namespace libcamera { -class ImageFormats -{ -public: - int addFormat(unsigned int format, const std::vector &sizes); - - bool isEmpty() const; - std::vector formats() const; - const std::vector &sizes(unsigned int format) const; - const std::map> &data() const; - -private: - std::map> data_; -}; - struct PixelFormatPlaneInfo { unsigned int bytesPerGroup; diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index af3996c954ae1457..60b42ce23c2145fd 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -23,94 +23,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Formats) -/** - * \class ImageFormats - * \brief Describe V4L2Device and V4L2SubDevice image formats - * - * This class stores a list of image formats, each associated with a - * corresponding set of image sizes. It is used to describe the formats and - * sizes supported by a V4L2Device or V4L2Subdevice. - * - * Formats are stored as an integer. When used for a V4L2Device, the image - * formats are fourcc pixel formats. When used for a V4L2Subdevice they are - * media bus codes. Both are defined by the V4L2 specification. - * - * Sizes are stored as a list of SizeRange. - */ - -/** - * \brief Add a format and corresponding sizes to the description - * \param[in] format Pixel format or media bus code to describe - * \param[in] sizes List of supported size ranges for the format - * - * \return 0 on success or a negative error code otherwise - * \retval -EEXIST The format is already described - */ -int ImageFormats::addFormat(unsigned int format, const std::vector &sizes) -{ - if (data_.find(format) != data_.end()) - return -EEXIST; - - data_[format] = sizes; - - return 0; -} - -/** - * \brief Check if the list of devices supported formats is empty - * \return True if the list of supported formats is empty - */ -bool ImageFormats::isEmpty() const -{ - return data_.empty(); -} - -/** - * \brief Retrieve a list of all supported image formats - * \return List of pixel formats or media bus codes - */ -std::vector ImageFormats::formats() const -{ - std::vector formats; - formats.reserve(data_.size()); - - /* \todo: Should this be cached instead of computed each time? */ - for (auto const &it : data_) - formats.push_back(it.first); - - return formats; -} - -/** - * \brief Retrieve all sizes for a specific format - * \param[in] format The pixel format or mbus code - * - * Retrieve all size ranges for a specific format. For V4L2Device \a format is a - * pixel format while for a V4L2Subdevice \a format is a media bus code. - * - * \return The list of image sizes supported for \a format, or an empty list if - * the format is not supported - */ -const std::vector &ImageFormats::sizes(unsigned int format) const -{ - static const std::vector empty; - - auto const &it = data_.find(format); - if (it == data_.end()) - return empty; - - return it->second; -} - -/** - * \brief Retrieve the map that associates formats to image sizes - * \return The map that associates formats to image sizes - */ -const std::map> &ImageFormats::data() const -{ - return data_; -} - /** * \class PixelFormatPlaneInfo * \brief Information about a single plane of a pixel format From patchwork Tue Jul 21 13:55:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 8907 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A0007C2E7B for ; Tue, 21 Jul 2020 13:55:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3BCBB60933; Tue, 21 Jul 2020 15:55:59 +0200 (CEST) Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A69DA608E0 for ; Tue, 21 Jul 2020 15:55:57 +0200 (CEST) X-Halon-ID: bedbcce0-cb59-11ea-86ee-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id bedbcce0-cb59-11ea-86ee-0050569116f7; Tue, 21 Jul 2020 15:54:51 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 21 Jul 2020 15:55:41 +0200 Message-Id: <20200721135541.2931205-4-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200721135541.2931205-1-niklas.soderlund@ragnatech.se> References: <20200721135541.2931205-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/3] libcamera: v4l2_videodevice: Add using statement for format map 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Define a using statement for the format maps returned by V4L2Device::formats() and use it in all call sites. There is no functional change in this patch. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/internal/v4l2_videodevice.h | 4 +++- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 13 ++++++------- src/libcamera/pipeline/simple/simple.cpp | 2 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 +-- src/libcamera/v4l2_videodevice.cpp | 9 +++++++-- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index fb4c0aabdd46206c..40ed87e17cfa6d3c 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -168,6 +168,8 @@ public: class V4L2VideoDevice : public V4L2Device { public: + using Formats = std::map>; + explicit V4L2VideoDevice(const std::string &deviceNode); explicit V4L2VideoDevice(const MediaEntity *entity); V4L2VideoDevice(const V4L2VideoDevice &) = delete; @@ -188,7 +190,7 @@ public: int getFormat(V4L2DeviceFormat *format); int tryFormat(V4L2DeviceFormat *format); int setFormat(V4L2DeviceFormat *format); - std::map> formats(uint32_t code = 0); + Formats formats(uint32_t code = 0); int setSelection(unsigned int target, Rectangle *rect); diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index bf1c77144f855df9..82a0a4dfd6824fce 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -39,8 +39,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(RPI) -using V4L2PixFmtMap = std::map>; - namespace { bool isRaw(PixelFormat &pixFmt) @@ -69,7 +67,8 @@ double scoreFormat(double desired, double actual) return score; } -V4L2DeviceFormat findBestMode(V4L2PixFmtMap &formatsMap, const Size &req) +V4L2DeviceFormat findBestMode(V4L2VideoDevice::Formats &formatsMap, + const Size &req) { double bestScore = std::numeric_limits::max(), score; V4L2DeviceFormat bestMode = {}; @@ -410,7 +409,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() * Calculate the best sensor mode we can use based on * the user request. */ - V4L2PixFmtMap fmts = data_->unicam_[Unicam::Image].dev()->formats(); + V4L2VideoDevice::Formats fmts = data_->unicam_[Unicam::Image].dev()->formats(); V4L2DeviceFormat sensorFormat = findBestMode(fmts, cfg.size); int ret = data_->unicam_[Unicam::Image].dev()->tryFormat(&sensorFormat); if (ret) @@ -480,7 +479,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() else dev = data_->isp_[Isp::Output1].dev(); - V4L2PixFmtMap fmts = dev->formats(); + V4L2VideoDevice::Formats fmts = dev->formats(); if (fmts.find(V4L2PixelFormat::fromPixelFormat(cfgPixFmt, false)) == fmts.end()) { /* If we cannot find a native format, use a default one. */ @@ -517,7 +516,7 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, V4L2DeviceFormat sensorFormat; unsigned int bufferCount; PixelFormat pixelFormat; - V4L2PixFmtMap fmts; + V4L2VideoDevice::Formats fmts; Size size; if (roles.empty()) @@ -633,7 +632,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) } /* First calculate the best sensor mode we can use based on the user request. */ - V4L2PixFmtMap fmts = data->unicam_[Unicam::Image].dev()->formats(); + V4L2VideoDevice::Formats fmts = data->unicam_[Unicam::Image].dev()->formats(); V4L2DeviceFormat sensorFormat = findBestMode(fmts, rawStream ? sensorSize : maxSize); /* diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 28d367883323d855..5221ff3384923f56 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -275,7 +275,7 @@ int SimpleCameraData::init() return ret; } - std::map> videoFormats = + V4L2VideoDevice::Formats videoFormats = video_->formats(format.mbus_code); LOG(SimplePipeline, Debug) diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 47f383d1551d5193..93e3dc17e3a7105e 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -172,8 +172,7 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera, if (roles.empty()) return config; - std::map> v4l2Formats = - data->video_->formats(); + V4L2VideoDevice::Formats v4l2Formats = data->video_->formats(); std::map> deviceFormats; for (const auto &format : v4l2Formats) { PixelFormat pixelFormat = format.first.toPixelFormat(); diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index e0d2201269440795..9c4f3524af735598 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -461,6 +461,11 @@ const std::string V4L2DeviceFormat::toString() const * \context This class is \threadbound. */ +/** + * \typedef V4L2VideoDevice::Formats + * \brief A map of supported V4L2 pixel formats to frame sizes + */ + /** * \brief Construct a V4L2VideoDevice * \param[in] deviceNode The file-system path to the video device node @@ -951,9 +956,9 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set) * * \return A list of the supported video device formats */ -std::map> V4L2VideoDevice::formats(uint32_t code) +V4L2VideoDevice::Formats V4L2VideoDevice::formats(uint32_t code) { - std::map> formats; + V4L2VideoDevice::Formats formats; for (V4L2PixelFormat pixelFormat : enumPixelformats(code)) { std::vector sizes = enumSizes(pixelFormat);