2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-23 16:42:33 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
2003-01-06 15:07:21 +00:00
|
|
|
* <2000> Daniel Fischer <dan@f3c.com>
|
2004-10-15 09:59:01 +00:00
|
|
|
* <2004> Wim Taymans <wim@fluendo.com>
|
2006-05-31 10:31:23 +00:00
|
|
|
* <2006> Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
2001-12-23 16:42:33 +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
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2001-12-23 16:42:33 +00:00
|
|
|
*/
|
2008-05-28 14:31:05 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-dv1394src
|
|
|
|
*
|
|
|
|
* Read DV (digital video) data from firewire port.
|
2009-01-28 15:46:06 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2008-05-28 14:31:05 +00:00
|
|
|
* <title>Example launch line</title>
|
2009-01-28 15:46:06 +00:00
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 dv1394src ! queue ! dvdemux name=d ! queue ! dvdec ! xvimagesink d. ! queue ! alsasink
|
2009-01-28 15:46:06 +00:00
|
|
|
* ]| This pipeline captures from the firewire port and displays it (might need
|
2008-05-28 14:31:05 +00:00
|
|
|
* format converters for audio/video).
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2003-11-06 23:36:33 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2005-10-07 15:24:24 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/poll.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
2003-01-06 15:07:21 +00:00
|
|
|
#include <string.h>
|
2009-05-08 18:42:10 +00:00
|
|
|
#include <stdlib.h>
|
2005-10-07 15:24:24 +00:00
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
#include <libavc1394/avc1394.h>
|
|
|
|
#include <libavc1394/avc1394_vcr.h>
|
|
|
|
#include <libavc1394/rom1394.h>
|
2005-10-07 15:24:24 +00:00
|
|
|
#include <libraw1394/raw1394.h>
|
2006-05-31 10:31:23 +00:00
|
|
|
#ifdef HAVE_LIBIEC61883
|
|
|
|
#include <libiec61883/iec61883.h>
|
|
|
|
#endif
|
2005-10-07 15:24:24 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2004-10-15 09:59:01 +00:00
|
|
|
|
2001-12-23 16:42:33 +00:00
|
|
|
#include "gstdv1394src.h"
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
#include "gst1394probe.h"
|
2009-09-10 00:51:19 +00:00
|
|
|
#include "gst1394clock.h"
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-10-07 15:24:24 +00:00
|
|
|
|
|
|
|
#define CONTROL_STOP 'S' /* stop the select call */
|
|
|
|
#define CONTROL_SOCKETS(src) src->control_sock
|
|
|
|
#define WRITE_SOCKET(src) src->control_sock[1]
|
|
|
|
#define READ_SOCKET(src) src->control_sock[0]
|
|
|
|
|
|
|
|
#define SEND_COMMAND(src, command) \
|
|
|
|
G_STMT_START { \
|
2011-04-15 13:14:13 +00:00
|
|
|
int G_GNUC_UNUSED _res; unsigned char c; c = command; \
|
2008-09-11 11:26:06 +00:00
|
|
|
_res = write (WRITE_SOCKET(src), &c, 1); \
|
2005-10-07 15:24:24 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
#define READ_COMMAND(src, command, res) \
|
|
|
|
G_STMT_START { \
|
|
|
|
res = read(READ_SOCKET(src), &command, 1); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (dv1394src_debug);
|
|
|
|
#define GST_CAT_DEFAULT (dv1394src_debug)
|
2003-01-06 15:07:21 +00:00
|
|
|
|
|
|
|
#define PAL_FRAMESIZE 144000
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
#define PAL_FRAMERATE 25
|
|
|
|
|
2003-01-06 15:07:21 +00:00
|
|
|
#define NTSC_FRAMESIZE 120000
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
#define NTSC_FRAMERATE 30
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
SIGNAL_FRAME_DROPPED,
|
2001-12-23 16:42:33 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2005-10-07 16:22:59 +00:00
|
|
|
#define DEFAULT_PORT -1
|
|
|
|
#define DEFAULT_CHANNEL 63
|
|
|
|
#define DEFAULT_CONSECUTIVE 1
|
|
|
|
#define DEFAULT_SKIP 0
|
|
|
|
#define DEFAULT_DROP_INCOMPLETE TRUE
|
|
|
|
#define DEFAULT_USE_AVC TRUE
|
|
|
|
#define DEFAULT_GUID 0
|
2004-10-15 09:59:01 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-10-07 13:17:53 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_PORT,
|
|
|
|
PROP_CHANNEL,
|
|
|
|
PROP_CONSECUTIVE,
|
|
|
|
PROP_SKIP,
|
|
|
|
PROP_DROP_INCOMPLETE,
|
|
|
|
PROP_USE_AVC,
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
PROP_GUID,
|
|
|
|
PROP_DEVICE_NAME
|
2001-12-23 16:42:33 +00:00
|
|
|
};
|
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2005-02-01 22:06:17 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-dv, "
|
|
|
|
"format = (string) { NTSC, PAL }, " "systemstream = (boolean) true")
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
static void gst_dv1394src_uri_handler_init (gpointer g_iface,
|
|
|
|
gpointer iface_data);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_dv1394src_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_dv1394src_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2005-11-22 11:49:30 +00:00
|
|
|
static void gst_dv1394src_dispose (GObject * object);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2009-09-10 00:51:19 +00:00
|
|
|
static GstClock *gst_dv1394src_provide_clock (GstElement * element);
|
2010-07-09 15:33:55 +00:00
|
|
|
static GstStateChangeReturn gst_dv1394_src_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2009-09-10 00:51:19 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
static gboolean gst_dv1394src_start (GstBaseSrc * bsrc);
|
|
|
|
static gboolean gst_dv1394src_stop (GstBaseSrc * bsrc);
|
2005-10-07 15:24:24 +00:00
|
|
|
static gboolean gst_dv1394src_unlock (GstBaseSrc * bsrc);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
static GstFlowReturn gst_dv1394src_create (GstPushSrc * psrc, GstBuffer ** buf);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2009-07-03 12:04:13 +00:00
|
|
|
static gboolean gst_dv1394src_query (GstBaseSrc * src, GstQuery * query);
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
static void gst_dv1394src_update_device_name (GstDV1394Src * src);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
2012-04-18 15:09:45 +00:00
|
|
|
#define gst_dv1394src_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstDV1394Src, gst_dv1394src, GST_TYPE_PUSH_SRC,
|
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
|
|
|
|
gst_dv1394src_uri_handler_init));
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
static guint gst_dv1394src_signals[LAST_SIGNAL] = { 0 };
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_class_init (GstDV1394SrcClass * klass)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2009-09-10 00:51:19 +00:00
|
|
|
GstElementClass *gstelement_class;
|
2005-07-07 08:34:11 +00:00
|
|
|
GstBaseSrcClass *gstbasesrc_class;
|
|
|
|
GstPushSrcClass *gstpushsrc_class;
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2009-09-10 00:51:19 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2005-07-07 08:34:11 +00:00
|
|
|
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
|
|
|
gstpushsrc_class = (GstPushSrcClass *) klass;
|
|
|
|
|
|
|
|
gobject_class->set_property = gst_dv1394src_set_property;
|
|
|
|
gobject_class->get_property = gst_dv1394src_get_property;
|
2005-11-22 11:49:30 +00:00
|
|
|
gobject_class->dispose = gst_dv1394src_dispose;
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2009-09-10 00:51:19 +00:00
|
|
|
gstelement_class->provide_clock = gst_dv1394src_provide_clock;
|
2010-07-09 15:33:55 +00:00
|
|
|
gstelement_class->change_state = gst_dv1394_src_change_state;
|
2009-09-10 00:51:19 +00:00
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
gst_dv1394src_signals[SIGNAL_FRAME_DROPPED] =
|
|
|
|
g_signal_new ("frame-dropped", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDV1394SrcClass, frame_dropped),
|
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
|
2004-10-15 09:59:01 +00:00
|
|
|
g_param_spec_int ("port", "Port", "Port number (-1 automatic)",
|
2010-10-13 13:25:15 +00:00
|
|
|
-1, 16, DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-10-07 13:17:53 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CHANNEL,
|
2004-10-15 09:59:01 +00:00
|
|
|
g_param_spec_int ("channel", "Channel", "Channel number for listening",
|
2010-10-13 13:25:15 +00:00
|
|
|
0, 64, DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-10-07 13:17:53 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CONSECUTIVE,
|
2004-03-14 22:34:33 +00:00
|
|
|
g_param_spec_int ("consecutive", "consecutive frames",
|
2004-10-15 09:59:01 +00:00
|
|
|
"send n consecutive frames after skipping", 1, G_MAXINT,
|
2010-10-13 13:25:15 +00:00
|
|
|
DEFAULT_CONSECUTIVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-10-07 13:17:53 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SKIP,
|
2004-10-15 09:59:01 +00:00
|
|
|
g_param_spec_int ("skip", "skip frames", "skip n frames",
|
2010-10-13 13:25:15 +00:00
|
|
|
0, G_MAXINT, DEFAULT_SKIP,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-10-07 13:17:53 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DROP_INCOMPLETE,
|
2010-10-07 20:12:48 +00:00
|
|
|
g_param_spec_boolean ("drop-incomplete", "drop incomplete",
|
2004-10-15 09:59:01 +00:00
|
|
|
"drop incomplete frames", DEFAULT_DROP_INCOMPLETE,
|
2010-10-13 13:25:15 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-10-07 13:17:53 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_USE_AVC,
|
2004-10-15 09:59:01 +00:00
|
|
|
g_param_spec_boolean ("use-avc", "Use AV/C", "Use AV/C VTR control",
|
2010-10-13 13:25:15 +00:00
|
|
|
DEFAULT_USE_AVC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-10-07 13:17:53 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GUID,
|
2004-10-15 09:59:01 +00:00
|
|
|
g_param_spec_uint64 ("guid", "GUID",
|
|
|
|
"select one of multiple DV devices by its GUID. use a hexadecimal "
|
|
|
|
"like 0xhhhhhhhhhhhhhhhh. (0 = no guid)", 0, G_MAXUINT64,
|
2010-10-13 13:25:15 +00:00
|
|
|
DEFAULT_GUID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
/**
|
2013-11-18 14:44:36 +00:00
|
|
|
* GstDV1394Src:device-name:
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
*
|
|
|
|
* Descriptive name of the currently opened device
|
2013-11-18 14:44:36 +00:00
|
|
|
*/
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE_NAME,
|
|
|
|
g_param_spec_string ("device-name", "device name",
|
2010-10-13 13:25:15 +00:00
|
|
|
"user-friendly name of the device", "Default",
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2003-01-06 15:07:21 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
gstbasesrc_class->negotiate = NULL;
|
2005-10-07 13:17:53 +00:00
|
|
|
gstbasesrc_class->start = gst_dv1394src_start;
|
|
|
|
gstbasesrc_class->stop = gst_dv1394src_stop;
|
2005-10-07 15:24:24 +00:00
|
|
|
gstbasesrc_class->unlock = gst_dv1394src_unlock;
|
2009-07-03 12:04:13 +00:00
|
|
|
gstbasesrc_class->query = gst_dv1394src_query;
|
2005-10-07 15:24:24 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
gstpushsrc_class->create = gst_dv1394src_create;
|
2012-04-18 15:09:45 +00:00
|
|
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&src_factory));
|
|
|
|
|
|
|
|
gst_element_class_set_static_metadata (gstelement_class,
|
|
|
|
"Firewire (1394) DV video source", "Source/Video",
|
|
|
|
"Source for DV video data from firewire port",
|
|
|
|
"Erik Walthinsen <omega@temple-baptist.com>, "
|
|
|
|
"Daniel Fischer <dan@f3c.com>, " "Wim Taymans <wim@fluendo.com>, "
|
|
|
|
"Zaheer Abbas Merali <zaheerabbas at merali dot org>");
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (dv1394src_debug, "dv1394src", 0,
|
|
|
|
"DV firewire source");
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-04-18 15:09:45 +00:00
|
|
|
gst_dv1394src_init (GstDV1394Src * dv1394src)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-07-07 08:34:11 +00:00
|
|
|
GstPad *srcpad = GST_BASE_SRC_PAD (dv1394src);
|
|
|
|
|
|
|
|
gst_base_src_set_live (GST_BASE_SRC (dv1394src), TRUE);
|
2009-07-03 12:04:13 +00:00
|
|
|
gst_base_src_set_format (GST_BASE_SRC (dv1394src), GST_FORMAT_TIME);
|
|
|
|
gst_base_src_set_do_timestamp (GST_BASE_SRC (dv1394src), TRUE);
|
2005-07-07 08:34:11 +00:00
|
|
|
gst_pad_use_fixed_caps (srcpad);
|
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
dv1394src->port = DEFAULT_PORT;
|
|
|
|
dv1394src->channel = DEFAULT_CHANNEL;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
dv1394src->consecutive = DEFAULT_CONSECUTIVE;
|
|
|
|
dv1394src->skip = DEFAULT_SKIP;
|
|
|
|
dv1394src->drop_incomplete = DEFAULT_DROP_INCOMPLETE;
|
|
|
|
dv1394src->use_avc = DEFAULT_USE_AVC;
|
|
|
|
dv1394src->guid = DEFAULT_GUID;
|
2005-11-22 11:49:30 +00:00
|
|
|
dv1394src->uri = g_strdup_printf ("dv://%d", dv1394src->port);
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
dv1394src->device_name = g_strdup_printf ("Default");
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-10-07 15:24:24 +00:00
|
|
|
READ_SOCKET (dv1394src) = -1;
|
|
|
|
WRITE_SOCKET (dv1394src) = -1;
|
|
|
|
|
2003-01-06 15:07:21 +00:00
|
|
|
/* initialized when first header received */
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_size = 0;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-01-06 15:07:21 +00:00
|
|
|
dv1394src->buf = NULL;
|
|
|
|
dv1394src->frame = NULL;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_sequence = 0;
|
2009-09-10 00:51:19 +00:00
|
|
|
|
|
|
|
dv1394src->provided_clock = gst_1394_clock_new ("dv1394clock");
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
}
|
|
|
|
|
2005-11-22 11:49:30 +00:00
|
|
|
static void
|
|
|
|
gst_dv1394src_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GstDV1394Src *src = GST_DV1394SRC (object);
|
|
|
|
|
2009-09-10 00:51:19 +00:00
|
|
|
if (src->provided_clock) {
|
|
|
|
g_object_unref (src->provided_clock);
|
|
|
|
}
|
|
|
|
|
2005-11-22 11:49:30 +00:00
|
|
|
g_free (src->uri);
|
|
|
|
src->uri = NULL;
|
|
|
|
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
g_free (src->device_name);
|
|
|
|
src->device_name = NULL;
|
|
|
|
|
2005-11-22 11:49:30 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2001-12-23 16:42:33 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-08-08 16:43:47 +00:00
|
|
|
GstDV1394Src *filter = GST_DV1394SRC (object);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_PORT:
|
2004-10-15 09:59:01 +00:00
|
|
|
filter->port = g_value_get_int (value);
|
2005-11-22 11:49:30 +00:00
|
|
|
g_free (filter->uri);
|
|
|
|
filter->uri = g_strdup_printf ("dv://%d", filter->port);
|
2004-10-15 09:59:01 +00:00
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_CHANNEL:
|
2004-10-15 09:59:01 +00:00
|
|
|
filter->channel = g_value_get_int (value);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_SKIP:
|
2004-03-14 22:34:33 +00:00
|
|
|
filter->skip = g_value_get_int (value);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_CONSECUTIVE:
|
2004-03-14 22:34:33 +00:00
|
|
|
filter->consecutive = g_value_get_int (value);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_DROP_INCOMPLETE:
|
2004-03-14 22:34:33 +00:00
|
|
|
filter->drop_incomplete = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_USE_AVC:
|
2004-10-15 09:59:01 +00:00
|
|
|
filter->use_avc = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_GUID:
|
2004-10-15 09:59:01 +00:00
|
|
|
filter->guid = g_value_get_uint64 (value);
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
gst_dv1394src_update_device_name (filter);
|
2004-10-15 09:59:01 +00:00
|
|
|
break;
|
2001-12-23 16:42:33 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-08-08 16:43:47 +00:00
|
|
|
GstDV1394Src *filter = GST_DV1394SRC (object);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_PORT:
|
2004-10-15 09:59:01 +00:00
|
|
|
g_value_set_int (value, filter->port);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_CHANNEL:
|
2004-10-15 09:59:01 +00:00
|
|
|
g_value_set_int (value, filter->channel);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_SKIP:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_int (value, filter->skip);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_CONSECUTIVE:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_int (value, filter->consecutive);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_DROP_INCOMPLETE:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_boolean (value, filter->drop_incomplete);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_USE_AVC:
|
2004-10-15 09:59:01 +00:00
|
|
|
g_value_set_boolean (value, filter->use_avc);
|
|
|
|
break;
|
2005-10-07 13:17:53 +00:00
|
|
|
case PROP_GUID:
|
2004-10-15 09:59:01 +00:00
|
|
|
g_value_set_uint64 (value, filter->guid);
|
|
|
|
break;
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
case PROP_DEVICE_NAME:
|
|
|
|
g_value_set_string (value, filter->device_name);
|
|
|
|
break;
|
2001-12-23 16:42:33 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-10 00:51:19 +00:00
|
|
|
static GstClock *
|
|
|
|
gst_dv1394src_provide_clock (GstElement * element)
|
|
|
|
{
|
|
|
|
GstDV1394Src *dv1394src = GST_DV1394SRC (element);
|
|
|
|
|
|
|
|
return GST_CLOCK_CAST (gst_object_ref (dv1394src->provided_clock));
|
|
|
|
}
|
|
|
|
|
2010-07-09 15:33:55 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_dv1394_src_change_state (GstElement * element, GstStateChange transition)
|
|
|
|
{
|
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
|
|
|
GstDV1394Src *src = GST_DV1394SRC (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
|
|
gst_element_post_message (element,
|
|
|
|
gst_message_new_clock_lost (GST_OBJECT_CAST (element),
|
|
|
|
GST_CLOCK_CAST (src->provided_clock)));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
gst_element_post_message (element,
|
|
|
|
gst_message_new_clock_provide (GST_OBJECT_CAST (element),
|
|
|
|
GST_CLOCK_CAST (src->provided_clock), TRUE));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-08-28 16:59:13 +00:00
|
|
|
#ifdef HAVE_LIBIEC61883
|
|
|
|
static GstDV1394Src *
|
|
|
|
gst_dv1394src_from_raw1394handle (raw1394handle_t handle)
|
|
|
|
{
|
|
|
|
iec61883_dv_t dv = (iec61883_dv_t) raw1394_get_userdata (handle);
|
|
|
|
iec61883_dv_fb_t dv_fb =
|
|
|
|
(iec61883_dv_fb_t) iec61883_dv_get_callback_data (dv);
|
|
|
|
return GST_DV1394SRC (iec61883_dv_fb_get_callback_data (dv_fb));
|
|
|
|
}
|
|
|
|
#else /* HAVE_LIBIEC61883 */
|
|
|
|
static GstDV1394Src *
|
|
|
|
gst_dv1394src_from_raw1394handle (raw1394handle_t handle)
|
|
|
|
{
|
|
|
|
return GST_DV1394SRC (raw1394_get_userdata (handle));
|
|
|
|
}
|
|
|
|
#endif /* HAVE_LIBIEC61883 */
|
2006-05-31 10:31:23 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBIEC61883
|
|
|
|
static int
|
|
|
|
gst_dv1394src_iec61883_receive (unsigned char *data, int len,
|
|
|
|
int complete, void *cbdata)
|
|
|
|
{
|
|
|
|
GstDV1394Src *dv1394src = GST_DV1394SRC (cbdata);
|
|
|
|
|
2012-04-18 15:09:45 +00:00
|
|
|
if (G_UNLIKELY (!gst_pad_has_current_caps (GST_BASE_SRC_PAD (dv1394src)))) {
|
2006-05-31 10:31:23 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
unsigned char *p = data;
|
|
|
|
|
|
|
|
// figure format (NTSC/PAL)
|
|
|
|
if (p[3] & 0x80) {
|
|
|
|
// PAL
|
|
|
|
dv1394src->frame_size = PAL_FRAMESIZE;
|
|
|
|
dv1394src->frame_rate = PAL_FRAMERATE;
|
|
|
|
GST_DEBUG ("PAL data");
|
|
|
|
caps = gst_caps_new_simple ("video/x-dv",
|
|
|
|
"format", G_TYPE_STRING, "PAL",
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
|
|
|
} else {
|
|
|
|
// NTSC (untested)
|
|
|
|
dv1394src->frame_size = NTSC_FRAMESIZE;
|
|
|
|
dv1394src->frame_rate = NTSC_FRAMERATE;
|
|
|
|
GST_DEBUG
|
|
|
|
("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
|
|
|
|
caps = gst_caps_new_simple ("video/x-dv",
|
|
|
|
"format", G_TYPE_STRING, "NTSC",
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
|
|
|
}
|
|
|
|
gst_pad_set_caps (GST_BASE_SRC_PAD (dv1394src), caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
}
|
2009-06-23 14:54:32 +00:00
|
|
|
|
2006-05-31 10:31:23 +00:00
|
|
|
dv1394src->frame = NULL;
|
2009-06-23 14:54:32 +00:00
|
|
|
if (G_LIKELY ((dv1394src->frame_sequence + 1) % (dv1394src->skip +
|
|
|
|
dv1394src->consecutive) < dv1394src->consecutive)) {
|
2006-05-31 10:31:23 +00:00
|
|
|
if (complete && len == dv1394src->frame_size) {
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
buf = gst_buffer_new_and_alloc (dv1394src->frame_size);
|
|
|
|
|
|
|
|
GST_BUFFER_OFFSET (buf) = dv1394src->frame_sequence;
|
2012-04-18 15:09:45 +00:00
|
|
|
gst_buffer_fill (buf, 0, data, len);
|
2006-05-31 10:31:23 +00:00
|
|
|
dv1394src->buf = buf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dv1394src->frame_sequence++;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2004-03-14 22:34:33 +00:00
|
|
|
static int
|
|
|
|
gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len,
|
|
|
|
quadlet_t * data)
|
|
|
|
{
|
2006-08-28 16:59:13 +00:00
|
|
|
GstDV1394Src *dv1394src = gst_dv1394src_from_raw1394handle (handle);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
if (len > 16) {
|
2004-03-14 22:34:33 +00:00
|
|
|
/*
|
|
|
|
the following code taken from kino-0.51 (Dan Dennedy/Charles Yates)
|
2005-08-16 14:04:39 +00:00
|
|
|
Kindly relicensed under the LGPL. See the commit log for version 1.6 of
|
|
|
|
this file in CVS.
|
2004-03-14 22:34:33 +00:00
|
|
|
*/
|
|
|
|
unsigned char *p = (unsigned char *) &data[3];
|
2006-05-31 10:31:23 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
int section_type = p[0] >> 5; /* section type is in bits 5 - 7 */
|
|
|
|
int dif_sequence = p[1] >> 4; /* dif sequence number is in bits 4 - 7 */
|
2004-03-14 22:34:33 +00:00
|
|
|
int dif_block = p[2];
|
|
|
|
|
|
|
|
/* if we are at the beginning of a frame,
|
|
|
|
we set buf=frame, and alloc a new buffer for frame
|
|
|
|
*/
|
2004-03-15 19:32:27 +00:00
|
|
|
if (section_type == 0 && dif_sequence == 0) { // dif header
|
2005-10-07 15:24:24 +00:00
|
|
|
if (!GST_PAD_CAPS (GST_BASE_SRC_PAD (dv1394src))) {
|
2005-07-07 08:34:11 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
// figure format (NTSC/PAL)
|
|
|
|
if (p[3] & 0x80) {
|
|
|
|
// PAL
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_size = PAL_FRAMESIZE;
|
|
|
|
dv1394src->frame_rate = PAL_FRAMERATE;
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_DEBUG ("PAL data");
|
2005-07-07 08:34:11 +00:00
|
|
|
caps = gst_caps_new_simple ("video/x-dv",
|
|
|
|
"format", G_TYPE_STRING, "PAL",
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
2004-03-15 19:32:27 +00:00
|
|
|
} else {
|
|
|
|
// NTSC (untested)
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_size = NTSC_FRAMESIZE;
|
|
|
|
dv1394src->frame_rate = NTSC_FRAMERATE;
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_DEBUG
|
|
|
|
("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
|
2005-07-07 08:34:11 +00:00
|
|
|
caps = gst_caps_new_simple ("video/x-dv",
|
|
|
|
"format", G_TYPE_STRING, "NTSC",
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
2004-03-15 19:32:27 +00:00
|
|
|
}
|
2005-07-07 08:34:11 +00:00
|
|
|
gst_pad_set_caps (GST_BASE_SRC_PAD (dv1394src), caps);
|
|
|
|
gst_caps_unref (caps);
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
// drop last frame when not complete
|
|
|
|
if (!dv1394src->drop_incomplete
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|| dv1394src->bytes_in_frame == dv1394src->frame_size) {
|
2004-03-15 19:32:27 +00:00
|
|
|
dv1394src->buf = dv1394src->frame;
|
2004-03-14 22:34:33 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped");
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
g_signal_emit (G_OBJECT (dv1394src),
|
|
|
|
gst_dv1394src_signals[SIGNAL_FRAME_DROPPED], 0);
|
|
|
|
if (dv1394src->frame) {
|
|
|
|
gst_buffer_unref (dv1394src->frame);
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
if ((dv1394src->frame_sequence + 1) % (dv1394src->skip +
|
2004-03-15 19:32:27 +00:00
|
|
|
dv1394src->consecutive) < dv1394src->consecutive) {
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
GstBuffer *buf;
|
2005-10-07 13:17:53 +00:00
|
|
|
gint64 i64;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
buf = gst_buffer_new_and_alloc (dv1394src->frame_size);
|
2005-10-07 13:17:53 +00:00
|
|
|
|
|
|
|
/* fill in offset, duration, timestamp */
|
|
|
|
GST_BUFFER_OFFSET (buf) = dv1394src->frame_sequence;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame = buf;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_sequence++;
|
|
|
|
dv1394src->bytes_in_frame = 0;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dv1394src->frame != NULL) {
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
guint8 *data = GST_BUFFER_DATA (dv1394src->frame);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
switch (section_type) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case 0: /* 1 Header block */
|
|
|
|
/* p[3] |= 0x80; // hack to force PAL data */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80, p, 480);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* 2 Subcode blocks */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80 + (1 + dif_block) * 80, p,
|
|
|
|
480);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* 3 VAUX blocks */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80 + (3 + dif_block) * 80, p,
|
|
|
|
480);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /* 9 Audio blocks interleaved with video */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80 + (6 + dif_block * 16) * 80, p,
|
|
|
|
480);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: /* 135 Video blocks interleaved with audio */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80 + (7 + (dif_block / 15) +
|
|
|
|
dif_block) * 80, p, 480);
|
|
|
|
break;
|
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
default: /* we can't handle any other data */
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->bytes_in_frame += 480;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2006-05-31 10:31:23 +00:00
|
|
|
#endif
|
2006-03-16 17:28:07 +00:00
|
|
|
/*
|
|
|
|
* When an ieee1394 bus reset happens, usually a device has been removed
|
|
|
|
* or added. We send a message on the message bus with the node count
|
|
|
|
* and whether the capture device used in this element connected, disconnected
|
|
|
|
* or was unchanged
|
|
|
|
* Message structure:
|
|
|
|
* nodecount - integer with number of nodes on bus
|
|
|
|
* current-device-change - integer (1 if device connected, 0 if no change to
|
|
|
|
* current device status, -1 if device disconnected)
|
|
|
|
*/
|
2004-03-14 22:34:33 +00:00
|
|
|
static int
|
|
|
|
gst_dv1394src_bus_reset (raw1394handle_t handle, unsigned int generation)
|
|
|
|
{
|
2005-10-07 16:22:59 +00:00
|
|
|
GstDV1394Src *src;
|
|
|
|
gint nodecount;
|
|
|
|
GstMessage *message;
|
|
|
|
GstStructure *structure;
|
2006-03-16 17:28:07 +00:00
|
|
|
gint current_device_change;
|
|
|
|
gint i;
|
2005-10-07 16:22:59 +00:00
|
|
|
|
2006-08-28 16:59:13 +00:00
|
|
|
src = gst_dv1394src_from_raw1394handle (handle);
|
2005-10-07 16:22:59 +00:00
|
|
|
|
|
|
|
GST_INFO_OBJECT (src, "have bus reset");
|
|
|
|
|
2006-03-16 17:28:07 +00:00
|
|
|
/* update generation - told to do so by docs */
|
|
|
|
raw1394_update_generation (handle, generation);
|
2005-10-07 16:22:59 +00:00
|
|
|
nodecount = raw1394_get_nodecount (handle);
|
2006-03-16 17:28:07 +00:00
|
|
|
/* allocate memory for portinfo */
|
|
|
|
|
|
|
|
/* current_device_change is -1 if camera disconnected, 0 if other device
|
|
|
|
* connected or 1 if camera has now connected */
|
|
|
|
current_device_change = -1;
|
|
|
|
for (i = 0; i < nodecount; i++) {
|
|
|
|
if (src->guid == rom1394_get_guid (handle, i)) {
|
|
|
|
/* Camera is with us */
|
|
|
|
GST_DEBUG ("Camera is with us");
|
|
|
|
if (!src->connected) {
|
|
|
|
current_device_change = 1;
|
|
|
|
src->connected = TRUE;
|
|
|
|
} else
|
|
|
|
current_device_change = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (src->connected && current_device_change == -1) {
|
|
|
|
GST_DEBUG ("Camera has disconnected");
|
|
|
|
src->connected = FALSE;
|
|
|
|
} else if (!src->connected && current_device_change == -1) {
|
|
|
|
GST_DEBUG ("Camera is still not with us");
|
|
|
|
current_device_change = 0;
|
|
|
|
}
|
2005-10-07 16:22:59 +00:00
|
|
|
|
|
|
|
structure = gst_structure_new ("ieee1394-bus-reset", "nodecount", G_TYPE_INT,
|
2006-03-16 17:28:07 +00:00
|
|
|
nodecount, "current-device-change", G_TYPE_INT, current_device_change,
|
|
|
|
NULL);
|
2005-10-07 16:22:59 +00:00
|
|
|
message = gst_message_new_element (GST_OBJECT (src), structure);
|
|
|
|
gst_element_post_message (GST_ELEMENT (src), message);
|
|
|
|
|
2001-12-23 16:42:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_dv1394src_create (GstPushSrc * psrc, GstBuffer ** buf)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-07-07 08:34:11 +00:00
|
|
|
GstDV1394Src *dv1394src = GST_DV1394SRC (psrc);
|
2005-10-07 15:24:24 +00:00
|
|
|
struct pollfd pollfds[2];
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-10-07 15:24:24 +00:00
|
|
|
pollfds[0].fd = raw1394_get_fd (dv1394src->handle);
|
|
|
|
pollfds[0].events = POLLIN | POLLERR | POLLHUP | POLLPRI;
|
|
|
|
pollfds[1].fd = READ_SOCKET (dv1394src);
|
|
|
|
pollfds[1].events = POLLIN | POLLERR | POLLHUP | POLLPRI;
|
2006-08-28 16:59:13 +00:00
|
|
|
|
2009-07-03 12:04:13 +00:00
|
|
|
if (G_UNLIKELY (dv1394src->buf)) {
|
2005-10-07 15:24:24 +00:00
|
|
|
/* maybe we had an error before, and there's a stale buffer? */
|
|
|
|
gst_buffer_unref (dv1394src->buf);
|
|
|
|
dv1394src->buf = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (TRUE) {
|
2006-08-28 16:59:13 +00:00
|
|
|
int res = poll (pollfds, 2, -1);
|
2005-10-07 15:24:24 +00:00
|
|
|
|
2009-06-23 14:54:32 +00:00
|
|
|
if (G_UNLIKELY (res < 0)) {
|
2005-10-07 15:24:24 +00:00
|
|
|
if (errno == EAGAIN || errno == EINTR)
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
goto error_while_polling;
|
|
|
|
}
|
2009-06-23 14:54:32 +00:00
|
|
|
|
2006-08-28 16:59:13 +00:00
|
|
|
if (G_UNLIKELY (pollfds[1].revents)) {
|
2005-10-07 15:24:24 +00:00
|
|
|
char command;
|
|
|
|
|
|
|
|
if (pollfds[1].revents & POLLIN)
|
|
|
|
READ_COMMAND (dv1394src, command, res);
|
|
|
|
|
|
|
|
goto told_to_stop;
|
2006-08-28 16:59:13 +00:00
|
|
|
} else if (G_LIKELY (pollfds[0].revents & POLLIN)) {
|
2005-10-07 15:24:24 +00:00
|
|
|
/* shouldn't block in theory */
|
|
|
|
raw1394_loop_iterate (dv1394src->handle);
|
2006-05-31 10:31:23 +00:00
|
|
|
|
2005-10-07 15:24:24 +00:00
|
|
|
if (dv1394src->buf)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (dv1394src->buf);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
*buf = dv1394src->buf;
|
2005-10-07 15:24:24 +00:00
|
|
|
dv1394src->buf = NULL;
|
2005-07-07 08:34:11 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-10-07 15:24:24 +00:00
|
|
|
|
|
|
|
error_while_polling:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (dv1394src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
|
2012-01-04 09:01:48 +00:00
|
|
|
return GST_FLOW_EOS;
|
2005-10-07 15:24:24 +00:00
|
|
|
}
|
|
|
|
told_to_stop:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (dv1394src, "told to stop, shutting down");
|
2012-02-08 15:34:00 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
2005-10-07 15:24:24 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
static int
|
|
|
|
gst_dv1394src_discover_avc_node (GstDV1394Src * src)
|
|
|
|
{
|
|
|
|
int node = -1;
|
|
|
|
int i, j = 0;
|
|
|
|
int m = src->num_ports;
|
|
|
|
|
|
|
|
if (src->port >= 0) {
|
|
|
|
/* search on explicit port */
|
|
|
|
j = src->port;
|
|
|
|
m = j + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* loop over all our ports */
|
|
|
|
for (; j < m && node == -1; j++) {
|
|
|
|
raw1394handle_t handle;
|
|
|
|
struct raw1394_portinfo pinf[16];
|
|
|
|
|
|
|
|
/* open the port */
|
|
|
|
handle = raw1394_new_handle ();
|
|
|
|
if (!handle) {
|
2006-05-31 10:31:23 +00:00
|
|
|
GST_WARNING ("raw1394 - failed to get handle: %s.\n", strerror (errno));
|
2004-10-15 09:59:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-08-09 07:43:41 +00:00
|
|
|
if (raw1394_get_port_info (handle, pinf, 16) < 0) {
|
2006-05-31 10:31:23 +00:00
|
|
|
GST_WARNING ("raw1394 - failed to get port info: %s.\n",
|
|
|
|
strerror (errno));
|
2004-10-15 09:59:01 +00:00
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tell raw1394 which host adapter to use */
|
|
|
|
if (raw1394_set_port (handle, j) < 0) {
|
2006-05-31 10:31:23 +00:00
|
|
|
GST_WARNING ("raw1394 - failed to set set port: %s.\n", strerror (errno));
|
2004-10-15 09:59:01 +00:00
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now loop over all the nodes */
|
|
|
|
for (i = 0; i < raw1394_get_nodecount (handle); i++) {
|
2006-06-11 18:52:19 +00:00
|
|
|
/* are we looking for an explicit GUID ? */
|
2004-10-15 09:59:01 +00:00
|
|
|
if (src->guid != 0) {
|
|
|
|
if (src->guid == rom1394_get_guid (handle, i)) {
|
|
|
|
node = i;
|
|
|
|
src->port = j;
|
2005-11-22 11:49:30 +00:00
|
|
|
g_free (src->uri);
|
|
|
|
src->uri = g_strdup_printf ("dv://%d", src->port);
|
2004-10-15 09:59:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
rom1394_directory rom_dir;
|
|
|
|
|
2006-06-11 18:52:19 +00:00
|
|
|
/* select first AV/C Tape Recorder Player node */
|
2004-10-15 09:59:01 +00:00
|
|
|
if (rom1394_get_directory (handle, i, &rom_dir) < 0) {
|
2006-05-31 10:31:23 +00:00
|
|
|
GST_WARNING ("error reading config rom directory for node %d\n", i);
|
2004-10-15 09:59:01 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((rom1394_get_node_type (&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
|
|
|
|
avc1394_check_subunit_type (handle, i, AVC1394_SUBUNIT_TYPE_VCR)) {
|
|
|
|
node = i;
|
|
|
|
src->port = j;
|
2006-03-16 17:28:07 +00:00
|
|
|
src->guid = rom1394_get_guid (handle, i);
|
2005-11-22 11:49:30 +00:00
|
|
|
g_free (src->uri);
|
|
|
|
src->uri = g_strdup_printf ("dv://%d", src->port);
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
g_free (src->device_name);
|
|
|
|
src->device_name = g_strdup (rom_dir.label);
|
2004-10-15 09:59:01 +00:00
|
|
|
break;
|
|
|
|
}
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
rom1394_free_directory (&rom_dir);
|
2004-10-15 09:59:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
next:
|
|
|
|
raw1394_destroy_handle (handle);
|
|
|
|
}
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
static gboolean
|
|
|
|
gst_dv1394src_start (GstBaseSrc * bsrc)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-10-07 13:17:53 +00:00
|
|
|
GstDV1394Src *src = GST_DV1394SRC (bsrc);
|
2005-10-07 15:24:24 +00:00
|
|
|
int control_sock[2];
|
|
|
|
|
2006-03-16 17:28:07 +00:00
|
|
|
src->connected = FALSE;
|
|
|
|
|
2005-10-07 15:24:24 +00:00
|
|
|
if (socketpair (PF_UNIX, SOCK_STREAM, 0, control_sock) < 0)
|
|
|
|
goto socket_pair;
|
|
|
|
|
|
|
|
READ_SOCKET (src) = control_sock[0];
|
|
|
|
WRITE_SOCKET (src) = control_sock[1];
|
|
|
|
|
|
|
|
fcntl (READ_SOCKET (src), F_SETFL, O_NONBLOCK);
|
|
|
|
fcntl (WRITE_SOCKET (src), F_SETFL, O_NONBLOCK);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
src->handle = raw1394_new_handle ();
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2006-04-05 12:41:14 +00:00
|
|
|
if (!src->handle) {
|
|
|
|
if (errno == EACCES)
|
|
|
|
goto permission_denied;
|
|
|
|
else if (errno == ENOENT)
|
|
|
|
goto not_found;
|
|
|
|
else
|
|
|
|
goto no_handle;
|
|
|
|
}
|
2005-07-07 08:34:11 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
src->num_ports = raw1394_get_port_info (src->handle, src->pinfo, 16);
|
2004-10-15 09:59:01 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
if (src->num_ports == 0)
|
|
|
|
goto no_ports;
|
2004-10-15 09:59:01 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
if (src->use_avc || src->port == -1)
|
|
|
|
src->avc_node = gst_dv1394src_discover_avc_node (src);
|
2005-07-07 08:34:11 +00:00
|
|
|
|
2006-05-31 10:31:23 +00:00
|
|
|
/* lets destroy handle and create one on port
|
|
|
|
this is more reliable than setting port on
|
|
|
|
the existing handle */
|
|
|
|
raw1394_destroy_handle (src->handle);
|
|
|
|
src->handle = raw1394_new_handle_on_port (src->port);
|
|
|
|
if (!src->handle)
|
2005-10-07 13:17:53 +00:00
|
|
|
goto cannot_set_port;
|
2004-10-15 09:59:01 +00:00
|
|
|
|
2006-08-28 16:59:13 +00:00
|
|
|
raw1394_set_userdata (src->handle, src);
|
|
|
|
raw1394_set_bus_reset_handler (src->handle, gst_dv1394src_bus_reset);
|
2006-05-31 10:31:23 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBIEC61883
|
|
|
|
if ((src->iec61883dv =
|
|
|
|
iec61883_dv_fb_init (src->handle,
|
|
|
|
gst_dv1394src_iec61883_receive, src)) == NULL)
|
|
|
|
goto cannot_initialise_dv;
|
|
|
|
|
|
|
|
#else
|
2005-10-07 13:17:53 +00:00
|
|
|
raw1394_set_iso_handler (src->handle, src->channel,
|
|
|
|
gst_dv1394src_iso_receive);
|
2006-05-31 10:31:23 +00:00
|
|
|
#endif
|
2005-07-07 08:34:11 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
GST_DEBUG_OBJECT (src, "successfully opened up 1394 connection");
|
2006-03-16 17:28:07 +00:00
|
|
|
src->connected = TRUE;
|
2006-05-31 10:31:23 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBIEC61883
|
|
|
|
if (iec61883_dv_fb_start (src->iec61883dv, src->channel) != 0)
|
|
|
|
goto cannot_start;
|
|
|
|
#else
|
2005-10-07 13:17:53 +00:00
|
|
|
if (raw1394_start_iso_rcv (src->handle, src->channel) < 0)
|
|
|
|
goto cannot_start;
|
2006-05-31 10:31:23 +00:00
|
|
|
#endif
|
2005-10-07 13:17:53 +00:00
|
|
|
|
|
|
|
if (src->use_avc) {
|
2006-08-28 16:59:13 +00:00
|
|
|
raw1394handle_t avc_handle = raw1394_new_handle_on_port (src->port);
|
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
/* start the VCR */
|
2006-08-28 16:59:13 +00:00
|
|
|
if (avc_handle) {
|
|
|
|
if (!avc1394_vcr_is_recording (avc_handle, src->avc_node)
|
|
|
|
&& avc1394_vcr_is_playing (avc_handle, src->avc_node)
|
|
|
|
!= AVC1394_VCR_OPERAND_PLAY_FORWARD)
|
|
|
|
avc1394_vcr_play (avc_handle, src->avc_node);
|
|
|
|
raw1394_destroy_handle (avc_handle);
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (src, "Starting VCR via avc1394 failed: %s",
|
|
|
|
g_strerror (errno));
|
|
|
|
}
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
|
|
|
|
2009-09-10 00:51:19 +00:00
|
|
|
gst_1394_clock_set_handle (src->provided_clock, src->handle);
|
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
return TRUE;
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-10-07 15:24:24 +00:00
|
|
|
socket_pair:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
|
|
|
|
GST_ERROR_SYSTEM);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2006-04-05 12:41:14 +00:00
|
|
|
permission_denied:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
not_found:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL), GST_ERROR_SYSTEM);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-07-07 08:34:11 +00:00
|
|
|
no_handle:
|
|
|
|
{
|
2006-04-05 12:41:14 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
|
|
|
|
("can't get raw1394 handle (%s)", g_strerror (errno)));
|
2005-10-07 13:17:53 +00:00
|
|
|
return FALSE;
|
2005-07-07 08:34:11 +00:00
|
|
|
}
|
|
|
|
no_ports:
|
|
|
|
{
|
2007-03-07 19:48:03 +00:00
|
|
|
raw1394_destroy_handle (src->handle);
|
|
|
|
src->handle = NULL;
|
2005-10-07 13:17:53 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
|
2005-07-07 08:34:11 +00:00
|
|
|
("no ports available for raw1394"));
|
2005-10-07 13:17:53 +00:00
|
|
|
return FALSE;
|
2005-07-07 08:34:11 +00:00
|
|
|
}
|
|
|
|
cannot_set_port:
|
|
|
|
{
|
2005-10-07 13:17:53 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
|
|
|
|
("can't set 1394 port %d", src->port));
|
|
|
|
return FALSE;
|
2005-07-07 08:34:11 +00:00
|
|
|
}
|
|
|
|
cannot_start:
|
|
|
|
{
|
2007-03-07 19:48:03 +00:00
|
|
|
raw1394_destroy_handle (src->handle);
|
|
|
|
src->handle = NULL;
|
|
|
|
#ifdef HAVE_LIBIEC61883
|
|
|
|
iec61883_dv_fb_close (src->iec61883dv);
|
|
|
|
src->iec61883dv = NULL;
|
|
|
|
#endif
|
2005-10-07 13:17:53 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
2005-07-07 08:34:11 +00:00
|
|
|
("can't start 1394 iso receive"));
|
2005-10-07 13:17:53 +00:00
|
|
|
return FALSE;
|
2005-07-07 08:34:11 +00:00
|
|
|
}
|
2006-05-31 10:31:23 +00:00
|
|
|
#ifdef HAVE_LIBIEC61883
|
|
|
|
cannot_initialise_dv:
|
|
|
|
{
|
2007-03-07 19:48:03 +00:00
|
|
|
raw1394_destroy_handle (src->handle);
|
|
|
|
src->handle = NULL;
|
2006-05-31 10:31:23 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
|
|
|
("can't initialise iec61883 dv"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
static gboolean
|
2005-10-07 13:17:53 +00:00
|
|
|
gst_dv1394src_stop (GstBaseSrc * bsrc)
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
{
|
2005-10-07 13:17:53 +00:00
|
|
|
GstDV1394Src *src = GST_DV1394SRC (bsrc);
|
|
|
|
|
2005-10-07 15:24:24 +00:00
|
|
|
close (READ_SOCKET (src));
|
|
|
|
close (WRITE_SOCKET (src));
|
|
|
|
READ_SOCKET (src) = -1;
|
|
|
|
WRITE_SOCKET (src) = -1;
|
2006-05-31 10:31:23 +00:00
|
|
|
#ifdef HAVE_LIBIEC61883
|
|
|
|
iec61883_dv_fb_close (src->iec61883dv);
|
|
|
|
#else
|
2005-10-07 13:17:53 +00:00
|
|
|
raw1394_stop_iso_rcv (src->handle, src->channel);
|
2006-05-31 10:31:23 +00:00
|
|
|
#endif
|
2006-08-28 16:59:13 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
if (src->use_avc) {
|
2006-08-28 16:59:13 +00:00
|
|
|
raw1394handle_t avc_handle = raw1394_new_handle_on_port (src->port);
|
|
|
|
|
|
|
|
/* pause and stop the VCR */
|
|
|
|
if (avc_handle) {
|
|
|
|
if (!avc1394_vcr_is_recording (avc_handle, src->avc_node)
|
|
|
|
&& (avc1394_vcr_is_playing (avc_handle, src->avc_node)
|
|
|
|
!= AVC1394_VCR_OPERAND_PLAY_FORWARD_PAUSE))
|
|
|
|
avc1394_vcr_pause (avc_handle, src->avc_node);
|
|
|
|
avc1394_vcr_stop (avc_handle, src->avc_node);
|
|
|
|
raw1394_destroy_handle (avc_handle);
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (src, "Starting VCR via avc1394 failed: %s",
|
|
|
|
g_strerror (errno));
|
|
|
|
}
|
2005-10-07 13:17:53 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
2009-09-10 00:51:19 +00:00
|
|
|
gst_1394_clock_unset_handle (src->provided_clock);
|
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
raw1394_destroy_handle (src->handle);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
2005-10-07 13:17:53 +00:00
|
|
|
return TRUE;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
}
|
|
|
|
|
2005-10-07 15:24:24 +00:00
|
|
|
static gboolean
|
|
|
|
gst_dv1394src_unlock (GstBaseSrc * bsrc)
|
|
|
|
{
|
|
|
|
GstDV1394Src *src = GST_DV1394SRC (bsrc);
|
|
|
|
|
|
|
|
SEND_COMMAND (src, CONTROL_STOP);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static gboolean
|
2009-07-03 12:04:13 +00:00
|
|
|
gst_dv1394src_query (GstBaseSrc * basesrc, GstQuery * query)
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
{
|
2005-07-07 08:34:11 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2009-07-03 12:04:13 +00:00
|
|
|
case GST_QUERY_LATENCY:
|
2005-07-07 08:34:11 +00:00
|
|
|
{
|
2015-02-11 12:53:02 +00:00
|
|
|
gst_query_set_latency (query, TRUE, GST_SECOND / 25, GST_SECOND / 25);
|
2005-07-07 08:34:11 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
break;
|
2005-07-07 08:34:11 +00:00
|
|
|
default:
|
|
|
|
goto not_supported;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
not_supported:
|
2009-07-03 12:04:13 +00:00
|
|
|
return GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
}
|
|
|
|
|
ext/raw1394/: Implement GstPropertyProbe interface and add "device-name" property, so applications can use this to pr...
Original commit message from CVS:
Patch by: Julien Puydt <julien dot puydt at laposte net>
* ext/raw1394/Makefile.am:
* ext/raw1394/gst1394probe.c: (gst_1394_get_guid_array),
(gst_1394_property_probe_get_properties),
(gst_1394_property_probe_probe_property),
(gst_1394_property_probe_needs_probe),
(gst_1394_property_probe_get_values),
(gst_1394_property_probe_interface_init),
(gst_1394_type_add_property_probe_interface):
* ext/raw1394/gst1394probe.h: (GST_1394_PROBE_H):
* ext/raw1394/gstdv1394src.c: (_do_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_set_property), (gst_dv1394src_get_property),
(gst_dv1394src_discover_avc_node), (gst_dv1394src_query),
(gst_dv1394src_update_device_name):
* ext/raw1394/gstdv1394src.h:
Implement GstPropertyProbe interface and add "device-name" property,
so applications can use this to probe for available devices in the
same way they can already with v4lsrc and v4l2src (however horrible
this property probe interface may be). Fixes #358841.
2007-11-14 19:10:37 +00:00
|
|
|
static void
|
|
|
|
gst_dv1394src_update_device_name (GstDV1394Src * src)
|
|
|
|
{
|
|
|
|
raw1394handle_t handle;
|
|
|
|
gint portcount, port, nodecount, node;
|
|
|
|
rom1394_directory directory;
|
|
|
|
|
|
|
|
g_free (src->device_name);
|
|
|
|
src->device_name = NULL;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (src, "updating device name for current GUID");
|
|
|
|
|
|
|
|
handle = raw1394_new_handle ();
|
|
|
|
|
|
|
|
if (handle == NULL)
|
|
|
|
goto gethandle_failed;
|
|
|
|
|
|
|
|
portcount = raw1394_get_port_info (handle, NULL, 0);
|
|
|
|
for (port = 0; port < portcount; port++) {
|
|
|
|
if (raw1394_set_port (handle, port) >= 0) {
|
|
|
|
nodecount = raw1394_get_nodecount (handle);
|
|
|
|
for (node = 0; node < nodecount; node++) {
|
|
|
|
if (src->guid == rom1394_get_guid (handle, node)) {
|
|
|
|
if (rom1394_get_directory (handle, node, &directory) >= 0) {
|
|
|
|
g_free (src->device_name);
|
|
|
|
src->device_name = g_strdup (directory.label);
|
|
|
|
rom1394_free_directory (&directory);
|
|
|
|
goto done;
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("error reading rom directory for node %d", node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
src->device_name = g_strdup ("Unknown"); /* FIXME: translate? */
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
|
|
|
raw1394_destroy_handle (handle);
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
gethandle_failed:
|
|
|
|
{
|
|
|
|
GST_WARNING ("failed to get raw1394 handle: %s", g_strerror (errno));
|
|
|
|
src->device_name = g_strdup ("Unknown"); /* FIXME: translate? */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
/*** GSTURIHANDLER INTERFACE *************************************************/
|
|
|
|
|
2012-04-18 15:09:45 +00:00
|
|
|
static GstURIType
|
|
|
|
gst_dv1394src_uri_get_type (GType type)
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
{
|
|
|
|
return GST_URI_SRC;
|
|
|
|
}
|
2008-07-08 12:51:34 +00:00
|
|
|
|
2012-04-18 15:09:45 +00:00
|
|
|
static const gchar *const *
|
|
|
|
gst_dv1394src_uri_get_protocols (GType type)
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
{
|
2012-04-18 15:09:45 +00:00
|
|
|
static const gchar *protocols[] = { (char *) "dv", NULL };
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
return protocols;
|
|
|
|
}
|
2008-07-08 12:51:34 +00:00
|
|
|
|
2012-04-18 15:09:45 +00:00
|
|
|
static gchar *
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
gst_dv1394src_uri_get_uri (GstURIHandler * handler)
|
|
|
|
{
|
|
|
|
GstDV1394Src *gst_dv1394src = GST_DV1394SRC (handler);
|
|
|
|
|
|
|
|
return gst_dv1394src->uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-04-18 15:09:45 +00:00
|
|
|
gst_dv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
|
|
|
|
GError ** error)
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
{
|
|
|
|
gchar *protocol, *location;
|
2008-07-08 12:51:34 +00:00
|
|
|
gboolean ret = TRUE;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
GstDV1394Src *gst_dv1394src = GST_DV1394SRC (handler);
|
|
|
|
|
|
|
|
protocol = gst_uri_get_protocol (uri);
|
|
|
|
if (strcmp (protocol, "dv") != 0) {
|
|
|
|
g_free (protocol);
|
2012-04-18 15:09:45 +00:00
|
|
|
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI, "Invalid DV URI");
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
g_free (protocol);
|
|
|
|
|
|
|
|
location = gst_uri_get_location (uri);
|
2007-05-16 16:30:03 +00:00
|
|
|
if (location && *location != '\0')
|
2005-11-22 11:49:30 +00:00
|
|
|
gst_dv1394src->port = strtol (location, NULL, 10);
|
|
|
|
else
|
|
|
|
gst_dv1394src->port = DEFAULT_PORT;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
g_free (location);
|
2005-11-22 11:49:30 +00:00
|
|
|
g_free (gst_dv1394src->uri);
|
|
|
|
gst_dv1394src->uri = g_strdup_printf ("dv://%d", gst_dv1394src->port);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_dv1394src_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
|
|
|
|
|
|
|
iface->get_type = gst_dv1394src_uri_get_type;
|
|
|
|
iface->get_protocols = gst_dv1394src_uri_get_protocols;
|
|
|
|
iface->get_uri = gst_dv1394src_uri_get_uri;
|
|
|
|
iface->set_uri = gst_dv1394src_uri_set_uri;
|
|
|
|
}
|