Commit 957282a6 authored by Ronald S. Bultje's avatar Ronald S. Bultje

v4l plugins: add open/close signals v4l2 plugins: add open/close signals move...

v4l plugins: add open/close signals v4l2 plugins: add open/close signals move source format enumeration from v4l2elem...

Original commit message from CVS:
v4l plugins:
* add open/close signals

v4l2 plugins:
* add open/close signals
* move source format enumeration from v4l2element to v4l2src
* adapt to the final v4l2 API in kernel 2.5 (patches for 2.4 on http://bytesex.org/patches)
* small tweaks
parent f0ceb74e
TODO list (short term):
=======================
* fix clocking issues by using gst clock for v4lsrc and by using it
as a correction for v4lmjpegsrc/v4l2src
as a correction for v4lmjpegsrc/v4l2src (pause brokenness etc.)
* v4lsrc/v4lmjpegsrc/v4l2src: fix interlacing (not handled at all...)
TODO list (long term):
======================
* v4lmpegsrc (*hint* MPEG card needed *hint*)
* v4l2sink
* BSD-videosrc (meteorsrc?)
* BSD-videosrc (bktr)
* color correction (brightness, hue, etc.)
* gamma correction
......@@ -17,6 +17,8 @@ Useful Documentation:
MJPEG/V4L API : ./videodev_mjpeg.h
Linux/V4L API : /usr/include/linux/videodev.h or
http://roadrunner.swansea.uk.linux.org/v4l.shtml
Linux/V4L2 API: http://www.thedirks.org/v4l2/
Linux/V4L2 API: /usr/include/linux/videodev2.h or
http://www.thedirks.org/v4l2/
(kernel patches: http://bytesex.org/patches/)
BSD/Meteor API: /usr/include/machine/ioctl_meteor.h
mjpegtools : http://www.sourceforge.net/projects/mjpeg
......@@ -33,6 +33,8 @@ static GstElementDetails gst_v4lelement_details = {
/* V4lElement signals and args */
enum {
/* FILL ME */
SIGNAL_OPEN,
SIGNAL_CLOSE,
LAST_SIGNAL
};
......@@ -82,7 +84,7 @@ static gboolean plugin_init (GModule *mo
static GstElementClass *parent_class = NULL;
/*static guint gst_v4lelement_signals[LAST_SIGNAL] = { 0 }; */
static guint gst_v4lelement_signals[LAST_SIGNAL] = { 0 };
GType
......@@ -205,6 +207,18 @@ gst_v4lelement_class_init (GstV4lElementClass *klass)
g_param_spec_pointer("videowindow","videowindow","videowindow",
G_PARAM_WRITABLE));
/* signals */
gst_v4lelement_signals[SIGNAL_OPEN] =
g_signal_new("open", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GstV4lElementClass, open),
NULL, NULL, g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
gst_v4lelement_signals[SIGNAL_CLOSE] =
g_signal_new("close", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GstV4lElementClass, close),
NULL, NULL, g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
gobject_class->set_property = gst_v4lelement_set_property;
gobject_class->get_property = gst_v4lelement_get_property;
......@@ -532,6 +546,10 @@ gst_v4lelement_change_state (GstElement *element)
if (!gst_v4l_open(v4lelement))
return GST_STATE_FAILURE;
g_signal_emit(G_OBJECT(v4lelement),
gst_v4lelement_signals[SIGNAL_OPEN], 0,
v4lelement->videodev);
/* now, sync options */
if (v4lelement->norm >= VIDEO_MODE_PAL &&
v4lelement->norm < VIDEO_MODE_AUTO &&
......@@ -581,6 +599,10 @@ gst_v4lelement_change_state (GstElement *element)
case GST_STATE_READY_TO_NULL:
if (!gst_v4l_close(v4lelement))
return GST_STATE_FAILURE;
g_signal_emit(G_OBJECT(v4lelement),
gst_v4lelement_signals[SIGNAL_CLOSE], 0,
v4lelement->videodev);
break;
}
......
......@@ -81,6 +81,12 @@ struct _GstV4lElement {
struct _GstV4lElementClass {
GstElementClass parent_class;
/* signals */
void (*open) (GstElement *element,
const gchar *device);
void (*close) (GstElement *element,
const gchar *device);
};
GType gst_v4lelement_get_type(void);
......
Markdown is supported
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