From e3393f147e5d011c6f02447a18eb73b1cf134b4b Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Sat, 3 Oct 2020 12:00:54 +0200 Subject: 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 Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/android/camera_device.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/android/camera_device.cpp') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 47c42319..678dca60 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -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(&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(&streams_.back()); } -- cgit v1.2.1