summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-24 17:54:07 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-03 00:59:13 +0200
commitfe29aa676162ae73c8a85b77705c3dbf296d46f4 (patch)
tree9436fd3b6f3b9e7c042116e0cba400675c2083cb
parent973c12488c772e02ee9f027a49f25052cd991c20 (diff)
libcamera: pipeline: simple: Store streams in a vector
To prepare for multiple streams support, store the streams in a vector in the SimpleCameraData class. 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>
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index a873670e..b71f4267 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -61,7 +61,6 @@ public:
SimpleCameraData(SimplePipelineHandler *pipe, MediaEntity *sensor);
bool isValid() const { return sensor_ != nullptr; }
- std::set<Stream *> streams() { return { &stream_ }; }
int init();
int setupLinks();
@@ -80,7 +79,7 @@ public:
SizeRange outputSizes;
};
- Stream stream_;
+ std::vector<Stream> streams_;
std::unique_ptr<CameraSensor> sensor_;
std::list<Entity> entities_;
V4L2VideoDevice *video_;
@@ -169,6 +168,8 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
{
int ret;
+ streams_.resize(1);
+
/*
* Walk the pipeline towards the video node and store all entities
* along the way.
@@ -620,7 +621,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
LOG(SimplePipeline, Debug) << "Using format converter";
}
- cfg.setStream(&data->stream_);
+ cfg.setStream(&data->streams_[0]);
return 0;
}
@@ -645,7 +646,7 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] const ControlL
{
SimpleCameraData *data = cameraData(camera);
V4L2VideoDevice *video = data->video_;
- unsigned int count = data->stream_.configuration().bufferCount;
+ unsigned int count = data->streams_[0].configuration().bufferCount;
int ret;
if (useConverter_)
@@ -696,7 +697,7 @@ void SimplePipelineHandler::stop(Camera *camera)
int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)
{
SimpleCameraData *data = cameraData(camera);
- Stream *stream = &data->stream_;
+ Stream *stream = &data->streams_[0];
FrameBuffer *buffer = request->findBuffer(stream);
if (!buffer) {
@@ -825,9 +826,13 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
if (ret < 0)
continue;
+ std::set<Stream *> streams;
+ std::transform(data->streams_.begin(), data->streams_.end(),
+ std::inserter(streams, streams.end()),
+ [](Stream &stream) { return &stream; });
+
std::shared_ptr<Camera> camera =
- Camera::create(this, data->sensor_->id(),
- data->streams());
+ Camera::create(this, data->sensor_->id(), streams);
registerCamera(std::move(camera), std::move(data));
registered = true;
}