summaryrefslogtreecommitdiff
path: root/src/android/camera_stream.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-10-03 11:36:41 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-10-07 16:07:44 +0200
commit216030aa9d0953cff552d5892d32e5cd73864202 (patch)
tree6374d754012666ecfab24cc8fe84f894d29aaebc /src/android/camera_stream.cpp
parent9e95d5e4531039f8e21c65ea88be9ad6aaa1ced0 (diff)
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 <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/camera_stream.cpp')
-rw-r--r--src/android/camera_stream.cpp10
1 files changed, 10 insertions, 0 deletions
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<EncoderLibJpeg>();
}
+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_)