From patchwork Tue Jul 20 17:35:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13062 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 3F2DFC322B for ; Tue, 20 Jul 2021 17:36:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7E01A6852A; Tue, 20 Jul 2021 19:36:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E5ImE4xo"; dkim-atps=neutral Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6F50868521 for ; Tue, 20 Jul 2021 19:36:11 +0200 (CEST) Received: by mail-pg1-x534.google.com with SMTP id t9so23189919pgn.4 for ; Tue, 20 Jul 2021 10:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QfzlIZvRRrQ+Dzm43JuVObfNnYivEBjggFAXwbLJ3ok=; b=E5ImE4xonlHtOxlLHYrofyXP8cKo51WHAvJlBFt5IrHE2o/5aiqNaYEDMZzuVyQrYU 16f23zsayTUVYgGD9BNHYeptQbBo14/AmnU6B35r/6VHNpDKm5UXXds+sAb2koqu8C62 R7mcd9udLDGNu02o4w+1XiNLuLZU6gyT5G5WhxmFue8mN9ckTG6ZcR+NmTbOdgotGvWj Dza+TgK4BfUETOh/0hMB9UZX8cXe+2Sf0By8rUXD6KDxnogv9RBjWHDPpVi/Im81Y5Fu dZHfpoN07lE3FfA6SZjJTOrcUIpJ1g5uOHVrLYcoZZEDb76QMLJYS8s6eqFClozIvX77 AMUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QfzlIZvRRrQ+Dzm43JuVObfNnYivEBjggFAXwbLJ3ok=; b=jl9dS5pv0VDLcm/A2xv/zfaF9SqsOShSOhwHc391MHXxjlWJp6eYuqGxuHilvY4OOd Sz4Z0F9L3ihqrNvbBreKPW+IUC5iQs0mZcZ8sky7hDkUglFRJ3biCkhn00PwW2svHTZP FLzWRvAjtJz9frZPSFxwLu0/4Lro5mIl7s8M1aoYysdixvt86AQRtw/p5NKOtEiv3LdB QjpMylakXYdyPr4L7XXCV8A8pBAt6inJuoV0ah/ZqknSeFVYk9ovrmNh7GtCWYFtquCg Rqex2QcbbPkDWjyM/cvWGLXssE8GxpVixb4rtj205urXXsj3VYnrI+fmGLJC6uBD3Bhl LthQ== X-Gm-Message-State: AOAM531rRPR0Mqe17YyCu+egzct+EFYbiLeS5dy/ntuPiLZA43IJZW0j W8MRszbmm3/g1e2yAGf/5iQjfTZerdCfKw== X-Google-Smtp-Source: ABdhPJx4QbmTIagd9e0yn5E5lfc6U/QhWLRd0noiFXiZGxFpc47d5e9gN1F5Scss6wrZ94zICEoyfA== X-Received: by 2002:a05:6a00:1582:b029:333:a366:fe47 with SMTP id u2-20020a056a001582b0290333a366fe47mr28600550pfk.0.1626802569582; Tue, 20 Jul 2021 10:36:09 -0700 (PDT) Received: from localhost.localdomain ([1.186.165.221]) by smtp.googlemail.com with ESMTPSA id cp8sm8271113pjb.27.2021.07.20.10.36.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 10:36:09 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Jul 2021 23:05:47 +0530 Message-Id: <20210720173548.313901-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v1 1/2] gstreamer: Factor out _pad_push_stream_start from _task_enter 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: , Cc: Vedant Paranjape Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This patch creates gst_libcamera_pad_push_stream_start function to create stream id and to push the stream start. This is a non functional change. Signed-off-by: Vedant Paranjape --- src/gstreamer/gstlibcamerapad.cpp | 13 +++++++++++++ src/gstreamer/gstlibcamerapad.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp index c00e81c8..c5bd14f0 100644 --- a/src/gstreamer/gstlibcamerapad.cpp +++ b/src/gstreamer/gstlibcamerapad.cpp @@ -155,6 +155,19 @@ gst_libcamera_pad_get_stream(GstPad *pad) return nullptr; } +void +gst_libcamera_pad_push_stream_start(GstPad *pad, const guint group_id) +{ + g_autoptr(GstElement) element = gst_pad_get_parent_element(pad); + static gint stream_id_num = 0; + + g_autofree gchar *stream_id_intermediate = g_strdup_printf("%i%i", group_id, g_atomic_int_add(&stream_id_num, 1)); + g_autofree gchar *stream_id = gst_pad_create_stream_id(pad, element, stream_id_intermediate); + GstEvent *event = gst_event_new_stream_start(stream_id); + gst_event_set_group_id(event, group_id); + gst_pad_push_event(pad, event); +} + void gst_libcamera_pad_queue_buffer(GstPad *pad, GstBuffer *buffer) { diff --git a/src/gstreamer/gstlibcamerapad.h b/src/gstreamer/gstlibcamerapad.h index 779f2d13..7693374f 100644 --- a/src/gstreamer/gstlibcamerapad.h +++ b/src/gstreamer/gstlibcamerapad.h @@ -26,6 +26,8 @@ void gst_libcamera_pad_set_pool(GstPad *pad, GstLibcameraPool *pool); libcamera::Stream *gst_libcamera_pad_get_stream(GstPad *pad); +void gst_libcamera_pad_push_stream_start(GstPad *pad, const guint group_id); + void gst_libcamera_pad_queue_buffer(GstPad *pad, GstBuffer *buffer); GstFlowReturn gst_libcamera_pad_push_pending(GstPad *pad); From patchwork Tue Jul 20 17:35:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13063 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 19F55C322B for ; Tue, 20 Jul 2021 17:36:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C78366852A; Tue, 20 Jul 2021 19:36:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SzKuJh7N"; dkim-atps=neutral Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C952168521 for ; Tue, 20 Jul 2021 19:36:14 +0200 (CEST) Received: by mail-pj1-x1029.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so13741pjo.3 for ; Tue, 20 Jul 2021 10:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hk0FDmlWPCvHCNDSgXUbYjreQYjOCPgDYaZf1XT8LW8=; b=SzKuJh7NUuMSW7srn2LOG7a8ZCjbcuF0FZ8R3a9VnfmZOplhkBCYLuZell2e3R0xQs fKQk0cC3ckJDOw7vNkpNUh8355WzDwReOzVuf27NKliHZWbQD7B+XSnNUArjXQa4y7wb uSQenTP61LK0GnPin3/rW35IKkvbfqSQm2PrOL5Ubl4aYH9bya8QhaS3BA19bFsPscCM v1jWp+ENcGykIwAoo1ZQXivS6F4Oa0p/ANtgJ2wU4gwIjFiLHDJNQaLV890dJKlPVL8S vnRlfOfTanID0bhhFNqAg6XYiWV+W4v7eZYpjx8R8bPbzyeO6q+HXUN0L2AQA6V+SFkT WilQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hk0FDmlWPCvHCNDSgXUbYjreQYjOCPgDYaZf1XT8LW8=; b=JfCM7eHgefSL3ar9mQcAVOctF4S8jOIe6UjpeJZWm6/oge+aH6oD3gHErQaVTOqJ6c yETWCFnmPbB2S0PaC8884JPYXeW1x9vva9TMOzjCXNF4H3NZTxxydTeNWrrY24e4nwpK uTDX5CcVfvf5PeXJFpd5zit1wu8cmcdVjmkaMs3FLmBvS0l7BOq0hZhbwCnRp39oT0T2 UdyTA+O5fjFbcbjipWtRu30QLUEisV8ox2Iz18wGaq1T41Fc+C3qebDxAnUBM7GHgePF YVNvdP9g/VfMCGjkmOgxqTEU4URTYNj/Vurgd6xbVXoL910B/B9pv/V9Z3r/bvUCQkr1 bX8g== X-Gm-Message-State: AOAM530cRbWVt5D0clrOp2uHqzix486jgQuPxtTTtE9VpLEwizJr3odv tmjW/fXMthtVTUw7tdvbGYpXSzObqv2/cQ== X-Google-Smtp-Source: ABdhPJx1/u+dgeSbuRG3oxQ/WaNIKgCjUQmAxnQGm45qZAM3W6rR87QTCKUKmIM4Hu7YmwEvngLDOQ== X-Received: by 2002:a17:90a:2f63:: with SMTP id s90mr36035988pjd.168.1626802573068; Tue, 20 Jul 2021 10:36:13 -0700 (PDT) Received: from localhost.localdomain ([1.186.165.221]) by smtp.googlemail.com with ESMTPSA id cp8sm8271113pjb.27.2021.07.20.10.36.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 10:36:12 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Jul 2021 23:05:48 +0530 Message-Id: <20210720173548.313901-2-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720173548.313901-1-vedantparanjape160201@gmail.com> References: <20210720173548.313901-1-vedantparanjape160201@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v1 2/2] gstreamer: Replace code to push the stream start with factored out function 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: , Cc: Vedant Paranjape Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Update functional code in gst_libcamera_src_task_enter(), which creates stream id and pushes the stream start with the refactored function gst_libcamera_pad_push_stream_start(). Signed-off-by: Vedant Paranjape --- src/gstreamer/gstlibcamerasrc.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index b18f1efb..bb8ea07a 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -361,15 +361,10 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, GST_DEBUG_OBJECT(self, "Streaming thread has started"); - gint stream_id_num = 0; StreamRoles roles; for (GstPad *srcpad : state->srcpads_) { /* Create stream-id and push stream-start. */ - g_autofree gchar *stream_id_intermediate = g_strdup_printf("%i%i", state->group_id_, stream_id_num++); - g_autofree gchar *stream_id = gst_pad_create_stream_id(srcpad, GST_ELEMENT(self), stream_id_intermediate); - GstEvent *event = gst_event_new_stream_start(stream_id); - gst_event_set_group_id(event, state->group_id_); - gst_pad_push_event(srcpad, event); + gst_libcamera_pad_push_stream_start(srcpad, state->group_id_); /* Collect the streams roles for the next iteration. */ roles.push_back(gst_libcamera_pad_get_role(srcpad));