summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_subdevice.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-05-25 02:20:55 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-06-19 03:06:33 +0200
commitce02ea29cda94f065d857ae00101e2fef5467a40 (patch)
tree0dda3d96451acd515629f73adb592ff273c279f3 /src/libcamera/v4l2_subdevice.cpp
parentbe78ffbe9abbd0fa6aab7a76c4a56d655d7b7548 (diff)
libcamera: v4l2_subdevice: Replace FormatEnum with ImageFormats
Replace all usage of FormatEnum with ImageFormats and completely remove FormatEnum which is no longer needed. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/v4l2_subdevice.cpp')
-rw-r--r--src/libcamera/v4l2_subdevice.cpp26
1 files changed, 13 insertions, 13 deletions
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;
}
/**