Commit 717bbbbe authored by Nicolas Dufresne's avatar Nicolas Dufresne
Browse files

v4l2devicemonitor: Port to use GstV4l2Iterator

https://bugzilla.gnome.org/show_bug.cgi?id=727925
parent aa748710
......@@ -32,6 +32,7 @@
#include "gstv4l2object.h"
#include "v4l2_calls.h"
#include "v4l2-utils.h"
#ifdef HAVE_GUDEV
#include <gudev/gudev.h>
......@@ -162,29 +163,24 @@ static GList *
gst_v4l2_device_monitor_probe (GstDeviceMonitor * monitor)
{
GstV4l2DeviceMonitor *self = GST_V4L2_DEVICE_MONITOR (monitor);
GstV4l2Iterator *it;
GList *devices = NULL;
const gchar *dev_base[] = { "/dev/video", "/dev/v4l2/video", NULL };
gint base, n;
/*
* detect /dev entries
*/
for (n = 0; n < 64; n++) {
for (base = 0; dev_base[base] != NULL; base++) {
gchar *dev = g_strdup_printf ("%s%d", dev_base[base], n);
GstV4l2Device *device;
device = gst_v4l2_device_monitor_probe_device (self, dev, NULL);
if (device) {
gst_object_ref_sink (device);
devices = g_list_prepend (devices, device);
}
g_free (dev);
it = gst_v4l2_iterator_new ();
while (gst_v4l2_iterator_next (it)) {
GstV4l2Device *device;
device = gst_v4l2_device_monitor_probe_device (self, it->device_path, NULL);
if (device) {
gst_object_ref_sink (device);
devices = g_list_prepend (devices, device);
}
}
gst_v4l2_iterator_free (it);
return devices;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment