devicemonitor: don't fail when started without any filters

Just show all devices then.
This commit is contained in:
Tim-Philipp Müller 2014-06-27 10:44:32 +01:00
parent 9b07b935a4
commit 0e0e78e8af
2 changed files with 11 additions and 5 deletions

View file

@ -35,7 +35,7 @@
* the application has set.
*
*
* The basic use pattern of an iterator is as follows:
* The basic use pattern of a device monitor is as follows:
* |[
* static gboolean
* my_bus_func (GstBus * bus, GstMessage * message, gpointer user_data)
@ -348,8 +348,10 @@ gst_device_monitor_start (GstDeviceMonitor * monitor)
if (monitor->priv->filters->len == 0) {
GST_OBJECT_UNLOCK (monitor);
GST_WARNING_OBJECT (monitor, "No filters have been set");
return FALSE;
GST_WARNING_OBJECT (monitor, "No filters have been set, will expose all "
"devices found");
gst_device_monitor_add_filter (monitor, NULL, NULL);
GST_OBJECT_LOCK (monitor);
}
if (monitor->priv->providers->len == 0) {

View file

@ -420,8 +420,6 @@ GST_START_TEST (test_device_monitor)
mon = gst_device_monitor_new ();
fail_if (gst_device_monitor_start (mon));
devices = g_list_append (NULL, test_device_new ());
devs = gst_device_monitor_get_devices (mon);
@ -533,6 +531,12 @@ GST_START_TEST (test_device_monitor)
gst_object_unref (dp);
gst_object_unref (dp2);
g_list_free_full (devices, (GDestroyNotify) gst_object_unref);
/* should work fine without any filters */
mon = gst_device_monitor_new ();
fail_unless (gst_device_monitor_start (mon));
gst_device_monitor_stop (mon);
gst_object_unref (mon);
}
GST_END_TEST;