android: camera_stream: Add sourceStream

Add a sourceStream field to the CameraStream class, meant to contain a
reference to the direct stream which produces actual image data for
streams of type CameraStream::Mapped.

The sourceStream of mapped streams will be used in later patches to make
sure for each Mapped stream at least one libcamera::Stream is queued to
the libcamera::Camera.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Hirokazu Honda 2022-05-27 18:34:36 +09:00 committed by Jacopo Mondi
parent b4d4b78c82
commit fec64fb75a
3 changed files with 23 additions and 4 deletions

View file

@ -681,10 +681,23 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
for (const auto &streamConfig : streamConfigs) {
config->addConfiguration(streamConfig.config);
CameraStream *sourceStream = nullptr;
for (auto &stream : streamConfig.streams) {
streams_.emplace_back(this, config.get(), stream.type,
stream.stream, config->size() - 1);
stream.stream, sourceStream,
config->size() - 1);
stream.stream->priv = static_cast<void *>(&streams_.back());
/*
* The streamConfig.streams vector contains as its first
* element a Direct (or Internal) stream, and then an
* optional set of Mapped streams derived from the
* Direct stream. Cache the Direct stream pointer, to
* be used when constructing the subsequent mapped
* streams.
*/
if (stream.type == CameraStream::Type::Direct)
sourceStream = &streams_.back();
}
}