android: camera_stream: Construct with Android stream

Pass the android camera3_stream_t, and a libcamera::StreamConfiguration
to identify the source and destination parameters of this stream.

Pass a CameraDevice pointer to the CameraStream constructor to allow
retrieval of the StreamConfiguration associated with the CameraStream.

Also change the format on which the CameraDevice performs checks to
decide if post-processing is required, as the libcamera facing format is
not meaningful anymore, but the Android requested format should be used
instead.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2020-10-02 20:48:35 +02:00
parent 3c84d88193
commit 160bb0998b
4 changed files with 36 additions and 10 deletions

View file

@ -7,14 +7,24 @@
#include "camera_stream.h"
#include "camera_device.h"
#include "jpeg/encoder.h"
#include "jpeg/encoder_libjpeg.h"
using namespace libcamera;
CameraStream::CameraStream(PixelFormat format, Size size, Type type, unsigned int index)
: format_(format), size_(size), type_(type), index_(index)
CameraStream::CameraStream(CameraDevice *cameraDevice,
camera3_stream_t *camera3Stream,
const libcamera::StreamConfiguration &cfg,
Type type, unsigned int index)
: cameraDevice_(cameraDevice), camera3Stream_(camera3Stream),
type_(type), index_(index)
{
config_ = cameraDevice_->cameraConfiguration();
format_ = cfg.pixelFormat;
size_ = cfg.size;
if (type_ == Type::Internal || type_ == Type::Mapped)
encoder_ = std::make_unique<EncoderLibJpeg>();
}