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 <laurent.pinchart@ideasonboard.com>
Tested-by: Phi-Bang Nguyen <pnguyen@baylibre.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2020-12-26 23:45:04 +02:00
parent be50270b7d
commit 973c12488c
3 changed files with 269 additions and 97 deletions
+3 -3
View File
@@ -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;
}