diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2014-06-27 10:44:32 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2014-06-27 10:47:50 +0100 |
commit | 0e0e78e8af129fd411381f18e75999d1aa9195de (patch) | |
tree | 5ba094d229a5d997fd67a49eb7900bf9b13558e9 | |
parent | 9b07b935a4d65b416176f0da64f2a8a509615e51 (diff) |
devicemonitor: don't fail when started without any filters
Just show all devices then.
-rw-r--r-- | gst/gstdevicemonitor.c | 8 | ||||
-rw-r--r-- | tests/check/gst/gstdevice.c | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gst/gstdevicemonitor.c b/gst/gstdevicemonitor.c index eb8759c84..e19366186 100644 --- a/gst/gstdevicemonitor.c +++ b/gst/gstdevicemonitor.c @@ -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) { diff --git a/tests/check/gst/gstdevice.c b/tests/check/gst/gstdevice.c index befcd9d0b..c59d43bea 100644 --- a/tests/check/gst/gstdevice.c +++ b/tests/check/gst/gstdevice.c @@ -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; |