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(rect_); break; #endif +#if SDL_VERSION_ATLEAST(2, 0, 16) case libcamera::formats::NV12: texture_ = std::make_unique(rect_, cfg.stride); break; +#endif case libcamera::formats::YUYV: texture_ = std::make_unique(rect_, cfg.stride); break; 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) diff --git a/src/cam/sdl_texture_yuv.h b/src/cam/sdl_texture_yuv.h index 633ab510..310e4e50 100644 --- a/src/cam/sdl_texture_yuv.h +++ b/src/cam/sdl_texture_yuv.h @@ -9,12 +9,14 @@ #include "sdl_texture.h" +#if SDL_VERSION_ATLEAST(2, 0, 16) class SDLTextureNV12 : public SDLTexture { public: SDLTextureNV12(const SDL_Rect &rect, unsigned int stride); void update(const std::vector> &data) override; }; +#endif class SDLTextureYUYV : public SDLTexture {