From 216030aa9d0953cff552d5892d32e5cd73864202 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Sat, 3 Oct 2020 11:36:41 +0200 Subject: android: camera_stream: Retrieve Stream and Configuration It's a common pattern to access the libcamera::Stream and libcamera::StreamConfiguration using the CameraStream instance's index. Add two methods to the CameraStream to shorten access to the two fields. This allows removing the index() method from the class interface. Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/android/camera_stream.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/android/camera_stream.cpp') diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index e86a7ba6..9c7819ef 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -33,6 +33,16 @@ CameraStream::CameraStream(CameraDevice *cameraDevice, encoder_ = std::make_unique(); } +const StreamConfiguration &CameraStream::configuration() const +{ + return config_->at(index_); +} + +Stream *CameraStream::stream() const +{ + return configuration().stream(); +} + int CameraStream::configure(const libcamera::StreamConfiguration &cfg) { if (encoder_) -- cgit v1.2.1