From fe8941d7d61bd22ed66e5b5615e931c68fdf9bfa Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 8 Aug 2022 18:32:04 +0300 Subject: cam: sdl_sink: Fix compilation with SDL2 <2.0.16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 >&)’: ../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 Reviewed-by: Eric Curtin --- src/cam/sdl_texture_yuv.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/cam/sdl_texture_yuv.cpp') diff --git a/src/cam/sdl_texture_yuv.cpp b/src/cam/sdl_texture_yuv.cpp index 431e836d..aa424559 100644 --- a/src/cam/sdl_texture_yuv.cpp +++ b/src/cam/sdl_texture_yuv.cpp @@ -9,6 +9,7 @@ using namespace libcamera; +#if SDL_VERSION_ATLEAST(2, 0, 16) SDLTextureNV12::SDLTextureNV12(const SDL_Rect &rect, unsigned int stride) : SDLTexture(rect, SDL_PIXELFORMAT_NV12, stride) { @@ -19,6 +20,7 @@ void SDLTextureNV12::update(const std::vector> &d SDL_UpdateNVTexture(ptr_, &rect_, data[0].data(), pitch_, data[1].data(), pitch_); } +#endif SDLTextureYUYV::SDLTextureYUYV(const SDL_Rect &rect, unsigned int stride) : SDLTexture(rect, SDL_PIXELFORMAT_YUY2, stride) -- cgit v1.2.1