Show a patch.

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

{
    "id": 13813,
    "url": "https://patchwork.libcamera.org/api/patches/13813/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13813/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20210910181152.878132-1-vedantparanjape160201@gmail.com>",
    "date": "2021-09-10T18:11:52",
    "name": "[libcamera-devel,v2] test: gstreamer: Add a test for gstreamer multi stream",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "daf431e0dce757449ac9b6b0f0c54b952d786746",
    "submitter": {
        "id": 85,
        "url": "https://patchwork.libcamera.org/api/people/85/?format=api",
        "name": "Vedant Paranjape",
        "email": "vedantparanjape160201@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13813/mbox/",
    "series": [
        {
            "id": 2517,
            "url": "https://patchwork.libcamera.org/api/series/2517/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2517",
            "date": "2021-09-10T18:11:52",
            "name": "[libcamera-devel,v2] test: gstreamer: Add a test for gstreamer multi stream",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2517/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13813/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13813/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 63AF7BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Sep 2021 18:12:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2A55069170;\n\tFri, 10 Sep 2021 20:12:02 +0200 (CEST)",
            "from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com\n\t[IPv6:2607:f8b0:4864:20::102e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B23669169\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Sep 2021 20:12:01 +0200 (CEST)",
            "by mail-pj1-x102e.google.com with SMTP id\n\tm21-20020a17090a859500b00197688449c4so2037932pjn.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Sep 2021 11:12:01 -0700 (PDT)",
            "from localhost.localdomain ([1.186.165.88])\n\tby smtp.googlemail.com with ESMTPSA id\n\th8sm5570378pfr.219.2021.09.10.11.11.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 10 Sep 2021 11:11:59 -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=\"GarYdL1D\"; 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=zJ89xjz7qF10EGdij96cvdRRIEc5qE/mO1UTQBIMZrc=;\n\tb=GarYdL1DHdzL1PbyCh0UkbrjHmR/pTXMzD/8btaEJqwkqh00I9MRSq4cJauFmZQIH7\n\tRjZfTS0sn4Zkbz9ciL/Se0wLn2Z3CZ3a+MV6HkfCoTBiMe9Y9wnevb5vSN33gXEQTMpB\n\ti9c6Ti3MjDhJRG1ljl/9pN/2LbF9qy6AW8BFHC/sZHpIOCnfWIz7i6Gdm1ONlsUGfZMv\n\tsR6Gfn1eD6kdyX+CnKNEjOEUlENCX8FnArqbMFrhiLAxjENwzIjIn2p6/aWY+8B2vb1x\n\t+262TwK/wJdUwvm1hE7FmI1AKKDeqdoZFAtK/PhWdpU85m3d+Cj2jKxfs1mtIlQvjvna\n\tNbrg==",
        "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=zJ89xjz7qF10EGdij96cvdRRIEc5qE/mO1UTQBIMZrc=;\n\tb=XEGCNmp3v/vcBkkNiXSxnpYDwI8NIcPaAwROggrrlNiSWLwnl5KkVBtHtbwpYpr4C1\n\tcvON4Kn9dQWVgrskNS4PoYp8tptiAQBsqdH7rCpF7b0ivdyo6wmcUQt7NPV3zeuwUdQA\n\tDQYZTNFZuAVHQnrH8nBFYEFQUTjeX4ULFr6XdcWgSmOzRedAXXnXGApKmlCx1WREpQKz\n\tkEQ9qtqp6kBdlQa49ba6cDsDsPKk5k+kgXvu6nRXoAsh0vGkHNntgu9LrGn33c1iSHEZ\n\tfE3zxrTeaUuFIiajyJBsGQMtFmg3iotZMvdiUs+g8p+MFlLKRQi358o2Xiyus06zbV/r\n\tPVrQ==",
        "X-Gm-Message-State": "AOAM5325s8Ol+L2BevgmfDPzZGkpotPwe4KV/GxMxesKROlR3OzLY97M\n\trQPvEeUeFfKlt2rN7yRe4Pmtldn+iSaiXg==",
        "X-Google-Smtp-Source": "ABdhPJz/7XBccsmZtwlVsszzdR7GN3t3fqnyvQ+OtX+f68avp0Cx9claKJdH8BqYAobga3Ath1PPLg==",
        "X-Received": "by 2002:a17:902:e550:b0:13b:63c3:46b4 with SMTP id\n\tn16-20020a170902e55000b0013b63c346b4mr4009582plf.78.1631297519697; \n\tFri, 10 Sep 2021 11:11:59 -0700 (PDT)",
        "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 10 Sep 2021 23:41:52 +0530",
        "Message-Id": "<20210910181152.878132-1-vedantparanjape160201@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] 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>\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..e5c909c85da2\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 &i : cm.cameras()) {\n+\t\t\tif (i->streams().size() > 1) {\n+\t\t\t\tcameraName = i->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\t\t\t\t\tconvert0_, convert1_, sink0_, sink1_, NULL);\n+\t\tif (gst_element_link_many(queue0_, convert0_, sink0_, NULL) != TRUE\n+\t\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+        gst_object_unref(queue0_sink_pad);\n+        gst_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",
        "v2"
    ]
}