{"id":23462,"url":"https://patchwork.libcamera.org/api/patches/23462/?format=json","web_url":"https://patchwork.libcamera.org/patch/23462/","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":"<20250604130741.9228-2-laurent.pinchart@ideasonboard.com>","date":"2025-06-04T13:07:35","name":"[v2,1/7] gstreamer: Document improvements when updating minimum GStreamer version","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c66677222718ac0c272f7f6e81779b391fd98325","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/23462/mbox/","series":[{"id":5204,"url":"https://patchwork.libcamera.org/api/series/5204/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5204","date":"2025-06-04T13:07:34","name":"gstreamer: Miscellaneous cleanups + two fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/5204/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23462/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23462/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 99AF1C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Jun 2025 13:07:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ACB5C68DC2;\n\tWed,  4 Jun 2025 15:07:54 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C8B2868DA8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Jun 2025 15:07:52 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C507CD21;\n\tWed,  4 Jun 2025 15:07:49 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tA52AUVh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749042470;\n\tbh=oHdMYAWVQJ61xAla214M0VduvDQQTO3f+76Zlwi9opU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=tA52AUVhIW/YwJLOyRNhwF0WcijKSpsi4Ao/37UeT8fguNcSJegm1p2uky+y7b6ef\n\tD1fr0gbiWp8gs3eM4U7yArW4BOvvNmFIYhiGjI7CRsbAW5djAZC3cJj6HZPGS6060Z\n\tOdyubfH1g8HGmJQcu1YkmVLBid92TLUSBJjtqGjU=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Hou Qi <qi.hou@nxp.com>,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>","Subject":"[PATCH v2 1/7] gstreamer: Document improvements when updating\n\tminimum GStreamer version","Date":"Wed,  4 Jun 2025 16:07:35 +0300","Message-ID":"<20250604130741.9228-2-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.49.0","In-Reply-To":"<20250604130741.9228-1-laurent.pinchart@ideasonboard.com>","References":"<20250604130741.9228-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"A const_cast<> was recently added to fix a compilation issue with older\nGStreamer versions. Add a comment to indicate it can be removed when\nbumping the minimum GStreamer version requirement. While at it, also\ndocument a possible future improvement in the same function, and wrap\nlong lines.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 20 +++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)","diff":"diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex b34f089778ec..6ede43b06a8a 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -285,10 +285,19 @@ gst_libcamera_extrapolate_info(GstVideoInfo *info, guint32 stride)\n }\n \n static GstFlowReturn\n-gst_libcamera_video_frame_copy(GstBuffer *src, GstBuffer *dest, const GstVideoInfo *dest_info, guint32 stride)\n+gst_libcamera_video_frame_copy(GstBuffer *src, GstBuffer *dest,\n+\t\t\t       const GstVideoInfo *dest_info, guint32 stride)\n {\n-\tGstVideoInfo src_info = *dest_info;\n+\t/*\n+\t * When dropping support for versions earlier than v1.22.0, use\n+\t *\n+\t * g_auto (GstVideoFrame) src_frame = GST_VIDEO_FRAME_INIT;\n+\t * g_auto (GstVideoFrame) dest_frame = GST_VIDEO_FRAME_INIT;\n+\t *\n+\t * and drop the gst_video_frame_unmap() calls.\n+\t */\n \tGstVideoFrame src_frame, dest_frame;\n+\tGstVideoInfo src_info = *dest_info;\n \n \tgst_libcamera_extrapolate_info(&src_info, stride);\n \tsrc_info.size = gst_buffer_get_size(src);\n@@ -298,7 +307,12 @@ gst_libcamera_video_frame_copy(GstBuffer *src, GstBuffer *dest, const GstVideoIn\n \t\treturn GST_FLOW_ERROR;\n \t}\n \n-\tif (!gst_video_frame_map(&dest_frame, const_cast<GstVideoInfo *>(dest_info), dest, GST_MAP_WRITE)) {\n+\t/*\n+\t * When dropping support for versions earlier than 1.20.0, drop the\n+\t * const_cast<>().\n+\t */\n+\tif (!gst_video_frame_map(&dest_frame, const_cast<GstVideoInfo *>(dest_info),\n+\t\t\t\t dest, GST_MAP_WRITE)) {\n \t\tGST_ERROR(\"Could not map dest buffer\");\n \t\tgst_video_frame_unmap(&src_frame);\n \t\treturn GST_FLOW_ERROR;\n","prefixes":["v2","1/7"]}