{"id":18781,"url":"https://patchwork.libcamera.org/api/1.1/patches/18781/?format=json","web_url":"https://patchwork.libcamera.org/patch/18781/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230704155329.28734-1-umang.jain@ideasonboard.com>","date":"2023-07-04T15:53:29","name":"[libcamera-devel] tests: gstreamer: Test cameras' enumeration from GstDeviceProvider","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"3414cd18285b53ac87eddf09cfe8e1aa1c6425d1","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18781/mbox/","series":[{"id":3949,"url":"https://patchwork.libcamera.org/api/1.1/series/3949/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3949","date":"2023-07-04T15:53:29","name":"[libcamera-devel] tests: gstreamer: Test cameras' enumeration from GstDeviceProvider","version":1,"mbox":"https://patchwork.libcamera.org/series/3949/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18781/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18781/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 83C84BE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Jul 2023 15:53:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4841661E38;\n\tTue,  4 Jul 2023 17:53:40 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F33D860384\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Jul 2023 17:53:37 +0200 (CEST)","from umang.jainideasonboard.com (85-160-42-71.reb.o2.cz\n\t[85.160.42.71])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 10951D4A;\n\tTue,  4 Jul 2023 17:52:52 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1688486020;\n\tbh=YF3cB3HCkOyspkdVqt96dhdY2lMeMLayMVavt5ox4O0=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=KjQKoQDG5yoY54XYMKOeYKKNWwE0jZnXmvsdNI04jKVgCx6HNlsIqiBwlTj2QeshP\n\tGUSiBaru4SRiSO+e7EwLTIFYz6cqyZQIPkxrv+KQNHh1CEvtwTLC54R29R95/W2AFb\n\t/pX3lL2JK1Ad/85+5P3rKO4+Fjo2ngRSkW0KRcelc3Fl+cFeTwrAWFbTQUj5j979Jh\n\t3S53ajvedR0QGTd0yFky/xmiCeJKUczMTHn95OFstdsJIrUj0j7MdDVqL1vm5ocxMw\n\t077P9opwm1Df1n0hUJrYUjSartW7Bbm0mzV5fmu4MDDsTTJhUwGwdHdtANpdlkUmSb\n\tFdkSg7cAZxc8w==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1688485973;\n\tbh=YF3cB3HCkOyspkdVqt96dhdY2lMeMLayMVavt5ox4O0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=BAQ10/MC+2xzwiww+/ilE2sF9jj+RWrYIR3wGX23N/qB9I6lLJv835wHgzB46T3Z8\n\tg4IcdTAAiIBUb/IBApwq0677uDxLL0SsCpNuCI+O/iiNw/7Y1z576CCGRFvY7q9+l1\n\tWef4J4CFIHJLt4gNFCm/eMbT2xG3lVoHFic1nkII="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"BAQ10/MC\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  4 Jul 2023 17:53:29 +0200","Message-Id":"<20230704155329.28734-1-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.39.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] tests: gstreamer: Test cameras'\n\tenumeration from GstDeviceProvider","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"nicolas.dufresne@collabora.com, vedantparanjape160201@gmail.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Test the enumeration of the cameras through GstDeviceProvider against\nthe libcamera camera manager.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n test/gstreamer/gstreamer_test.cpp | 52 +++++++++++++++++++++++++++++++\n test/gstreamer/gstreamer_test.h   |  1 +\n 2 files changed, 53 insertions(+)","diff":"diff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp\nindex 6ad0c15c..f94f3fd9 100644\n--- a/test/gstreamer/gstreamer_test.cpp\n+++ b/test/gstreamer/gstreamer_test.cpp\n@@ -27,6 +27,18 @@ const char *__asan_default_options()\n }\n }\n \n+static GstDeviceMonitor *\n+libcamerasrc_get_device_provider()\n+{\n+\tGstDeviceMonitor *monitor = gst_device_monitor_new();\n+\n+\tgst_device_monitor_add_filter(monitor, \"Video/Source\", NULL);\n+\n+\tgst_device_monitor_start(monitor);\n+\n+\treturn monitor;\n+}\n+\n GstreamerTest::GstreamerTest(unsigned int numStreams)\n \t: pipeline_(nullptr), libcameraSrc_(nullptr)\n {\n@@ -78,6 +90,12 @@ GstreamerTest::GstreamerTest(unsigned int numStreams)\n \t\treturn;\n \t}\n \n+\tif (!checkCameraEnumeration()) {\n+\t\tg_printerr(\"Failed to enumerate cameras on GstDeviceProvider\\n\");\n+\t\tstatus_ = TestFail;\n+\t\treturn;\n+\t}\n+\n \tstatus_ = TestPass;\n }\n \n@@ -102,6 +120,40 @@ bool GstreamerTest::checkMinCameraStreamsAndSetCameraName(unsigned int numStream\n \treturn cameraFound;\n }\n \n+bool GstreamerTest::checkCameraEnumeration()\n+{\n+\tGstDeviceMonitor *monitor;\n+\tGList *devices, *l;\n+\tstd::vector<const char *> cameraNames;\n+\tstd::unique_ptr<libcamera::CameraManager> cm\n+\t\t= std::make_unique<libcamera::CameraManager>();\n+\n+\tcm->start();\n+\tfor (auto &camera : cm->cameras())\n+\t\tcameraNames.push_back(strdup(camera->id().c_str()));\n+\tcm->stop();\n+\tcm.reset();\n+\n+\tmonitor = libcamerasrc_get_device_provider();\n+\tdevices = gst_device_monitor_get_devices(monitor);\n+\n+\tfor (l = devices; l != NULL; l = g_list_next(l)) {\n+\t\tbool matched = false;\n+\t\tGstDevice *device = GST_DEVICE(l->data);\n+\t\tfor (const gchar *name : cameraNames) {\n+\t\t\tif (strcmp(name, gst_device_get_display_name(device)) == 0) {\n+\t\t\t\tmatched = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (!matched)\n+\t\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n GstreamerTest::~GstreamerTest()\n {\n \tg_clear_object(&pipeline_);\ndiff --git a/test/gstreamer/gstreamer_test.h b/test/gstreamer/gstreamer_test.h\nindex aa2261e2..3479c7c4 100644\n--- a/test/gstreamer/gstreamer_test.h\n+++ b/test/gstreamer/gstreamer_test.h\n@@ -31,4 +31,5 @@ protected:\n \n private:\n \tbool checkMinCameraStreamsAndSetCameraName(unsigned int numStreams);\n+\tbool checkCameraEnumeration();\n };\n","prefixes":["libcamera-devel"]}