summaryrefslogtreecommitdiff
path: root/src/cam/sdl_sink.cpp
diff options
context:
space:
mode:
authorEric Curtin <ecurtin@redhat.com>2022-05-20 20:01:06 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-23 12:49:44 +0300
commit153b468930a9df22debb28889312f8a5c511ee04 (patch)
tree2ee7a8b9c25386378858271854157824010eee16 /src/cam/sdl_sink.cpp
parent11554a259f4e8df3cc2ddce0217d35fd7797cfc5 (diff)
cam: sdl_sink: Add MJPG support to SDL sink
So we have at least two supported capturing pixel formats (although many possible output pixel formats thanks to SDL conversion). MJPG support only built in if SDL2_image is available, provides decompression. Signed-off-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/cam/sdl_sink.cpp')
-rw-r--r--src/cam/sdl_sink.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cam/sdl_sink.cpp b/src/cam/sdl_sink.cpp
index 4c74bce7..f8e3e95d 100644
--- a/src/cam/sdl_sink.cpp
+++ b/src/cam/sdl_sink.cpp
@@ -21,6 +21,9 @@
#include "event_loop.h"
#include "image.h"
+#ifdef HAVE_SDL_IMAGE
+#include "sdl_texture_mjpg.h"
+#endif
#include "sdl_texture_yuyv.h"
using namespace libcamera;
@@ -59,6 +62,11 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config)
rect_.h = cfg.size.height;
switch (cfg.pixelFormat) {
+#ifdef HAVE_SDL_IMAGE
+ case libcamera::formats::MJPEG:
+ texture_ = std::make_unique<SDLTextureMJPG>(rect_);
+ break;
+#endif
case libcamera::formats::YUYV:
texture_ = std::make_unique<SDLTextureYUYV>(rect_);
break;