android: camera_device: Make CameraStream a class

Complete the transformation of CameraStream into a class and provide
a read-only interface that allows to access its parameters but not
modify them at run-time.

No functional changes intended but this change aims to make the code
more robust by enforcing a stricter interface in the CameraStream class.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi
2020-09-02 12:17:09 +02:00
parent facadb188e
commit 45fe8e99c8
2 changed files with 14 additions and 11 deletions
+8 -6
View File
@@ -27,18 +27,20 @@
class CameraMetadata;
struct CameraStream {
class CameraStream
{
public:
CameraStream(libcamera::PixelFormat, libcamera::Size, unsigned int i,
Encoder *e = nullptr);
CameraStream(libcamera::PixelFormat format, libcamera::Size size,
unsigned int index, Encoder *encoder = nullptr);
const libcamera::PixelFormat &format() const { return format_; }
const libcamera::Size &size() const { return size_; }
unsigned int index() const { return index_; }
Encoder *encoder() const { return encoder_.get(); }
libcamera::PixelFormat format;
libcamera::Size size;
private:
libcamera::PixelFormat format_;
libcamera::Size size_;
/*
* The index of the libcamera StreamConfiguration as added during
* configureStreams(). A single libcamera Stream may be used to deliver