From patchwork Tue Jan 9 14:30:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19382 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 692DFBEFBE for ; Tue, 9 Jan 2024 14:30:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2DDBA62B41; Tue, 9 Jan 2024 15:30:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1704810611; bh=8sSCqT07WNK3cV3srutZqAi634bzx+oBXKe6kvn+xPk=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=JCpcj6UfMjUL6iFrC6VfOIL3VJ8yuJ0+Klk0aHWMNStuEYhsRNxJSZ5ZaulRHOHbz vMc2Ky5OjsiljgoZ8MBrdzM9gZQF8x8cHLHa4QXjSfLZk2AhSmmziEzxYVm0Iw2SZC 5jiXc8JkwERz3YH8b8tz7r2W496ETppAjx47B1Ag62jqlM4YV2lZLfV5oNJd8U65JD D3K1G0WrszdYdThqJizqstvqQ2nO/4ilZUUDSmSVVCUxlhUMCrot1Gc35PM0AVkb9a 6qlwN2s5PE6ifD+gW1aN7ZRy86NeP9/wYPxoVAzfYcwBRmcgIHYggxnLxx9sHIELhb uaK3FNcO/sg4w== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3651062B32 for ; Tue, 9 Jan 2024 15:30:09 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="B4mVI7Oj"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A416552; Tue, 9 Jan 2024 15:29:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1704810545; bh=8sSCqT07WNK3cV3srutZqAi634bzx+oBXKe6kvn+xPk=; h=From:To:Cc:Subject:Date:From; b=B4mVI7OjSE9bkxaFND4/OFyZqZJiTKDd1K8auENxGmxvcDTizaZ2gEcarBj6F+/kj nqZ/KIr9yVXWxn7xSQl/O1GGIbz3DDct/jTUefMYCXjhCJUpL8/X8UrFYjVbvLXXGI EtkCnaQMOZiToleE3Y0c5nfUMVeQ4XjEgFepIaK0= To: libcamera-devel@lists.libcamera.org Date: Tue, 9 Jan 2024 16:30:17 +0200 Message-ID: <20240109143017.21783-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] gstreamer: Support for pre-1.16 GstEvent X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Cc: Nicolas Dufresne Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The gst_clear_event() function used by libcamerasrc has been introduced in GStreamer 1.16, while libcamera claims to need 1.14 or newer. This causes a compilation error. Fix it by copying the gst_clear_event() implementation to gstlibcamera-utils.h when compiling with older GStreamer version. The version check makes it clear that the workaround is needed with older versions only, flagging it for removal when the minimum GStreamer version requirement will be bumped. Signed-off-by: Laurent Pinchart Reviewed-by: Nicolas Dufresne Reviewed-by: Kieran Bingham --- src/gstreamer/gstlibcamera-utils.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gstreamer/gstlibcamera-utils.h b/src/gstreamer/gstlibcamera-utils.h index fd304a8bae15..6adeab0eb35a 100644 --- a/src/gstreamer/gstlibcamera-utils.h +++ b/src/gstreamer/gstlibcamera-utils.h @@ -25,6 +25,13 @@ void gst_libcamera_clamp_and_set_frameduration(libcamera::ControlList &controls, GstStructure *element_caps); void gst_libcamera_framerate_to_caps(GstCaps *caps, const GstStructure *element_caps); +#if !GST_CHECK_VERSION(1, 16, 0) +static inline void gst_clear_event(GstEvent **event_ptr) +{ + g_clear_pointer(event_ptr, gst_mini_object_unref); +} +#endif + #if !GST_CHECK_VERSION(1, 17, 1) gboolean gst_task_resume(GstTask *task); #endif