{"id":17027,"url":"https://patchwork.libcamera.org/api/patches/17027/?format=json","web_url":"https://patchwork.libcamera.org/patch/17027/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220808155605.7925-2-laurent.pinchart@ideasonboard.com>","date":"2022-08-08T15:56:04","name":"[libcamera-devel,1/2] cam: sdl_sink: Fix compilation with SDL2 <2.0.16","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"93d2d0df1d9da08452d962aed94011f786fbc699","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17027/mbox/","series":[{"id":3389,"url":"https://patchwork.libcamera.org/api/series/3389/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3389","date":"2022-08-08T15:56:03","name":"cam: Miscellaneous fixes for the SDL sink","version":1,"mbox":"https://patchwork.libcamera.org/series/3389/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17027/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17027/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 15BA5C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Aug 2022 15:56:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D2F4E6332E;\n\tMon,  8 Aug 2022 17:56:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D80163327\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Aug 2022 17:56:18 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B6F2E56D;\n\tMon,  8 Aug 2022 17:56:17 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659974179;\n\tbh=8vwAW602/hcHJc5ZmZy+SX4BEfYiTdGy4GpFQeZR1mU=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=rFksmj2+769ryfs2rVndJuxw1v1puPusk9f9kNaEo2vEhfFOHlGztE2DJeVpSUyou\n\t7gWFKGAzEqIWOiexjhXNiB/7eTjU/AZojel0Hy/ChIOIB4tvZYUDtPeEfRFJip5do+\n\t9+kmnCFyvCOmwhVr5BLmzOByblo1RkmdeejOKXeJcbI2mXdBgRCIMd0be9OaAhT6e9\n\tmEf78V0Qu6ionHZSDgmXzEw8v+EC6zmT6WJM/BozdT62g/1DlGvlpIaeF7f47DIXOE\n\tN2QE0OyX4Q563gXXL25YwwpZ6FO6T7pg1lejzN5yzHFGn1/7rP+cQuii3rrnOoZDuz\n\tg2OMQNE2VVDDw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659974177;\n\tbh=8vwAW602/hcHJc5ZmZy+SX4BEfYiTdGy4GpFQeZR1mU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VGTvq/4selP0/LL7mQ4j4wTPFu5VSo1AeGjZ1HKi7d4rpHE6OZe0RWh2N3HDaWIyU\n\tLmq1mdLB2/4caESdcvTcQZ3/1wcH58GfYdO8P0hmcx3Dq1JGpUVzSJ4o4uoq3VIZBa\n\tDca00+5o/mSupCW2WdZ2lYejebF9Q7nZgXJ6bq4E="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"VGTvq/4s\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  8 Aug 2022 18:56:04 +0300","Message-Id":"<20220808155605.7925-2-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220808155605.7925-1-laurent.pinchart@ideasonboard.com>","References":"<20220808155605.7925-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/2] cam: sdl_sink: Fix compilation with\n\tSDL2 <2.0.16","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The SDL_UpdateNVTexture() function, used for NV12 texture support, has\nbeen introduced in SDL2 2.0.16. Compiling against older SDL versions\nfails with\n\n../src/cam/sdl_texture_yuv.cpp: In member function ‘virtual void SDLTextureNV12::update(const std::vector<libcamera::Span<const unsigned char> >&)’:\n../src/cam/sdl_texture_yuv.cpp:19:2: error: ‘SDL_UpdateNVTexture’ was not declared in this scope; did you mean ‘SDL_UpdateYUVTexture’?\n   19 |  SDL_UpdateNVTexture(ptr_, &rect_, data[0].data(), pitch_,\n      |  ^~~~~~~~~~~~~~~~~~~\n      |  SDL_UpdateYUVTexture\n\nFix it with conditional compilation based on the SDL version.\n\nFixes: 7b8df9fe6b3e (\"cam: sdl_sink: Add NV12 texture support\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/cam/sdl_sink.cpp        | 2 ++\n src/cam/sdl_texture_yuv.cpp | 2 ++\n src/cam/sdl_texture_yuv.h   | 2 ++\n 3 files changed, 6 insertions(+)","diff":"diff --git a/src/cam/sdl_sink.cpp b/src/cam/sdl_sink.cpp\nindex 5f2583721419..ee177227dbca 100644\n--- a/src/cam/sdl_sink.cpp\n+++ b/src/cam/sdl_sink.cpp\n@@ -67,9 +67,11 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config)\n \t\ttexture_ = std::make_unique<SDLTextureMJPG>(rect_);\n \t\tbreak;\n #endif\n+#if SDL_VERSION_ATLEAST(2, 0, 16)\n \tcase libcamera::formats::NV12:\n \t\ttexture_ = std::make_unique<SDLTextureNV12>(rect_, cfg.stride);\n \t\tbreak;\n+#endif\n \tcase libcamera::formats::YUYV:\n \t\ttexture_ = std::make_unique<SDLTextureYUYV>(rect_, cfg.stride);\n \t\tbreak;\ndiff --git a/src/cam/sdl_texture_yuv.cpp b/src/cam/sdl_texture_yuv.cpp\nindex 431e836d2d2c..aa424559abd7 100644\n--- a/src/cam/sdl_texture_yuv.cpp\n+++ b/src/cam/sdl_texture_yuv.cpp\n@@ -9,6 +9,7 @@\n \n using namespace libcamera;\n \n+#if SDL_VERSION_ATLEAST(2, 0, 16)\n SDLTextureNV12::SDLTextureNV12(const SDL_Rect &rect, unsigned int stride)\n \t: SDLTexture(rect, SDL_PIXELFORMAT_NV12, stride)\n {\n@@ -19,6 +20,7 @@ void SDLTextureNV12::update(const std::vector<libcamera::Span<const uint8_t>> &d\n \tSDL_UpdateNVTexture(ptr_, &rect_, data[0].data(), pitch_,\n \t\t\t    data[1].data(), pitch_);\n }\n+#endif\n \n SDLTextureYUYV::SDLTextureYUYV(const SDL_Rect &rect, unsigned int stride)\n \t: SDLTexture(rect, SDL_PIXELFORMAT_YUY2, stride)\ndiff --git a/src/cam/sdl_texture_yuv.h b/src/cam/sdl_texture_yuv.h\nindex 633ab510259b..310e4e5046f4 100644\n--- a/src/cam/sdl_texture_yuv.h\n+++ b/src/cam/sdl_texture_yuv.h\n@@ -9,12 +9,14 @@\n \n #include \"sdl_texture.h\"\n \n+#if SDL_VERSION_ATLEAST(2, 0, 16)\n class SDLTextureNV12 : public SDLTexture\n {\n public:\n \tSDLTextureNV12(const SDL_Rect &rect, unsigned int stride);\n \tvoid update(const std::vector<libcamera::Span<const uint8_t>> &data) override;\n };\n+#endif\n \n class SDLTextureYUYV : public SDLTexture\n {\n","prefixes":["libcamera-devel","1/2"]}