2004-06-15 09:11:06 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* gstv4lelement.c: base class for V4L elements
|
|
|
|
*
|
2002-01-31 22:22:42 +00:00
|
|
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2001-12-23 15:31:15 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-03-09 15:07:53 +00:00
|
|
|
#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>
|
2003-03-02 21:58:52 +00:00
|
|
|
#include <string.h>
|
2005-07-07 11:29:29 +00:00
|
|
|
|
|
|
|
#include <gst/interfaces/propertyprobe.h>
|
|
|
|
|
2009-07-03 09:38:01 +00:00
|
|
|
#ifdef HAVE_GUDEV
|
|
|
|
#include <gudev/gudev.h>
|
|
|
|
#endif
|
|
|
|
|
2001-12-23 15:31:15 +00:00
|
|
|
#include "v4l_calls.h"
|
2003-10-10 12:47:41 +00:00
|
|
|
#include "gstv4ltuner.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:14 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2003-10-10 12:47:41 +00:00
|
|
|
#include "gstv4lxoverlay.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:14 +00:00
|
|
|
#endif
|
2003-10-10 12:47:41 +00:00
|
|
|
#include "gstv4lcolorbalance.h"
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-07-07 11:29:29 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_DEVICE,
|
|
|
|
PROP_DEVICE_NAME,
|
|
|
|
PROP_FLAGS
|
2001-12-23 15:31:15 +00:00
|
|
|
};
|
|
|
|
|
2009-07-03 09:38:01 +00:00
|
|
|
GST_DEBUG_CATEGORY (v4lelement_debug);
|
|
|
|
#define GST_CAT_DEFAULT v4lelement_debug
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2005-07-07 11:29:29 +00:00
|
|
|
static void gst_v4lelement_init_interfaces (GType type);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2005-07-07 11:29:29 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstV4lElement, gst_v4lelement, GstPushSrc,
|
2008-02-29 21:48:00 +00:00
|
|
|
GST_TYPE_PUSH_SRC, gst_v4lelement_init_interfaces);
|
2005-07-07 11:29:29 +00:00
|
|
|
|
2008-02-29 21:48:00 +00:00
|
|
|
static void gst_v4lelement_dispose (GObject * object);
|
|
|
|
static void gst_v4lelement_set_property (GObject * object,
|
2004-03-14 22:34:34 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
2008-02-29 21:48:00 +00:00
|
|
|
static void gst_v4lelement_get_property (GObject * object,
|
2004-03-14 22:34:34 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2009-06-26 18:11:45 +00:00
|
|
|
/* element methods */
|
|
|
|
static GstStateChangeReturn gst_v4lelement_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2008-02-29 21:48:00 +00:00
|
|
|
static gboolean
|
|
|
|
gst_v4l_iface_supported (GstImplementsInterface * iface, GType iface_type)
|
2003-10-10 12:47:41 +00:00
|
|
|
{
|
2005-01-14 18:12:24 +00:00
|
|
|
GstV4lElement *v4lelement = GST_V4LELEMENT (iface);
|
|
|
|
|
2004-11-11 14:20:17 +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:20:17 +00:00
|
|
|
iface_type == GST_TYPE_COLOR_BALANCE);
|
2004-12-19 16:46:21 +00:00
|
|
|
#endif
|
2003-10-10 12:47:41 +00:00
|
|
|
|
2005-01-14 18:12:24 +00:00
|
|
|
if (v4lelement->video_fd == -1)
|
|
|
|
return FALSE;
|
|
|
|
|
2005-01-25 09:06:19 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2005-01-14 18:12:24 +00:00
|
|
|
if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L_IS_OVERLAY (v4lelement))
|
|
|
|
return FALSE;
|
2005-01-25 09:06:19 +00:00
|
|
|
#endif
|
2005-01-14 18:12:24 +00:00
|
|
|
|
2003-10-10 12:47:41 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4l_interface_init (GstImplementsInterfaceClass * klass)
|
2003-10-10 12:47:41 +00:00
|
|
|
{
|
|
|
|
/* default virtual functions */
|
|
|
|
klass->supported = gst_v4l_iface_supported;
|
|
|
|
}
|
|
|
|
|
2003-11-07 12:45:20 +00:00
|
|
|
static const GList *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4l_probe_get_properties (GstPropertyProbe * probe)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
|
|
|
GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
|
|
|
|
static GList *list = NULL;
|
|
|
|
|
|
|
|
if (!list) {
|
|
|
|
list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2009-07-03 09:38:01 +00:00
|
|
|
static gboolean init = FALSE;
|
|
|
|
static GList *devices = NULL;
|
|
|
|
|
|
|
|
#ifdef HAVE_GUDEV
|
2003-11-07 12:45:20 +00:00
|
|
|
static gboolean
|
2009-07-03 09:38:01 +00:00
|
|
|
gst_v4l_class_probe_devices_with_udev (GstV4lElementClass * klass,
|
|
|
|
gboolean check)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
2009-07-03 09:38:01 +00:00
|
|
|
GUdevClient *client;
|
|
|
|
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 v4l1 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 == 1 || 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 */
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2009-07-03 09:38:01 +00:00
|
|
|
static gboolean
|
|
|
|
gst_v4l_class_probe_devices (GstV4lElementClass * klass, gboolean check)
|
|
|
|
{
|
2008-08-23 15:25:44 +00:00
|
|
|
if (!check) {
|
2003-11-07 12:45:20 +00:00
|
|
|
gchar *dev_base[] = { "/dev/video", "/dev/v4l/video", NULL };
|
|
|
|
gint base, n, fd;
|
|
|
|
|
2003-11-09 20:54:24 +00:00
|
|
|
while (devices) {
|
2009-07-03 09:38:01 +00:00
|
|
|
gchar *device = devices->data;
|
2008-08-23 15:25:44 +00:00
|
|
|
devices = g_list_remove (devices, device);
|
2003-11-07 12:45:20 +00:00
|
|
|
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:28 +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);
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
init = TRUE;
|
|
|
|
}
|
|
|
|
|
2003-11-09 20:54:24 +00:00
|
|
|
klass->devices = devices;
|
|
|
|
|
2003-11-07 12:45:20 +00:00
|
|
|
return init;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4l_probe_probe_property (GstPropertyProbe * probe,
|
|
|
|
guint prop_id, const GParamSpec * pspec)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
|
|
|
GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-07-07 11:29:29 +00:00
|
|
|
case PROP_DEVICE:
|
2009-07-03 09:38:01 +00:00
|
|
|
#ifdef HAVE_GUDEV
|
|
|
|
if (!gst_v4l_class_probe_devices_with_udev (klass, FALSE))
|
|
|
|
gst_v4l_class_probe_devices (klass, FALSE);
|
|
|
|
#else /* !HAVE_GUDEV */
|
2003-11-07 12:45:20 +00:00
|
|
|
gst_v4l_class_probe_devices (klass, FALSE);
|
2009-07-03 09:38:01 +00:00
|
|
|
#endif /* HAVE_GUDEV */
|
2003-11-07 12:45:20 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4l_probe_needs_probe (GstPropertyProbe * probe,
|
|
|
|
guint prop_id, const GParamSpec * pspec)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
|
|
|
GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-07-07 11:29:29 +00:00
|
|
|
case PROP_DEVICE:
|
2009-07-03 09:38:01 +00:00
|
|
|
#ifdef HAVE_GUDEV
|
|
|
|
ret = !gst_v4l_class_probe_devices_with_udev (klass, FALSE);
|
|
|
|
#else /* !HAVE_GUDEV */
|
|
|
|
ret = !gst_v4l_class_probe_devices (klass, TRUE);
|
|
|
|
#endif /* HAVE_GUDEV */
|
2003-11-07 12:45:20 +00:00
|
|
|
ret = !gst_v4l_class_probe_devices (klass, TRUE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GValueArray *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4l_class_list_devices (GstV4lElementClass * klass)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GValueArray *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4l_probe_get_values (GstPropertyProbe * probe,
|
|
|
|
guint prop_id, const GParamSpec * pspec)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
|
|
|
GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
|
|
|
|
GValueArray *array = NULL;
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-07-07 11:29:29 +00:00
|
|
|
case PROP_DEVICE:
|
2003-11-07 12:45:20 +00:00
|
|
|
array = gst_v4l_class_list_devices (klass);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4l_property_probe_interface_init (GstPropertyProbeInterface * iface)
|
2003-11-07 12:45:20 +00:00
|
|
|
{
|
|
|
|
iface->get_properties = gst_v4l_probe_get_properties;
|
|
|
|
iface->probe_property = gst_v4l_probe_probe_property;
|
2004-03-14 22:34:34 +00:00
|
|
|
iface->needs_probe = gst_v4l_probe_needs_probe;
|
|
|
|
iface->get_values = gst_v4l_probe_get_values;
|
2003-11-07 12:45:20 +00:00
|
|
|
}
|
|
|
|
|
2003-10-10 12:47:41 +00:00
|
|
|
#define GST_TYPE_V4L_DEVICE_FLAGS (gst_v4l_device_get_type ())
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_get_type):
* ext/alsa/gstalsasink.c: (set_hwparams):
* ext/alsa/gstalsasrc.c: (set_hwparams):
* ext/gio/gstgio.c: (gst_gio_uri_handler_get_uri):
* ext/ogg/gstoggmux.h:
* ext/ogg/gstogmparse.c:
* gst-libs/gst/audio/audio.c:
* gst-libs/gst/fft/kiss_fft_f64.c: (kiss_fft_f64_alloc):
* gst-libs/gst/pbutils/missing-plugins.c:
(gst_missing_uri_sink_message_new),
(gst_missing_element_message_new),
(gst_missing_decoder_message_new),
(gst_missing_encoder_message_new):
* gst-libs/gst/rtp/gstbasertppayload.c:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_packet_bye_get_reason):
* gst/audioconvert/gstaudioconvert.c:
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/imgconvert.c:
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/typefind/gsttypefindfunctions.c:
* gst/videoscale/vs_4tap.c:
* gst/videoscale/vs_4tap.h:
* sys/v4l/gstv4lelement.c:
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get_any_caps):
* sys/v4l/v4l_calls.c:
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_capture_init),
(gst_v4lsrc_try_capture):
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new):
* tests/check/elements/audioconvert.c:
* tests/check/elements/audioresample.c:
(fail_unless_perfect_stream):
* tests/check/elements/audiotestsrc.c: (setup_audiotestsrc):
* tests/check/elements/decodebin.c:
* tests/check/elements/gdpdepay.c: (setup_gdpdepay),
(setup_gdpdepay_streamheader):
* tests/check/elements/gdppay.c: (setup_gdppay), (GST_START_TEST),
(setup_gdppay_streamheader):
* tests/check/elements/gnomevfssink.c: (setup_gnomevfssink):
* tests/check/elements/multifdsink.c: (setup_multifdsink):
* tests/check/elements/textoverlay.c:
* tests/check/elements/videorate.c: (setup_videorate):
* tests/check/elements/videotestsrc.c: (setup_videotestsrc):
* tests/check/elements/volume.c: (setup_volume):
* tests/check/elements/vorbisdec.c: (setup_vorbisdec):
* tests/check/elements/vorbistag.c:
* tests/check/generic/clock-selection.c:
* tests/check/generic/states.c: (setup), (teardown):
* tests/check/libs/cddabasesrc.c:
* tests/check/libs/video.c:
* tests/check/pipelines/gio.c:
* tests/check/pipelines/oggmux.c:
* tests/check/pipelines/simple-launch-lines.c:
(simple_launch_lines_suite):
* tests/check/pipelines/streamheader.c:
* tests/check/pipelines/theoraenc.c:
* tests/check/pipelines/vorbisdec.c:
* tests/check/pipelines/vorbisenc.c:
* tests/examples/seek/scrubby.c:
* tests/examples/seek/seek.c: (query_positions_elems),
(query_positions_pads):
* tests/icles/stress-xoverlay.c: (myclock):
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers and using "foo (void)" instead
of "foo ()" for declarations.
* win32/common/libgstrtp.def:
Add gst_rtp_buffer_set_extension_data to the symbol definition file.
2008-03-03 06:04:31 +00:00
|
|
|
static GType
|
2003-10-10 12:47:41 +00:00
|
|
|
gst_v4l_device_get_type (void)
|
|
|
|
{
|
|
|
|
static GType v4l_device_type = 0;
|
|
|
|
|
|
|
|
if (v4l_device_type == 0) {
|
|
|
|
static const GFlagsValue values[] = {
|
2004-03-14 22:34:34 +00:00
|
|
|
{VID_TYPE_CAPTURE, "CAPTURE", "Device can capture"},
|
|
|
|
{VID_TYPE_TUNER, "TUNER", "Device has a tuner"},
|
|
|
|
{VID_TYPE_OVERLAY, "OVERLAY", "Device can do overlay"},
|
|
|
|
{VID_TYPE_MPEG_DECODER, "MPEG_DECODER", "Device can decode MPEG"},
|
|
|
|
{VID_TYPE_MPEG_ENCODER, "MPEG_ENCODER", "Device can encode MPEG"},
|
|
|
|
{VID_TYPE_MJPEG_DECODER, "MJPEG_DECODER", "Device can decode MJPEG"},
|
|
|
|
{VID_TYPE_MJPEG_ENCODER, "MJPEG_ENCODER", "Device can encode MJPEG"},
|
|
|
|
{0x10000, "AUDIO", "Device handles audio"},
|
|
|
|
{0, NULL, NULL}
|
2003-10-10 12:47:41 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
v4l_device_type = g_flags_register_static ("GstV4lDeviceTypeFlags", values);
|
2003-10-10 12:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return v4l_device_type;
|
|
|
|
}
|
|
|
|
|
2005-07-07 11:29:29 +00:00
|
|
|
static void
|
|
|
|
gst_v4lelement_init_interfaces (GType type)
|
2001-12-23 15:31:15 +00:00
|
|
|
{
|
2005-07-07 11:29:29 +00:00
|
|
|
static const GInterfaceInfo v4liface_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo v4l_tuner_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l_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:14 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2005-07-07 11:29:29 +00:00
|
|
|
static const GInterfaceInfo v4l_xoverlay_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l_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:14 +00:00
|
|
|
#endif
|
2005-07-07 11:29:29 +00:00
|
|
|
static const GInterfaceInfo v4l_colorbalance_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l_color_balance_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo v4l_propertyprobe_info = {
|
|
|
|
(GInterfaceInitFunc) gst_v4l_property_probe_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
g_type_add_interface_static (type,
|
|
|
|
GST_TYPE_IMPLEMENTS_INTERFACE, &v4liface_info);
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_TUNER, &v4l_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:14 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2005-07-07 11:29:29 +00:00
|
|
|
g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &v4l_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:14 +00:00
|
|
|
#endif
|
2005-07-07 11:29:29 +00:00
|
|
|
g_type_add_interface_static (type,
|
|
|
|
GST_TYPE_COLOR_BALANCE, &v4l_colorbalance_info);
|
|
|
|
g_type_add_interface_static (type,
|
|
|
|
GST_TYPE_PROPERTY_PROBE, &v4l_propertyprobe_info);
|
2003-03-02 21:58:52 +00:00
|
|
|
}
|
|
|
|
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void
|
2003-11-02 14:47:52 +00:00
|
|
|
gst_v4lelement_base_init (gpointer g_class)
|
|
|
|
{
|
2003-11-07 12:45:20 +00:00
|
|
|
GstV4lElementClass *klass = GST_V4LELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
klass->devices = NULL;
|
2009-07-03 09:38:01 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (v4lelement_debug, "v4lelement", 0,
|
|
|
|
"V4L Base Class debug");
|
2003-11-02 14:47:52 +00:00
|
|
|
}
|
2003-11-07 12:45:20 +00:00
|
|
|
|
2001-12-23 15:31:15 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4lelement_class_init (GstV4lElementClass * klass)
|
2001-12-23 15:31:15 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2009-06-26 18:11:45 +00:00
|
|
|
GstElementClass *element_class;
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2009-06-26 18:11:45 +00:00
|
|
|
element_class = GST_ELEMENT_CLASS (klass);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2005-07-07 11:29:29 +00:00
|
|
|
gobject_class->set_property = gst_v4lelement_set_property;
|
|
|
|
gobject_class->get_property = gst_v4lelement_get_property;
|
2009-06-26 18:11:45 +00:00
|
|
|
gobject_class->dispose = gst_v4lelement_dispose;
|
|
|
|
|
|
|
|
element_class->change_state = gst_v4lelement_change_state;
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2005-07-07 11:29:29 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_string ("device", "Device", "Device location",
|
2008-03-22 15:00:53 +00:00
|
|
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-07-07 11:29:29 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE_NAME,
|
2008-03-22 15:00:53 +00:00
|
|
|
g_param_spec_string ("device-name", "Device name", "Name of the device",
|
|
|
|
NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2005-07-07 11:29:29 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FLAGS,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_flags ("flags", "Flags", "Device type flags",
|
2008-03-22 15:00:53 +00:00
|
|
|
GST_TYPE_V4L_DEVICE_FLAGS, 0,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2002-02-23 14:05:33 +00:00
|
|
|
|
2001-12-23 15:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2005-08-28 17:52:45 +00:00
|
|
|
gst_v4lelement_init (GstV4lElement * v4lelement, GstV4lElementClass * klass)
|
2001-12-23 15:31:15 +00:00
|
|
|
{
|
|
|
|
/* some default values */
|
|
|
|
v4lelement->video_fd = -1;
|
|
|
|
v4lelement->buffer = NULL;
|
2004-05-31 14:16:54 +00:00
|
|
|
v4lelement->videodev = g_strdup ("/dev/video0");
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2003-10-10 12:47:41 +00:00
|
|
|
v4lelement->norms = NULL;
|
|
|
|
v4lelement->channels = NULL;
|
|
|
|
v4lelement->colors = NULL;
|
2001-12-23 15:31:15 +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:14 +00:00
|
|
|
v4lelement->xwindow_id = 0;
|
2003-10-10 12:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4lelement_dispose (GObject * object)
|
2003-10-10 12:47:41 +00:00
|
|
|
{
|
|
|
|
GstV4lElement *v4lelement = GST_V4LELEMENT (object);
|
|
|
|
|
|
|
|
if (v4lelement->videodev) {
|
|
|
|
g_free (v4lelement->videodev);
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
v4lelement->videodev = NULL;
|
2003-10-10 12:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (((GObjectClass *) parent_class)->dispose)
|
|
|
|
((GObjectClass *) parent_class)->dispose (object);
|
2001-12-23 15:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4lelement_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
2001-12-23 15:31:15 +00:00
|
|
|
{
|
2005-07-07 11:29:29 +00:00
|
|
|
GstV4lElement *v4lelement = GST_V4LELEMENT (object);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
switch (prop_id) {
|
2005-07-07 11:29:29 +00:00
|
|
|
case PROP_DEVICE:
|
2001-12-23 15:31:15 +00:00
|
|
|
if (v4lelement->videodev)
|
2004-03-15 19:32:28 +00:00
|
|
|
g_free (v4lelement->videodev);
|
2004-03-14 22:34:34 +00:00
|
|
|
v4lelement->videodev = g_strdup (g_value_get_string (value));
|
2001-12-23 15:31:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2002-01-15 15:52:09 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-12-23 15:31:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_v4lelement_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
2001-12-23 15:31:15 +00:00
|
|
|
{
|
2005-07-07 11:29:29 +00:00
|
|
|
GstV4lElement *v4lelement = GST_V4LELEMENT (object);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
switch (prop_id) {
|
2005-07-07 11:29:29 +00:00
|
|
|
case PROP_DEVICE:
|
2004-03-14 22:34:34 +00:00
|
|
|
g_value_set_string (value, v4lelement->videodev);
|
2001-12-28 19:54:23 +00:00
|
|
|
break;
|
2005-07-07 11:29:29 +00:00
|
|
|
case PROP_DEVICE_NAME:{
|
2003-10-10 12:47:41 +00:00
|
|
|
gchar *new = NULL;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2006-07-19 14:46:36 +00:00
|
|
|
if (GST_V4L_IS_OPEN (v4lelement)) {
|
|
|
|
new = v4lelement->vcap.name;
|
|
|
|
} else if (gst_v4l_open (v4lelement)) {
|
2004-03-15 19:32:28 +00:00
|
|
|
new = v4lelement->vcap.name;
|
2006-07-19 14:46:36 +00:00
|
|
|
gst_v4l_close (v4lelement);
|
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
g_value_set_string (value, new);
|
2001-12-28 19:54:23 +00:00
|
|
|
break;
|
2003-10-10 12:47:41 +00:00
|
|
|
}
|
2005-07-07 11:29:29 +00:00
|
|
|
case PROP_FLAGS:{
|
2003-10-10 12:47:41 +00:00
|
|
|
guint flags = 0;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
if (GST_V4L_IS_OPEN (v4lelement)) {
|
2004-03-15 19:32:28 +00:00
|
|
|
flags |= v4lelement->vcap.type & 0x3C0B;
|
|
|
|
if (v4lelement->vcap.audios)
|
|
|
|
flags |= 0x10000;
|
2003-10-10 12:47:41 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
g_value_set_flags (value, flags);
|
2001-12-23 15:31:15 +00:00
|
|
|
break;
|
2003-10-10 12:47:41 +00:00
|
|
|
}
|
2001-12-23 15:31:15 +00:00
|
|
|
default:
|
2002-01-15 15:52:09 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-12-23 15:31:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-26 18:11:45 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_v4lelement_change_state (GstElement * element, GstStateChange transition)
|
2001-12-23 15:31:15 +00:00
|
|
|
{
|
2009-06-26 18:11:45 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
|
|
|
GstV4lElement *v4lelement = GST_V4LELEMENT (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
/* open the device */
|
|
|
|
if (!gst_v4l_open (v4lelement))
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
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:14 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2009-06-26 18:11:45 +00:00
|
|
|
gst_v4l_xoverlay_start (v4lelement);
|
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:14 +00:00
|
|
|
#endif
|
2009-06-26 18:11:45 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-03-01 13:12:41 +00:00
|
|
|
|
2009-06-26 18:11:45 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2003-10-10 12:47:41 +00:00
|
|
|
|
2009-06-26 18:11:45 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
/* close the device */
|
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:14 +00:00
|
|
|
#ifdef HAVE_XVIDEO
|
2009-06-26 18:11:45 +00:00
|
|
|
gst_v4l_xoverlay_stop (v4lelement);
|
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:14 +00:00
|
|
|
#endif
|
2009-06-26 18:11:45 +00:00
|
|
|
if (!gst_v4l_close (v4lelement))
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-10-10 12:47:41 +00:00
|
|
|
|
2009-06-26 18:11:45 +00:00
|
|
|
return ret;
|
2001-12-23 15:31:15 +00:00
|
|
|
}
|