summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-07-21 15:30:43 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-07-23 16:31:41 +0200
commita8a2048ab0541d7a9743bc7f0db91229cc34f320 (patch)
tree6c14dc98689719a62609c31b6460f02653c4d2ea /src/libcamera/pipeline
parent4a5b0df9841f7d19d706adbefb2f2cbb4ea8569b (diff)
libcamera: v4l2_videodevice: Add using statement for format map
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 <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp13
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp2
-rw-r--r--src/libcamera/pipeline/uvcvideo/uvcvideo.cpp3
3 files changed, 8 insertions, 10 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index bf1c7714..82a0a4df 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<V4L2PixelFormat, std::vector<SizeRange>>;
-
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<double>::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 28d36788..5221ff33 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<V4L2PixelFormat, std::vector<SizeRange>> 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 47f383d1..93e3dc17 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<V4L2PixelFormat, std::vector<SizeRange>> v4l2Formats =
- data->video_->formats();
+ V4L2VideoDevice::Formats v4l2Formats = data->video_->formats();
std::map<PixelFormat, std::vector<SizeRange>> deviceFormats;
for (const auto &format : v4l2Formats) {
PixelFormat pixelFormat = format.first.toPixelFormat();