devicemonitor: get a list of currently monitored providers
authorWim Taymans <wtaymans@redhat.com>
Fri, 17 Jul 2015 08:18:02 +0000 (10:18 +0200)
committerWim Taymans <wtaymans@redhat.com>
Tue, 4 Aug 2015 11:24:10 +0000 (13:24 +0200)
Get a list of the currently monitored providers.

gst/gstdevicemonitor.c
gst/gstdevicemonitor.h
win32/common/libgstreamer.def

index a07c6d8..9784232 100644 (file)
@@ -671,3 +671,48 @@ gst_device_monitor_get_bus (GstDeviceMonitor * monitor)
 
   return gst_object_ref (monitor->priv->bus);
 }
+
+/**
+ * gst_device_monitor_get_providers:
+ * @monitor: a #GstDeviceMonitor
+ *
+ * Get a list of the currently selected device provider factories.
+ *
+ * This
+ *
+ * Returns: (transfer full) (array zero-terminated=1) (element-type gchar*):
+ *     A list of device provider factory names that are currently being
+ *     monitored by @monitor or %NULL when nothing is being monitored.
+ *
+ * Since: 1.6
+ */
+gchar **
+gst_device_monitor_get_providers (GstDeviceMonitor * monitor)
+{
+  guint i, len;
+  gchar **res = NULL;
+
+  g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), NULL);
+
+  GST_OBJECT_LOCK (monitor);
+  len = monitor->priv->providers->len;
+  if (len == 0)
+    goto done;
+
+  res = g_new (gchar *, len + 1);
+
+  for (i = 0; i < len; i++) {
+    GstDeviceProvider *provider =
+        g_ptr_array_index (monitor->priv->providers, i);
+    GstDeviceProviderFactory *factory =
+        gst_device_provider_get_factory (provider);
+
+    res[i] = g_strdup (GST_OBJECT_NAME (factory));
+  }
+  res[i] = NULL;
+
+done:
+  GST_OBJECT_UNLOCK (monitor);
+
+  return res;
+}
index 2df07e4..5fe4677 100644 (file)
@@ -95,6 +95,8 @@ guint     gst_device_monitor_add_filter (GstDeviceMonitor * monitor,
 gboolean  gst_device_monitor_remove_filter (GstDeviceMonitor * monitor,
                                             guint filter_id);
 
+gchar **  gst_device_monitor_get_providers (GstDeviceMonitor * monitor);
+
 G_END_DECLS
 
 #endif /* __GST_DEVICE_MONITOR_H__ */
index ec8db23..0e6963a 100644 (file)
@@ -435,6 +435,7 @@ EXPORTS
        gst_device_monitor_add_filter
        gst_device_monitor_get_bus
        gst_device_monitor_get_devices
+       gst_device_monitor_get_providers
        gst_device_monitor_get_type
        gst_device_monitor_new
        gst_device_monitor_remove_filter