From 973c12488c772e02ee9f027a49f25052cd991c20 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 26 Dec 2020 23:45:04 +0200 Subject: libcamera: pipeline: simple: converter: Add multi-stream support While the M2M device backing the converter doesn't support multiple streams natively, it can be run once per stream to produce multiple outputs from the same input, with different output formats and sizes. To support this, create a class to model a stream and move control of the M2M device to the Stream class. The SimpleConverter class then creates stream instances and iterates over them. Each stream needs its own instance of the V4L2M2MDevice, to support different output configurations. The SimpleConverter class retains a device instance to support the query operations. Signed-off-by: Laurent Pinchart Tested-by: Phi-Bang Nguyen Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/libcamera/pipeline/simple/simple.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libcamera/pipeline/simple/simple.cpp') diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index a5089dba..a873670e 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -610,7 +610,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) inputCfg.stride = captureFormat.planes[0].bpl; inputCfg.bufferCount = cfg.bufferCount; - ret = converter_->configure(inputCfg, cfg); + ret = converter_->configure(inputCfg, { cfg }); if (ret < 0) { LOG(SimplePipeline, Error) << "Unable to configure converter"; @@ -636,7 +636,7 @@ int SimplePipelineHandler::exportFrameBuffers(Camera *camera, Stream *stream, * whether the converter is used or not. */ if (useConverter_) - return converter_->exportBuffers(count, buffers); + return converter_->exportBuffers(0, count, buffers); else return data->video_->exportBuffers(count, buffers); } @@ -917,7 +917,7 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer) FrameBuffer *output = converterQueue_.front(); converterQueue_.pop(); - converter_->queueBuffers(buffer, output); + converter_->queueBuffers(buffer, { { 0, output } }); return; } -- cgit v1.2.1