summaryrefslogtreecommitdiff
path: root/src/cam/sdl_sink.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-08-08 18:32:04 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-08-08 22:39:35 +0300
commitfe8941d7d61bd22ed66e5b5615e931c68fdf9bfa (patch)
tree5b8920fd5a8a4cb14d63f39a14e6df67cc5821fd /src/cam/sdl_sink.cpp
parent7b8df9fe6b3eedc46667d07ad2c90c89ca823e0c (diff)
cam: sdl_sink: Fix compilation with SDL2 <2.0.16
The SDL_UpdateNVTexture() function, used for NV12 texture support, has been introduced in SDL2 2.0.16. Compiling against older SDL versions fails with ../src/cam/sdl_texture_yuv.cpp: In member function ‘virtual void SDLTextureNV12::update(const std::vector<libcamera::Span<const unsigned char> >&)’: ../src/cam/sdl_texture_yuv.cpp:19:2: error: ‘SDL_UpdateNVTexture’ was not declared in this scope; did you mean ‘SDL_UpdateYUVTexture’? 19 | SDL_UpdateNVTexture(ptr_, &rect_, data[0].data(), pitch_, | ^~~~~~~~~~~~~~~~~~~ | SDL_UpdateYUVTexture Fix it with conditional compilation based on the SDL version. Fixes: 7b8df9fe6b3e ("cam: sdl_sink: Add NV12 texture support") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Diffstat (limited to 'src/cam/sdl_sink.cpp')
-rw-r--r--src/cam/sdl_sink.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cam/sdl_sink.cpp b/src/cam/sdl_sink.cpp
index 5f258372..ee177227 100644
--- a/src/cam/sdl_sink.cpp
+++ b/src/cam/sdl_sink.cpp
@@ -67,9 +67,11 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config)
texture_ = std::make_unique<SDLTextureMJPG>(rect_);
break;
#endif
+#if SDL_VERSION_ATLEAST(2, 0, 16)
case libcamera::formats::NV12:
texture_ = std::make_unique<SDLTextureNV12>(rect_, cfg.stride);
break;
+#endif
case libcamera::formats::YUYV:
texture_ = std::make_unique<SDLTextureYUYV>(rect_, cfg.stride);
break;