2002-09-09 07:14:35 +00:00
|
|
|
/* G-Streamer generic V4L2 element
|
|
|
|
* Copyright (C) 2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-11-07 12:45:20 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2002-09-09 07:14:35 +00:00
|
|
|
#include "v4l2_calls.h"
|
2003-10-10 12:47:42 +00:00
|
|
|
#include "gstv4l2tuner.h"
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2003-10-10 12:47:42 +00:00
|
|
|
#include "gstv4l2xoverlay.h"
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#endif
|
2003-10-10 12:47:42 +00:00
|
|
|
#include "gstv4l2colorbalance.h"
|
2002-09-09 07:14:35 +00:00
|
|
|
|
2003-11-07 12:45:20 +00:00
|
|
|
#include <gst/propertyprobe/propertyprobe.h>
|
|
|
|
|
2002-09-20 09:28:46 +00:00
|
|
|
/* elementfactory details */
|
2002-09-09 07:14:35 +00:00
|
|
|
static GstElementDetails gst_v4l2element_details = {
|
2004-03-14 22:34:33 +00:00
|
|
|
"Generic video4linux2 Element",
|
|
|
|
"Generic/Video",
|
|
|
|
"Generic plugin for handling common video4linux2 calls",
|
|
|
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
|
2002-09-09 07:14:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* V4l2Element signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-01-12 02:19:57 +00:00
|
|
|
/* FILL ME */
|
|
|
|
SIGNAL_OPEN,
|
|
|
|
SIGNAL_CLOSE,
|
|
|
|
LAST_SIGNAL
|
2002-09-09 07:14:35 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-01-12 02:19:57 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_DEVICE,
|
|
|
|
ARG_DEVICE_NAME,
|
|
|
|
ARG_NORM,
|
|
|
|
ARG_CHANNEL,
|
|
|
|
ARG_FREQUENCY,
|
|
|
|
ARG_FLAGS
|
2002-09-09 07:14:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_v4l2element_class_init (GstV4l2ElementClass * klass);
|
|
|
|
static void gst_v4l2element_base_init (GstV4l2ElementClass * klass);
|
|
|
|
static void gst_v4l2element_init (GstV4l2Element * v4lelement);
|
|
|
|
static void gst_v4l2element_dispose (GObject * object);
|
|
|
|
static void gst_v4l2element_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_v4l2element_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2003-10-10 12:47:42 +00:00
|
|
|
static GstElementStateReturn
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2element_change_state (GstElement * element);
|
2002-09-09 07:14:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
2002-11-13 12:35:56 +00:00
|
|
|
static guint gst_v4l2element_signals[LAST_SIGNAL] = { 0 };
|
2002-09-09 07:14:35 +00:00
|
|
|
|
|
|
|
|
2003-10-10 12:47:42 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_iface_supported (GstImplementsInterface * iface, GType iface_type)
|
2003-10-10 12:47:42 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstV4l2Element *v4l2element = GST_V4L2ELEMENT (iface);
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2004-11-11 14:25:11 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2004-12-19 16:46:21 +00:00
|
|
|
g_assert (iface_type == GST_TYPE_TUNER ||
|
|
|
|
iface_type == GST_TYPE_X_OVERLAY || iface_type == GST_TYPE_COLOR_BALANCE);
|
|
|
|
#else
|
|
|
|
g_assert (iface_type == GST_TYPE_TUNER ||
|
2004-11-11 14:25:11 +00:00
|
|
|
iface_type == GST_TYPE_COLOR_BALANCE);
|
2004-12-19 16:46:21 +00:00
|
|
|
#endif
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (v4l2element->video_fd == -1)
|
|
|
|
return FALSE;
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2004-11-11 14:25:11 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2004-03-14 22:34:33 +00:00
|
|
|
if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L2_IS_OVERLAY (v4l2element))
|
|
|
|
return FALSE;
|
2004-11-11 14:25:11 +00:00
|
|
|
#endif
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
return TRUE;
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_interface_init (GstImplementsInterfaceClass * klass)
|
2003-10-10 12:47:42 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
/* default virtual functions */
|
|
|
|
klass->supported = gst_v4l2_iface_supported;
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-07 12:45:20 +00:00
|
|
|
static const GList *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_probe_get_properties (GstPropertyProbe * probe)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
|
|
|
|
static GList *list = NULL;
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (!list) {
|
|
|
|
list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
|
|
|
|
}
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
return list;
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_class_probe_devices (GstV4l2ElementClass * klass, gboolean check)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
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 (devices) {
|
|
|
|
GList *item = devices;
|
|
|
|
gchar *device = item->data;
|
|
|
|
|
|
|
|
devices = g_list_remove (devices, item);
|
|
|
|
g_free (device);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* detect /dev entries */
|
|
|
|
for (n = 0; n < 64; n++) {
|
|
|
|
for (base = 0; dev_base[base] != NULL; base++) {
|
2004-03-15 19:32:27 +00:00
|
|
|
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 ((fd = open (device, O_RDONLY)) > 0 || errno == EBUSY) {
|
|
|
|
if (fd > 0)
|
|
|
|
close (fd);
|
|
|
|
|
|
|
|
devices = g_list_append (devices, device);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free (device);
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
init = TRUE;
|
|
|
|
}
|
2003-11-09 20:54:24 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
klass->devices = devices;
|
|
|
|
|
|
|
|
return init;
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_probe_probe_property (GstPropertyProbe * probe,
|
|
|
|
guint prop_id, const GParamSpec * pspec)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstV4l2ElementClass *klass = GST_V4L2ELEMENT_GET_CLASS (probe);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DEVICE:
|
|
|
|
gst_v4l2_class_probe_devices (klass, FALSE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_probe_needs_probe (GstPropertyProbe * probe,
|
|
|
|
guint prop_id, const GParamSpec * pspec)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstV4l2ElementClass *klass = GST_V4L2ELEMENT_GET_CLASS (probe);
|
|
|
|
gboolean ret = FALSE;
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DEVICE:
|
|
|
|
ret = !gst_v4l2_class_probe_devices (klass, TRUE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GValueArray *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_class_list_devices (GstV4l2ElementClass * klass)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GValueArray *array;
|
|
|
|
GValue value = { 0 };
|
|
|
|
GList *item;
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (!klass->devices)
|
|
|
|
return NULL;
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
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;
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_string (&value, device);
|
|
|
|
g_value_array_append (array, &value);
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
item = item->next;
|
|
|
|
}
|
|
|
|
g_value_unset (&value);
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
return array;
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GValueArray *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_probe_get_values (GstPropertyProbe * probe,
|
|
|
|
guint prop_id, const GParamSpec * pspec)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstV4l2ElementClass *klass = GST_V4L2ELEMENT_GET_CLASS (probe);
|
|
|
|
GValueArray *array = NULL;
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DEVICE:
|
|
|
|
array = gst_v4l2_class_list_devices (klass);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
return array;
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_property_probe_interface_init (GstPropertyProbeInterface * iface)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
iface->get_properties = gst_v4l2_probe_get_properties;
|
|
|
|
iface->probe_property = gst_v4l2_probe_probe_property;
|
|
|
|
iface->needs_probe = gst_v4l2_probe_needs_probe;
|
|
|
|
iface->get_values = gst_v4l2_probe_get_values;
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-09 07:14:35 +00:00
|
|
|
GType
|
|
|
|
gst_v4l2element_get_type (void)
|
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
static GType v4l2element_type = 0;
|
|
|
|
|
|
|
|
if (!v4l2element_type) {
|
|
|
|
static const GTypeInfo v4l2element_info = {
|
|
|
|
sizeof (GstV4l2ElementClass),
|
|
|
|
(GBaseInitFunc) gst_v4l2element_base_init,
|
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) gst_v4l2element_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (GstV4l2Element),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_v4l2element_init,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo v4l2iface_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l2_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo v4l2_tuner_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l2_tuner_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2004-03-14 22:34:33 +00:00
|
|
|
static const GInterfaceInfo v4l2_xoverlay_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l2_xoverlay_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#endif
|
2004-03-14 22:34:33 +00:00
|
|
|
static const GInterfaceInfo v4l2_colorbalance_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l2_color_balance_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo v4l2_propertyprobe_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l2_property_probe_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
v4l2element_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT,
|
|
|
|
"GstV4l2Element", &v4l2element_info, 0);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
g_type_add_interface_static (v4l2element_type,
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info);
|
2004-03-14 22:34:33 +00:00
|
|
|
g_type_add_interface_static (v4l2element_type,
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_TUNER, &v4l2_tuner_info);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2004-03-14 22:34:33 +00:00
|
|
|
g_type_add_interface_static (v4l2element_type,
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#endif
|
2004-03-14 22:34:33 +00:00
|
|
|
g_type_add_interface_static (v4l2element_type,
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_COLOR_BALANCE, &v4l2_colorbalance_info);
|
2004-03-14 22:34:33 +00:00
|
|
|
g_type_add_interface_static (v4l2element_type,
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_PROPERTY_PROBE, &v4l2_propertyprobe_info);
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
return v4l2element_type;
|
2002-09-09 07:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-10 12:47:42 +00:00
|
|
|
#define GST_TYPE_V4L2_DEVICE_FLAGS (gst_v4l2_device_get_type ())
|
|
|
|
GType
|
|
|
|
gst_v4l2_device_get_type (void)
|
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
static GType v4l2_device_type = 0;
|
|
|
|
|
|
|
|
if (v4l2_device_type == 0) {
|
|
|
|
static const GFlagsValue values[] = {
|
|
|
|
{V4L2_CAP_VIDEO_CAPTURE, "CAPTURE",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Device can capture"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{V4L2_CAP_VIDEO_OUTPUT, "PLAYBACK",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Device can playback"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{V4L2_CAP_VIDEO_OVERLAY, "OVERLAY",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Device can do overlay"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{V4L2_CAP_TUNER, "TUNER",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Device has a tuner"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{V4L2_CAP_AUDIO, "AUDIO",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Device handles audio"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
v4l2_device_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_flags_register_static ("GstV4l2DeviceTypeFlags", values);
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
return v4l2_device_type;
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2003-11-02 17:02:51 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2element_base_init (GstV4l2ElementClass * klass)
|
2003-11-02 17:02:51 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
klass->devices = NULL;
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_element_class_set_details (gstelement_class, &gst_v4l2element_details);
|
2003-11-02 17:02:51 +00:00
|
|
|
}
|
2002-09-09 07:14:35 +00:00
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2element_class_init (GstV4l2ElementClass * klass)
|
2002-09-09 07:14:35 +00:00
|
|
|
{
|
2004-01-12 02:19:57 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_DEVICE,
|
|
|
|
g_param_spec_string ("device", "Device", "Device location",
|
2004-03-15 19:32:27 +00:00
|
|
|
NULL, G_PARAM_READWRITE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_DEVICE_NAME,
|
|
|
|
g_param_spec_string ("device_name", "Device name",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Name of the device", NULL, G_PARAM_READABLE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_FLAGS,
|
|
|
|
g_param_spec_flags ("flags", "Flags", "Device type flags",
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_V4L2_DEVICE_FLAGS, 0, G_PARAM_READABLE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_NORM,
|
|
|
|
g_param_spec_string ("norm", "norm",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Norm to use", NULL, G_PARAM_READWRITE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_CHANNEL,
|
|
|
|
g_param_spec_string ("channel", "channel",
|
2004-03-15 19:32:27 +00:00
|
|
|
"input/output to switch to", NULL, G_PARAM_READWRITE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_FREQUENCY,
|
2004-01-12 02:19:57 +00:00
|
|
|
g_param_spec_ulong ("frequency", "frequency",
|
2004-05-31 14:16:54 +00:00
|
|
|
"frequency to tune to (in Hz)", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
|
2004-01-12 02:19:57 +00:00
|
|
|
|
|
|
|
/* signals */
|
|
|
|
gst_v4l2element_signals[SIGNAL_OPEN] =
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_new ("open", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstV4l2ElementClass, open),
|
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__STRING,
|
|
|
|
G_TYPE_NONE, 1, G_TYPE_STRING);
|
2004-01-12 02:19:57 +00:00
|
|
|
gst_v4l2element_signals[SIGNAL_CLOSE] =
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_new ("close", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstV4l2ElementClass, close),
|
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__STRING,
|
|
|
|
G_TYPE_NONE, 1, G_TYPE_STRING);
|
2004-01-12 02:19:57 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_v4l2element_set_property;
|
|
|
|
gobject_class->get_property = gst_v4l2element_get_property;
|
|
|
|
gobject_class->dispose = gst_v4l2element_dispose;
|
|
|
|
|
|
|
|
gstelement_class->change_state = gst_v4l2element_change_state;
|
2002-09-09 07:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2element_init (GstV4l2Element * v4l2element)
|
2002-09-09 07:14:35 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
/* some default values */
|
|
|
|
v4l2element->video_fd = -1;
|
|
|
|
v4l2element->buffer = NULL;
|
2004-05-31 14:16:54 +00:00
|
|
|
v4l2element->device = g_strdup ("/dev/video0");
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
v4l2element->channels = NULL;
|
|
|
|
v4l2element->norms = NULL;
|
|
|
|
v4l2element->colors = NULL;
|
2002-09-09 07:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-10 12:47:42 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2element_dispose (GObject * object)
|
2003-10-10 12:47:42 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstV4l2Element *v4l2element = GST_V4L2ELEMENT (object);
|
2003-10-10 12:47:42 +00:00
|
|
|
|
2004-01-12 02:19:57 +00:00
|
|
|
g_free (v4l2element->device);
|
|
|
|
v4l2element->device = NULL;
|
|
|
|
g_free (v4l2element->norm);
|
|
|
|
v4l2element->norm = NULL;
|
|
|
|
g_free (v4l2element->channel);
|
|
|
|
v4l2element->channel = NULL;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-10-10 12:47:42 +00:00
|
|
|
if (((GObjectClass *) parent_class)->dispose)
|
2004-03-14 22:34:33 +00:00
|
|
|
((GObjectClass *) parent_class)->dispose (object);
|
2003-10-10 12:47:42 +00:00
|
|
|
}
|
|
|
|
|
2002-09-09 07:14:35 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2element_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
2002-09-09 07:14:35 +00:00
|
|
|
{
|
2004-01-12 02:19:57 +00:00
|
|
|
GstV4l2Element *v4l2element;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-12 02:19:57 +00:00
|
|
|
/* it's not null if we got it, but it might not be ours */
|
|
|
|
g_return_if_fail (GST_IS_V4L2ELEMENT (object));
|
|
|
|
v4l2element = GST_V4L2ELEMENT (object);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-12 02:19:57 +00:00
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DEVICE:
|
2004-03-14 22:34:33 +00:00
|
|
|
if (!GST_V4L2_IS_OPEN (v4l2element)) {
|
2004-03-15 19:32:27 +00:00
|
|
|
if (v4l2element->device)
|
|
|
|
g_free (v4l2element->device);
|
|
|
|
v4l2element->device = g_value_dup_string (value);
|
2004-01-12 02:19:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ARG_NORM:
|
2004-03-14 22:34:33 +00:00
|
|
|
if (GST_V4L2_IS_OPEN (v4l2element)) {
|
2004-10-24 19:37:32 +00:00
|
|
|
GstTuner *tuner = GST_TUNER (v4l2element);
|
|
|
|
GstTunerNorm *norm = gst_tuner_find_norm_by_name (tuner,
|
|
|
|
(gchar *) g_value_get_string (value));
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
if (norm) {
|
|
|
|
gst_tuner_set_norm (tuner, norm);
|
|
|
|
}
|
2004-01-12 02:19:57 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
g_free (v4l2element->norm);
|
|
|
|
v4l2element->norm = g_value_dup_string (value);
|
|
|
|
g_object_notify (object, "norm");
|
2004-01-12 02:19:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ARG_CHANNEL:
|
2004-03-14 22:34:33 +00:00
|
|
|
if (GST_V4L2_IS_OPEN (v4l2element)) {
|
2004-10-24 19:37:32 +00:00
|
|
|
GstTuner *tuner = GST_TUNER (v4l2element);
|
|
|
|
GstTunerChannel *channel = gst_tuner_find_channel_by_name (tuner,
|
|
|
|
(gchar *) g_value_get_string (value));
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
if (channel) {
|
|
|
|
gst_tuner_set_channel (tuner, channel);
|
|
|
|
}
|
2004-01-12 02:19:57 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
g_free (v4l2element->channel);
|
|
|
|
v4l2element->channel = g_value_dup_string (value);
|
|
|
|
g_object_notify (object, "channel");
|
2004-01-12 02:19:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ARG_FREQUENCY:
|
2004-03-14 22:34:33 +00:00
|
|
|
if (GST_V4L2_IS_OPEN (v4l2element)) {
|
2004-10-24 19:37:32 +00:00
|
|
|
GstTuner *tuner = GST_TUNER (v4l2element);
|
|
|
|
GstTunerChannel *channel = gst_tuner_get_channel (tuner);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-10-24 19:37:32 +00:00
|
|
|
if (channel &&
|
|
|
|
GST_TUNER_CHANNEL_HAS_FLAG (channel, GST_TUNER_CHANNEL_FREQUENCY)) {
|
|
|
|
gst_tuner_set_frequency (tuner, channel, g_value_get_ulong (value));
|
|
|
|
}
|
2004-01-12 02:19:57 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
v4l2element->frequency = g_value_get_ulong (value);
|
|
|
|
g_object_notify (object, "frequency");
|
2004-01-12 02:19:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2002-09-09 07:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2element_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
2002-09-09 07:14:35 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstV4l2Element *v4l2element;
|
|
|
|
|
|
|
|
/* it's not null if we got it, but it might not be ours */
|
|
|
|
g_return_if_fail (GST_IS_V4L2ELEMENT (object));
|
|
|
|
v4l2element = GST_V4L2ELEMENT (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DEVICE:
|
|
|
|
g_value_set_string (value, v4l2element->device);
|
|
|
|
break;
|
|
|
|
case ARG_DEVICE_NAME:{
|
|
|
|
gchar *new = NULL;
|
|
|
|
|
|
|
|
if (GST_V4L2_IS_OPEN (v4l2element))
|
2004-03-15 19:32:27 +00:00
|
|
|
new = v4l2element->vcap.card;
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_string (value, new);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ARG_FLAGS:{
|
|
|
|
guint flags = 0;
|
|
|
|
|
|
|
|
if (GST_V4L2_IS_OPEN (v4l2element)) {
|
2004-10-24 19:13:58 +00:00
|
|
|
flags |= v4l2element->vcap.capabilities & 0x30007;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
g_value_set_flags (value, flags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ARG_NORM:
|
|
|
|
g_value_set_string (value, v4l2element->norm);
|
|
|
|
break;
|
|
|
|
case ARG_CHANNEL:
|
|
|
|
g_value_set_string (value, v4l2element->channel);
|
|
|
|
break;
|
|
|
|
case ARG_FREQUENCY:
|
|
|
|
g_value_set_ulong (value, v4l2element->frequency);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2002-09-09 07:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GstElementStateReturn
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2element_change_state (GstElement * element)
|
2002-09-09 07:14:35 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstV4l2Element *v4l2element;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_V4L2ELEMENT (element), GST_STATE_FAILURE);
|
|
|
|
|
|
|
|
v4l2element = GST_V4L2ELEMENT (element);
|
|
|
|
|
|
|
|
/* if going down into NULL state, close the device if it's open
|
|
|
|
* if going to READY, open the device (and set some options)
|
|
|
|
*/
|
|
|
|
switch (GST_STATE_TRANSITION (element)) {
|
|
|
|
case GST_STATE_NULL_TO_READY:
|
|
|
|
if (!gst_v4l2_open (v4l2element))
|
2004-03-15 19:32:27 +00:00
|
|
|
return GST_STATE_FAILURE;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_xoverlay_open (v4l2element);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#endif
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
/* emit a signal! whoopie! */
|
|
|
|
g_signal_emit (G_OBJECT (v4l2element),
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_v4l2element_signals[SIGNAL_OPEN], 0, v4l2element->device);
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_NULL:
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_v4l2_xoverlay_close (v4l2element);
|
sys/: Remove client-side overlay handling, use the X-server v4l plugin for that. Nicer overlay, less code. Also make ...
Original commit message from CVS:
* sys/v4l/Makefile.am:
* sys/v4l/gstv4l.c: (plugin_init):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_get_type),
(gst_v4lelement_init), (gst_v4lelement_dispose),
(gst_v4lelement_change_state):
* sys/v4l/gstv4lelement.h:
* sys/v4l/gstv4lxoverlay.c: (gst_v4l_xoverlay_open),
(gst_v4l_xoverlay_close), (idle_refresh),
(gst_v4l_xoverlay_set_xwindow_id):
* sys/v4l/gstv4lxoverlay.h:
* sys/v4l/v4l-overlay_calls.c:
* sys/v4l/v4l_calls.h:
* sys/v4l2/Makefile.am:
* sys/v4l2/gstv4l2.c: (plugin_init):
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_get_type),
(gst_v4l2element_init), (gst_v4l2element_dispose),
(gst_v4l2element_change_state):
* sys/v4l2/gstv4l2element.h:
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open),
(gst_v4l2_xoverlay_close), (idle_refresh),
(gst_v4l2_xoverlay_set_xwindow_id):
* sys/v4l2/gstv4l2xoverlay.h:
* sys/v4l2/v4l2-overlay_calls.c:
* sys/v4l2/v4l2_calls.h:
Remove client-side overlay handling, use the X-server v4l plugin
for that. Nicer overlay, less code. Also make the plugin
compileable without X (but then without overlay, obviously).
Makes xwindowlistener obsolete, should we remove that?
2004-10-25 08:51:15 +00:00
|
|
|
#endif
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
if (!gst_v4l2_close (v4l2element))
|
2004-03-15 19:32:27 +00:00
|
|
|
return GST_STATE_FAILURE;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
/* emit yet another signal! wheehee! */
|
|
|
|
g_signal_emit (G_OBJECT (v4l2element),
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_v4l2element_signals[SIGNAL_CLOSE], 0, v4l2element->device);
|
2004-03-14 22:34:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-09-09 07:14:35 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
|
|
|
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
2002-09-09 07:14:35 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
return GST_STATE_SUCCESS;
|
2002-09-09 07:14:35 +00:00
|
|
|
}
|