mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 00:45:56 +00:00
dv1394: port to 0.11
This commit is contained in:
parent
67e168aef4
commit
38d571fa57
5 changed files with 65 additions and 105 deletions
|
@ -309,7 +309,7 @@ dnl *** plug-ins to include ***
|
|||
dnl Non ported plugins (non-dependant, then dependant)
|
||||
dnl Make sure you have a space before and after all plugins
|
||||
GST_PLUGINS_NONPORTED="deinterlace \
|
||||
cairo cairo_gobject dv1394 gdk_pixbuf \
|
||||
cairo cairo_gobject gdk_pixbuf \
|
||||
oss oss4 \
|
||||
osx_video osx_audio "
|
||||
AC_SUBST(GST_PLUGINS_NONPORTED)
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#include "gst1394probe.h"
|
||||
#include "gst/interfaces/propertyprobe.h"
|
||||
|
||||
#if 0
|
||||
|
||||
static GValueArray *
|
||||
gst_1394_get_guid_array (void)
|
||||
|
@ -138,3 +139,5 @@ gst_1394_type_add_property_probe_interface (GType type)
|
|||
g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE,
|
||||
&probe_iface_info);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#if 0
|
||||
void gst_1394_type_add_property_probe_interface (GType type);
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -142,45 +142,13 @@ static GstFlowReturn gst_dv1394src_create (GstPushSrc * psrc, GstBuffer ** buf);
|
|||
static gboolean gst_dv1394src_query (GstBaseSrc * src, GstQuery * query);
|
||||
static void gst_dv1394src_update_device_name (GstDV1394Src * src);
|
||||
|
||||
static void
|
||||
_do_init (GType type)
|
||||
{
|
||||
static const GInterfaceInfo urihandler_info = {
|
||||
gst_dv1394src_uri_handler_init,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
|
||||
|
||||
gst_1394_type_add_property_probe_interface (type);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (dv1394src_debug, "dv1394src", 0,
|
||||
"DV firewire source");
|
||||
}
|
||||
|
||||
GST_BOILERPLATE_FULL (GstDV1394Src, gst_dv1394src, GstPushSrc,
|
||||
GST_TYPE_PUSH_SRC, _do_init);
|
||||
|
||||
#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));
|
||||
|
||||
static guint gst_dv1394src_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
static void
|
||||
gst_dv1394src_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&src_factory));
|
||||
|
||||
gst_element_class_set_static_metadata (element_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>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dv1394src_class_init (GstDV1394SrcClass * klass)
|
||||
{
|
||||
|
@ -251,10 +219,23 @@ gst_dv1394src_class_init (GstDV1394SrcClass * klass)
|
|||
gstbasesrc_class->query = gst_dv1394src_query;
|
||||
|
||||
gstpushsrc_class->create = gst_dv1394src_create;
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dv1394src_init (GstDV1394Src * dv1394src, GstDV1394SrcClass * klass)
|
||||
gst_dv1394src_init (GstDV1394Src * dv1394src)
|
||||
{
|
||||
GstPad *srcpad = GST_BASE_SRC_PAD (dv1394src);
|
||||
|
||||
|
@ -443,7 +424,7 @@ gst_dv1394src_iec61883_receive (unsigned char *data, int len,
|
|||
{
|
||||
GstDV1394Src *dv1394src = GST_DV1394SRC (cbdata);
|
||||
|
||||
if (G_UNLIKELY (!GST_PAD_CAPS (GST_BASE_SRC_PAD (dv1394src)))) {
|
||||
if (G_UNLIKELY (!gst_pad_has_current_caps (GST_BASE_SRC_PAD (dv1394src)))) {
|
||||
GstCaps *caps;
|
||||
unsigned char *p = data;
|
||||
|
||||
|
@ -474,14 +455,12 @@ gst_dv1394src_iec61883_receive (unsigned char *data, int len,
|
|||
if (G_LIKELY ((dv1394src->frame_sequence + 1) % (dv1394src->skip +
|
||||
dv1394src->consecutive) < dv1394src->consecutive)) {
|
||||
if (complete && len == dv1394src->frame_size) {
|
||||
guint8 *bufdata;
|
||||
GstBuffer *buf;
|
||||
|
||||
buf = gst_buffer_new_and_alloc (dv1394src->frame_size);
|
||||
|
||||
GST_BUFFER_OFFSET (buf) = dv1394src->frame_sequence;
|
||||
bufdata = GST_BUFFER_DATA (buf);
|
||||
memcpy (bufdata, data, len);
|
||||
gst_buffer_fill (buf, 0, data, len);
|
||||
dv1394src->buf = buf;
|
||||
}
|
||||
}
|
||||
|
@ -667,7 +646,6 @@ static GstFlowReturn
|
|||
gst_dv1394src_create (GstPushSrc * psrc, GstBuffer ** buf)
|
||||
{
|
||||
GstDV1394Src *dv1394src = GST_DV1394SRC (psrc);
|
||||
GstCaps *caps;
|
||||
struct pollfd pollfds[2];
|
||||
|
||||
pollfds[0].fd = raw1394_get_fd (dv1394src->handle);
|
||||
|
@ -709,10 +687,6 @@ gst_dv1394src_create (GstPushSrc * psrc, GstBuffer ** buf)
|
|||
|
||||
g_assert (dv1394src->buf);
|
||||
|
||||
caps = gst_pad_get_caps (GST_BASE_SRC_PAD (psrc));
|
||||
gst_buffer_set_caps (dv1394src->buf, caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
*buf = dv1394src->buf;
|
||||
dv1394src->buf = NULL;
|
||||
return GST_FLOW_OK;
|
||||
|
@ -1075,21 +1049,21 @@ gethandle_failed:
|
|||
|
||||
/*** GSTURIHANDLER INTERFACE *************************************************/
|
||||
|
||||
static guint
|
||||
gst_dv1394src_uri_get_type (void)
|
||||
static GstURIType
|
||||
gst_dv1394src_uri_get_type (GType type)
|
||||
{
|
||||
return GST_URI_SRC;
|
||||
}
|
||||
|
||||
static gchar **
|
||||
gst_dv1394src_uri_get_protocols (void)
|
||||
static const gchar *const *
|
||||
gst_dv1394src_uri_get_protocols (GType type)
|
||||
{
|
||||
static gchar *protocols[] = { (char *) "dv", NULL };
|
||||
static const gchar *protocols[] = { (char *) "dv", NULL };
|
||||
|
||||
return protocols;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
static gchar *
|
||||
gst_dv1394src_uri_get_uri (GstURIHandler * handler)
|
||||
{
|
||||
GstDV1394Src *gst_dv1394src = GST_DV1394SRC (handler);
|
||||
|
@ -1098,7 +1072,8 @@ gst_dv1394src_uri_get_uri (GstURIHandler * handler)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_dv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
||||
gst_dv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
|
||||
GError ** error)
|
||||
{
|
||||
gchar *protocol, *location;
|
||||
gboolean ret = TRUE;
|
||||
|
@ -1107,6 +1082,7 @@ gst_dv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
|||
protocol = gst_uri_get_protocol (uri);
|
||||
if (strcmp (protocol, "dv") != 0) {
|
||||
g_free (protocol);
|
||||
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI, "Invalid DV URI");
|
||||
return FALSE;
|
||||
}
|
||||
g_free (protocol);
|
||||
|
|
|
@ -115,48 +115,21 @@ static GstFlowReturn gst_hdv1394src_create (GstPushSrc * psrc,
|
|||
|
||||
static void gst_hdv1394src_update_device_name (GstHDV1394Src * src);
|
||||
|
||||
static void
|
||||
_do_init (GType type)
|
||||
{
|
||||
static const GInterfaceInfo urihandler_info = {
|
||||
gst_hdv1394src_uri_handler_init,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
|
||||
|
||||
gst_1394_type_add_property_probe_interface (type);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (hdv1394src_debug, "hdv1394src", 0,
|
||||
"MPEG-TS firewire source");
|
||||
}
|
||||
|
||||
GST_BOILERPLATE_FULL (GstHDV1394Src, gst_hdv1394src, GstPushSrc,
|
||||
GST_TYPE_PUSH_SRC, _do_init);
|
||||
|
||||
|
||||
static void
|
||||
gst_hdv1394src_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&src_factory));
|
||||
|
||||
gst_element_class_set_static_metadata (element_class,
|
||||
"Firewire (1394) HDV video source", "Source/Video",
|
||||
"Source for MPEG-TS video data from firewire port",
|
||||
"Edward Hervey <bilboed@bilboed.com>");
|
||||
}
|
||||
#define gst_hdv1394src_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstHDV1394Src, gst_hdv1394src, GST_TYPE_PUSH_SRC,
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
|
||||
gst_hdv1394src_uri_handler_init));
|
||||
|
||||
static void
|
||||
gst_hdv1394src_class_init (GstHDV1394SrcClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstBaseSrcClass *gstbasesrc_class;
|
||||
GstPushSrcClass *gstpushsrc_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
||||
gstpushsrc_class = (GstPushSrcClass *) klass;
|
||||
|
||||
|
@ -196,10 +169,21 @@ gst_hdv1394src_class_init (GstHDV1394SrcClass * klass)
|
|||
gstbasesrc_class->unlock = gst_hdv1394src_unlock;
|
||||
|
||||
gstpushsrc_class->create = gst_hdv1394src_create;
|
||||
|
||||
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) HDV video source", "Source/Video",
|
||||
"Source for MPEG-TS video data from firewire port",
|
||||
"Edward Hervey <bilboed@bilboed.com>");
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (hdv1394src_debug, "hdv1394src", 0,
|
||||
"MPEG-TS firewire source");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_hdv1394src_init (GstHDV1394Src * dv1394src, GstHDV1394SrcClass * klass)
|
||||
gst_hdv1394src_init (GstHDV1394Src * dv1394src)
|
||||
{
|
||||
GstPad *srcpad = GST_BASE_SRC_PAD (dv1394src);
|
||||
|
||||
|
@ -387,7 +371,6 @@ static GstFlowReturn
|
|||
gst_hdv1394src_create (GstPushSrc * psrc, GstBuffer ** buf)
|
||||
{
|
||||
GstHDV1394Src *dv1394src = GST_HDV1394SRC (psrc);
|
||||
GstCaps *caps;
|
||||
struct pollfd pollfds[2];
|
||||
|
||||
pollfds[0].fd = raw1394_get_fd (dv1394src->handle);
|
||||
|
@ -439,17 +422,10 @@ gst_hdv1394src_create (GstPushSrc * psrc, GstBuffer ** buf)
|
|||
GST_LOG ("We have some frames (%u bytes)", (guint) dv1394src->outoffset);
|
||||
|
||||
/* Create the buffer */
|
||||
*buf = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (*buf) = dv1394src->outdata;
|
||||
GST_BUFFER_MALLOCDATA (*buf) = dv1394src->outdata;
|
||||
GST_BUFFER_SIZE (*buf) = dv1394src->outoffset;
|
||||
*buf = gst_buffer_new_wrapped (dv1394src->outdata, dv1394src->outoffset);
|
||||
dv1394src->outdata = NULL;
|
||||
dv1394src->outoffset = 0;
|
||||
|
||||
caps = gst_pad_get_caps (GST_BASE_SRC_PAD (psrc));
|
||||
gst_buffer_set_caps (*buf, caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
||||
error_while_polling:
|
||||
|
@ -785,21 +761,21 @@ gethandle_failed:
|
|||
|
||||
/*** GSTURIHANDLER INTERFACE *************************************************/
|
||||
|
||||
static guint
|
||||
gst_hdv1394src_uri_get_type (void)
|
||||
static GstURIType
|
||||
gst_hdv1394src_uri_get_type (GType type)
|
||||
{
|
||||
return GST_URI_SRC;
|
||||
}
|
||||
|
||||
static gchar **
|
||||
gst_hdv1394src_uri_get_protocols (void)
|
||||
static const gchar *const *
|
||||
gst_hdv1394src_uri_get_protocols (GType type)
|
||||
{
|
||||
static gchar *protocols[] = { (char *) "hdv", NULL };
|
||||
static const gchar *protocols[] = { (char *) "hdv", NULL };
|
||||
|
||||
return protocols;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
static gchar *
|
||||
gst_hdv1394src_uri_get_uri (GstURIHandler * handler)
|
||||
{
|
||||
GstHDV1394Src *gst_hdv1394src = GST_HDV1394SRC (handler);
|
||||
|
@ -808,7 +784,8 @@ gst_hdv1394src_uri_get_uri (GstURIHandler * handler)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_hdv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
||||
gst_hdv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
|
||||
GError ** error)
|
||||
{
|
||||
gchar *protocol, *location;
|
||||
gboolean ret = TRUE;
|
||||
|
@ -817,6 +794,8 @@ gst_hdv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
|||
protocol = gst_uri_get_protocol (uri);
|
||||
if (strcmp (protocol, "hdv") != 0) {
|
||||
g_free (protocol);
|
||||
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
|
||||
"Invalid HDV URI");
|
||||
return FALSE;
|
||||
}
|
||||
g_free (protocol);
|
||||
|
|
Loading…
Reference in a new issue