Patch Detail
Show a patch.
GET /api/1.1/patches/13756/?format=api
{ "id": 13756, "url": "https://patchwork.libcamera.org/api/1.1/patches/13756/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13756/", "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": "<20210908043651.114895-1-vedantparanjape160201@gmail.com>", "date": "2021-09-08T04:36:51", "name": "[libcamera-devel,v2] test: gstreamer: Factor out code into a base class", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "1cee99bf71080e1d8bdfba364847b490ff4d9323", "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/13756/mbox/", "series": [ { "id": 2494, "url": "https://patchwork.libcamera.org/api/1.1/series/2494/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2494", "date": "2021-09-08T04:36:51", "name": "[libcamera-devel,v2] test: gstreamer: Factor out code into a base class", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2494/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13756/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13756/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 7EB5ABDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 8 Sep 2021 04:37:21 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C33A36916E;\n\tWed, 8 Sep 2021 06:37:20 +0200 (CEST)", "from mail-pg1-x531.google.com (mail-pg1-x531.google.com\n\t[IPv6:2607:f8b0:4864:20::531])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CAA766024C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 8 Sep 2021 06:37:17 +0200 (CEST)", "by mail-pg1-x531.google.com with SMTP id s11so1224885pgr.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 07 Sep 2021 21:37:17 -0700 (PDT)", "from localhost.localdomain ([1.186.166.2])\n\tby smtp.googlemail.com with ESMTPSA id\n\tbx2sm562636pjb.35.2021.09.07.21.37.13\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 07 Sep 2021 21:37:15 -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=\"GswoqdOm\"; 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=tLCBRnRhgXXyStCGLL39MgyceXMh+bhEj48PaYnUb+A=;\n\tb=GswoqdOmBGl5ipXwysEpxhHzu90ipm2XMZMMvNXBuMW7KJHm/BNKnhu4ZFNqTqI8HY\n\t6i/zrFKpuOQTjoQjog/eL0SkqKhKt/hq7CZUlAQVmgcSxvmZ/LqMDgOkvoioA5bMiyP7\n\tHK++lCvTPhzlTvhyjRp6RRXppWWn5jYOGYrDrA/tOMlE8anqOSJX7x3lU7H7LRIg+6go\n\tRr32PqBBQqD0aDqSrS7r29B2nS+i3rZSCIqa/F9JjI4WKd9lC69Lk/G4tspH/bbmW5Ze\n\tojFcidU6pmQoBcd2y1LDwfCKYF2+tLKCPgUVCsannMwsWkwOd8yk9zKPfOpU0JxFXQwV\n\tEKHQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=tLCBRnRhgXXyStCGLL39MgyceXMh+bhEj48PaYnUb+A=;\n\tb=kalYcABTeRddpt9U7TObEjYC7ZapX2QEg8cnJc5AwRap9A5j0h8BASCAWZTe2rfLJ6\n\tz1sh7/Jyd9l6tDbo0WBob6P5m9tXJLRFOmglQUEt4wzjqVTPsOGwL+hq7Qqitgq3s/eJ\n\tR1oV90rnik1NMibjiuOKKyhpzgRvI9hljmifmNM1l2AoILOSsdz/4PtilH2KrONTniSV\n\tg+Fsrs77YosLWjbFXoX4vx4lhnxjAZU0+JOwTpRldvwy9RPjfIPpUMyxVi9o6Pr1ptcH\n\tzpy3KXMn7S6lRoquDmUKljjn+gI9FVDDYnfWSP6vQ84eOlW74uahyJspmcf9/bEkt49U\n\t23Wg==", "X-Gm-Message-State": "AOAM532jRaB+MxDSjZgGXdYIfUeFZHWwzQh+jwLTn/I5Qvb8YVvTgIUU\n\tjB3ow0sWjX4V7rZ2joXaj1fomEoR/FVsgDgZ", "X-Google-Smtp-Source": "ABdhPJyDnbHx3y+qoraq00VRTBFBOTHvEMj0j0sBoh3L2FIJlJ1rQIZzenPTPxGTO0R27D9EI2Nzyg==", "X-Received": "by 2002:a63:2d86:: with SMTP id\n\tt128mr1843178pgt.316.1631075835564; \n\tTue, 07 Sep 2021 21:37:15 -0700 (PDT)", "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 8 Sep 2021 10:06:51 +0530", "Message-Id": "<20210908043651.114895-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: Factor out code into\n\ta base class", "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": "Nicolas Dufresne <nicolas.dufresne@collabora.com>,\n\tVedant Paranjape <vedantparanjape160201@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Lot of code used in single stream test is boiler plate and common across\nevery gstreamer test. Factored out this code into a base class called\nGstreamerTest.\n\nAlso updated the gstreamer_single_stream_test to use the GstreamerTest\nbase class\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n .../gstreamer_single_stream_test.cpp | 145 +++-------------\n test/gstreamer/gstreamer_test.cpp | 156 ++++++++++++++++++\n test/gstreamer/gstreamer_test.h | 39 +++++\n test/gstreamer/meson.build | 2 +-\n 4 files changed, 220 insertions(+), 122 deletions(-)\n create mode 100644 test/gstreamer/gstreamer_test.cpp\n create mode 100644 test/gstreamer/gstreamer_test.h", "diff": "diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp\nindex 4c8d4804..adfde65c 100644\n--- a/test/gstreamer/gstreamer_single_stream_test.cpp\n+++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n@@ -14,104 +14,48 @@\n \n #include <gst/gst.h>\n \n+#include \"gstreamer_test.h\"\n #include \"test.h\"\n \n using namespace std;\n \n-extern \"C\" {\n-const char *__asan_default_options()\n-{\n-\t/*\n-\t * Disable leak detection due to a known global variable initialization\n-\t * leak in glib's g_quark_init(). This should ideally be handled by\n-\t * using a suppression file instead of disabling leak detection.\n-\t */\n-\treturn \"detect_leaks=false\";\n-}\n-}\n-\n-class GstreamerSingleStreamTest : public Test\n+class GstreamerSingleStreamTest : public GstreamerTest, public Test\n {\n+public:\n+\tGstreamerSingleStreamTest()\n+\t\t: GstreamerTest()\n+\t{\n+\t}\n+\n protected:\n \tint init() override\n \t{\n-\t\t/*\n-\t\t * GStreamer by default spawns a process to run the\n-\t\t * gst-plugin-scanner helper. If libcamera is compiled with ASan\n-\t\t * enabled, and as GStreamer is most likely not, this causes the\n-\t\t * ASan link order check to fail when gst-plugin-scanner\n-\t\t * dlopen()s the plugin as many libraries will have already been\n-\t\t * loaded by then. Fix this issue by disabling spawning of a\n-\t\t * child helper process when scanning the build directory for\n-\t\t * plugins.\n-\t\t */\n-\t\tgst_registry_fork_set_enabled(false);\n-\n-\t\t/* Initialize GStreamer */\n-\t\tg_autoptr(GError) errInit = NULL;\n-\t\tif (!gst_init_check(nullptr, nullptr, &errInit)) {\n-\t\t\tg_printerr(\"Could not initialize GStreamer: %s\\n\",\n-\t\t\t\t errInit ? errInit->message : \"unknown error\");\n+\t\tif (status_ != TestPass)\n+\t\t\treturn status_;\n \n-\t\t\treturn TestFail;\n-\t\t}\n+\t\tg_autoptr(GstElement) convert0 = gst_element_factory_make(\"videoconvert\", \"convert0\");\n+\t\tg_autoptr(GstElement) sink0 = gst_element_factory_make(\"fakesink\", \"sink0\");\n+\t\tg_object_ref_sink(convert0);\n+\t\tg_object_ref_sink(sink0);\n \n-\t\t/*\n-\t\t * Remove the system libcamera plugin, if any, and add the\n-\t\t * plugin from the build directory.\n-\t\t */\n-\t\tGstRegistry *registry = gst_registry_get();\n-\t\tGstPlugin *plugin = gst_registry_lookup(registry, \"libgstlibcamera.so\");\n-\t\tif (plugin) {\n-\t\t\tgst_registry_remove_plugin(registry, plugin);\n-\t\t\tgst_object_unref(plugin);\n-\t\t}\n+\t\tif (!convert0 || !sink0) {\n+\t\t\tg_printerr(\"Not all elements could be created. %p.%p\\n\",\n+\t\t\t\t convert0, sink0);\n \n-\t\tstd::string path = libcamera::utils::libcameraBuildPath()\n-\t\t\t\t + \"src/gstreamer\";\n-\t\tif (!gst_registry_scan_path(registry, path.c_str())) {\n-\t\t\tg_printerr(\"Failed to add plugin to registry\\n\");\n-\t\t\tgst_deinit();\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\t/* Create the elements */\n-\t\tlibcameraSrc_ = gst_element_factory_make(\"libcamerasrc\", \"libcamera\");\n-\t\tconvert0_ = gst_element_factory_make(\"videoconvert\", \"convert0\");\n-\t\tsink0_ = gst_element_factory_make(\"fakesink\", \"sink0\");\n-\n-\t\t/* Create the empty pipeline_ */\n-\t\tpipeline_ = gst_pipeline_new(\"test-pipeline\");\n-\n-\t\tif (!pipeline_ || !convert0_ || !sink0_ || !libcameraSrc_) {\n-\t\t\tg_printerr(\"Not all elements could be created. %p.%p.%p.%p\\n\",\n-\t\t\t\t pipeline_, convert0_, sink0_, libcameraSrc_);\n-\t\t\tif (pipeline_)\n-\t\t\t\tgst_object_unref(pipeline_);\n-\t\t\tif (convert0_)\n-\t\t\t\tgst_object_unref(convert0_);\n-\t\t\tif (sink0_)\n-\t\t\t\tgst_object_unref(sink0_);\n-\t\t\tif (libcameraSrc_)\n-\t\t\t\tgst_object_unref(libcameraSrc_);\n-\t\t\tgst_deinit();\n+\t\tconvert0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&convert0));\n+\t\tsink0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&sink0));\n \n+\t\tif (gstreamer_create_pipeline() != TestPass)\n \t\t\treturn TestFail;\n-\t\t}\n \n \t\treturn TestPass;\n \t}\n \n-\tvoid cleanup() override\n-\t{\n-\t\tgst_object_unref(pipeline_);\n-\t\tgst_deinit();\n-\t}\n-\n \tint run() override\n \t{\n-\t\tGstStateChangeReturn ret;\n-\n \t\t/* Build the pipeline */\n \t\tgst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, convert0_, sink0_, NULL);\n \t\tif (gst_element_link_many(libcameraSrc_, convert0_, sink0_, NULL) != TRUE) {\n@@ -119,57 +63,16 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\t/* Start playing */\n-\t\tret = gst_element_set_state(pipeline_, GST_STATE_PLAYING);\n-\t\tif (ret == GST_STATE_CHANGE_FAILURE) {\n-\t\t\tg_printerr(\"Unable to set the pipeline to the playing state.\\n\");\n+\t\tif (gstreamer_start_pipeline() != TestPass)\n \t\t\treturn TestFail;\n-\t\t}\n \n-\t\t/* Wait until error or EOS or timeout after 2 seconds */\n-\t\tconstexpr GstMessageType msgType =\n-\t\t\tstatic_cast<GstMessageType>(GST_MESSAGE_ERROR | GST_MESSAGE_EOS);\n-\t\tconstexpr GstClockTime timeout = 2 * GST_SECOND;\n-\n-\t\tg_autoptr(GstBus) bus = gst_element_get_bus(pipeline_);\n-\t\tg_autoptr(GstMessage) msg = gst_bus_timed_pop_filtered(bus, timeout, msgType);\n-\n-\t\tgst_element_set_state(pipeline_, GST_STATE_NULL);\n-\n-\t\t/* Parse error message */\n-\t\tif (msg == NULL)\n-\t\t\treturn TestPass;\n-\n-\t\tswitch (GST_MESSAGE_TYPE(msg)) {\n-\t\tcase GST_MESSAGE_ERROR:\n-\t\t\tgstreamer_print_error(msg);\n-\t\t\tbreak;\n-\t\tcase GST_MESSAGE_EOS:\n-\t\t\tg_print(\"End-Of-Stream reached.\\n\");\n-\t\t\tbreak;\n-\t\tdefault:\n-\t\t\tg_printerr(\"Unexpected message received.\\n\");\n-\t\t\tbreak;\n-\t\t}\n+\t\tif (gstreamer_process_event() != TestPass)\n+\t\t\treturn TestFail;\n \n-\t\treturn TestFail;\n+\t\treturn TestPass;\n \t}\n \n private:\n-\tvoid gstreamer_print_error(GstMessage *msg)\n-\t{\n-\t\tg_autoptr(GError) err = NULL;\n-\t\tg_autofree gchar *debug_info = NULL;\n-\n-\t\tgst_message_parse_error(msg, &err, &debug_info);\n-\t\tg_printerr(\"Error received from element %s: %s\\n\",\n-\t\t\t GST_OBJECT_NAME(msg->src), err->message);\n-\t\tg_printerr(\"Debugging information: %s\\n\",\n-\t\t\t debug_info ? debug_info : \"none\");\n-\t}\n-\n-\tGstElement *pipeline_;\n-\tGstElement *libcameraSrc_;\n \tGstElement *convert0_;\n \tGstElement *sink0_;\n };\ndiff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp\nnew file mode 100644\nindex 00000000..0368e178\n--- /dev/null\n+++ b/test/gstreamer/gstreamer_test.cpp\n@@ -0,0 +1,156 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Vedant Paranjape\n+ *\n+ * libcamera Gstreamer element API tests\n+ */\n+\n+#include \"gstreamer_test.h\"\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+\n+extern \"C\" {\n+const char *__asan_default_options()\n+{\n+\t/*\n+\t * Disable leak detection due to a known global variable initialization\n+\t * leak in glib's g_quark_init(). This should ideally be handled by\n+\t * using a suppression file instead of disabling leak detection.\n+\t */\n+\treturn \"detect_leaks=false\";\n+}\n+}\n+\n+GstreamerTest::GstreamerTest()\n+{\n+\t/*\n+\t* GStreamer by default spawns a process to run the\n+\t* gst-plugin-scanner helper. If libcamera is compiled with ASan\n+\t* enabled, and as GStreamer is most likely not, this causes the\n+\t* ASan link order check to fail when gst-plugin-scanner\n+\t* dlopen()s the plugin as many libraries will have already been\n+\t* loaded by then. Fix this issue by disabling spawning of a\n+\t* child helper process when scanning the build directory for\n+\t* plugins.\n+\t*/\n+\tgst_registry_fork_set_enabled(false);\n+\n+\t/* Initialize GStreamer */\n+\tg_autoptr(GError) errInit = NULL;\n+\tif (!gst_init_check(nullptr, nullptr, &errInit)) {\n+\t\tg_printerr(\"Could not initialize GStreamer: %s\\n\",\n+\t\t\t errInit ? errInit->message : \"unknown error\");\n+\n+\t\tstatus_ = TestFail;\n+\t\treturn;\n+\t}\n+\n+\t/*\n+\t* Remove the system libcamera plugin, if any, and add the\n+\t* plugin from the build directory.\n+\t*/\n+\tGstRegistry *registry = gst_registry_get();\n+\tg_autoptr(GstPlugin) plugin = gst_registry_lookup(registry, \"libgstlibcamera.so\");\n+\tif (plugin)\n+\t\tgst_registry_remove_plugin(registry, plugin);\n+\n+\tstd::string path = libcamera::utils::libcameraBuildPath() + \"src/gstreamer\";\n+\tif (!gst_registry_scan_path(registry, path.c_str())) {\n+\t\tg_printerr(\"Failed to add plugin to registry\\n\");\n+\n+\t\tstatus_ = TestFail;\n+\t\treturn;\n+\t}\n+\n+\tstatus_ = TestPass;\n+}\n+\n+GstreamerTest::~GstreamerTest()\n+{\n+\tif (libcameraSrc_ &&\n+\t !gst_object_has_as_ancestor(GST_OBJECT(libcameraSrc_),\n+\t\t\t\t\tGST_OBJECT(pipeline_)))\n+\t\tgst_object_unref(libcameraSrc_);\n+\tif (pipeline_)\n+\t\tgst_object_unref(pipeline_);\n+\n+\tgst_deinit();\n+}\n+\n+int GstreamerTest::gstreamer_create_pipeline()\n+{\n+\tg_autoptr(GstElement) libcameraSrc = gst_element_factory_make(\"libcamerasrc\", \"libcamera\");\n+\tpipeline_ = gst_pipeline_new(\"test-pipeline\");\n+\tg_object_ref_sink(libcameraSrc);\n+\n+\tif (!libcameraSrc || !pipeline_) {\n+\t\tg_printerr(\"Unable to create create pipeline %p.%p\\n\",\n+\t\t\t libcameraSrc, pipeline_);\n+\n+\t\treturn TestFail;\n+\t}\n+\n+\tlibcameraSrc_ = reinterpret_cast<GstElement *>(g_steal_pointer(&libcameraSrc));\n+\n+\treturn TestPass;\n+}\n+\n+int GstreamerTest::gstreamer_start_pipeline()\n+{\n+\tGstStateChangeReturn ret;\n+\n+\t/* Start playing */\n+\tret = gst_element_set_state(pipeline_, GST_STATE_PLAYING);\n+\tif (ret == GST_STATE_CHANGE_FAILURE) {\n+\t\tg_printerr(\"Unable to set the pipeline to the playing state.\\n\");\n+\t\treturn TestFail;\n+\t}\n+\n+\treturn TestPass;\n+}\n+\n+int GstreamerTest::gstreamer_process_event()\n+{\n+\t/* Wait until error or EOS or timeout after 2 seconds */\n+\tconstexpr GstMessageType msgType =\n+\t\tstatic_cast<GstMessageType>(GST_MESSAGE_ERROR | GST_MESSAGE_EOS);\n+\tconstexpr GstClockTime timeout = 2 * GST_SECOND;\n+\n+\tg_autoptr(GstBus) bus = gst_element_get_bus(pipeline_);\n+\tg_autoptr(GstMessage) msg = gst_bus_timed_pop_filtered(bus, timeout, msgType);\n+\n+\tgst_element_set_state(pipeline_, GST_STATE_NULL);\n+\n+\t/* Parse error message */\n+\tif (msg == NULL)\n+\t\treturn TestPass;\n+\n+\tswitch (GST_MESSAGE_TYPE(msg)) {\n+\tcase GST_MESSAGE_ERROR:\n+\t\tgstreamer_print_error(msg);\n+\t\tbreak;\n+\tcase GST_MESSAGE_EOS:\n+\t\tg_print(\"End-Of-Stream reached.\\n\");\n+\t\tbreak;\n+\tdefault:\n+\t\tg_printerr(\"Unexpected message received.\\n\");\n+\t\tbreak;\n+\t}\n+\n+\treturn TestFail;\n+}\n+\n+void GstreamerTest::gstreamer_print_error(GstMessage *msg)\n+{\n+\tg_autoptr(GError) err = NULL;\n+\tg_autofree gchar *debug_info = NULL;\n+\n+\tgst_message_parse_error(msg, &err, &debug_info);\n+\tg_printerr(\"Error received from element %s: %s\\n\",\n+\t\t GST_OBJECT_NAME(msg->src), err->message);\n+\tg_printerr(\"Debugging information: %s\\n\",\n+\t\t debug_info ? debug_info : \"none\");\n+}\n+\ndiff --git a/test/gstreamer/gstreamer_test.h b/test/gstreamer/gstreamer_test.h\nnew file mode 100644\nindex 00000000..cdffdea9\n--- /dev/null\n+++ b/test/gstreamer/gstreamer_test.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Vedant Paranjape\n+ *\n+ * gstreamer_test.cpp - GStreamer test base class\n+ */\n+\n+#ifndef __LIBCAMERA_GSTREAMER_TEST_H__\n+#define __LIBCAMERA_GSTREAMER_TEST_H__\n+\n+#include <iostream>\n+#include <unistd.h>\n+\n+#include <libcamera/base/utils.h>\n+\n+#include \"libcamera/internal/source_paths.h\"\n+\n+#include <gst/gst.h>\n+\n+using namespace std;\n+\n+class GstreamerTest\n+{\n+public:\n+\tGstreamerTest();\n+\tvirtual ~GstreamerTest();\n+\n+protected:\n+\tvirtual int gstreamer_create_pipeline();\n+\tint gstreamer_start_pipeline();\n+\tint gstreamer_process_event();\n+\tvoid gstreamer_print_error(GstMessage *msg);\n+\n+\tGstElement *pipeline_;\n+\tGstElement *libcameraSrc_;\n+\tint status_;\n+};\n+\n+#endif /* __LIBCAMERA_GSTREAMER_TEST_H__ */\ndiff --git a/test/gstreamer/meson.build b/test/gstreamer/meson.build\nindex b99aa0da..aca53b92 100644\n--- a/test/gstreamer/meson.build\n+++ b/test/gstreamer/meson.build\n@@ -10,7 +10,7 @@ gstreamer_tests = [\n gstreamer_dep = dependency('gstreamer-1.0', required: true)\n \n foreach t : gstreamer_tests\n- exe = executable(t[0], t[1],\n+ exe = executable(t[0], t[1], 'gstreamer_test.cpp',\n dependencies : [libcamera_private, gstreamer_dep],\n link_with : test_libraries,\n include_directories : test_includes_internal)\n", "prefixes": [ "libcamera-devel", "v2" ] }