[libcamera-devel,v2,3/3] libcamera: pipeline: ipu3: Use parameterized StreamConfiguration

Message ID 20200324175643.22382-4-kgupta@es.iitr.ac.in
State New
Delegated to: Kieran Bingham
Headers show
Series
  • Use StreamFormats in pipelines
Related show

Commit Message

Kaaira Gupta March 24, 2020, 5:56 p.m. UTC
Replace default constructor StreamConfiguration() by its parameterized
counterpart by using StreamFormats in generateConfiguration() in
ipu3

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Patch

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 36f3990..1400099 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -399,9 +399,18 @@  CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,
 	};
 
 	config = new IPU3CameraConfiguration(camera, data);
+	ImgUDevice *imgu = data->imgu_;
+	V4L2VideoDevice *dev = (imgu->output_).dev;
+	auto formats = (*dev).formats();
+
+	/* We find the range of the only pixel format that the driver upports. */
+	std::vector<SizeRange> range = formats[V4L2PixelFormat(PixelFormat(DRM_FORMAT_NV12))];
+	std::map<PixelFormat, std::vector<SizeRange>> pixelformats;
+	pixelformats[PixelFormat(DRM_FORMAT_NV12)] = {range};
 
 	for (const StreamRole role : roles) {
-		StreamConfiguration cfg = {};
+		StreamFormats format(pixelformats);
+		StreamConfiguration cfg(format);
 		IPU3Stream *stream = nullptr;
 
 		cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);