Show a patch.

GET /api/1.1/patches/13842/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 13842,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/13842/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13842/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20210914063404.53621-1-vedantparanjape160201@gmail.com>",
    "date": "2021-09-14T06:34:04",
    "name": "[libcamera-devel,v3] test: gstreamer: Add a test for gstreamer multi stream",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ed1be49139217dcb3a02cc59d1a7e19bdb7c5fc5",
    "submitter": {
        "id": 85,
        "url": "https://patchwork.libcamera.org/api/1.1/people/85/?format=api",
        "name": "Vedant Paranjape",
        "email": "vedantparanjape160201@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13842/mbox/",
    "series": [
        {
            "id": 2526,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2526/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2526",
            "date": "2021-09-14T06:34:04",
            "name": "[libcamera-devel,v3] test: gstreamer: Add a test for gstreamer multi stream",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2526/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13842/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13842/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 E430EBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Sep 2021 06:34:27 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 53D556916F;\n\tTue, 14 Sep 2021 08:34:27 +0200 (CEST)",
            "from mail-pg1-x535.google.com (mail-pg1-x535.google.com\n\t[IPv6:2607:f8b0:4864:20::535])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1876E6916F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Sep 2021 08:34:26 +0200 (CEST)",
            "by mail-pg1-x535.google.com with SMTP id t1so11805958pgv.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Sep 2021 23:34:25 -0700 (PDT)",
            "from localhost.localdomain ([1.186.166.254])\n\tby smtp.googlemail.com with ESMTPSA id\n\tl6sm9081176pff.74.2021.09.13.23.34.22\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 13 Sep 2021 23:34:23 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"nYJYyzdo\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=rX3t3kqsPE5dxb6s9T51FplxW2wMBXEcQry411D9gBo=;\n\tb=nYJYyzdoS7YGr8d3CMY3+w7slib9+jfrRSi9a2KpP3SiB9ZPJG1TUQx0B95B30OdYc\n\teD63KIiKfEYaBUjB5NM++6MTur7k2em6g7/MbpEMepsZz2064zgNW93mUjl6JMpHf0N+\n\tyAkf6qq3c3VigsvMlUg6Q1owZm8DWJ6aCqhXKTnv1fkZbdNQhd4JPJ3dgeraImiDnxYg\n\t9R0hMHT+ySjRpb8ybUhR3h4Ellg9p4wIIO87VwZb62xIyHZ7OI7iuX9ek5uZL8TJEdZD\n\t33Q3J+prWA9+NazazEepe/jH3A4iAl386D3BQt628r9vn4B6/dHO14k9iNHCjqicL+Jy\n\tj54Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=rX3t3kqsPE5dxb6s9T51FplxW2wMBXEcQry411D9gBo=;\n\tb=dc0QJ5koTurrrXG1B3faY6aaIW05yl3QE/jlQNIAxthBeCR8ii5+dJmPAUqjw1Arlb\n\tNDp+9gzj//qqllkFMBArOQfbHtHZt2J44hktVDeBBjKF/IMUTapI/ym0J3nG91k0ZL+P\n\tNmfkMVMx8wrtk+iYaCUfOniw/fFk9ZT6jhA7vegsEY6QE7C6yPrFTwxBmwpy/7nAMr+N\n\t1e/14KYHyKKZ3g+o15L2AtH0SQpUHb/yPySbpvnmr3qUc5IOCe9tgKkowF+zGuDIfKJ2\n\tIwz43Fw4Om7jx3/3aHhnJ/2biwW1tsvC5AGqKT4fCJgayHvCyW7czxmu+dMNo8/6Rzqw\n\t+dwg==",
        "X-Gm-Message-State": "AOAM531r2Qt0nFABmix2y4n3N6a6F6I/ptQqD6pulQrS4DhQGDdA7Tc4\n\tPTc95yOITTlilUeiUBgEFgqR3K5CH+smNhrQ",
        "X-Google-Smtp-Source": "ABdhPJxO39ZKk84ur8rfaJd20gE4fDzGLUQHM8WJ5AYOdWpaQpdJNWRm61cA6orKIYprtgKCfIkLug==",
        "X-Received": "by 2002:a63:e506:: with SMTP id r6mr14179344pgh.85.1631601263920;\n\tMon, 13 Sep 2021 23:34:23 -0700 (PDT)",
        "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 14 Sep 2021 12:04:04 +0530",
        "Message-Id": "<20210914063404.53621-1-vedantparanjape160201@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3] test: gstreamer: Add a test for\n\tgstreamer multi stream",
        "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>",
        "Cc": "Vedant Paranjape <vedantparanjape160201@gmail.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "This patch adds a test to test if multi stream using libcamera's\ngstreamer element works.\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nTested-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n .../gstreamer/gstreamer_multi_stream_test.cpp | 138 ++++++++++++++++++\n test/gstreamer/meson.build                    |   1 +\n 2 files changed, 139 insertions(+)\n create mode 100644 test/gstreamer/gstreamer_multi_stream_test.cpp",
    "diff": "diff --git a/test/gstreamer/gstreamer_multi_stream_test.cpp b/test/gstreamer/gstreamer_multi_stream_test.cpp\nnew file mode 100644\nindex 000000000000..aba86a3f8e27\n--- /dev/null\n+++ b/test/gstreamer/gstreamer_multi_stream_test.cpp\n@@ -0,0 +1,138 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Vedant Paranjape\n+ *\n+ * gstreamer_multi_stream_test.cpp - GStreamer multi stream capture test\n+ */\n+\n+#include <iostream>\n+#include <unistd.h>\n+\n+#include <libcamera/base/utils.h>\n+\n+#include <libcamera/libcamera.h>\n+\n+#include \"libcamera/internal/source_paths.h\"\n+\n+#include <gst/gst.h>\n+\n+#include \"gstreamer_test.h\"\n+#include \"test.h\"\n+\n+using namespace std;\n+\n+class GstreamerMultiStreamTest : public GstreamerTest, public Test\n+{\n+public:\n+\tGstreamerMultiStreamTest()\n+\t\t: GstreamerTest()\n+\t{\n+\t}\n+\n+protected:\n+\tint init() override\n+\t{\n+\t\tif (status_ != TestPass)\n+\t\t\treturn status_;\n+\n+\t\t/* Check if platform support multistream output */\n+\t\tlibcamera::CameraManager cm;\n+\t\tcm.start();\n+\t\tbool cameraFound = false;\n+\t\tfor (auto &camera : cm.cameras()) {\n+\t\t\tif (camera->streams().size() > 1) {\n+\t\t\t\tcameraName = camera->id();\n+\t\t\t\tcameraFound = true;\n+\t\t\t\tcm.stop();\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (!cameraFound) {\n+\t\t\tcm.stop();\n+\t\t\treturn TestSkip;\n+\t\t}\n+\n+\t\tg_autoptr(GstElement) convert0 = gst_element_factory_make(\"videoconvert\", \"convert0\");\n+\t\tg_autoptr(GstElement) convert1 = gst_element_factory_make(\"videoconvert\", \"convert1\");\n+\t\tg_autoptr(GstElement) sink0 = gst_element_factory_make(\"fakesink\", \"sink0\");\n+\t\tg_autoptr(GstElement) sink1 = gst_element_factory_make(\"fakesink\", \"sink1\");\n+\t\tg_autoptr(GstElement) queue0 = gst_element_factory_make(\"queue\", \"queue0\");\n+\t\tg_autoptr(GstElement) queue1 = gst_element_factory_make(\"queue\", \"queue1\");\n+\t\tg_object_ref_sink(convert0);\n+\t\tg_object_ref_sink(convert1);\n+\t\tg_object_ref_sink(sink0);\n+\t\tg_object_ref_sink(sink1);\n+\t\tg_object_ref_sink(queue0);\n+\t\tg_object_ref_sink(queue1);\n+\n+\t\tif (!convert0 || !convert1 || !sink0 || !sink1 || !queue0 || !queue1) {\n+\t\t\tg_printerr(\"Not all elements could be created. %p.%p.%p.%p.%p.%p\\n\",\n+\t\t\t\t   convert0, convert1, sink0, sink1, queue0, queue1);\n+\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tconvert0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&convert0));\n+\t\tconvert1_ = reinterpret_cast<GstElement *>(g_steal_pointer(&convert1));\n+\t\tsink0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&sink0));\n+\t\tsink1_ = reinterpret_cast<GstElement *>(g_steal_pointer(&sink1));\n+\t\tqueue0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&queue0));\n+\t\tqueue1_ = reinterpret_cast<GstElement *>(g_steal_pointer(&queue1));\n+\n+\t\tif (createPipeline() != TestPass)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tint run() override\n+\t{\n+\t\tg_object_set(libcameraSrc_, \"camera-name\", cameraName.c_str(), NULL);\n+\n+\t\t/* Build the pipeline */\n+\t\tgst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, queue0_, queue1_,\n+\t\t\t\t convert0_, convert1_, sink0_, sink1_, NULL);\n+\t\tif (gst_element_link_many(queue0_, convert0_, sink0_, NULL) != TRUE ||\n+\t\t    gst_element_link_many(queue1_, convert1_, sink1_, NULL) != TRUE) {\n+\t\t\tg_printerr(\"Elements could not be linked.\\n\");\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tg_autoptr(GstPad) src_pad = gst_element_get_static_pad(libcameraSrc_, \"src\");\n+\t\tg_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, \"src_%u\");\n+\t\tGstPad *queue0_sink_pad = gst_element_get_static_pad(queue0_, \"sink\");\n+\t\tGstPad *queue1_sink_pad = gst_element_get_static_pad(queue1_, \"sink\");\n+\n+\t\tif (gst_pad_link(src_pad, queue0_sink_pad) != GST_PAD_LINK_OK\n+\t\t\t|| gst_pad_link(request_pad, queue1_sink_pad) != GST_PAD_LINK_OK) {\n+\t\t\tif (queue0_sink_pad)\n+\t\t\t\tgst_object_unref(queue0_sink_pad);\n+\t\t\tif (queue1_sink_pad)\n+\t\t\t\tgst_object_unref(queue1_sink_pad);\n+\t\t\tg_printerr(\"Pads could not be linked.\\n\");\n+\t\t\treturn TestFail;\n+\t\t}\n+\t\tgst_object_unref(queue0_sink_pad);\n+\t\tgst_object_unref(queue1_sink_pad);\n+\n+\t\tif (startPipeline() != TestPass)\n+\t\t\treturn TestFail;\n+\n+\t\tif (processEvent() != TestPass)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+private:\n+\tstd::string cameraName;\n+\tGstElement *convert0_;\n+\tGstElement *convert1_;\n+\tGstElement *sink0_;\n+\tGstElement *sink1_;\n+\tGstElement *queue0_;\n+\tGstElement *queue1_;\n+};\n+\n+TEST_REGISTER(GstreamerMultiStreamTest)\ndiff --git a/test/gstreamer/meson.build b/test/gstreamer/meson.build\nindex aca53b920365..13652e87d05c 100644\n--- a/test/gstreamer/meson.build\n+++ b/test/gstreamer/meson.build\n@@ -6,6 +6,7 @@ endif\n \n gstreamer_tests = [\n     ['single_stream_test',   'gstreamer_single_stream_test.cpp'],\n+    ['multi_stream_test',   'gstreamer_multi_stream_test.cpp'],\n ]\n gstreamer_dep = dependency('gstreamer-1.0', required: true)\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3"
    ]
}