From patchwork Mon Aug 29 10:02:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 17221 X-Patchwork-Delegate: umang.jain@ideasonboard.com 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 338F6C3272 for ; Mon, 29 Aug 2022 10:03:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8517861FC0; Mon, 29 Aug 2022 12:03:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1661767384; bh=AUNPCG01eUfBBlFiGu317cUINwdnLmYHHGEJXiCiYCo=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=RPwwqhT4pGmQ5ETm7XZaeGlsJES3QWJu2yYT9RXFV1aaKvKujyM2nlIpFTYe9xYZo QAbtuHOoy2YCqFbfE38bPpn2NZA6GxdQ1U45HSDc9trqrSYuZk14uXAPdhQpmMJuu3 toULEYdPOHUp4ZhFOXoigdri6nO+j+Zzow1Eawz0SGTK0JniEk0Ob1xpnFlS3uykQo OvDH4pBcK/jwl5chmicuthdmCOusYi+G+c6ErCY/CXuAlJuek2NRKDOjo+An6wrKtr pNGTQCfPhmXOyoGy1PlE7WlsNGj+6pLtdHWSUju5X/nsfO1Ii4/vjJ7oLcQpJ5Lixn BwzihOS+9md+g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6390561FBB for ; Mon, 29 Aug 2022 12:03:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="C1ZyoGG5"; dkim-atps=neutral Received: from umang.jainideasonboard.com (unknown [IPv6:2401:4900:1f3f:1548:78ac:4a3:edc3:c28a]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 10FD78BD; Mon, 29 Aug 2022 12:03:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1661767382; bh=AUNPCG01eUfBBlFiGu317cUINwdnLmYHHGEJXiCiYCo=; h=From:To:Cc:Subject:Date:From; b=C1ZyoGG55YWz715QsJR6t3O3zEj33LvRM7tUJT0UC0xH2eVae+MZ8SCb83FrbGxDD HSG3fx2+Is4fJA1H80oi4L9O5p8QhTLeWCUUi5YVdVGB/FH50PC5yPXvnKwzCw8/02 ILxLIPGQGDpeK93JJWV4+yXRbWG4ZTXMBbeaqIIE= To: libcamera-devel@lists.libcamera.org Date: Mon, 29 Aug 2022 15:32:51 +0530 Message-Id: <20220829100251.935217-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] gstreamer: Provide interlace-mode as fixated caps 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: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Cc: rishikeshdonadkar@gmail.com, vedantparanjape160201@gmail.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The 'interlace-mode' for libcamerasrc will always be 'progressive'. Provide it via fixated caps mechanism [1] [1] https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/negotiation.html?gi-language=c#fixed-negotiation Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- Rishi, Can you please check this patch as well? I think it will closely co-relate with the framerate being captured in caps, as fixate negotitation mechanism. --- src/gstreamer/gstlibcamerasrc.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 16d70fea..24a2e33e 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -800,11 +800,37 @@ gst_libcamera_src_release_pad(GstElement *element, GstPad *pad) gst_element_remove_pad(element, pad); } +static GstCaps *gst_libcamera_src_src_fixate([[maybe_unused]] GstBaseSrc *bsrc, + GstCaps *caps) +{ + GstStructure *structure; + GstCaps *fixated_caps; + + fixated_caps = gst_caps_make_writable(caps); + + for (guint i = 0; i < gst_caps_get_size(fixated_caps); ++i) { + structure = gst_caps_get_structure(fixated_caps, i); + if (gst_structure_has_field(structure, "interlace-mode")) + gst_structure_fixate_field_string(structure, "interlace-mode", + "progressive"); + else + gst_structure_set(structure, "interlace-mode", G_TYPE_STRING, + "progressive", NULL); + } + + fixated_caps = gst_caps_fixate(fixated_caps); + + return fixated_caps; +} + static void gst_libcamera_src_class_init(GstLibcameraSrcClass *klass) { GstElementClass *element_class = GST_ELEMENT_CLASS(klass); GObjectClass *object_class = G_OBJECT_CLASS(klass); + GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *)klass; + + gstbasesrc_class->fixate = gst_libcamera_src_src_fixate; object_class->set_property = gst_libcamera_src_set_property; object_class->get_property = gst_libcamera_src_get_property;