Fix device probing from multiple childs. It's done once in the parent class only now, but the childs do get the corre...

Original commit message from CVS:
Fix device probing from multiple childs. It's done once in the parent class only now, but the childs do get the correct values. Also fixes an incorrect succesful state change if we opened a v4l device that doesn't have the capabilities that are needed by the plugin.
This commit is contained in:
Ronald S. Bultje 2003-11-09 20:54:24 +00:00
parent 3d601dbe9f
commit ba7dfbdbb3

View file

@ -125,16 +125,17 @@ gst_v4l2_class_probe_devices (GstV4l2ElementClass *klass,
gboolean check) gboolean check)
{ {
static gboolean init = FALSE; static gboolean init = FALSE;
static GList *devices = NULL;
if (!init && !check) { if (!init && !check) {
gchar *dev_base[] = { "/dev/video", "/dev/v4l/video", NULL }; gchar *dev_base[] = { "/dev/video", "/dev/v4l/video", NULL };
gint base, n, fd; gint base, n, fd;
while (klass->devices) { while (devices) {
GList *item = klass->devices; GList *item = devices;
gchar *device = item->data; gchar *device = item->data;
klass->devices = g_list_remove (klass->devices, item); devices = g_list_remove (devices, item);
g_free (device); g_free (device);
} }
@ -153,8 +154,8 @@ gst_v4l2_class_probe_devices (GstV4l2ElementClass *klass,
if (fd > 0) if (fd > 0)
close (fd); close (fd);
klass->devices = devices =
g_list_append (klass->devices, g_list_append (devices,
device); device);
break; break;
} }
@ -166,6 +167,8 @@ gst_v4l2_class_probe_devices (GstV4l2ElementClass *klass,
init = TRUE; init = TRUE;
} }
klass->devices = devices;
return init; return init;
} }