summaryrefslogtreecommitdiff
path: root/src/android/camera_stream.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-10-02 19:40:42 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-10-07 16:07:44 +0200
commit3c84d88193c8807feb6cd426ce1bfc1d12e66ffa (patch)
tree23ed7aea3e27818690ed7eb3ae76fdfda174a24a /src/android/camera_stream.cpp
parent94c4d49ebe41a58657d402df5f57556da96b5023 (diff)
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>
Diffstat (limited to 'src/android/camera_stream.cpp')
-rw-r--r--src/android/camera_stream.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp
index 7205721d..2d0c6ff9 100644
--- a/src/android/camera_stream.cpp
+++ b/src/android/camera_stream.cpp
@@ -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;
}