static GSList *gst_v4l2_object_get_format_list (GstV4l2Object * v4l2object);
-#if 0
-G_LOCK_DEFINE_STATIC (probe_lock);
-
-const GList *
-gst_v4l2_probe_get_properties (GstPropertyProbe * probe)
-{
- GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
- static GList *list = NULL;
-
- G_LOCK (probe_lock);
-
- if (!list) {
- list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
- }
-
- G_UNLOCK (probe_lock);
-
- return list;
-}
-
-static gboolean init = FALSE;
-static GList *devices = NULL;
-
-#ifdef HAVE_GUDEV
-static gboolean
-gst_v4l2_class_probe_devices_with_udev (GstElementClass * klass, gboolean check,
- GList ** klass_devices)
-{
- GUdevClient *client = NULL;
- GList *item;
-
- if (!check) {
- while (devices) {
- gchar *device = devices->data;
- devices = g_list_remove (devices, device);
- g_free (device);
- }
-
- GST_INFO ("Enumerating video4linux devices from udev");
- client = g_udev_client_new (NULL);
- if (!client) {
- GST_WARNING ("Failed to initialize gudev client");
- goto finish;
- }
-
- item = g_udev_client_query_by_subsystem (client, "video4linux");
- while (item) {
- GUdevDevice *device = item->data;
- gchar *devnode = g_strdup (g_udev_device_get_device_file (device));
- gint api = g_udev_device_get_property_as_int (device, "ID_V4L_VERSION");
- GST_INFO ("Found new device: %s, API: %d", devnode, api);
- /* Append v4l2 devices only. If api is 0 probably v4l_id has
- been stripped out of the current udev installation, append
- anyway */
- if (api == 0) {
- GST_WARNING
- ("Couldn't retrieve ID_V4L_VERSION, silly udev installation?");
- }
- if ((api == 2 || api == 0)) {
- devices = g_list_append (devices, devnode);
- } else {
- g_free (devnode);
- }
- g_object_unref (device);
- item = item->next;
- }
- g_list_free (item);
- init = TRUE;
- }
-
-finish:
- if (client) {
- g_object_unref (client);
- }
-
- *klass_devices = devices;
-
- return init;
-}
-#endif /* HAVE_GUDEV */
-
-static gboolean
-gst_v4l2_class_probe_devices (GstElementClass * klass, gboolean check,
- GList ** klass_devices)
-{
- if (!check) {
- const gchar *dev_base[] = { "/dev/video", "/dev/v4l2/video", NULL };
- gint base, n, fd;
-
- while (devices) {
- gchar *device = devices->data;
- devices = g_list_remove (devices, device);
- g_free (device);
- }
-
- /*
- * detect /dev entries
- */
- for (n = 0; n < 64; n++) {
- for (base = 0; dev_base[base] != NULL; base++) {
- struct stat s;
- gchar *device = g_strdup_printf ("%s%d",
- dev_base[base],
- n);
-
- /*
- * does the /dev/ entry exist at all?
- */
- if (stat (device, &s) == 0) {
- /*
- * yes: is a device attached?
- */
- if (S_ISCHR (s.st_mode)) {
-
- if ((fd = open (device, O_RDWR | O_NONBLOCK)) > 0 || errno == EBUSY) {
- if (fd > 0)
- close (fd);
-
- devices = g_list_append (devices, device);
- break;
- }
- }
- }
- g_free (device);
- }
- }
- init = TRUE;
- }
-
- *klass_devices = devices;
-
- return init;
-}
-
-void
-gst_v4l2_probe_probe_property (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec, GList ** klass_devices)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (probe);
-
- switch (prop_id) {
- case PROP_DEVICE:
-#ifdef HAVE_GUDEV
- if (!gst_v4l2_class_probe_devices_with_udev (klass, FALSE, klass_devices))
- gst_v4l2_class_probe_devices (klass, FALSE, klass_devices);
-#else /* !HAVE_GUDEV */
- gst_v4l2_class_probe_devices (klass, FALSE, klass_devices);
-#endif /* HAVE_GUDEV */
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-}
-
-gboolean
-gst_v4l2_probe_needs_probe (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec, GList ** klass_devices)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (probe);
- gboolean ret = FALSE;
-
- switch (prop_id) {
- case PROP_DEVICE:
-#ifdef HAVE_GUDEV
- ret =
- !gst_v4l2_class_probe_devices_with_udev (klass, FALSE, klass_devices);
-#else /* !HAVE_GUDEV */
- ret = !gst_v4l2_class_probe_devices (klass, TRUE, klass_devices);
-#endif /* HAVE_GUDEV */
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
- return ret;
-}
-
-static GValueArray *
-gst_v4l2_class_list_devices (GstElementClass * klass, GList ** klass_devices)
-{
- GValueArray *array;
- GValue value = { 0 };
- GList *item;
-
- if (!*klass_devices)
- return NULL;
-
- array = g_value_array_new (g_list_length (*klass_devices));
- item = *klass_devices;
- g_value_init (&value, G_TYPE_STRING);
- while (item) {
- gchar *device = item->data;
-
- g_value_set_string (&value, device);
- g_value_array_append (array, &value);
-
- item = item->next;
- }
- g_value_unset (&value);
-
- return array;
-}
-
-GValueArray *
-gst_v4l2_probe_get_values (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec, GList ** klass_devices)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (probe);
- GValueArray *array = NULL;
-
- switch (prop_id) {
- case PROP_DEVICE:
- array = gst_v4l2_class_list_devices (klass, klass_devices);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-
- return array;
-}
-#endif
#define GST_TYPE_V4L2_DEVICE_FLAGS (gst_v4l2_device_get_type ())
static GType