gboolean check)
{
static gboolean init = FALSE;
+ static GList *devices = NULL;
if (!init && !check) {
gchar *dev_base[] = { "/dev/video", "/dev/v4l/video", NULL };
gint base, n, fd;
- while (klass->devices) {
- GList *item = klass->devices;
+ while (devices) {
+ GList *item = devices;
gchar *device = item->data;
- klass->devices = g_list_remove (klass->devices, item);
+ devices = g_list_remove (devices, item);
g_free (device);
}
if (fd > 0)
close (fd);
- klass->devices = g_list_append (klass->devices, device);
+ devices = g_list_append (devices, device);
break;
}
}
init = TRUE;
}
+ klass->devices = devices;
+
return init;
}
#include "gstv4ltuner.h"
#include "gstv4lcolorbalance.h"
+#include "gstv4lsrc.h"
+#include "gstv4lmjpegsrc.h"
+#include "gstv4lmjpegsink.h"
+
#define DEBUG(format, args...) \
GST_DEBUG_OBJECT (\
GST_ELEMENT(v4lelement), \
return FALSE;
}
+ /* device type check */
+ if ((GST_IS_V4LSRC(v4lelement) &&
+ !(v4lelement->vcap.type & VID_TYPE_CAPTURE)) ||
+ (GST_IS_V4LMJPEGSRC(v4lelement) &&
+ !(v4lelement->vcap.type & VID_TYPE_MJPEG_ENCODER)) ||
+ (GST_IS_V4LMJPEGSINK(v4lelement) &&
+ !(v4lelement->vcap.type & VID_TYPE_MJPEG_DECODER))) {
+ gst_element_error(GST_ELEMENT(v4lelement),
+ "Device opened, but wrong type (0x%x)",
+ v4lelement->vcap.type);
+ close(v4lelement->video_fd);
+ v4lelement->video_fd = -1;
+ return FALSE;
+ }
+
gst_info("Opened device \'%s\' (\'%s\') successfully\n",
v4lelement->vcap.name, v4lelement->videodev);