From patchwork Sun Jul 18 06:48:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13035 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 F2EADC0109 for ; Sun, 18 Jul 2021 06:49:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 21DE06851F; Sun, 18 Jul 2021 08:49:26 +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="ST6k7wHo"; dkim-atps=neutral Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 903B460279 for ; Sun, 18 Jul 2021 08:49:11 +0200 (CEST) Received: by mail-pl1-x629.google.com with SMTP id j3so7810476plx.7 for ; Sat, 17 Jul 2021 23:49: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=z4aoEY0Tuh1KDrUqCLumfu9K7nlW7O9ok8mQITHXYN4=; b=ST6k7wHoQmiCMIl/g+//6YOgSw6uS5BnRdsvfCaYHTbuNvrjbGI3XPTM721cc5OkkJ tf3bbbw4NHL111HPVzHfWgNWzdtFmvk2Uc3wKDOFPJdDVZA9bMAfTDqVp7lYUQX6Dkg5 QwBHCKVOXZOnLlwfXkGJ0ce8iXSWMcS8Q3Wuw8/w1ZhS4clR+trH5CO6DRyym8fr3dZI MORJbEyQ3CstNxdbqHnmEcl89lQbS1MLl1qG3Osp5c1E1LhwiSuNu3tr9dFBRFCRBuJa Geo0kosmJ3G8tI9Y5yKwKGFRKAgMmQ86XAjuP394sGC/3XSwylu9bkgRSc3OjJPhWvfz RIVA== 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=z4aoEY0Tuh1KDrUqCLumfu9K7nlW7O9ok8mQITHXYN4=; b=JZAqD6WNvmI4aCFUSQXqG9zHIq+9nSDjVIPML5WWJXwN1/oSftm1M8T0nIGDBj2bCJ 20FQc1sd8pSp8z5L+EKd7fdsJhNv3sUe+4Bte7Gv5ZANfr+TfEexrgJAcN1JQ4h2+TfU mJFpN2wNeYsWRB+22MLPg2yfeJka5VSy5gVuLQIEhlCzsYpoSQQyth3IKw7AKomvH9UP Ae47woFnR/83YcHN9Nele+lTj6uOXg0Vbx3Vib7Loiz+C7BiVvT8SivhNdx04UROKe3g N4i+FaGD99A26bEZ8GkVUiPR2UJ9SIHSLVcQLSsg0YlMYa9J5sDrM+ujQa77OsikkHgF ImhQ== X-Gm-Message-State: AOAM533uVXk3W74keUFdyMIBX7s005lxpUAxgumoP8VR8mP4tLeZ6Bt4 o+gHz12HGMJLKdWN73+dNakrAJ3TGXverw== X-Google-Smtp-Source: ABdhPJyT2C1iz98KeCREm9OxpOQtJb4cuLvssdEcTuGzqguFCwhk818VIXmkQFL//HacaJD/uEmYXw== X-Received: by 2002:a17:902:6b42:b029:11d:a147:bb7b with SMTP id g2-20020a1709026b42b029011da147bb7bmr14624529plt.9.1626590949689; Sat, 17 Jul 2021 23:49:09 -0700 (PDT) Received: from localhost.localdomain ([1.186.166.94]) by smtp.googlemail.com with ESMTPSA id q14sm15002216pff.209.2021.07.17.23.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 23:49:09 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Sun, 18 Jul 2021 12:18:50 +0530 Message-Id: <20210718064850.837873-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1] 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 ++ src/gstreamer/gstlibcamerasrc.cpp | 7 +------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp index c00e81c8..6f889472 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) +{ + 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, stream_id_num++); + 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); diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 79b0d867..f9ac50ef 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -364,15 +364,10 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, if (state->group_id_ == 0) { state->group_id_ = gst_util_group_id_next(); } - 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));