android: camera_stream: Delegate Encoder construction

Delegate the construction of the encoder to the CameraStream class
for streams that need post-processing.

Reviewed-by: Umang Jain <email@uajain.com>
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-02 19:40:42 +02:00
parent 94c4d49ebe
commit 3c84d88193
3 changed files with 26 additions and 17 deletions

View file

@ -8,11 +8,21 @@
#include "camera_stream.h"
#include "jpeg/encoder.h"
#include "jpeg/encoder_libjpeg.h"
using namespace libcamera;
CameraStream::CameraStream(PixelFormat format, Size size,
Type type, unsigned int index, Encoder *encoder)
: format_(format), size_(size), type_(type), index_(index), encoder_(encoder)
CameraStream::CameraStream(PixelFormat format, Size size, Type type, unsigned int index)
: format_(format), size_(size), type_(type), index_(index)
{
if (type_ == Type::Internal || type_ == Type::Mapped)
encoder_ = std::make_unique<EncoderLibJpeg>();
}
int CameraStream::configure(const libcamera::StreamConfiguration &cfg)
{
if (encoder_)
return encoder_->configure(cfg);
return 0;
}