From 36edb00c93cecf70f2c7ea2272efbd7fc3ff9bd5 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Wed, 11 May 2022 17:06:25 +0800 Subject: [PATCH 7/8] v4l2src: Filter out unavailable sources Use env "GST_V4L2SRC_DEVICES" to specify available builtin sources. Default is "rkisp_mainpath:rkisp_selfpath". Signed-off-by: Jeffy Chen --- sys/v4l2/gstv4l2deviceprovider.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/v4l2/gstv4l2deviceprovider.c b/sys/v4l2/gstv4l2deviceprovider.c index 7c2c87f..b99a06c 100644 --- a/sys/v4l2/gstv4l2deviceprovider.c +++ b/sys/v4l2/gstv4l2deviceprovider.c @@ -146,6 +146,19 @@ gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider, type = GST_V4L2_DEVICE_TYPE_SOURCE; v4l2obj->skip_try_fmt_probes = TRUE; + + if (strcmp ((char *) v4l2obj->vcap.driver, "uvcvideo")) { + /* Filter out unavailable source devices */ + const gchar *devices = g_getenv ("GST_V4L2SRC_DEVICES"); + if (!devices) + devices = "rkisp_mainpath:rkisp_selfpath"; + + /* Only check start-with */ + if (!strstr (devices, device_name)) { + GST_WARNING ("%s(%s) been ignored", device_path, device_name); + goto destroy; + } + } } if (v4l2obj->device_caps & -- 2.20.1