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>
This commit is contained in:
Jacopo Mondi 2020-10-03 11:36:41 +02:00
parent 9e95d5e453
commit 216030aa9d
3 changed files with 16 additions and 9 deletions

View file

@ -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_)