v4l2devicemonitor: Port to use GstV4l2Iterator
https://bugzilla.gnome.org/show_bug.cgi?id=727925
This commit is contained in:
parent
aa74871080
commit
717bbbbe70
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "gstv4l2object.h"
|
#include "gstv4l2object.h"
|
||||||
#include "v4l2_calls.h"
|
#include "v4l2_calls.h"
|
||||||
|
#include "v4l2-utils.h"
|
||||||
|
|
||||||
#ifdef HAVE_GUDEV
|
#ifdef HAVE_GUDEV
|
||||||
#include <gudev/gudev.h>
|
#include <gudev/gudev.h>
|
||||||
@ -162,28 +163,23 @@ static GList *
|
|||||||
gst_v4l2_device_monitor_probe (GstDeviceMonitor * monitor)
|
gst_v4l2_device_monitor_probe (GstDeviceMonitor * monitor)
|
||||||
{
|
{
|
||||||
GstV4l2DeviceMonitor *self = GST_V4L2_DEVICE_MONITOR (monitor);
|
GstV4l2DeviceMonitor *self = GST_V4L2_DEVICE_MONITOR (monitor);
|
||||||
|
GstV4l2Iterator *it;
|
||||||
GList *devices = NULL;
|
GList *devices = NULL;
|
||||||
const gchar *dev_base[] = { "/dev/video", "/dev/v4l2/video", NULL };
|
|
||||||
gint base, n;
|
|
||||||
|
|
||||||
/*
|
it = gst_v4l2_iterator_new ();
|
||||||
* detect /dev entries
|
|
||||||
*/
|
while (gst_v4l2_iterator_next (it)) {
|
||||||
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;
|
GstV4l2Device *device;
|
||||||
|
|
||||||
device = gst_v4l2_device_monitor_probe_device (self, dev, NULL);
|
device = gst_v4l2_device_monitor_probe_device (self, it->device_path, NULL);
|
||||||
|
|
||||||
if (device) {
|
if (device) {
|
||||||
gst_object_ref_sink (device);
|
gst_object_ref_sink (device);
|
||||||
devices = g_list_prepend (devices, device);
|
devices = g_list_prepend (devices, device);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_free (dev);
|
gst_v4l2_iterator_free (it);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user