android: camera_stream: Fetch format and size from configuration

Fetch the format and size of the libcamera::StreamConfiguration
associated with a CameraStream by accessing the configuration by
index.

This removes the need to store the libcamera stream format and sizes
as class members and avoid duplicating information that might get out
of sync.

It also allows to remove the StreamConfiguration from the constructor
parameters list, as it can be identified by its index. While at it,
re-order the constructor parameters order.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2020-10-03 12:00:54 +02:00
parent 216030aa9d
commit e3393f147e
3 changed files with 12 additions and 29 deletions

View file

@ -1206,9 +1206,8 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
streamConfiguration.pixelFormat = format;
config_->addConfiguration(streamConfiguration);
unsigned int index = config_->size() - 1;
streams_.emplace_back(this, stream, streamConfiguration,
CameraStream::Type::Direct, index);
streams_.emplace_back(this, CameraStream::Type::Direct,
stream, config_->size() - 1);
stream->priv = static_cast<void *>(&streams_.back());
}
@ -1262,8 +1261,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
index = config_->size() - 1;
}
StreamConfiguration &cfg = config_->at(index);
streams_.emplace_back(this, jpegStream, cfg, type, index);
streams_.emplace_back(this, type, jpegStream, index);
jpegStream->priv = static_cast<void *>(&streams_.back());
}