[libcamera-devel,v5,07/23] libcamera: pipeline: raspberrypi: Simplify format fetching

Message ID 20200709132835.112593-8-paul.elder@ideasonboard.com
State Accepted
Headers show
Series
  • Clean up formats in v4l2-compat and pipeline handlers
Related show

Commit Message

Paul Elder July 9, 2020, 1:28 p.m. UTC
Simplify code for looking up PixelFormatInfo using a V4L2 format by
using the new PixelFormatInfo lookup function based on V4L2 format.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

---
No change in v5

No change in v4

No change in v3

Changes in v2:
- just a few words in the commit message
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index f4966f8..1c0000b 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -81,8 +81,7 @@  V4L2DeviceFormat findBestMode(V4L2PixFmtMap &formatsMap, const Size &req)
 	/* Calculate the closest/best mode from the user requested size. */
 	for (const auto &iter : formatsMap) {
 		V4L2PixelFormat v4l2Format = iter.first;
-		PixelFormat pixelFormat = v4l2Format.toPixelFormat();
-		const PixelFormatInfo &info = PixelFormatInfo::info(pixelFormat);
+		const PixelFormatInfo &info = PixelFormatInfo::info(v4l2Format);
 
 		for (const SizeRange &sz : iter.second) {
 			double modeWidth = sz.contains(req) ? req.width : sz.max.width;