From ce02ea29cda94f065d857ae00101e2fef5467a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Sat, 25 May 2019 02:20:55 +0200 Subject: libcamera: v4l2_subdevice: Replace FormatEnum with ImageFormats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace all usage of FormatEnum with ImageFormats and completely remove FormatEnum which is no longer needed. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/v4l2_subdevice.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/libcamera/v4l2_subdevice.cpp') diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 3296bc01..c38f95a3 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -187,22 +187,17 @@ int V4L2Subdevice::setCompose(unsigned int pad, Rectangle *rect) } /** - * \brief List the sub-device image resolutions and formats on \a pad + * \brief Enumerate all media bus codes and frame sizes on a \a pad * \param[in] pad The 0-indexed pad number to enumerate formats on * - * Retrieve a list of image formats and sizes on the \a pad of a video - * subdevice. Subdevices can report either a list of discrete sizes they - * support or a list of intervals expressed as a [min-max] sizes range. + * Enumerate all media bus codes and frame sizes supported by the subdevice on + * a \a pad. * - * Each image size list is associated with a media bus pixel code for which - * the reported resolutions are supported. - * - * \return A map of image formats associated with a list of image sizes, or - * an empty map on error or if the pad does not exist + * \return A list of the supported device formats */ -FormatEnum V4L2Subdevice::formats(unsigned int pad) +ImageFormats V4L2Subdevice::formats(unsigned int pad) { - FormatEnum formatMap = {}; + ImageFormats formats; if (pad >= entity_->pads().size()) { LOG(V4L2Subdev, Error) << "Invalid pad: " << pad; @@ -214,10 +209,15 @@ FormatEnum V4L2Subdevice::formats(unsigned int pad) if (sizes.empty()) return {}; - formatMap[code] = sizes; + if (formats.addFormat(code, sizes)) { + LOG(V4L2Subdev, Error) + << "Could not add sizes for media bus code " + << code << " on pad " << pad; + return {}; + } } - return formatMap; + return formats; } /** -- cgit v1.2.1