summaryrefslogtreecommitdiff
path: root/ext/raw1394
diff options
context:
space:
mode:
Diffstat (limited to 'ext/raw1394')
-rw-r--r--ext/raw1394/Makefile.am29
-rw-r--r--ext/raw1394/Makefile.in864
-rw-r--r--ext/raw1394/gst1394.c51
-rw-r--r--ext/raw1394/gst1394clock.c154
-rw-r--r--ext/raw1394/gst1394clock.h77
-rw-r--r--ext/raw1394/gst1394probe.c140
-rw-r--r--ext/raw1394/gst1394probe.h32
-rw-r--r--ext/raw1394/gstdv1394src.c1134
-rw-r--r--ext/raw1394/gstdv1394src.h101
-rw-r--r--ext/raw1394/gsthdv1394src.c844
-rw-r--r--ext/raw1394/gsthdv1394src.h85
11 files changed, 3511 insertions, 0 deletions
diff --git a/ext/raw1394/Makefile.am b/ext/raw1394/Makefile.am
new file mode 100644
index 0000000..ae55f86
--- /dev/null
+++ b/ext/raw1394/Makefile.am
@@ -0,0 +1,29 @@
+plugin_LTLIBRARIES = libgst1394.la
+
+if USE_LIBIEC61883
+hdvsource = gsthdv1394src.c
+hdvheaders = gsthdv1394src.h
+else
+hdvsource =
+hdvheaders =
+endif
+
+libgst1394_la_SOURCES = \
+ gst1394.c gst1394probe.c gstdv1394src.c $(hdvsource) \
+ gst1394clock.c
+libgst1394_la_CFLAGS = \
+ $(GST_PLUGINS_BASE_CFLAGS) \
+ $(GST_BASE_CFLAGS) \
+ $(GST_CFLAGS) \
+ $(DV1394_CFLAGS)
+libgst1394_la_LIBADD = \
+ $(GST_PLUGINS_BASE_LIBS) -lgstinterfaces-$(GST_MAJORMINOR) \
+ $(GST_BASE_LIBS) \
+ $(GST_LIBS) \
+ $(DV1394_LIBS)
+libgst1394_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgst1394_la_LIBTOOLFLAGS = --tag=disable-static
+
+noinst_HEADERS = gstdv1394src.h gst1394probe.h $(hdvheaders) \
+ gst1394clock.h
+
diff --git a/ext/raw1394/Makefile.in b/ext/raw1394/Makefile.in
new file mode 100644
index 0000000..0b4e7ac
--- /dev/null
+++ b/ext/raw1394/Makefile.in
@@ -0,0 +1,864 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = ext/raw1394
+DIST_COMMON = $(am__noinst_HEADERS_DIST) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
+ $(top_srcdir)/common/m4/as-auto-alt.m4 \
+ $(top_srcdir)/common/m4/as-compiler-flag.m4 \
+ $(top_srcdir)/common/m4/as-gcc-inline-assembly.m4 \
+ $(top_srcdir)/common/m4/as-objc.m4 \
+ $(top_srcdir)/common/m4/as-python.m4 \
+ $(top_srcdir)/common/m4/as-scrub-include.m4 \
+ $(top_srcdir)/common/m4/as-version.m4 \
+ $(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/common/m4/gst-arch.m4 \
+ $(top_srcdir)/common/m4/gst-args.m4 \
+ $(top_srcdir)/common/m4/gst-check.m4 \
+ $(top_srcdir)/common/m4/gst-default.m4 \
+ $(top_srcdir)/common/m4/gst-dowhile.m4 \
+ $(top_srcdir)/common/m4/gst-error.m4 \
+ $(top_srcdir)/common/m4/gst-feature.m4 \
+ $(top_srcdir)/common/m4/gst-gettext.m4 \
+ $(top_srcdir)/common/m4/gst-glib2.m4 \
+ $(top_srcdir)/common/m4/gst-package-release-datetime.m4 \
+ $(top_srcdir)/common/m4/gst-platform.m4 \
+ $(top_srcdir)/common/m4/gst-plugin-docs.m4 \
+ $(top_srcdir)/common/m4/gst-plugindir.m4 \
+ $(top_srcdir)/common/m4/gst-x11.m4 \
+ $(top_srcdir)/common/m4/gst.m4 \
+ $(top_srcdir)/common/m4/gtk-doc.m4 \
+ $(top_srcdir)/common/m4/orc.m4 $(top_srcdir)/common/m4/pkg.m4 \
+ $(top_srcdir)/m4/aalib.m4 $(top_srcdir)/m4/esd.m4 \
+ $(top_srcdir)/m4/gconf-2.m4 $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/gst-fionread.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(plugindir)"
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libgst1394_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am__libgst1394_la_SOURCES_DIST = gst1394.c gst1394probe.c \
+ gstdv1394src.c gsthdv1394src.c gst1394clock.c
+@USE_LIBIEC61883_TRUE@am__objects_1 = libgst1394_la-gsthdv1394src.lo
+am_libgst1394_la_OBJECTS = libgst1394_la-gst1394.lo \
+ libgst1394_la-gst1394probe.lo libgst1394_la-gstdv1394src.lo \
+ $(am__objects_1) libgst1394_la-gst1394clock.lo
+libgst1394_la_OBJECTS = $(am_libgst1394_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+libgst1394_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+ $(CCLD) $(libgst1394_la_CFLAGS) $(CFLAGS) \
+ $(libgst1394_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(libgst1394_la_SOURCES)
+DIST_SOURCES = $(am__libgst1394_la_SOURCES_DIST)
+am__noinst_HEADERS_DIST = gstdv1394src.h gst1394probe.h \
+ gsthdv1394src.h gst1394clock.h
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+AALIB_CFLAGS = @AALIB_CFLAGS@
+AALIB_CONFIG = @AALIB_CONFIG@
+AALIB_LIBS = @AALIB_LIBS@
+ACLOCAL = @ACLOCAL@
+ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+ANNODEX_CFLAGS = @ANNODEX_CFLAGS@
+ANNODEX_LIBS = @ANNODEX_LIBS@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BZ2_LIBS = @BZ2_LIBS@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_GOBJECT_CFLAGS = @CAIRO_GOBJECT_CFLAGS@
+CAIRO_GOBJECT_LIBS = @CAIRO_GOBJECT_LIBS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFAULT_AUDIOSINK = @DEFAULT_AUDIOSINK@
+DEFAULT_AUDIOSRC = @DEFAULT_AUDIOSRC@
+DEFAULT_VIDEOSINK = @DEFAULT_VIDEOSINK@
+DEFAULT_VIDEOSRC = @DEFAULT_VIDEOSRC@
+DEFAULT_VISUALIZER = @DEFAULT_VISUALIZER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
+DIRECTSOUND_CFLAGS = @DIRECTSOUND_CFLAGS@
+DIRECTSOUND_LDFLAGS = @DIRECTSOUND_LDFLAGS@
+DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DV1394_CFLAGS = @DV1394_CFLAGS@
+DV1394_LIBS = @DV1394_LIBS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+ERROR_CXXFLAGS = @ERROR_CXXFLAGS@
+ESD_CFLAGS = @ESD_CFLAGS@
+ESD_CONFIG = @ESD_CONFIG@
+ESD_LIBS = @ESD_LIBS@
+EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLAC_CFLAGS = @FLAC_CFLAGS@
+FLAC_LIBS = @FLAC_LIBS@
+GCONFTOOL = @GCONFTOOL@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
+GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_EXTRA_CFLAGS = @GLIB_EXTRA_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_PREFIX = @GLIB_PREFIX@
+GLIB_REQ = @GLIB_REQ@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
+GSTPB_PREFIX = @GSTPB_PREFIX@
+GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@
+GST_BASE_CFLAGS = @GST_BASE_CFLAGS@
+GST_BASE_LIBS = @GST_BASE_LIBS@
+GST_CFLAGS = @GST_CFLAGS@
+GST_CHECK_CFLAGS = @GST_CHECK_CFLAGS@
+GST_CHECK_LIBS = @GST_CHECK_LIBS@
+GST_CONTROLLER_CFLAGS = @GST_CONTROLLER_CFLAGS@
+GST_CONTROLLER_LIBS = @GST_CONTROLLER_LIBS@
+GST_CXXFLAGS = @GST_CXXFLAGS@
+GST_GDP_CFLAGS = @GST_GDP_CFLAGS@
+GST_GDP_LIBS = @GST_GDP_LIBS@
+GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@
+GST_LIBS = @GST_LIBS@
+GST_LICENSE = @GST_LICENSE@
+GST_LT_LDFLAGS = @GST_LT_LDFLAGS@
+GST_MAJORMINOR = @GST_MAJORMINOR@
+GST_OPTION_CFLAGS = @GST_OPTION_CFLAGS@
+GST_OPTION_CXXFLAGS = @GST_OPTION_CXXFLAGS@
+GST_PACKAGE_NAME = @GST_PACKAGE_NAME@
+GST_PACKAGE_ORIGIN = @GST_PACKAGE_ORIGIN@
+GST_PLUGINS_ALL = @GST_PLUGINS_ALL@
+GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@
+GST_PLUGINS_BASE_DIR = @GST_PLUGINS_BASE_DIR@
+GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@
+GST_PLUGINS_DIR = @GST_PLUGINS_DIR@
+GST_PLUGINS_SELECTED = @GST_PLUGINS_SELECTED@
+GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
+GST_PREFIX = @GST_PREFIX@
+GST_TOOLS_DIR = @GST_TOOLS_DIR@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GTK_X11_CFLAGS = @GTK_X11_CFLAGS@
+GTK_X11_LIBS = @GTK_X11_LIBS@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+HAVE_AVC1394 = @HAVE_AVC1394@
+HAVE_BZ2 = @HAVE_BZ2@
+HAVE_CXX = @HAVE_CXX@
+HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
+HAVE_GCONFTOOL = @HAVE_GCONFTOOL@
+HAVE_ROM1394 = @HAVE_ROM1394@
+HAVE_SPEEX = @HAVE_SPEEX@
+HAVE_X = @HAVE_X@
+HAVE_XSHM = @HAVE_XSHM@
+HAVE_ZLIB = @HAVE_ZLIB@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+JACK_0_120_1_CFLAGS = @JACK_0_120_1_CFLAGS@
+JACK_0_120_1_LIBS = @JACK_0_120_1_LIBS@
+JACK_1_9_7_CFLAGS = @JACK_1_9_7_CFLAGS@
+JACK_1_9_7_LIBS = @JACK_1_9_7_LIBS@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JPEG_LIBS = @JPEG_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCACA_CFLAGS = @LIBCACA_CFLAGS@
+LIBCACA_LIBS = @LIBCACA_LIBS@
+LIBDV_CFLAGS = @LIBDV_CFLAGS@
+LIBDV_LIBS = @LIBDV_LIBS@
+LIBICONV = @LIBICONV@
+LIBIEC61883_CFLAGS = @LIBIEC61883_CFLAGS@
+LIBIEC61883_LIBS = @LIBIEC61883_LIBS@
+LIBINTL = @LIBINTL@
+LIBM = @LIBM@
+LIBOBJS = @LIBOBJS@
+LIBPNG_CFLAGS = @LIBPNG_CFLAGS@
+LIBPNG_LIBS = @LIBPNG_LIBS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBV4L2_CFLAGS = @LIBV4L2_CFLAGS@
+LIBV4L2_LIBS = @LIBV4L2_LIBS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LOCALEDIR = @LOCALEDIR@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJC_LDFLAGS = @OBJC_LDFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+ORCC = @ORCC@
+ORCC_FLAGS = @ORCC_FLAGS@
+ORC_CFLAGS = @ORC_CFLAGS@
+ORC_LIBS = @ORC_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
+PACKAGE_VERSION_MICRO = @PACKAGE_VERSION_MICRO@
+PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
+PACKAGE_VERSION_NANO = @PACKAGE_VERSION_NANO@
+PACKAGE_VERSION_RELEASE = @PACKAGE_VERSION_RELEASE@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGINDIR = @PLUGINDIR@
+POSUB = @POSUB@
+PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PULSE_0_9_20_CFLAGS = @PULSE_0_9_20_CFLAGS@
+PULSE_0_9_20_LIBS = @PULSE_0_9_20_LIBS@
+PULSE_1_0_CFLAGS = @PULSE_1_0_CFLAGS@
+PULSE_1_0_LIBS = @PULSE_1_0_LIBS@
+PULSE_CFLAGS = @PULSE_CFLAGS@
+PULSE_LIBS = @PULSE_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RAW1394_CFLAGS = @RAW1394_CFLAGS@
+RAW1394_LIBS = @RAW1394_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOUT2_CFLAGS = @SHOUT2_CFLAGS@
+SHOUT2_LIBS = @SHOUT2_LIBS@
+SOUP_CFLAGS = @SOUP_CFLAGS@
+SOUP_LIBS = @SOUP_LIBS@
+SPEEX_CFLAGS = @SPEEX_CFLAGS@
+SPEEX_LIBS = @SPEEX_LIBS@
+STRIP = @STRIP@
+TAGLIB_CFLAGS = @TAGLIB_CFLAGS@
+TAGLIB_CXXFLAGS = @TAGLIB_CXXFLAGS@
+TAGLIB_LIBS = @TAGLIB_LIBS@
+USE_NLS = @USE_NLS@
+VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
+VALGRIND_LIBS = @VALGRIND_LIBS@
+VALGRIND_PATH = @VALGRIND_PATH@
+VERSION = @VERSION@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
+WAVPACK_CFLAGS = @WAVPACK_CFLAGS@
+WAVPACK_LIBS = @WAVPACK_LIBS@
+WIN32_LIBS = @WIN32_LIBS@
+XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
+XDAMAGE_LIBS = @XDAMAGE_LIBS@
+XFIXES_CFLAGS = @XFIXES_CFLAGS@
+XFIXES_LIBS = @XFIXES_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+XMKMF = @XMKMF@
+XSHM_LIBS = @XSHM_LIBS@
+XVIDEO_LIBS = @XVIDEO_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJC = @ac_ct_OBJC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+plugindir = @plugindir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+plugin_LTLIBRARIES = libgst1394.la
+@USE_LIBIEC61883_FALSE@hdvsource =
+@USE_LIBIEC61883_TRUE@hdvsource = gsthdv1394src.c
+@USE_LIBIEC61883_FALSE@hdvheaders =
+@USE_LIBIEC61883_TRUE@hdvheaders = gsthdv1394src.h
+libgst1394_la_SOURCES = \
+ gst1394.c gst1394probe.c gstdv1394src.c $(hdvsource) \
+ gst1394clock.c
+
+libgst1394_la_CFLAGS = \
+ $(GST_PLUGINS_BASE_CFLAGS) \
+ $(GST_BASE_CFLAGS) \
+ $(GST_CFLAGS) \
+ $(DV1394_CFLAGS)
+
+libgst1394_la_LIBADD = \
+ $(GST_PLUGINS_BASE_LIBS) -lgstinterfaces-$(GST_MAJORMINOR) \
+ $(GST_BASE_LIBS) \
+ $(GST_LIBS) \
+ $(DV1394_LIBS)
+
+libgst1394_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgst1394_la_LIBTOOLFLAGS = --tag=disable-static
+noinst_HEADERS = gstdv1394src.h gst1394probe.h $(hdvheaders) \
+ gst1394clock.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/raw1394/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu ext/raw1394/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+ }
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgst1394.la: $(libgst1394_la_OBJECTS) $(libgst1394_la_DEPENDENCIES) $(EXTRA_libgst1394_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libgst1394_la_LINK) -rpath $(plugindir) $(libgst1394_la_OBJECTS) $(libgst1394_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgst1394_la-gst1394.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgst1394_la-gst1394clock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgst1394_la-gst1394probe.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgst1394_la-gstdv1394src.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgst1394_la-gsthdv1394src.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+libgst1394_la-gst1394.lo: gst1394.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -MT libgst1394_la-gst1394.lo -MD -MP -MF $(DEPDIR)/libgst1394_la-gst1394.Tpo -c -o libgst1394_la-gst1394.lo `test -f 'gst1394.c' || echo '$(srcdir)/'`gst1394.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgst1394_la-gst1394.Tpo $(DEPDIR)/libgst1394_la-gst1394.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gst1394.c' object='libgst1394_la-gst1394.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -c -o libgst1394_la-gst1394.lo `test -f 'gst1394.c' || echo '$(srcdir)/'`gst1394.c
+
+libgst1394_la-gst1394probe.lo: gst1394probe.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -MT libgst1394_la-gst1394probe.lo -MD -MP -MF $(DEPDIR)/libgst1394_la-gst1394probe.Tpo -c -o libgst1394_la-gst1394probe.lo `test -f 'gst1394probe.c' || echo '$(srcdir)/'`gst1394probe.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgst1394_la-gst1394probe.Tpo $(DEPDIR)/libgst1394_la-gst1394probe.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gst1394probe.c' object='libgst1394_la-gst1394probe.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -c -o libgst1394_la-gst1394probe.lo `test -f 'gst1394probe.c' || echo '$(srcdir)/'`gst1394probe.c
+
+libgst1394_la-gstdv1394src.lo: gstdv1394src.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -MT libgst1394_la-gstdv1394src.lo -MD -MP -MF $(DEPDIR)/libgst1394_la-gstdv1394src.Tpo -c -o libgst1394_la-gstdv1394src.lo `test -f 'gstdv1394src.c' || echo '$(srcdir)/'`gstdv1394src.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgst1394_la-gstdv1394src.Tpo $(DEPDIR)/libgst1394_la-gstdv1394src.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstdv1394src.c' object='libgst1394_la-gstdv1394src.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -c -o libgst1394_la-gstdv1394src.lo `test -f 'gstdv1394src.c' || echo '$(srcdir)/'`gstdv1394src.c
+
+libgst1394_la-gsthdv1394src.lo: gsthdv1394src.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -MT libgst1394_la-gsthdv1394src.lo -MD -MP -MF $(DEPDIR)/libgst1394_la-gsthdv1394src.Tpo -c -o libgst1394_la-gsthdv1394src.lo `test -f 'gsthdv1394src.c' || echo '$(srcdir)/'`gsthdv1394src.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgst1394_la-gsthdv1394src.Tpo $(DEPDIR)/libgst1394_la-gsthdv1394src.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsthdv1394src.c' object='libgst1394_la-gsthdv1394src.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -c -o libgst1394_la-gsthdv1394src.lo `test -f 'gsthdv1394src.c' || echo '$(srcdir)/'`gsthdv1394src.c
+
+libgst1394_la-gst1394clock.lo: gst1394clock.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -MT libgst1394_la-gst1394clock.lo -MD -MP -MF $(DEPDIR)/libgst1394_la-gst1394clock.Tpo -c -o libgst1394_la-gst1394clock.lo `test -f 'gst1394clock.c' || echo '$(srcdir)/'`gst1394clock.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgst1394_la-gst1394clock.Tpo $(DEPDIR)/libgst1394_la-gst1394clock.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gst1394clock.c' object='libgst1394_la-gst1394clock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgst1394_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgst1394_la_CFLAGS) $(CFLAGS) -c -o libgst1394_la-gst1394clock.lo `test -f 'gst1394clock.c' || echo '$(srcdir)/'`gst1394clock.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pluginLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-pluginLTLIBRARIES \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/ext/raw1394/gst1394.c b/ext/raw1394/gst1394.c
new file mode 100644
index 0000000..dafeb73
--- /dev/null
+++ b/ext/raw1394/gst1394.c
@@ -0,0 +1,51 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gst/gst.h>
+
+
+#include "gstdv1394src.h"
+#ifdef HAVE_LIBIEC61883
+#include "gsthdv1394src.h"
+#endif
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ if (!gst_element_register (plugin, "dv1394src", GST_RANK_NONE,
+ GST_TYPE_DV1394SRC))
+ return FALSE;
+#ifdef HAVE_LIBIEC61883
+ if (!gst_element_register (plugin, "hdv1394src", GST_RANK_NONE,
+ GST_TYPE_HDV1394SRC))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "1394",
+ "Source for video data via IEEE1394 interface",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
diff --git a/ext/raw1394/gst1394clock.c b/ext/raw1394/gst1394clock.c
new file mode 100644
index 0000000..0505c8c
--- /dev/null
+++ b/ext/raw1394/gst1394clock.c
@@ -0,0 +1,154 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ * Copyright (C) 2009 David Schleef <ds@schleef.org>
+ *
+ * gst1394clock.c: Clock for use by IEEE 1394 plugins
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gst1394clock.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_1394_clock_debug);
+#define GST_CAT_DEFAULT gst_1394_clock_debug
+
+static void gst_1394_clock_class_init (Gst1394ClockClass * klass);
+static void gst_1394_clock_init (Gst1394Clock * clock);
+
+static GstClockTime gst_1394_clock_get_internal_time (GstClock * clock);
+
+static GstSystemClockClass *parent_class = NULL;
+
+/* static guint gst_1394_clock_signals[LAST_SIGNAL] = { 0 }; */
+
+GType
+gst_1394_clock_get_type (void)
+{
+ static GType clock_type = 0;
+
+ if (!clock_type) {
+ static const GTypeInfo clock_info = {
+ sizeof (Gst1394ClockClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gst_1394_clock_class_init,
+ NULL,
+ NULL,
+ sizeof (Gst1394Clock),
+ 4,
+ (GInstanceInitFunc) gst_1394_clock_init,
+ NULL
+ };
+
+ clock_type = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "Gst1394Clock",
+ &clock_info, 0);
+ }
+ return clock_type;
+}
+
+
+static void
+gst_1394_clock_class_init (Gst1394ClockClass * klass)
+{
+ GstClockClass *gstclock_class;
+
+ gstclock_class = (GstClockClass *) klass;
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ gstclock_class->get_internal_time = gst_1394_clock_get_internal_time;
+
+ GST_DEBUG_CATEGORY_INIT (gst_1394_clock_debug, "1394clock", 0, "1394clock");
+}
+
+static void
+gst_1394_clock_init (Gst1394Clock * clock)
+{
+ GST_OBJECT_FLAG_SET (clock, GST_CLOCK_FLAG_CAN_SET_MASTER);
+}
+
+/**
+ * gst_1394_clock_new:
+ * @name: the name of the clock
+ *
+ * Create a new #Gst1394Clock instance.
+ *
+ * Returns: a new #Gst1394Clock
+ */
+Gst1394Clock *
+gst_1394_clock_new (const gchar * name)
+{
+ Gst1394Clock *_1394clock =
+ GST_1394_CLOCK (g_object_new (GST_TYPE_1394_CLOCK, "name", name, NULL));
+
+ return _1394clock;
+}
+
+static GstClockTime
+gst_1394_clock_get_internal_time (GstClock * clock)
+{
+ Gst1394Clock *_1394clock;
+ GstClockTime result;
+ guint32 cycle_timer;
+ guint64 local_time;
+
+ _1394clock = GST_1394_CLOCK_CAST (clock);
+
+ if (_1394clock->handle != NULL) {
+ GST_OBJECT_LOCK (clock);
+ raw1394_read_cycle_timer (_1394clock->handle, &cycle_timer, &local_time);
+
+ if (cycle_timer < _1394clock->cycle_timer_lo) {
+ GST_LOG_OBJECT (clock, "overflow %u to %u",
+ _1394clock->cycle_timer_lo, cycle_timer);
+
+ _1394clock->cycle_timer_hi++;
+ }
+ _1394clock->cycle_timer_lo = cycle_timer;
+
+ /* get the seconds from the cycleSeconds counter */
+ result = (((((guint64) _1394clock->cycle_timer_hi) << 32) |
+ cycle_timer) >> 25) * GST_SECOND;
+ /* add the microseconds from the cycleCount counter */
+ result += (((cycle_timer >> 12) & 0x1fff) * 125) * GST_USECOND;
+
+ GST_LOG_OBJECT (clock, "result %" GST_TIME_FORMAT, GST_TIME_ARGS (result));
+ GST_OBJECT_UNLOCK (clock);
+ } else {
+ result = GST_CLOCK_TIME_NONE;
+ }
+
+ return result;
+}
+
+void
+gst_1394_clock_set_handle (Gst1394Clock * clock, raw1394handle_t handle)
+{
+ clock->handle = handle;
+ clock->cycle_timer_lo = 0;
+ clock->cycle_timer_hi = 0;
+}
+
+void
+gst_1394_clock_unset_handle (Gst1394Clock * clock)
+{
+ clock->handle = NULL;
+}
diff --git a/ext/raw1394/gst1394clock.h b/ext/raw1394/gst1394clock.h
new file mode 100644
index 0000000..ab7594d
--- /dev/null
+++ b/ext/raw1394/gst1394clock.h
@@ -0,0 +1,77 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2005 Wim Taymans <wim@fluendo.com>
+ * Copyright (C) 2009 David Schleef <ds@schleef.org>
+ *
+ * gst1394clock.h: Clock for use by the IEEE 1394
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_1394_CLOCK_H__
+#define __GST_1394_CLOCK_H__
+
+#include <gst/gst.h>
+#include <gst/gstsystemclock.h>
+
+#include <libraw1394/raw1394.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_1394_CLOCK \
+ (gst_1394_clock_get_type())
+#define GST_1394_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_1394_CLOCK,Gst1394Clock))
+#define GST_1394_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_1394_CLOCK,Gst1394ClockClass))
+#define GST_IS_1394_CLOCK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_1394_CLOCK))
+#define GST_IS_1394_CLOCK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_1394_CLOCK))
+#define GST_1394_CLOCK_CAST(obj) \
+ ((Gst1394Clock*)(obj))
+
+typedef struct _Gst1394Clock Gst1394Clock;
+typedef struct _Gst1394ClockClass Gst1394ClockClass;
+
+/**
+ * Gst1394Clock:
+ * @clock: parent #GstSystemClock
+ *
+ * Opaque #Gst1394Clock.
+ */
+struct _Gst1394Clock {
+ GstSystemClock clock;
+
+ raw1394handle_t handle;
+
+ guint32 cycle_timer_lo;
+ guint32 cycle_timer_hi;
+};
+
+struct _Gst1394ClockClass {
+ GstSystemClockClass parent_class;
+};
+
+GType gst_1394_clock_get_type (void);
+Gst1394Clock* gst_1394_clock_new (const gchar *name);
+void gst_1394_clock_set_handle (Gst1394Clock *clock,
+ raw1394handle_t handle);
+void gst_1394_clock_unset_handle (Gst1394Clock *clock);
+
+G_END_DECLS
+
+#endif /* __GST_1394_CLOCK_H__ */
diff --git a/ext/raw1394/gst1394probe.c b/ext/raw1394/gst1394probe.c
new file mode 100644
index 0000000..ee51ba0
--- /dev/null
+++ b/ext/raw1394/gst1394probe.c
@@ -0,0 +1,140 @@
+/* GStreamer
+ * Copyright (C) 2007 Julien Puydt <jpuydt@free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <libavc1394/avc1394.h>
+#include <libavc1394/avc1394_vcr.h>
+#include <libavc1394/rom1394.h>
+#include <libraw1394/raw1394.h>
+
+#include <gst/gst.h>
+
+#include "gst1394probe.h"
+#include "gst/interfaces/propertyprobe.h"
+
+static GValueArray *
+gst_1394_get_guid_array (void)
+{
+ GValueArray *result = NULL;
+ raw1394handle_t handle = NULL;
+ int num_ports = 0;
+ int port = 0;
+ int num_nodes = 0;
+ int node = 0;
+ rom1394_directory directory;
+ GValue value = { 0, };
+
+ handle = raw1394_new_handle ();
+
+ if (handle == NULL)
+ return NULL;
+
+ num_ports = raw1394_get_port_info (handle, NULL, 0);
+ for (port = 0; port < num_ports; port++) {
+ if (raw1394_set_port (handle, port) >= 0) {
+ num_nodes = raw1394_get_nodecount (handle);
+ for (node = 0; node < num_nodes; node++) {
+ rom1394_get_directory (handle, node, &directory);
+ if (rom1394_get_node_type (&directory) == ROM1394_NODE_TYPE_AVC &&
+ avc1394_check_subunit_type (handle, node,
+ AVC1394_SUBUNIT_TYPE_VCR)) {
+ if (result == NULL)
+ result = g_value_array_new (3); /* looks like a sensible default */
+ g_value_init (&value, G_TYPE_UINT64);
+ g_value_set_uint64 (&value, rom1394_get_guid (handle, node));
+ g_value_array_append (result, &value);
+ g_value_unset (&value);
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+static const GList *
+gst_1394_property_probe_get_properties (GstPropertyProbe * probe)
+{
+ static GList *result = NULL;
+ GObjectClass *klass = NULL;
+ GParamSpec *spec = NULL;
+
+ if (result == NULL) {
+ klass = G_OBJECT_GET_CLASS (probe);
+ spec = g_object_class_find_property (klass, "guid");
+ result = g_list_append (result, spec);
+ }
+
+ return result;
+}
+
+static void
+gst_1394_property_probe_probe_property (GstPropertyProbe * probe, guint prop_id,
+ const GParamSpec * pspec)
+{
+ if (!g_str_equal (pspec->name, "guid"))
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
+}
+
+static gboolean
+gst_1394_property_probe_needs_probe (GstPropertyProbe * probe, guint prop_id,
+ const GParamSpec * pspec)
+{
+ return TRUE;
+}
+
+static GValueArray *
+gst_1394_property_probe_get_values (GstPropertyProbe * probe, guint prop_id,
+ const GParamSpec * pspec)
+{
+ GValueArray *result = NULL;
+
+ if (!g_str_equal (pspec->name, "guid")) {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
+ return NULL;
+ }
+
+ result = gst_1394_get_guid_array ();
+
+ if (result == NULL)
+ GST_LOG_OBJECT (probe, "No guid found");
+
+ return result;
+}
+
+static void
+gst_1394_property_probe_interface_init (GstPropertyProbeInterface * iface)
+{
+ iface->get_properties = gst_1394_property_probe_get_properties;
+ iface->probe_property = gst_1394_property_probe_probe_property;
+ iface->needs_probe = gst_1394_property_probe_needs_probe;
+ iface->get_values = gst_1394_property_probe_get_values;
+}
+
+void
+gst_1394_type_add_property_probe_interface (GType type)
+{
+ static const GInterfaceInfo probe_iface_info = {
+ (GInterfaceInitFunc) gst_1394_property_probe_interface_init,
+ NULL,
+ NULL,
+ };
+
+ g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE,
+ &probe_iface_info);
+}
diff --git a/ext/raw1394/gst1394probe.h b/ext/raw1394/gst1394probe.h
new file mode 100644
index 0000000..8436e70
--- /dev/null
+++ b/ext/raw1394/gst1394probe.h
@@ -0,0 +1,32 @@
+/* GStreamer
+ * Copyright (C) 2007 Julien Puydt <jpuydt@free.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GST_1394_PROBE_H
+#define GST_1394_PROBE_H
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+void gst_1394_type_add_property_probe_interface (GType type);
+
+G_END_DECLS
+
+#endif /* __GST_1394_PROBE_H */
+
diff --git a/ext/raw1394/gstdv1394src.c b/ext/raw1394/gstdv1394src.c
new file mode 100644
index 0000000..1a3cae6
--- /dev/null
+++ b/ext/raw1394/gstdv1394src.c
@@ -0,0 +1,1134 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * <2000> Daniel Fischer <dan@f3c.com>
+ * <2004> Wim Taymans <wim@fluendo.com>
+ * <2006> Zaheer Abbas Merali <zaheerabbas at merali dot org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/**
+ * SECTION:element-dv1394src
+ *
+ * Read DV (digital video) data from firewire port.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch dv1394src ! queue ! dvdemux name=d ! queue ! dvdec ! xvimagesink d. ! queue ! alsasink
+ * ]| This pipeline captures from the firewire port and displays it (might need
+ * format converters for audio/video).
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <unistd.h>
+#include <sys/poll.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <libavc1394/avc1394.h>
+#include <libavc1394/avc1394_vcr.h>
+#include <libavc1394/rom1394.h>
+#include <libraw1394/raw1394.h>
+#ifdef HAVE_LIBIEC61883
+#include <libiec61883/iec61883.h>
+#endif
+
+#include <gst/gst.h>
+
+#include "gstdv1394src.h"
+#include "gst1394probe.h"
+#include "gst1394clock.h"
+
+
+#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 { \
+ int G_GNUC_UNUSED _res; unsigned char c; c = command; \
+ _res = write (WRITE_SOCKET(src), &c, 1); \
+} G_STMT_END
+
+#define READ_COMMAND(src, command, res) \
+G_STMT_START { \
+ res = read(READ_SOCKET(src), &command, 1); \
+} G_STMT_END
+
+
+GST_DEBUG_CATEGORY_STATIC (dv1394src_debug);
+#define GST_CAT_DEFAULT (dv1394src_debug)
+
+#define PAL_FRAMESIZE 144000
+#define PAL_FRAMERATE 25
+
+#define NTSC_FRAMESIZE 120000
+#define NTSC_FRAMERATE 30
+
+enum
+{
+ SIGNAL_FRAME_DROPPED,
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+#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
+
+enum
+{
+ PROP_0,
+ PROP_PORT,
+ PROP_CHANNEL,
+ PROP_CONSECUTIVE,
+ PROP_SKIP,
+ PROP_DROP_INCOMPLETE,
+ PROP_USE_AVC,
+ PROP_GUID,
+ PROP_DEVICE_NAME
+};
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-dv, "
+ "format = (string) { NTSC, PAL }, " "systemstream = (boolean) true")
+ );
+
+static void gst_dv1394src_uri_handler_init (gpointer g_iface,
+ gpointer iface_data);
+
+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);
+static void gst_dv1394src_dispose (GObject * object);
+
+static GstClock *gst_dv1394src_provide_clock (GstElement * element);
+static GstStateChangeReturn gst_dv1394_src_change_state (GstElement * element,
+ GstStateChange transition);
+
+static gboolean gst_dv1394src_start (GstBaseSrc * bsrc);
+static gboolean gst_dv1394src_stop (GstBaseSrc * bsrc);
+static gboolean gst_dv1394src_unlock (GstBaseSrc * bsrc);
+
+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);
+
+
+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_static_pad_template (element_class, &src_factory);
+
+ gst_element_class_set_details_simple (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)
+{
+ 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;
+
+ gobject_class->set_property = gst_dv1394src_set_property;
+ gobject_class->get_property = gst_dv1394src_get_property;
+ gobject_class->dispose = gst_dv1394src_dispose;
+
+ gstelement_class->provide_clock = gst_dv1394src_provide_clock;
+ gstelement_class->change_state = gst_dv1394_src_change_state;
+
+ 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);
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
+ g_param_spec_int ("port", "Port", "Port number (-1 automatic)",
+ -1, 16, DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CHANNEL,
+ g_param_spec_int ("channel", "Channel", "Channel number for listening",
+ 0, 64, DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CONSECUTIVE,
+ g_param_spec_int ("consecutive", "consecutive frames",
+ "send n consecutive frames after skipping", 1, G_MAXINT,
+ DEFAULT_CONSECUTIVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SKIP,
+ g_param_spec_int ("skip", "skip frames", "skip n frames",
+ 0, G_MAXINT, DEFAULT_SKIP,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DROP_INCOMPLETE,
+ g_param_spec_boolean ("drop-incomplete", "drop incomplete",
+ "drop incomplete frames", DEFAULT_DROP_INCOMPLETE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_USE_AVC,
+ g_param_spec_boolean ("use-avc", "Use AV/C", "Use AV/C VTR control",
+ DEFAULT_USE_AVC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GUID,
+ 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,
+ DEFAULT_GUID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GstDV1394Src:device-name
+ *
+ * Descriptive name of the currently opened device
+ *
+ * Since: 0.10.7
+ **/
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE_NAME,
+ g_param_spec_string ("device-name", "device name",
+ "user-friendly name of the device", "Default",
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ gstbasesrc_class->negotiate = NULL;
+ gstbasesrc_class->start = gst_dv1394src_start;
+ gstbasesrc_class->stop = gst_dv1394src_stop;
+ gstbasesrc_class->unlock = gst_dv1394src_unlock;
+ gstbasesrc_class->query = gst_dv1394src_query;
+
+ gstpushsrc_class->create = gst_dv1394src_create;
+}
+
+static void
+gst_dv1394src_init (GstDV1394Src * dv1394src, GstDV1394SrcClass * klass)
+{
+ GstPad *srcpad = GST_BASE_SRC_PAD (dv1394src);
+
+ gst_base_src_set_live (GST_BASE_SRC (dv1394src), TRUE);
+ gst_base_src_set_format (GST_BASE_SRC (dv1394src), GST_FORMAT_TIME);
+ gst_base_src_set_do_timestamp (GST_BASE_SRC (dv1394src), TRUE);
+ gst_pad_use_fixed_caps (srcpad);
+
+ dv1394src->port = DEFAULT_PORT;
+ dv1394src->channel = DEFAULT_CHANNEL;
+
+ dv1394src->consecutive = DEFAULT_CONSECUTIVE;
+ dv1394src->skip = DEFAULT_SKIP;
+ dv1394src->drop_incomplete = DEFAULT_DROP_INCOMPLETE;
+ dv1394src->use_avc = DEFAULT_USE_AVC;
+ dv1394src->guid = DEFAULT_GUID;
+ dv1394src->uri = g_strdup_printf ("dv://%d", dv1394src->port);
+ dv1394src->device_name = g_strdup_printf ("Default");
+
+ READ_SOCKET (dv1394src) = -1;
+ WRITE_SOCKET (dv1394src) = -1;
+
+ /* initialized when first header received */
+ dv1394src->frame_size = 0;
+
+ dv1394src->buf = NULL;
+ dv1394src->frame = NULL;
+ dv1394src->frame_sequence = 0;
+
+ dv1394src->provided_clock = gst_1394_clock_new ("dv1394clock");
+}
+
+static void
+gst_dv1394src_dispose (GObject * object)
+{
+ GstDV1394Src *src = GST_DV1394SRC (object);
+
+ if (src->provided_clock) {
+ g_object_unref (src->provided_clock);
+ }
+
+ g_free (src->uri);
+ src->uri = NULL;
+
+ g_free (src->device_name);
+ src->device_name = NULL;
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gst_dv1394src_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstDV1394Src *filter = GST_DV1394SRC (object);
+
+ switch (prop_id) {
+ case PROP_PORT:
+ filter->port = g_value_get_int (value);
+ g_free (filter->uri);
+ filter->uri = g_strdup_printf ("dv://%d", filter->port);
+ break;
+ case PROP_CHANNEL:
+ filter->channel = g_value_get_int (value);
+ break;
+ case PROP_SKIP:
+ filter->skip = g_value_get_int (value);
+ break;
+ case PROP_CONSECUTIVE:
+ filter->consecutive = g_value_get_int (value);
+ break;
+ case PROP_DROP_INCOMPLETE:
+ filter->drop_incomplete = g_value_get_boolean (value);
+ break;
+ case PROP_USE_AVC:
+ filter->use_avc = g_value_get_boolean (value);
+ break;
+ case PROP_GUID:
+ filter->guid = g_value_get_uint64 (value);
+ gst_dv1394src_update_device_name (filter);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+gst_dv1394src_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
+{
+ GstDV1394Src *filter = GST_DV1394SRC (object);
+
+ switch (prop_id) {
+ case PROP_PORT:
+ g_value_set_int (value, filter->port);
+ break;
+ case PROP_CHANNEL:
+ g_value_set_int (value, filter->channel);
+ break;
+ case PROP_SKIP:
+ g_value_set_int (value, filter->skip);
+ break;
+ case PROP_CONSECUTIVE:
+ g_value_set_int (value, filter->consecutive);
+ break;
+ case PROP_DROP_INCOMPLETE:
+ g_value_set_boolean (value, filter->drop_incomplete);
+ break;
+ case PROP_USE_AVC:
+ g_value_set_boolean (value, filter->use_avc);
+ break;
+ case PROP_GUID:
+ g_value_set_uint64 (value, filter->guid);
+ break;
+ case PROP_DEVICE_NAME:
+ g_value_set_string (value, filter->device_name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static GstClock *
+gst_dv1394src_provide_clock (GstElement * element)
+{
+ GstDV1394Src *dv1394src = GST_DV1394SRC (element);
+
+ return GST_CLOCK_CAST (gst_object_ref (dv1394src->provided_clock));
+}
+
+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;
+}
+
+#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 */
+
+#ifdef HAVE_LIBIEC61883
+static int
+gst_dv1394src_iec61883_receive (unsigned char *data, int len,
+ int complete, void *cbdata)
+{
+ GstDV1394Src *dv1394src = GST_DV1394SRC (cbdata);
+
+ if (G_UNLIKELY (!GST_PAD_CAPS (GST_BASE_SRC_PAD (dv1394src)))) {
+ 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);
+ }
+
+ dv1394src->frame = NULL;
+ 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);
+ dv1394src->buf = buf;
+ }
+ }
+ dv1394src->frame_sequence++;
+ return 0;
+}
+
+#else
+static int
+gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len,
+ quadlet_t * data)
+{
+ GstDV1394Src *dv1394src = gst_dv1394src_from_raw1394handle (handle);
+
+ if (len > 16) {
+ /*
+ the following code taken from kino-0.51 (Dan Dennedy/Charles Yates)
+ Kindly relicensed under the LGPL. See the commit log for version 1.6 of
+ this file in CVS.
+ */
+ unsigned char *p = (unsigned char *) &data[3];
+
+ 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 */
+ 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
+ */
+ if (section_type == 0 && dif_sequence == 0) { // dif header
+ if (!GST_PAD_CAPS (GST_BASE_SRC_PAD (dv1394src))) {
+ GstCaps *caps;
+
+ // 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);
+ }
+ // drop last frame when not complete
+ if (!dv1394src->drop_incomplete
+ || dv1394src->bytes_in_frame == dv1394src->frame_size) {
+ dv1394src->buf = dv1394src->frame;
+ } else {
+ GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped");
+ g_signal_emit (G_OBJECT (dv1394src),
+ gst_dv1394src_signals[SIGNAL_FRAME_DROPPED], 0);
+ if (dv1394src->frame) {
+ gst_buffer_unref (dv1394src->frame);
+ }
+ }
+ if ((dv1394src->frame_sequence + 1) % (dv1394src->skip +
+ dv1394src->consecutive) < dv1394src->consecutive) {
+ GstBuffer *buf;
+ gint64 i64;
+
+ buf = gst_buffer_new_and_alloc (dv1394src->frame_size);
+
+ /* fill in offset, duration, timestamp */
+ GST_BUFFER_OFFSET (buf) = dv1394src->frame_sequence;
+ dv1394src->frame = buf;
+ }
+ dv1394src->frame_sequence++;
+ dv1394src->bytes_in_frame = 0;
+ }
+
+ if (dv1394src->frame != NULL) {
+ guint8 *data = GST_BUFFER_DATA (dv1394src->frame);
+
+ switch (section_type) {
+ 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;
+
+ default: /* we can't handle any other data */
+ break;
+ }
+ dv1394src->bytes_in_frame += 480;
+ }
+ }
+
+ return 0;
+}
+#endif
+/*
+ * 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)
+ */
+static int
+gst_dv1394src_bus_reset (raw1394handle_t handle, unsigned int generation)
+{
+ GstDV1394Src *src;
+ gint nodecount;
+ GstMessage *message;
+ GstStructure *structure;
+ gint current_device_change;
+ gint i;
+
+ src = gst_dv1394src_from_raw1394handle (handle);
+
+ GST_INFO_OBJECT (src, "have bus reset");
+
+ /* update generation - told to do so by docs */
+ raw1394_update_generation (handle, generation);
+ nodecount = raw1394_get_nodecount (handle);
+ /* 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;
+ }
+
+ structure = gst_structure_new ("ieee1394-bus-reset", "nodecount", G_TYPE_INT,
+ nodecount, "current-device-change", G_TYPE_INT, current_device_change,
+ NULL);
+ message = gst_message_new_element (GST_OBJECT (src), structure);
+ gst_element_post_message (GST_ELEMENT (src), message);
+
+ return 0;
+}
+
+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);
+ pollfds[0].events = POLLIN | POLLERR | POLLHUP | POLLPRI;
+ pollfds[1].fd = READ_SOCKET (dv1394src);
+ pollfds[1].events = POLLIN | POLLERR | POLLHUP | POLLPRI;
+
+ if (G_UNLIKELY (dv1394src->buf)) {
+ /* maybe we had an error before, and there's a stale buffer? */
+ gst_buffer_unref (dv1394src->buf);
+ dv1394src->buf = NULL;
+ }
+
+ while (TRUE) {
+ int res = poll (pollfds, 2, -1);
+
+ if (G_UNLIKELY (res < 0)) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+ else
+ goto error_while_polling;
+ }
+
+ if (G_UNLIKELY (pollfds[1].revents)) {
+ char command;
+
+ if (pollfds[1].revents & POLLIN)
+ READ_COMMAND (dv1394src, command, res);
+
+ goto told_to_stop;
+ } else if (G_LIKELY (pollfds[0].revents & POLLIN)) {
+ /* shouldn't block in theory */
+ raw1394_loop_iterate (dv1394src->handle);
+
+ if (dv1394src->buf)
+ break;
+ }
+ }
+
+ 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;
+
+error_while_polling:
+ {
+ GST_ELEMENT_ERROR (dv1394src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+ return GST_FLOW_UNEXPECTED;
+ }
+told_to_stop:
+ {
+ GST_DEBUG_OBJECT (dv1394src, "told to stop, shutting down");
+ return GST_FLOW_WRONG_STATE;
+ }
+}
+
+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) {
+ GST_WARNING ("raw1394 - failed to get handle: %s.\n", strerror (errno));
+ continue;
+ }
+ if (raw1394_get_port_info (handle, pinf, 16) < 0) {
+ GST_WARNING ("raw1394 - failed to get port info: %s.\n",
+ strerror (errno));
+ goto next;
+ }
+
+ /* tell raw1394 which host adapter to use */
+ if (raw1394_set_port (handle, j) < 0) {
+ GST_WARNING ("raw1394 - failed to set set port: %s.\n", strerror (errno));
+ goto next;
+ }
+
+ /* now loop over all the nodes */
+ for (i = 0; i < raw1394_get_nodecount (handle); i++) {
+ /* are we looking for an explicit GUID ? */
+ if (src->guid != 0) {
+ if (src->guid == rom1394_get_guid (handle, i)) {
+ node = i;
+ src->port = j;
+ g_free (src->uri);
+ src->uri = g_strdup_printf ("dv://%d", src->port);
+ break;
+ }
+ } else {
+ rom1394_directory rom_dir;
+
+ /* select first AV/C Tape Recorder Player node */
+ if (rom1394_get_directory (handle, i, &rom_dir) < 0) {
+ GST_WARNING ("error reading config rom directory for node %d\n", i);
+ 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;
+ src->guid = rom1394_get_guid (handle, i);
+ g_free (src->uri);
+ src->uri = g_strdup_printf ("dv://%d", src->port);
+ g_free (src->device_name);
+ src->device_name = g_strdup (rom_dir.label);
+ break;
+ }
+ rom1394_free_directory (&rom_dir);
+ }
+ }
+ next:
+ raw1394_destroy_handle (handle);
+ }
+ return node;
+}
+
+static gboolean
+gst_dv1394src_start (GstBaseSrc * bsrc)
+{
+ GstDV1394Src *src = GST_DV1394SRC (bsrc);
+ int control_sock[2];
+
+ src->connected = FALSE;
+
+ 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);
+
+ src->handle = raw1394_new_handle ();
+
+ if (!src->handle) {
+ if (errno == EACCES)
+ goto permission_denied;
+ else if (errno == ENOENT)
+ goto not_found;
+ else
+ goto no_handle;
+ }
+
+ src->num_ports = raw1394_get_port_info (src->handle, src->pinfo, 16);
+
+ if (src->num_ports == 0)
+ goto no_ports;
+
+ if (src->use_avc || src->port == -1)
+ src->avc_node = gst_dv1394src_discover_avc_node (src);
+
+ /* 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)
+ goto cannot_set_port;
+
+ raw1394_set_userdata (src->handle, src);
+ raw1394_set_bus_reset_handler (src->handle, gst_dv1394src_bus_reset);
+
+#ifdef HAVE_LIBIEC61883
+ if ((src->iec61883dv =
+ iec61883_dv_fb_init (src->handle,
+ gst_dv1394src_iec61883_receive, src)) == NULL)
+ goto cannot_initialise_dv;
+
+#else
+ raw1394_set_iso_handler (src->handle, src->channel,
+ gst_dv1394src_iso_receive);
+#endif
+
+ GST_DEBUG_OBJECT (src, "successfully opened up 1394 connection");
+ src->connected = TRUE;
+
+#ifdef HAVE_LIBIEC61883
+ if (iec61883_dv_fb_start (src->iec61883dv, src->channel) != 0)
+ goto cannot_start;
+#else
+ if (raw1394_start_iso_rcv (src->handle, src->channel) < 0)
+ goto cannot_start;
+#endif
+
+ if (src->use_avc) {
+ raw1394handle_t avc_handle = raw1394_new_handle_on_port (src->port);
+
+ /* start 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)
+ 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));
+ }
+ }
+
+ gst_1394_clock_set_handle (src->provided_clock, src->handle);
+
+ return TRUE;
+
+socket_pair:
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
+ GST_ERROR_SYSTEM);
+ return FALSE;
+ }
+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;
+ }
+no_handle:
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
+ ("can't get raw1394 handle (%s)", g_strerror (errno)));
+ return FALSE;
+ }
+no_ports:
+ {
+ raw1394_destroy_handle (src->handle);
+ src->handle = NULL;
+ GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
+ ("no ports available for raw1394"));
+ return FALSE;
+ }
+cannot_set_port:
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
+ ("can't set 1394 port %d", src->port));
+ return FALSE;
+ }
+cannot_start:
+ {
+ raw1394_destroy_handle (src->handle);
+ src->handle = NULL;
+#ifdef HAVE_LIBIEC61883
+ iec61883_dv_fb_close (src->iec61883dv);
+ src->iec61883dv = NULL;
+#endif
+ GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
+ ("can't start 1394 iso receive"));
+ return FALSE;
+ }
+#ifdef HAVE_LIBIEC61883
+cannot_initialise_dv:
+ {
+ raw1394_destroy_handle (src->handle);
+ src->handle = NULL;
+ GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
+ ("can't initialise iec61883 dv"));
+ return FALSE;
+ }
+#endif
+}
+
+static gboolean
+gst_dv1394src_stop (GstBaseSrc * bsrc)
+{
+ GstDV1394Src *src = GST_DV1394SRC (bsrc);
+
+ close (READ_SOCKET (src));
+ close (WRITE_SOCKET (src));
+ READ_SOCKET (src) = -1;
+ WRITE_SOCKET (src) = -1;
+#ifdef HAVE_LIBIEC61883
+ iec61883_dv_fb_close (src->iec61883dv);
+#else
+ raw1394_stop_iso_rcv (src->handle, src->channel);
+#endif
+
+ if (src->use_avc) {
+ 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));
+ }
+ }
+
+ gst_1394_clock_unset_handle (src->provided_clock);
+
+ raw1394_destroy_handle (src->handle);
+
+ return TRUE;
+}
+
+static gboolean
+gst_dv1394src_unlock (GstBaseSrc * bsrc)
+{
+ GstDV1394Src *src = GST_DV1394SRC (bsrc);
+
+ SEND_COMMAND (src, CONTROL_STOP);
+
+ return TRUE;
+}
+
+static gboolean
+gst_dv1394src_query (GstBaseSrc * basesrc, GstQuery * query)
+{
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_LATENCY:
+ {
+ gst_query_set_latency (query, TRUE, GST_SECOND / 25, GST_CLOCK_TIME_NONE);
+ }
+ break;
+ default:
+ goto not_supported;
+ }
+
+ return TRUE;
+
+not_supported:
+ return GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
+}
+
+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;
+ }
+}
+
+/*** GSTURIHANDLER INTERFACE *************************************************/
+
+static guint
+gst_dv1394src_uri_get_type (void)
+{
+ return GST_URI_SRC;
+}
+
+static gchar **
+gst_dv1394src_uri_get_protocols (void)
+{
+ static gchar *protocols[] = { (char *) "dv", NULL };
+
+ return protocols;
+}
+
+static const gchar *
+gst_dv1394src_uri_get_uri (GstURIHandler * handler)
+{
+ GstDV1394Src *gst_dv1394src = GST_DV1394SRC (handler);
+
+ return gst_dv1394src->uri;
+}
+
+static gboolean
+gst_dv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+{
+ gchar *protocol, *location;
+ gboolean ret = TRUE;
+ GstDV1394Src *gst_dv1394src = GST_DV1394SRC (handler);
+
+ protocol = gst_uri_get_protocol (uri);
+ if (strcmp (protocol, "dv") != 0) {
+ g_free (protocol);
+ return FALSE;
+ }
+ g_free (protocol);
+
+ location = gst_uri_get_location (uri);
+ if (location && *location != '\0')
+ gst_dv1394src->port = strtol (location, NULL, 10);
+ else
+ gst_dv1394src->port = DEFAULT_PORT;
+ g_free (location);
+ g_free (gst_dv1394src->uri);
+ gst_dv1394src->uri = g_strdup_printf ("dv://%d", gst_dv1394src->port);
+
+ 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;
+}
diff --git a/ext/raw1394/gstdv1394src.h b/ext/raw1394/gstdv1394src.h
new file mode 100644
index 0000000..bf9a3e0
--- /dev/null
+++ b/ext/raw1394/gstdv1394src.h
@@ -0,0 +1,101 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_GST1394_H__
+#define __GST_GST1394_H__
+
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+#include "gst1394clock.h"
+
+#include <libraw1394/raw1394.h>
+#ifdef HAVE_LIBIEC61883
+#include <libiec61883/iec61883.h>
+#endif
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DV1394SRC \
+ (gst_dv1394src_get_type())
+#define GST_DV1394SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DV1394SRC,GstDV1394Src))
+#define GST_DV1394SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DV1394SRC,GstDV1394SrcClass))
+#define GST_IS_DV1394SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DV1394SRC))
+#define GST_IS_DV1394SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DV1394SRC))
+
+typedef struct _GstDV1394Src GstDV1394Src;
+typedef struct _GstDV1394SrcClass GstDV1394SrcClass;
+
+struct _GstDV1394Src {
+ GstPushSrc element;
+
+ // consecutive=2, skip=4 will skip 4 frames, then let 2 consecutive ones thru
+ gint consecutive;
+ gint skip;
+ gboolean drop_incomplete;
+
+ gint num_ports;
+ gint port;
+ gint channel;
+ octlet_t guid;
+ gint avc_node;
+ gboolean use_avc;
+
+ struct raw1394_portinfo pinfo[16];
+ raw1394handle_t handle;
+
+ GstBuffer *buf;
+
+ GstBuffer *frame;
+ guint frame_size;
+ guint frame_rate;
+ guint bytes_in_frame;
+ guint frame_sequence;
+
+ int control_sock[2];
+
+ gchar *uri;
+
+ gchar *device_name;
+
+ gboolean connected;
+ #ifdef HAVE_LIBIEC61883
+ iec61883_dv_fb_t iec61883dv;
+ #endif
+
+ Gst1394Clock *provided_clock;
+};
+
+struct _GstDV1394SrcClass {
+ GstPushSrcClass parent_class;
+
+ /* signal */
+ void (*frame_dropped) (GstElement *elem);
+};
+
+GType gst_dv1394src_get_type(void);
+
+G_END_DECLS
+
+#endif /* __GST_GST1394_H__ */
diff --git a/ext/raw1394/gsthdv1394src.c b/ext/raw1394/gsthdv1394src.c
new file mode 100644
index 0000000..33ef11e
--- /dev/null
+++ b/ext/raw1394/gsthdv1394src.c
@@ -0,0 +1,844 @@
+/* GStreamer
+ * Copyright (C) <2008> Edward Hervey <bilboed@bilboed.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/**
+ * SECTION:element-hdv1394src
+ *
+ * Read MPEG-TS data from firewire port.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch hdv1394src ! queue ! decodebin name=d ! queue ! xvimagesink d. ! queue ! alsasink
+ * ]| captures from the firewire port and plays the streams.
+ * |[
+ * gst-launch hdv1394src ! queue ! filesink location=mydump.ts
+ * ]| capture to a disk file
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <unistd.h>
+#include <sys/poll.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <libavc1394/avc1394.h>
+#include <libavc1394/avc1394_vcr.h>
+#include <libavc1394/rom1394.h>
+#include <libraw1394/raw1394.h>
+#include <libiec61883/iec61883.h>
+
+#include <gst/gst.h>
+
+#include "gsthdv1394src.h"
+#include "gst1394probe.h"
+
+
+#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 { \
+ int G_GNUC_UNUSED _res; unsigned char c; c = command; \
+ _res = write (WRITE_SOCKET(src), &c, 1); \
+} G_STMT_END
+
+#define READ_COMMAND(src, command, res) \
+G_STMT_START { \
+ res = read(READ_SOCKET(src), &command, 1); \
+} G_STMT_END
+
+
+GST_DEBUG_CATEGORY_STATIC (hdv1394src_debug);
+#define GST_CAT_DEFAULT (hdv1394src_debug)
+
+#define DEFAULT_PORT -1
+#define DEFAULT_CHANNEL 63
+#define DEFAULT_USE_AVC TRUE
+#define DEFAULT_GUID 0
+
+enum
+{
+ PROP_0,
+ PROP_PORT,
+ PROP_CHANNEL,
+ PROP_USE_AVC,
+ PROP_GUID,
+ PROP_DEVICE_NAME
+};
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS
+ ("video/mpegts,systemstream=(boolean)true,packetsize=(int)188")
+ );
+
+static void gst_hdv1394src_uri_handler_init (gpointer g_iface,
+ gpointer iface_data);
+
+static void gst_hdv1394src_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_hdv1394src_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static void gst_hdv1394src_dispose (GObject * object);
+
+static gboolean gst_hdv1394src_start (GstBaseSrc * bsrc);
+static gboolean gst_hdv1394src_stop (GstBaseSrc * bsrc);
+static gboolean gst_hdv1394src_unlock (GstBaseSrc * bsrc);
+
+static GstFlowReturn gst_hdv1394src_create (GstPushSrc * psrc,
+ GstBuffer ** buf);
+
+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_static_pad_template (element_class, &src_factory);
+
+ gst_element_class_set_details_simple (element_class,
+ "Firewire (1394) HDV video source", "Source/Video",
+ "Source for MPEG-TS video data from firewire port",
+ "Edward Hervey <bilboed@bilboed.com>");
+}
+
+static void
+gst_hdv1394src_class_init (GstHDV1394SrcClass * klass)
+{
+ GObjectClass *gobject_class;
+ GstBaseSrcClass *gstbasesrc_class;
+ GstPushSrcClass *gstpushsrc_class;
+
+ gobject_class = (GObjectClass *) klass;
+ gstbasesrc_class = (GstBaseSrcClass *) klass;
+ gstpushsrc_class = (GstPushSrcClass *) klass;
+
+ gobject_class->set_property = gst_hdv1394src_set_property;
+ gobject_class->get_property = gst_hdv1394src_get_property;
+ gobject_class->dispose = gst_hdv1394src_dispose;
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
+ g_param_spec_int ("port", "Port", "Port number (-1 automatic)",
+ -1, 16, DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CHANNEL,
+ g_param_spec_int ("channel", "Channel", "Channel number for listening",
+ 0, 64, DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_USE_AVC,
+ g_param_spec_boolean ("use-avc", "Use AV/C", "Use AV/C VTR control",
+ DEFAULT_USE_AVC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GUID,
+ 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,
+ DEFAULT_GUID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GstHDV1394Src:device-name
+ *
+ * Descriptive name of the currently opened device
+ *
+ * Since: 0.10.7
+ **/
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE_NAME,
+ g_param_spec_string ("device-name", "device name",
+ "user-friendly name of the device", "Default",
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ gstbasesrc_class->negotiate = NULL;
+ gstbasesrc_class->start = gst_hdv1394src_start;
+ gstbasesrc_class->stop = gst_hdv1394src_stop;
+ gstbasesrc_class->unlock = gst_hdv1394src_unlock;
+
+ gstpushsrc_class->create = gst_hdv1394src_create;
+}
+
+static void
+gst_hdv1394src_init (GstHDV1394Src * dv1394src, GstHDV1394SrcClass * klass)
+{
+ GstPad *srcpad = GST_BASE_SRC_PAD (dv1394src);
+
+ gst_base_src_set_live (GST_BASE_SRC (dv1394src), TRUE);
+ gst_pad_use_fixed_caps (srcpad);
+
+ dv1394src->port = DEFAULT_PORT;
+ dv1394src->channel = DEFAULT_CHANNEL;
+
+ dv1394src->use_avc = DEFAULT_USE_AVC;
+ dv1394src->guid = DEFAULT_GUID;
+ dv1394src->uri = g_strdup_printf ("hdv://%d", dv1394src->port);
+ dv1394src->device_name = g_strdup_printf ("Default");
+
+ READ_SOCKET (dv1394src) = -1;
+ WRITE_SOCKET (dv1394src) = -1;
+
+ dv1394src->frame_sequence = 0;
+}
+
+static void
+gst_hdv1394src_dispose (GObject * object)
+{
+ GstHDV1394Src *src = GST_HDV1394SRC (object);
+
+ g_free (src->uri);
+ src->uri = NULL;
+
+ g_free (src->device_name);
+ src->device_name = NULL;
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gst_hdv1394src_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstHDV1394Src *filter = GST_HDV1394SRC (object);
+
+ switch (prop_id) {
+ case PROP_PORT:
+ filter->port = g_value_get_int (value);
+ g_free (filter->uri);
+ filter->uri = g_strdup_printf ("hdv://%d", filter->port);
+ break;
+ case PROP_CHANNEL:
+ filter->channel = g_value_get_int (value);
+ break;
+ case PROP_USE_AVC:
+ filter->use_avc = g_value_get_boolean (value);
+ break;
+ case PROP_GUID:
+ filter->guid = g_value_get_uint64 (value);
+ gst_hdv1394src_update_device_name (filter);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+gst_hdv1394src_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
+{
+ GstHDV1394Src *filter = GST_HDV1394SRC (object);
+
+ switch (prop_id) {
+ case PROP_PORT:
+ g_value_set_int (value, filter->port);
+ break;
+ case PROP_CHANNEL:
+ g_value_set_int (value, filter->channel);
+ break;
+ case PROP_USE_AVC:
+ g_value_set_boolean (value, filter->use_avc);
+ break;
+ case PROP_GUID:
+ g_value_set_uint64 (value, filter->guid);
+ break;
+ case PROP_DEVICE_NAME:
+ g_value_set_string (value, filter->device_name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static GstHDV1394Src *
+gst_hdv1394src_from_raw1394handle (raw1394handle_t handle)
+{
+ iec61883_mpeg2_t mpeg2 = (iec61883_mpeg2_t) raw1394_get_userdata (handle);
+ return GST_HDV1394SRC (iec61883_mpeg2_get_callback_data (mpeg2));
+}
+
+/* Within one loop iteration (which may call _receive() many times), it seems
+ * as though '*data' will always be different.
+ *
+ * We can therefore assume that any '*data' given to us will stay allocated until
+ * the next loop iteration.
+ */
+
+static int
+gst_hdv1394src_iec61883_receive (unsigned char *data, int len,
+ unsigned int dropped, void *cbdata)
+{
+ GstHDV1394Src *dv1394src = GST_HDV1394SRC (cbdata);
+
+ GST_LOG ("data:%p, len:%d, dropped:%d", data, len, dropped);
+
+ /* error out if we don't have enough room ! */
+ if (G_UNLIKELY (dv1394src->outoffset > (2048 * 188 - len)))
+ return -1;
+
+ if (G_LIKELY (len == IEC61883_MPEG2_TSP_SIZE)) {
+ memcpy ((guint8 *) dv1394src->outdata + dv1394src->outoffset, data, len);
+ dv1394src->outoffset += len;
+ }
+ dv1394src->frame_sequence++;
+ return 0;
+}
+
+/*
+ * 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)
+ */
+static int
+gst_hdv1394src_bus_reset (raw1394handle_t handle, unsigned int generation)
+{
+ GstHDV1394Src *src;
+ gint nodecount;
+ GstMessage *message;
+ GstStructure *structure;
+ gint current_device_change;
+ gint i;
+
+ src = gst_hdv1394src_from_raw1394handle (handle);
+
+ GST_INFO_OBJECT (src, "have bus reset");
+
+ /* update generation - told to do so by docs */
+ raw1394_update_generation (handle, generation);
+ nodecount = raw1394_get_nodecount (handle);
+ /* 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;
+ }
+
+ structure = gst_structure_new ("ieee1394-bus-reset", "nodecount", G_TYPE_INT,
+ nodecount, "current-device-change", G_TYPE_INT, current_device_change,
+ NULL);
+ message = gst_message_new_element (GST_OBJECT (src), structure);
+ gst_element_post_message (GST_ELEMENT (src), message);
+
+ return 0;
+}
+
+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);
+ pollfds[0].events = POLLIN | POLLERR | POLLHUP | POLLPRI;
+ pollfds[1].fd = READ_SOCKET (dv1394src);
+ pollfds[1].events = POLLIN | POLLERR | POLLHUP | POLLPRI;
+
+ /* allocate a 2048 samples buffer */
+ dv1394src->outdata = g_malloc (2048 * 188);
+ dv1394src->outoffset = 0;
+
+ GST_DEBUG ("Create...");
+
+ while (TRUE) {
+ int res = poll (pollfds, 2, -1);
+
+ GST_LOG ("res:%d", res);
+
+ if (G_UNLIKELY (res < 0)) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+ else
+ goto error_while_polling;
+ }
+
+ if (G_UNLIKELY (pollfds[1].revents)) {
+ char command;
+
+ if (pollfds[1].revents & POLLIN)
+ READ_COMMAND (dv1394src, command, res);
+
+ goto told_to_stop;
+ } else if (G_LIKELY (pollfds[0].revents & POLLIN)) {
+ int pt;
+
+ pt = dv1394src->frame_sequence;
+ /* shouldn't block in theory */
+ GST_LOG ("Iterating ! (%d)", dv1394src->frame_sequence);
+ raw1394_loop_iterate (dv1394src->handle);
+ GST_LOG ("After iteration : %d (diff:%d)",
+ dv1394src->frame_sequence, dv1394src->frame_sequence - pt);
+ if (dv1394src->outoffset)
+ break;
+ }
+ }
+
+ g_assert (dv1394src->outoffset);
+
+ 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;
+ 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:
+ {
+ GST_ELEMENT_ERROR (dv1394src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+ return GST_FLOW_UNEXPECTED;
+ }
+told_to_stop:
+ {
+ GST_DEBUG_OBJECT (dv1394src, "told to stop, shutting down");
+ return GST_FLOW_WRONG_STATE;
+ }
+}
+
+static int
+gst_hdv1394src_discover_avc_node (GstHDV1394Src * 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) {
+ GST_WARNING ("raw1394 - failed to get handle: %s.\n", strerror (errno));
+ continue;
+ }
+ if (raw1394_get_port_info (handle, pinf, 16) < 0) {
+ GST_WARNING ("raw1394 - failed to get port info: %s.\n",
+ strerror (errno));
+ goto next;
+ }
+
+ /* tell raw1394 which host adapter to use */
+ if (raw1394_set_port (handle, j) < 0) {
+ GST_WARNING ("raw1394 - failed to set set port: %s.\n", strerror (errno));
+ goto next;
+ }
+
+ /* now loop over all the nodes */
+ for (i = 0; i < raw1394_get_nodecount (handle); i++) {
+ /* are we looking for an explicit GUID ? */
+ if (src->guid != 0) {
+ if (src->guid == rom1394_get_guid (handle, i)) {
+ node = i;
+ src->port = j;
+ g_free (src->uri);
+ src->uri = g_strdup_printf ("dv://%d", src->port);
+ break;
+ }
+ } else {
+ rom1394_directory rom_dir;
+
+ /* select first AV/C Tape Recorder Player node */
+ if (rom1394_get_directory (handle, i, &rom_dir) < 0) {
+ GST_WARNING ("error reading config rom directory for node %d\n", i);
+ 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;
+ src->guid = rom1394_get_guid (handle, i);
+ g_free (src->uri);
+ src->uri = g_strdup_printf ("dv://%d", src->port);
+ g_free (src->device_name);
+ src->device_name = g_strdup (rom_dir.label);
+ break;
+ }
+ rom1394_free_directory (&rom_dir);
+ }
+ }
+ next:
+ raw1394_destroy_handle (handle);
+ }
+ return node;
+}
+
+static gboolean
+gst_hdv1394src_start (GstBaseSrc * bsrc)
+{
+ GstHDV1394Src *src = GST_HDV1394SRC (bsrc);
+ int control_sock[2];
+
+ src->connected = FALSE;
+
+ 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);
+
+ src->handle = raw1394_new_handle ();
+
+ if (!src->handle) {
+ if (errno == EACCES)
+ goto permission_denied;
+ else if (errno == ENOENT)
+ goto not_found;
+ else
+ goto no_handle;
+ }
+
+ src->num_ports = raw1394_get_port_info (src->handle, src->pinfo, 16);
+
+ if (src->num_ports == 0)
+ goto no_ports;
+
+ if (src->use_avc || src->port == -1)
+ src->avc_node = gst_hdv1394src_discover_avc_node (src);
+
+ /* 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)
+ goto cannot_set_port;
+
+ raw1394_set_userdata (src->handle, src);
+ raw1394_set_bus_reset_handler (src->handle, gst_hdv1394src_bus_reset);
+
+ if ((src->iec61883mpeg2 =
+ iec61883_mpeg2_recv_init (src->handle,
+ gst_hdv1394src_iec61883_receive, src)) == NULL)
+ goto cannot_initialise_dv;
+
+#if 0
+ raw1394_set_iso_handler (src->handle, src->channel,
+ gst_hdv1394src_iso_receive);
+#endif
+
+ GST_DEBUG_OBJECT (src, "successfully opened up 1394 connection");
+ src->connected = TRUE;
+
+ if (iec61883_mpeg2_recv_start (src->iec61883mpeg2, src->channel) != 0)
+ goto cannot_start;
+#if 0
+ if (raw1394_start_iso_rcv (src->handle, src->channel) < 0)
+ goto cannot_start;
+#endif
+
+ if (src->use_avc) {
+ raw1394handle_t avc_handle = raw1394_new_handle_on_port (src->port);
+
+ GST_LOG ("We have an avc_handle");
+
+ /* start 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) {
+ GST_LOG ("Calling avc1394_vcr_play()");
+ 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));
+ }
+ }
+
+ return TRUE;
+
+socket_pair:
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
+ GST_ERROR_SYSTEM);
+ return FALSE;
+ }
+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;
+ }
+no_handle:
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
+ ("can't get raw1394 handle (%s)", g_strerror (errno)));
+ return FALSE;
+ }
+no_ports:
+ {
+ raw1394_destroy_handle (src->handle);
+ src->handle = NULL;
+ GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
+ ("no ports available for raw1394"));
+ return FALSE;
+ }
+cannot_set_port:
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
+ ("can't set 1394 port %d", src->port));
+ return FALSE;
+ }
+cannot_start:
+ {
+ raw1394_destroy_handle (src->handle);
+ src->handle = NULL;
+ iec61883_mpeg2_close (src->iec61883mpeg2);
+ src->iec61883mpeg2 = NULL;
+ GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
+ ("can't start 1394 iso receive"));
+ return FALSE;
+ }
+cannot_initialise_dv:
+ {
+ raw1394_destroy_handle (src->handle);
+ src->handle = NULL;
+ GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
+ ("can't initialise iec61883 hdv"));
+ return FALSE;
+ }
+}
+
+static gboolean
+gst_hdv1394src_stop (GstBaseSrc * bsrc)
+{
+ GstHDV1394Src *src = GST_HDV1394SRC (bsrc);
+
+ close (READ_SOCKET (src));
+ close (WRITE_SOCKET (src));
+ READ_SOCKET (src) = -1;
+ WRITE_SOCKET (src) = -1;
+
+ iec61883_mpeg2_close (src->iec61883mpeg2);
+#if 0
+ raw1394_stop_iso_rcv (src->handle, src->channel);
+#endif
+
+ if (src->use_avc) {
+ 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));
+ }
+ }
+
+ raw1394_destroy_handle (src->handle);
+
+ return TRUE;
+}
+
+static gboolean
+gst_hdv1394src_unlock (GstBaseSrc * bsrc)
+{
+ GstHDV1394Src *src = GST_HDV1394SRC (bsrc);
+
+ SEND_COMMAND (src, CONTROL_STOP);
+
+ return TRUE;
+}
+
+static void
+gst_hdv1394src_update_device_name (GstHDV1394Src * 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;
+ }
+}
+
+/*** GSTURIHANDLER INTERFACE *************************************************/
+
+static guint
+gst_hdv1394src_uri_get_type (void)
+{
+ return GST_URI_SRC;
+}
+
+static gchar **
+gst_hdv1394src_uri_get_protocols (void)
+{
+ static gchar *protocols[] = { (char *) "hdv", NULL };
+
+ return protocols;
+}
+
+static const gchar *
+gst_hdv1394src_uri_get_uri (GstURIHandler * handler)
+{
+ GstHDV1394Src *gst_hdv1394src = GST_HDV1394SRC (handler);
+
+ return gst_hdv1394src->uri;
+}
+
+static gboolean
+gst_hdv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+{
+ gchar *protocol, *location;
+ gboolean ret = TRUE;
+ GstHDV1394Src *gst_hdv1394src = GST_HDV1394SRC (handler);
+
+ protocol = gst_uri_get_protocol (uri);
+ if (strcmp (protocol, "hdv") != 0) {
+ g_free (protocol);
+ return FALSE;
+ }
+ g_free (protocol);
+
+ location = gst_uri_get_location (uri);
+ if (location && *location != '\0')
+ gst_hdv1394src->port = strtol (location, NULL, 10);
+ else
+ gst_hdv1394src->port = DEFAULT_PORT;
+ g_free (location);
+ g_free (gst_hdv1394src->uri);
+ gst_hdv1394src->uri = g_strdup_printf ("hdv://%d", gst_hdv1394src->port);
+
+ return ret;
+}
+
+static void
+gst_hdv1394src_uri_handler_init (gpointer g_iface, gpointer iface_data)
+{
+ GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
+
+ iface->get_type = gst_hdv1394src_uri_get_type;
+ iface->get_protocols = gst_hdv1394src_uri_get_protocols;
+ iface->get_uri = gst_hdv1394src_uri_get_uri;
+ iface->set_uri = gst_hdv1394src_uri_set_uri;
+}
diff --git a/ext/raw1394/gsthdv1394src.h b/ext/raw1394/gsthdv1394src.h
new file mode 100644
index 0000000..a6014a4
--- /dev/null
+++ b/ext/raw1394/gsthdv1394src.h
@@ -0,0 +1,85 @@
+/* GStreamer
+ * Copyright (C) <2008> Edward Hervey <bilboed@bilboed.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_GSTHDV1394_H__
+#define __GST_GSTHDV1394_H__
+
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+
+#include <libraw1394/raw1394.h>
+#ifdef HAVE_LIBIEC61883
+#include <libiec61883/iec61883.h>
+#endif
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_HDV1394SRC \
+ (gst_hdv1394src_get_type())
+#define GST_HDV1394SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HDV1394SRC,GstHDV1394Src))
+#define GST_HDV1394SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_HDV1394SRC,GstHDV1394SrcClass))
+#define GST_IS_HDV1394SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_HDV1394SRC))
+#define GST_IS_HDV1394SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_HDV1394SRC))
+
+typedef struct _GstHDV1394Src GstHDV1394Src;
+typedef struct _GstHDV1394SrcClass GstHDV1394SrcClass;
+
+struct _GstHDV1394Src {
+ GstPushSrc element;
+
+ gint num_ports;
+ gint port;
+ gint channel;
+ octlet_t guid;
+ gint avc_node;
+ gboolean use_avc;
+
+ struct raw1394_portinfo pinfo[16];
+ raw1394handle_t handle;
+
+ gpointer outdata;
+ gsize outoffset;
+ guint frame_size;
+ guint frame_sequence;
+
+ int control_sock[2];
+
+ gchar *uri;
+
+ gchar *device_name;
+
+ gboolean connected;
+ iec61883_mpeg2_t iec61883mpeg2;
+};
+
+struct _GstHDV1394SrcClass {
+ GstPushSrcClass parent_class;
+};
+
+GType gst_hdv1394src_get_type(void);
+
+G_END_DECLS
+
+#endif /* __GST_GST1394_H__ */