diff options
author | Wim Taymans <wtaymans@redhat.com> | 2015-07-17 10:18:02 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2015-08-04 13:24:10 +0200 |
commit | 62f6207e044992e3f161bfb7406d7e6477527dc9 (patch) | |
tree | 3cfccdb9599d24d228a35be228e3a938c4b48977 /gst | |
parent | 794a08d7e9e4d1fc483c1fac49369f5aef964ba9 (diff) |
devicemonitor: get a list of currently monitored providers
Get a list of the currently monitored providers.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstdevicemonitor.c | 45 | ||||
-rw-r--r-- | gst/gstdevicemonitor.h | 2 |
2 files changed, 47 insertions, 0 deletions
diff --git a/gst/gstdevicemonitor.c b/gst/gstdevicemonitor.c index a07c6d8f0..9784232ac 100644 --- a/gst/gstdevicemonitor.c +++ b/gst/gstdevicemonitor.c @@ -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; +} diff --git a/gst/gstdevicemonitor.h b/gst/gstdevicemonitor.h index 2df07e442..5fe4677ad 100644 --- a/gst/gstdevicemonitor.h +++ b/gst/gstdevicemonitor.h @@ -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__ */ |