2006-09-02 14:28:55 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
2006-05-11 17:59:59 +00:00
|
|
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2006-09-02 14:28:55 +00:00
|
|
|
* 2006 Edgard Lima <edgard.lima@indt.org.br>
|
|
|
|
*
|
|
|
|
* gstv4l2object.c: base class for V4L2 elements
|
2006-05-11 17:59:59 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "v4l2_calls.h"
|
|
|
|
#include "gstv4l2tuner.h"
|
2006-11-01 19:48:26 +00:00
|
|
|
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */
|
2006-05-11 17:59:59 +00:00
|
|
|
#include "gstv4l2xoverlay.h"
|
|
|
|
#endif
|
|
|
|
#include "gstv4l2colorbalance.h"
|
|
|
|
|
2006-09-26 13:18:06 +00:00
|
|
|
#define DEFAULT_PROP_DEVICE "/dev/video0"
|
|
|
|
#define DEFAULT_PROP_DEVICE_NAME NULL
|
2008-03-26 15:10:08 +00:00
|
|
|
#define DEFAULT_PROP_DEVICE_FD -1
|
2006-09-26 13:18:06 +00:00
|
|
|
#define DEFAULT_PROP_FLAGS 0
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
#define DEFAULT_PROP_NORM NULL
|
|
|
|
#define DEFAULT_PROP_CHANNEL NULL
|
2006-09-26 13:18:06 +00:00
|
|
|
#define DEFAULT_PROP_FREQUENCY 0
|
|
|
|
|
2006-05-18 19:34:47 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
V4L2_STD_OBJECT_PROPS,
|
|
|
|
};
|
|
|
|
|
|
|
|
const GList *
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_v4l2_probe_get_properties (GstPropertyProbe * probe)
|
|
|
|
{
|
|
|
|
GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
|
|
|
|
static GList *list = NULL;
|
|
|
|
|
|
|
|
/* well, not perfect, but better than no locking at all.
|
|
|
|
* In the worst case we leak a list node, so who cares? */
|
|
|
|
GST_CLASS_LOCK (GST_OBJECT_CLASS (klass));
|
|
|
|
|
|
|
|
if (!list) {
|
|
|
|
list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_CLASS_UNLOCK (GST_OBJECT_CLASS (klass));
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_v4l2_class_probe_devices (GstElementClass * klass, gboolean check,
|
|
|
|
GList ** klass_devices)
|
|
|
|
{
|
|
|
|
static gboolean init = FALSE;
|
|
|
|
static GList *devices = NULL;
|
|
|
|
|
2008-08-23 15:33:49 +00:00
|
|
|
if (!check) {
|
2006-05-18 19:34:47 +00:00
|
|
|
const gchar *dev_base[] = { "/dev/video", "/dev/v4l2/video", NULL };
|
2006-05-11 17:59:59 +00:00
|
|
|
gint base, n, fd;
|
|
|
|
|
|
|
|
while (devices) {
|
|
|
|
GList *item = devices;
|
|
|
|
gchar *device = item->data;
|
|
|
|
|
2008-08-23 15:33:49 +00:00
|
|
|
devices = g_list_remove (devices, device);
|
2006-05-11 17:59:59 +00:00
|
|
|
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:
|
|
|
|
gst_v4l2_class_probe_devices (klass, FALSE, klass_devices);
|
|
|
|
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:
|
|
|
|
ret = !gst_v4l2_class_probe_devices (klass, TRUE, klass_devices);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GST_TYPE_V4L2_DEVICE_FLAGS (gst_v4l2_device_get_type ())
|
|
|
|
GType
|
|
|
|
gst_v4l2_device_get_type (void)
|
|
|
|
{
|
|
|
|
static GType v4l2_device_type = 0;
|
|
|
|
|
|
|
|
if (v4l2_device_type == 0) {
|
|
|
|
static const GFlagsValue values[] = {
|
2006-09-26 13:18:06 +00:00
|
|
|
{V4L2_CAP_VIDEO_CAPTURE, "Device supports video capture", "capture"},
|
|
|
|
{V4L2_CAP_VIDEO_OUTPUT, "Device supports video playback", "output"},
|
|
|
|
{V4L2_CAP_VIDEO_OVERLAY, "Device supports video overlay", "overlay"},
|
|
|
|
|
|
|
|
{V4L2_CAP_VBI_CAPTURE, "Device supports the VBI capture", "vbi-capture"},
|
|
|
|
{V4L2_CAP_VBI_OUTPUT, "Device supports the VBI output", "vbi-output"},
|
|
|
|
|
|
|
|
{V4L2_CAP_TUNER, "Device has a tuner or modulator", "tuner"},
|
|
|
|
{V4L2_CAP_AUDIO, "Device has audio inputs or outputs", "audio"},
|
2006-05-11 17:59:59 +00:00
|
|
|
|
|
|
|
{0, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
v4l2_device_type =
|
|
|
|
g_flags_register_static ("GstV4l2DeviceTypeFlags", values);
|
|
|
|
}
|
|
|
|
|
|
|
|
return v4l2_device_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-05-19 18:31:25 +00:00
|
|
|
gst_v4l2_object_install_properties_helper (GObjectClass * gobject_class)
|
2006-05-11 17:59:59 +00:00
|
|
|
{
|
2006-09-26 13:18:06 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DEVICE,
|
|
|
|
g_param_spec_string ("device", "Device", "Device location",
|
|
|
|
DEFAULT_PROP_DEVICE, G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
|
|
|
|
g_param_spec_string ("device-name", "Device name",
|
|
|
|
"Name of the device", DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE));
|
2008-03-26 15:10:08 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DEVICE_FD,
|
|
|
|
g_param_spec_int ("device-fd", "File descriptor",
|
|
|
|
"File descriptor of the device", -1, G_MAXINT, DEFAULT_PROP_DEVICE_FD,
|
|
|
|
G_PARAM_READABLE));
|
2006-09-26 13:18:06 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_FLAGS,
|
|
|
|
g_param_spec_flags ("flags", "Flags", "Device type flags",
|
|
|
|
GST_TYPE_V4L2_DEVICE_FLAGS, DEFAULT_PROP_FLAGS, G_PARAM_READABLE));
|
2006-05-11 17:59:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GstV4l2Object *
|
2006-05-19 18:31:25 +00:00
|
|
|
gst_v4l2_object_new (GstElement * element,
|
2006-05-11 17:59:59 +00:00
|
|
|
GstV4l2GetInOutFunction get_in_out_func,
|
2007-05-30 14:57:44 +00:00
|
|
|
GstV4l2SetInOutFunction set_in_out_func,
|
|
|
|
GstV4l2UpdateFpsFunction update_fps_func)
|
2006-05-11 17:59:59 +00:00
|
|
|
{
|
|
|
|
GstV4l2Object *v4l2object;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* some default values
|
|
|
|
*/
|
|
|
|
v4l2object = g_new0 (GstV4l2Object, 1);
|
|
|
|
|
|
|
|
v4l2object->element = element;
|
|
|
|
v4l2object->get_in_out_func = get_in_out_func;
|
|
|
|
v4l2object->set_in_out_func = set_in_out_func;
|
2007-05-30 14:57:44 +00:00
|
|
|
v4l2object->update_fps_func = update_fps_func;
|
2006-05-11 17:59:59 +00:00
|
|
|
|
|
|
|
v4l2object->video_fd = -1;
|
2009-03-01 18:55:26 +00:00
|
|
|
v4l2object->poll = gst_poll_new (TRUE);
|
2006-05-11 17:59:59 +00:00
|
|
|
v4l2object->buffer = NULL;
|
2006-09-26 13:18:06 +00:00
|
|
|
v4l2object->videodev = g_strdup (DEFAULT_PROP_DEVICE);
|
2006-05-11 17:59:59 +00:00
|
|
|
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
v4l2object->norms = NULL;
|
|
|
|
v4l2object->channels = NULL;
|
2006-05-11 17:59:59 +00:00
|
|
|
v4l2object->colors = NULL;
|
|
|
|
|
|
|
|
v4l2object->xwindow_id = 0;
|
|
|
|
|
|
|
|
return v4l2object;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.
2007-03-04 13:52:03 +00:00
|
|
|
gst_v4l2_object_destroy (GstV4l2Object * v4l2object)
|
2006-05-11 17:59:59 +00:00
|
|
|
{
|
Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.
2007-03-04 13:52:03 +00:00
|
|
|
g_return_if_fail (v4l2object != NULL);
|
2006-05-11 17:59:59 +00:00
|
|
|
|
Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.
2007-03-04 13:52:03 +00:00
|
|
|
if (v4l2object->videodev)
|
|
|
|
g_free (v4l2object->videodev);
|
|
|
|
|
2009-03-01 18:55:26 +00:00
|
|
|
if (v4l2object->poll)
|
|
|
|
gst_poll_free (v4l2object->poll);
|
|
|
|
|
2008-08-26 12:27:11 +00:00
|
|
|
if (v4l2object->channel)
|
|
|
|
g_free (v4l2object->channel);
|
|
|
|
|
|
|
|
if (v4l2object->norm)
|
|
|
|
g_free (v4l2object->norm);
|
|
|
|
|
Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.
2007-03-04 13:52:03 +00:00
|
|
|
g_free (v4l2object);
|
2006-05-11 17:59:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2006-05-19 18:31:25 +00:00
|
|
|
gst_v4l2_object_set_property_helper (GstV4l2Object * v4l2object,
|
2006-05-11 17:59:59 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_DEVICE:
|
Small cleanups.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_set_property_helper),
(gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_open), (gst_v4l2_set_norm),
(gst_v4l2_get_frequency), (gst_v4l2_set_frequency),
(gst_v4l2_signal_strength), (gst_v4l2_get_attribute),
(gst_v4l2_set_attribute), (gst_v4l2_get_input),
(gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_grab_frame), (gst_v4l2src_get_capture),
(gst_v4l2src_set_capture), (gst_v4l2src_capture_init),
(gst_v4l2src_capture_start), (gst_v4l2src_capture_stop),
(gst_v4l2src_buffer_new):
* tests/icles/v4l2src-test.c: (my_bus_callback), (main):
Small cleanups.
Fix error messages.
Use locks when getting timestamps.
Fix leaks in test.
Add licensing header to tests.
2006-09-27 16:14:18 +00:00
|
|
|
g_free (v4l2object->videodev);
|
sys/v4l2/: Fix pass at code cleanups, move errors cases out of the normal flow for additional code clarity.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices),
(gst_v4l2_probe_needs_probe),
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_destroy), (gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults),
(gst_v4l2_object_start), (gst_v4l2_object_stop):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_dispose),
(gst_v4l2src_set_property), (gst_v4l2src_get_property),
(gst_v4l2src_fixate), (gst_v4l2src_get_caps),
(gst_v4l2src_set_caps), (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_open), (gst_v4l2_close), (gst_v4l2_get_norm),
(gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop), (gst_v4l2src_capture_deinit),
(gst_v4l2src_get_size_limits), (gst_v4l2src_set_fps),
(gst_v4l2src_get_fps), (gst_v4l2src_buffer_finalize),
(gst_v4l2src_buffer_new):
Fix pass at code cleanups, move errors cases out of the normal
flow for additional code clarity.
2006-09-26 11:06:17 +00:00
|
|
|
v4l2object->videodev = g_value_dup_string (value);
|
2006-05-11 17:59:59 +00:00
|
|
|
break;
|
sys/v4l2/: Fix EIO handing when capturing. Add new property to specify the number of buffers to enque (and remove the...
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_set_property),
(gst_v4l2src_get_property), (gst_v4l2src_set_caps):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_grab_frame), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_deinit):
Fix EIO handing when capturing. Add new property to specify the number of
buffers to enque (and remove the borked num-buffers usage).
2007-01-17 14:30:50 +00:00
|
|
|
#if 0
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
case PROP_NORM:
|
2006-05-11 17:59:59 +00:00
|
|
|
if (GST_V4L2_IS_OPEN (v4l2object)) {
|
|
|
|
GstTuner *tuner = GST_TUNER (v4l2object->element);
|
|
|
|
GstTunerNorm *norm = gst_tuner_find_norm_by_name (tuner,
|
sys/v4l2/: Fix pass at code cleanups, move errors cases out of the normal flow for additional code clarity.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices),
(gst_v4l2_probe_needs_probe),
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_destroy), (gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults),
(gst_v4l2_object_start), (gst_v4l2_object_stop):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_dispose),
(gst_v4l2src_set_property), (gst_v4l2src_get_property),
(gst_v4l2src_fixate), (gst_v4l2src_get_caps),
(gst_v4l2src_set_caps), (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_open), (gst_v4l2_close), (gst_v4l2_get_norm),
(gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop), (gst_v4l2src_capture_deinit),
(gst_v4l2src_get_size_limits), (gst_v4l2src_set_fps),
(gst_v4l2src_get_fps), (gst_v4l2src_buffer_finalize),
(gst_v4l2src_buffer_new):
Fix pass at code cleanups, move errors cases out of the normal
flow for additional code clarity.
2006-09-26 11:06:17 +00:00
|
|
|
(gchar *) g_value_get_string (value));
|
2006-05-11 17:59:59 +00:00
|
|
|
|
|
|
|
if (norm) {
|
|
|
|
/* like gst_tuner_set_norm (tuner, norm)
|
|
|
|
without g_object_notify */
|
|
|
|
gst_v4l2_tuner_set_norm (v4l2object, norm);
|
|
|
|
}
|
|
|
|
} else {
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
g_free (v4l2object->norm);
|
|
|
|
v4l2object->norm = g_value_dup_string (value);
|
2006-05-11 17:59:59 +00:00
|
|
|
}
|
|
|
|
break;
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
case PROP_CHANNEL:
|
2006-05-11 17:59:59 +00:00
|
|
|
if (GST_V4L2_IS_OPEN (v4l2object)) {
|
|
|
|
GstTuner *tuner = GST_TUNER (v4l2object->element);
|
|
|
|
GstTunerChannel *channel = gst_tuner_find_channel_by_name (tuner,
|
sys/v4l2/: Fix pass at code cleanups, move errors cases out of the normal flow for additional code clarity.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices),
(gst_v4l2_probe_needs_probe),
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_destroy), (gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults),
(gst_v4l2_object_start), (gst_v4l2_object_stop):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_dispose),
(gst_v4l2src_set_property), (gst_v4l2src_get_property),
(gst_v4l2src_fixate), (gst_v4l2src_get_caps),
(gst_v4l2src_set_caps), (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_open), (gst_v4l2_close), (gst_v4l2_get_norm),
(gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop), (gst_v4l2src_capture_deinit),
(gst_v4l2src_get_size_limits), (gst_v4l2src_set_fps),
(gst_v4l2src_get_fps), (gst_v4l2src_buffer_finalize),
(gst_v4l2src_buffer_new):
Fix pass at code cleanups, move errors cases out of the normal
flow for additional code clarity.
2006-09-26 11:06:17 +00:00
|
|
|
(gchar *) g_value_get_string (value));
|
2006-05-11 17:59:59 +00:00
|
|
|
|
|
|
|
if (channel) {
|
|
|
|
/* like gst_tuner_set_channel (tuner, channel)
|
|
|
|
without g_object_notify */
|
|
|
|
gst_v4l2_tuner_set_channel (v4l2object, channel);
|
|
|
|
}
|
|
|
|
} else {
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
g_free (v4l2object->channel);
|
|
|
|
v4l2object->channel = g_value_dup_string (value);
|
2006-05-11 17:59:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PROP_FREQUENCY:
|
|
|
|
if (GST_V4L2_IS_OPEN (v4l2object)) {
|
|
|
|
GstTuner *tuner = GST_TUNER (v4l2object->element);
|
|
|
|
GstTunerChannel *channel = gst_tuner_get_channel (tuner);
|
|
|
|
|
|
|
|
if (channel &&
|
|
|
|
GST_TUNER_CHANNEL_HAS_FLAG (channel, GST_TUNER_CHANNEL_FREQUENCY)) {
|
|
|
|
/* like
|
|
|
|
gst_tuner_set_frequency (tuner, channel, g_value_get_ulong (value))
|
|
|
|
without g_object_notify */
|
|
|
|
gst_v4l2_tuner_set_frequency (v4l2object, channel,
|
|
|
|
g_value_get_ulong (value));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
v4l2object->frequency = g_value_get_ulong (value);
|
|
|
|
}
|
|
|
|
break;
|
sys/v4l2/: Fix EIO handing when capturing. Add new property to specify the number of buffers to enque (and remove the...
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_set_property),
(gst_v4l2src_get_property), (gst_v4l2src_set_caps):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_grab_frame), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_deinit):
Fix EIO handing when capturing. Add new property to specify the number of
buffers to enque (and remove the borked num-buffers usage).
2007-01-17 14:30:50 +00:00
|
|
|
#endif
|
2006-05-11 17:59:59 +00:00
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gboolean
|
2006-05-19 18:31:25 +00:00
|
|
|
gst_v4l2_object_get_property_helper (GstV4l2Object * v4l2object,
|
2006-05-11 17:59:59 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_DEVICE:
|
|
|
|
g_value_set_string (value, v4l2object->videodev);
|
|
|
|
break;
|
|
|
|
case PROP_DEVICE_NAME:
|
|
|
|
{
|
sys/v4l2/: Fix pass at code cleanups, move errors cases out of the normal flow for additional code clarity.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices),
(gst_v4l2_probe_needs_probe),
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_destroy), (gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults),
(gst_v4l2_object_start), (gst_v4l2_object_stop):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_dispose),
(gst_v4l2src_set_property), (gst_v4l2src_get_property),
(gst_v4l2src_fixate), (gst_v4l2src_get_caps),
(gst_v4l2src_set_caps), (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_open), (gst_v4l2_close), (gst_v4l2_get_norm),
(gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop), (gst_v4l2src_capture_deinit),
(gst_v4l2src_get_size_limits), (gst_v4l2src_set_fps),
(gst_v4l2src_get_fps), (gst_v4l2src_buffer_finalize),
(gst_v4l2src_buffer_new):
Fix pass at code cleanups, move errors cases out of the normal
flow for additional code clarity.
2006-09-26 11:06:17 +00:00
|
|
|
const guchar *new = NULL;
|
2006-05-11 17:59:59 +00:00
|
|
|
|
2006-07-19 14:36:00 +00:00
|
|
|
if (GST_V4L2_IS_OPEN (v4l2object)) {
|
sys/v4l2/: Fix pass at code cleanups, move errors cases out of the normal flow for additional code clarity.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices),
(gst_v4l2_probe_needs_probe),
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_destroy), (gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults),
(gst_v4l2_object_start), (gst_v4l2_object_stop):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_dispose),
(gst_v4l2src_set_property), (gst_v4l2src_get_property),
(gst_v4l2src_fixate), (gst_v4l2src_get_caps),
(gst_v4l2src_set_caps), (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_open), (gst_v4l2_close), (gst_v4l2_get_norm),
(gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop), (gst_v4l2src_capture_deinit),
(gst_v4l2src_get_size_limits), (gst_v4l2src_set_fps),
(gst_v4l2src_get_fps), (gst_v4l2src_buffer_finalize),
(gst_v4l2src_buffer_new):
Fix pass at code cleanups, move errors cases out of the normal
flow for additional code clarity.
2006-09-26 11:06:17 +00:00
|
|
|
new = v4l2object->vcap.card;
|
2006-07-19 14:36:00 +00:00
|
|
|
} else if (gst_v4l2_open (v4l2object)) {
|
sys/v4l2/: Fix pass at code cleanups, move errors cases out of the normal flow for additional code clarity.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices),
(gst_v4l2_probe_needs_probe),
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_destroy), (gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults),
(gst_v4l2_object_start), (gst_v4l2_object_stop):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_dispose),
(gst_v4l2src_set_property), (gst_v4l2src_get_property),
(gst_v4l2src_fixate), (gst_v4l2src_get_caps),
(gst_v4l2src_set_caps), (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_open), (gst_v4l2_close), (gst_v4l2_get_norm),
(gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop), (gst_v4l2src_capture_deinit),
(gst_v4l2src_get_size_limits), (gst_v4l2src_set_fps),
(gst_v4l2src_get_fps), (gst_v4l2src_buffer_finalize),
(gst_v4l2src_buffer_new):
Fix pass at code cleanups, move errors cases out of the normal
flow for additional code clarity.
2006-09-26 11:06:17 +00:00
|
|
|
new = v4l2object->vcap.card;
|
2006-07-19 14:36:00 +00:00
|
|
|
gst_v4l2_close (v4l2object);
|
|
|
|
}
|
sys/v4l2/: Fix pass at code cleanups, move errors cases out of the normal flow for additional code clarity.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices),
(gst_v4l2_probe_needs_probe),
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_destroy), (gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults),
(gst_v4l2_object_start), (gst_v4l2_object_stop):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_init), (gst_v4l2src_dispose),
(gst_v4l2src_set_property), (gst_v4l2src_get_property),
(gst_v4l2src_fixate), (gst_v4l2src_get_caps),
(gst_v4l2src_set_caps), (gst_v4l2src_get_read),
(gst_v4l2src_get_mmap), (gst_v4l2src_create):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_open), (gst_v4l2_close), (gst_v4l2_get_norm),
(gst_v4l2_set_norm), (gst_v4l2_get_frequency),
(gst_v4l2_set_frequency), (gst_v4l2_signal_strength),
(gst_v4l2_get_attribute), (gst_v4l2_set_attribute),
(gst_v4l2_get_input), (gst_v4l2_set_input):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_queue_frame), (gst_v4l2src_grab_frame),
(gst_v4l2src_get_capture), (gst_v4l2src_set_capture),
(gst_v4l2src_capture_init), (gst_v4l2src_capture_start),
(gst_v4l2src_capture_stop), (gst_v4l2src_capture_deinit),
(gst_v4l2src_get_size_limits), (gst_v4l2src_set_fps),
(gst_v4l2src_get_fps), (gst_v4l2src_buffer_finalize),
(gst_v4l2src_buffer_new):
Fix pass at code cleanups, move errors cases out of the normal
flow for additional code clarity.
2006-09-26 11:06:17 +00:00
|
|
|
g_value_set_string (value, (gchar *) new);
|
2006-05-11 17:59:59 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-03-26 15:10:08 +00:00
|
|
|
case PROP_DEVICE_FD:
|
|
|
|
{
|
|
|
|
if (GST_V4L2_IS_OPEN (v4l2object))
|
|
|
|
g_value_set_int (value, v4l2object->video_fd);
|
|
|
|
else
|
|
|
|
g_value_set_int (value, DEFAULT_PROP_DEVICE_FD);
|
|
|
|
break;
|
|
|
|
}
|
2006-05-11 17:59:59 +00:00
|
|
|
case PROP_FLAGS:
|
|
|
|
{
|
|
|
|
guint flags = 0;
|
|
|
|
|
|
|
|
if (GST_V4L2_IS_OPEN (v4l2object)) {
|
|
|
|
flags |= v4l2object->vcap.capabilities &
|
|
|
|
(V4L2_CAP_VIDEO_CAPTURE |
|
|
|
|
V4L2_CAP_VIDEO_OUTPUT |
|
2006-09-27 15:14:07 +00:00
|
|
|
V4L2_CAP_VIDEO_OVERLAY |
|
|
|
|
V4L2_CAP_VBI_CAPTURE |
|
|
|
|
V4L2_CAP_VBI_OUTPUT | V4L2_CAP_TUNER | V4L2_CAP_AUDIO);
|
2006-05-11 17:59:59 +00:00
|
|
|
}
|
|
|
|
g_value_set_flags (value, flags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_v4l2_set_defaults (GstV4l2Object * v4l2object)
|
|
|
|
{
|
|
|
|
GstTunerNorm *norm = NULL;
|
|
|
|
GstTunerChannel *channel = NULL;
|
|
|
|
GstTuner *tuner = GST_TUNER (v4l2object->element);
|
|
|
|
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
if (v4l2object->norm)
|
|
|
|
norm = gst_tuner_find_norm_by_name (tuner, v4l2object->norm);
|
2006-05-11 17:59:59 +00:00
|
|
|
if (norm) {
|
|
|
|
gst_tuner_set_norm (tuner, norm);
|
|
|
|
} else {
|
|
|
|
norm =
|
|
|
|
GST_TUNER_NORM (gst_tuner_get_norm (GST_TUNER (v4l2object->element)));
|
|
|
|
if (norm) {
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
g_free (v4l2object->norm);
|
|
|
|
v4l2object->norm = g_strdup (norm->label);
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_tuner_norm_changed (tuner, norm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
sys/v4l2/: Renamed some properties to match the tuner interface naming.
Original commit message from CVS:
* sys/v4l2/gstv4l2object.c:
(gst_v4l2_object_install_properties_helper), (gst_v4l2_object_new),
(gst_v4l2_object_set_property_helper),
(gst_v4l2_object_get_property_helper), (gst_v4l2_set_defaults):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_create):
* sys/v4l2/gstv4l2tuner.c: (gst_v4l2_tuner_contains_channel),
(gst_v4l2_tuner_list_channels),
(gst_v4l2_tuner_set_channel_and_notify),
(gst_v4l2_tuner_get_channel), (gst_v4l2_tuner_contains_norm),
(gst_v4l2_tuner_list_norms), (gst_v4l2_tuner_set_norm_and_notify),
(gst_v4l2_tuner_get_norm):
* sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities),
(gst_v4l2_fill_lists), (gst_v4l2_empty_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_get_fps):
Renamed some properties to match the tuner interface naming.
2006-09-27 17:04:22 +00:00
|
|
|
if (v4l2object->channel)
|
|
|
|
channel = gst_tuner_find_channel_by_name (tuner, v4l2object->channel);
|
2006-05-11 17:59:59 +00:00
|
|
|
if (channel) {
|
|
|
|
gst_tuner_set_channel (tuner, channel);
|
|
|
|
} else {
|
|
|
|
channel =
|
2008-08-23 15:33:49 +00:00
|
|
|
GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER
|
|
|
|
(v4l2object->element)));
|
2007-02-22 17:53:26 +00:00
|
|
|
if (channel) {
|
|
|
|
g_free (v4l2object->channel);
|
|
|
|
v4l2object->channel = g_strdup (channel->label);
|
|
|
|
gst_tuner_channel_changed (tuner, channel);
|
|
|
|
}
|
2006-05-11 17:59:59 +00:00
|
|
|
}
|
|
|
|
|
2007-02-22 17:53:26 +00:00
|
|
|
if (channel
|
|
|
|
&& GST_TUNER_CHANNEL_HAS_FLAG (channel, GST_TUNER_CHANNEL_FREQUENCY)) {
|
2006-05-11 17:59:59 +00:00
|
|
|
if (v4l2object->frequency != 0) {
|
|
|
|
gst_tuner_set_frequency (tuner, channel, v4l2object->frequency);
|
|
|
|
} else {
|
|
|
|
v4l2object->frequency = gst_tuner_get_frequency (tuner, channel);
|
|
|
|
if (v4l2object->frequency == 0) {
|
|
|
|
/* guess */
|
|
|
|
gst_tuner_set_frequency (tuner, channel, 1000);
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2006-05-19 18:31:25 +00:00
|
|
|
gst_v4l2_object_start (GstV4l2Object * v4l2object)
|
2006-05-11 17:59:59 +00:00
|
|
|
{
|
|
|
|
if (gst_v4l2_open (v4l2object))
|
|
|
|
gst_v4l2_set_defaults (v4l2object);
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
|
2006-11-01 19:48:26 +00:00
|
|
|
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_v4l2_xoverlay_start (v4l2object);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2006-05-19 18:31:25 +00:00
|
|
|
gst_v4l2_object_stop (GstV4l2Object * v4l2object)
|
2006-05-11 17:59:59 +00:00
|
|
|
{
|
2006-11-01 19:48:26 +00:00
|
|
|
#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */
|
2006-05-11 17:59:59 +00:00
|
|
|
gst_v4l2_xoverlay_stop (v4l2object);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!gst_v4l2_close (v4l2object))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|