cam: sdl_sink: Add SDL sink with initial YUYV support

This adds more portability to existing cam sinks. You can pass a
YUYV camera buffer and SDL will handle the pixel buffer conversion
to the display. This allows cam reference implementation to display
images on VMs, Mac M1, Raspberry Pi, etc. This also enables cam
reference implementation, to run as a desktop application in Wayland or
X11. SDL also has support for Android and ChromeOS which has not been
tested. Also tested on simpledrm Raspberry Pi 4 framebuffer
successfully where existing kms sink did not work. Can also be used as
kmsdrm sink. Only supports one camera stream at present.

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>
This commit is contained in:
Eric Curtin 2022-05-20 20:01:05 +01:00 committed by Laurent Pinchart
parent a5844adb7b
commit 11554a259f
10 changed files with 368 additions and 0 deletions

View file

@ -21,6 +21,9 @@
#include "kms_sink.h"
#endif
#include "main.h"
#ifdef HAVE_SDL
#include "sdl_sink.h"
#endif
#include "stream_options.h"
using namespace libcamera;
@ -197,6 +200,11 @@ int CameraSession::start()
sink_ = std::make_unique<KMSSink>(options_[OptDisplay].toString());
#endif
#ifdef HAVE_SDL
if (options_.isSet(OptSDL))
sink_ = std::make_unique<SDLSink>();
#endif
if (options_.isSet(OptFile)) {
if (!options_[OptFile].toString().empty())
sink_ = std::make_unique<FileSink>(streamNames_,