diff options
author | Nicolas Dechesne <n-dechesne@ti.com> | 2011-09-30 00:54:14 +0200 |
---|---|---|
committer | Nicolas Dechesne <n-dechesne@ti.com> | 2011-09-30 00:54:14 +0200 |
commit | beb43201c942afa12dfc4225218b61fcd6e90923 (patch) | |
tree | a1d85bac4a9ad32ed087d08ecd99ac3c03b9aa0a /tests |
Imported Upstream version 0.11.1upstream/0.11.1
Diffstat (limited to 'tests')
162 files changed, 55907 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..23ff192 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,35 @@ +EXTRA_DIST = README + +if BUILD_TESTS +## SUBDIRS_TESTS = tests testsuite +## FIXME: write tests from scratch +SUBDIRS_TESTS = +if HAVE_CHECK +SUBDIRS_CHECK = check +else +SUBDIRS_CHECK = +endif +else +SUBDIRS_TESTS = +SUBDIRS_CHECK = +endif + +if BUILD_EXAMPLES +SUBDIRS_EXAMPLES = examples +else +SUBDIRS_EXAMPLES = +endif + +SUBDIRS = \ + benchmarks \ + $(SUBDIRS_CHECK) \ + misc \ + $(SUBDIRS_TESTS) \ + $(SUBDIRS_EXAMPLES) + +# These are all the possible subdirs +DIST_SUBDIRS = \ + benchmarks \ + check \ + examples \ + misc diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..ba0d7b6 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,760 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 = tests +DIST_COMMON = README $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +EXTRA_DIST = README +@BUILD_TESTS_FALSE@SUBDIRS_TESTS = +@BUILD_TESTS_TRUE@SUBDIRS_TESTS = +@BUILD_TESTS_FALSE@SUBDIRS_CHECK = +@BUILD_TESTS_TRUE@@HAVE_CHECK_FALSE@SUBDIRS_CHECK = +@BUILD_TESTS_TRUE@@HAVE_CHECK_TRUE@SUBDIRS_CHECK = check +@BUILD_EXAMPLES_FALSE@SUBDIRS_EXAMPLES = +@BUILD_EXAMPLES_TRUE@SUBDIRS_EXAMPLES = examples +SUBDIRS = \ + benchmarks \ + $(SUBDIRS_CHECK) \ + misc \ + $(SUBDIRS_TESTS) \ + $(SUBDIRS_EXAMPLES) + + +# These are all the possible subdirs +DIST_SUBDIRS = \ + benchmarks \ + check \ + examples \ + misc + +all: all-recursive + +.SUFFIXES: +$(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 tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/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): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean 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-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +# 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/tests/README b/tests/README new file mode 100644 index 0000000..7dad473 --- /dev/null +++ b/tests/README @@ -0,0 +1,12 @@ +This directory contains regression tests, functionality tests, examples, +benchmarks, ... + +benchmarks/ + benchmarks to profile pieces of GStreamer +check/ + unit tests using the check library, non-interactive +examples/ + small examples demonstrating the use of various features +misc/ + prototypes, random bits, ... + diff --git a/tests/benchmarks/Makefile.am b/tests/benchmarks/Makefile.am new file mode 100644 index 0000000..5d6171c --- /dev/null +++ b/tests/benchmarks/Makefile.am @@ -0,0 +1,17 @@ +noinst_PROGRAMS = \ + caps \ + capsnego \ + complexity \ + controller \ + init \ + mass-elements \ + gstpollstress \ + gstclockstress \ + gstbufferstress + +LDADD = $(GST_OBJ_LIBS) +AM_CFLAGS = $(GST_OBJ_CFLAGS) + +controller_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)/libs +controller_LDADD = $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la $(LDADD) + diff --git a/tests/benchmarks/Makefile.in b/tests/benchmarks/Makefile.in new file mode 100644 index 0000000..06e6f1b --- /dev/null +++ b/tests/benchmarks/Makefile.in @@ -0,0 +1,762 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = caps$(EXEEXT) capsnego$(EXEEXT) complexity$(EXEEXT) \ + controller$(EXEEXT) init$(EXEEXT) mass-elements$(EXEEXT) \ + gstpollstress$(EXEEXT) gstclockstress$(EXEEXT) \ + gstbufferstress$(EXEEXT) +subdir = tests/benchmarks +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +caps_SOURCES = caps.c +caps_OBJECTS = caps.$(OBJEXT) +caps_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +caps_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +capsnego_SOURCES = capsnego.c +capsnego_OBJECTS = capsnego.$(OBJEXT) +capsnego_LDADD = $(LDADD) +capsnego_DEPENDENCIES = $(am__DEPENDENCIES_1) +complexity_SOURCES = complexity.c +complexity_OBJECTS = complexity.$(OBJEXT) +complexity_LDADD = $(LDADD) +complexity_DEPENDENCIES = $(am__DEPENDENCIES_1) +controller_SOURCES = controller.c +controller_OBJECTS = controller-controller.$(OBJEXT) +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +controller_DEPENDENCIES = $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_2) +controller_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(controller_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +gstbufferstress_SOURCES = gstbufferstress.c +gstbufferstress_OBJECTS = gstbufferstress.$(OBJEXT) +gstbufferstress_LDADD = $(LDADD) +gstbufferstress_DEPENDENCIES = $(am__DEPENDENCIES_1) +gstclockstress_SOURCES = gstclockstress.c +gstclockstress_OBJECTS = gstclockstress.$(OBJEXT) +gstclockstress_LDADD = $(LDADD) +gstclockstress_DEPENDENCIES = $(am__DEPENDENCIES_1) +gstpollstress_SOURCES = gstpollstress.c +gstpollstress_OBJECTS = gstpollstress.$(OBJEXT) +gstpollstress_LDADD = $(LDADD) +gstpollstress_DEPENDENCIES = $(am__DEPENDENCIES_1) +init_SOURCES = init.c +init_OBJECTS = init.$(OBJEXT) +init_LDADD = $(LDADD) +init_DEPENDENCIES = $(am__DEPENDENCIES_1) +mass_elements_SOURCES = mass-elements.c +mass_elements_OBJECTS = mass-elements.$(OBJEXT) +mass_elements_LDADD = $(LDADD) +mass_elements_DEPENDENCIES = $(am__DEPENDENCIES_1) +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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = caps.c capsnego.c complexity.c controller.c \ + gstbufferstress.c gstclockstress.c gstpollstress.c init.c \ + mass-elements.c +DIST_SOURCES = caps.c capsnego.c complexity.c controller.c \ + gstbufferstress.c gstclockstress.c gstpollstress.c init.c \ + mass-elements.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +LDADD = $(GST_OBJ_LIBS) +AM_CFLAGS = $(GST_OBJ_CFLAGS) +controller_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)/libs +controller_LDADD = $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la $(LDADD) +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 tests/benchmarks/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/benchmarks/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +caps$(EXEEXT): $(caps_OBJECTS) $(caps_DEPENDENCIES) + @rm -f caps$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(caps_OBJECTS) $(caps_LDADD) $(LIBS) +capsnego$(EXEEXT): $(capsnego_OBJECTS) $(capsnego_DEPENDENCIES) + @rm -f capsnego$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(capsnego_OBJECTS) $(capsnego_LDADD) $(LIBS) +complexity$(EXEEXT): $(complexity_OBJECTS) $(complexity_DEPENDENCIES) + @rm -f complexity$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(complexity_OBJECTS) $(complexity_LDADD) $(LIBS) +controller$(EXEEXT): $(controller_OBJECTS) $(controller_DEPENDENCIES) + @rm -f controller$(EXEEXT) + $(AM_V_CCLD)$(controller_LINK) $(controller_OBJECTS) $(controller_LDADD) $(LIBS) +gstbufferstress$(EXEEXT): $(gstbufferstress_OBJECTS) $(gstbufferstress_DEPENDENCIES) + @rm -f gstbufferstress$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gstbufferstress_OBJECTS) $(gstbufferstress_LDADD) $(LIBS) +gstclockstress$(EXEEXT): $(gstclockstress_OBJECTS) $(gstclockstress_DEPENDENCIES) + @rm -f gstclockstress$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gstclockstress_OBJECTS) $(gstclockstress_LDADD) $(LIBS) +gstpollstress$(EXEEXT): $(gstpollstress_OBJECTS) $(gstpollstress_DEPENDENCIES) + @rm -f gstpollstress$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gstpollstress_OBJECTS) $(gstpollstress_LDADD) $(LIBS) +init$(EXEEXT): $(init_OBJECTS) $(init_DEPENDENCIES) + @rm -f init$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(init_OBJECTS) $(init_LDADD) $(LIBS) +mass-elements$(EXEEXT): $(mass_elements_OBJECTS) $(mass_elements_DEPENDENCIES) + @rm -f mass-elements$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(mass_elements_OBJECTS) $(mass_elements_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/caps.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capsnego.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complexity.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller-controller.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstbufferstress.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstclockstress.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstpollstress.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mass-elements.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +controller-controller.o: controller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(controller_CFLAGS) $(CFLAGS) -MT controller-controller.o -MD -MP -MF $(DEPDIR)/controller-controller.Tpo -c -o controller-controller.o `test -f 'controller.c' || echo '$(srcdir)/'`controller.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/controller-controller.Tpo $(DEPDIR)/controller-controller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller.c' object='controller-controller.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(controller_CFLAGS) $(CFLAGS) -c -o controller-controller.o `test -f 'controller.c' || echo '$(srcdir)/'`controller.c + +controller-controller.obj: controller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(controller_CFLAGS) $(CFLAGS) -MT controller-controller.obj -MD -MP -MF $(DEPDIR)/controller-controller.Tpo -c -o controller-controller.obj `if test -f 'controller.c'; then $(CYGPATH_W) 'controller.c'; else $(CYGPATH_W) '$(srcdir)/controller.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/controller-controller.Tpo $(DEPDIR)/controller-controller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller.c' object='controller-controller.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(controller_CFLAGS) $(CFLAGS) -c -o controller-controller.obj `if test -f 'controller.c'; then $(CYGPATH_W) 'controller.c'; else $(CYGPATH_W) '$(srcdir)/controller.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/benchmarks/caps.c b/tests/benchmarks/caps.c new file mode 100644 index 0000000..000e46f --- /dev/null +++ b/tests/benchmarks/caps.c @@ -0,0 +1,70 @@ +/* GStreamer + * Copyright (C) 2005 Andy Wingo <wingo@pobox.com> + * + * caps.c: benchmark for caps creation and destruction + * + * 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 <gst/gst.h> + + +#define NUM_CAPS 10000 + + +#define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \ + "audio/x-raw-int, " \ + "rate = (int) [ 1, MAX ], " \ + "channels = (int) [ 1, MAX ], " \ + "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \ + "width = (int) { 8, 16, 24, 32 }, " \ + "depth = (int) [ 1, 32 ], " \ + "signed = (boolean) { true, false }" + + +gint +main (gint argc, gchar * argv[]) +{ + GstCaps **capses; + GstCaps *protocaps; + GstClockTime start, end; + gint i; + + gst_init (&argc, &argv); + + protocaps = gst_caps_from_string (GST_AUDIO_INT_PAD_TEMPLATE_CAPS); + + start = gst_util_get_timestamp (); + capses = g_new (GstCaps *, NUM_CAPS); + for (i = 0; i < NUM_CAPS; i++) + capses[i] = gst_caps_copy (protocaps); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - creating %d caps\n", + GST_TIME_ARGS (end - start), i); + + start = gst_util_get_timestamp (); + for (i = 0; i < NUM_CAPS; i++) + gst_caps_unref (capses[i]); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - destroying %d caps\n", + GST_TIME_ARGS (end - start), i); + + g_free (capses); + gst_caps_unref (protocaps); + + return 0; +} diff --git a/tests/benchmarks/capsnego.c b/tests/benchmarks/capsnego.c new file mode 100644 index 0000000..3d05d14 --- /dev/null +++ b/tests/benchmarks/capsnego.c @@ -0,0 +1,279 @@ +/* GStreamer + * Copyright (C) 2010 Stefan Kost <ensonic@users.sf.net> + * + * capsnego.c: benchmark for caps negotiation + * + * 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. + */ + +/* this benchmark recursively builds a pipeline and measures the time to go + * from ready to paused. + * The graph size and type can be controlled with a few commandline args: + * -d depth: is the depth of the tree + * -c children: is the number of branches on each level + * -f <flavour>: can be a=udio/v=ideo and is conttrolling the kind of elements + * that are used. + */ + +#include <gst/gst.h> +#include <stdlib.h> +#include <string.h> + +enum +{ + FLAVOUR_AUDIO = 0, + FLAVOUR_VIDEO, + NUM_FLAVOURS +}; + +enum +{ + ELEM_SRC = 0, + ELEM_MIX, + ELEM_PROC, + ELEM_CONV, + NUM_ELEM +}; + +static const gchar *factories[NUM_FLAVOURS][NUM_ELEM] = { + {"audiotestsrc", "adder", "volume", "audioconvert"}, + {"videotestsrc", "videomixer", "videoscale", "ffmpegcolorspace"} +}; + +static const gchar *sink_pads[NUM_FLAVOURS][NUM_ELEM] = { + {NULL, "sink%d", NULL, NULL}, + {NULL, "sink_%d", NULL, NULL} +}; + + +static gboolean +create_node (GstBin * bin, GstElement * sink, const gchar * sinkpadname, + GstElement ** new_sink, gint children, gint flavour) +{ + GstElement *mix, *proc, *conv; + + if (children >= 1) { + mix = gst_element_factory_make (factories[flavour][ELEM_MIX], NULL); + if (!mix) { + GST_WARNING ("need element '%s'", factories[flavour][ELEM_MIX]); + return FALSE; + } + } else { + mix = gst_element_factory_make ("identity", NULL); + } + proc = gst_element_factory_make (factories[flavour][ELEM_PROC], NULL); + if (!proc) { + GST_WARNING ("need element '%s'", factories[flavour][ELEM_PROC]); + return FALSE; + } + conv = gst_element_factory_make (factories[flavour][ELEM_CONV], NULL); + if (!conv) { + GST_WARNING ("need element '%s'", factories[flavour][ELEM_CONV]); + return FALSE; + } + gst_bin_add_many (bin, mix, proc, conv, NULL); + if (!gst_element_link_pads_full (mix, "src", proc, "sink", + GST_PAD_LINK_CHECK_NOTHING) + || !gst_element_link_pads_full (proc, "src", conv, "sink", + GST_PAD_LINK_CHECK_NOTHING) + || !gst_element_link_pads_full (conv, "src", sink, sinkpadname, + GST_PAD_LINK_CHECK_NOTHING)) { + GST_WARNING ("can't link elements"); + return FALSE; + } + *new_sink = mix; + return TRUE; +} + +static gboolean +create_nodes (GstBin * bin, GstElement * sink, gint depth, gint children, + gint flavour) +{ + GstElement *new_sink, *src; + gint i; + + for (i = 0; i < children; i++) { + if (depth > 0) { + if (!create_node (bin, sink, sink_pads[flavour][ELEM_MIX], &new_sink, + children, flavour)) { + return FALSE; + } + if (!create_nodes (bin, new_sink, depth - 1, children, flavour)) { + return FALSE; + } + } else { + src = gst_element_factory_make (factories[flavour][ELEM_SRC], NULL); + if (!src) { + GST_WARNING ("need element '%s'", factories[flavour][ELEM_SRC]); + return FALSE; + } + gst_bin_add (bin, src); + if (!gst_element_link_pads_full (src, "src", sink, + sink_pads[flavour][ELEM_MIX], GST_PAD_LINK_CHECK_NOTHING)) { + GST_WARNING ("can't link elements"); + return FALSE; + } + } + } + return TRUE; +} + +static void +event_loop (GstElement * bin, GstClockTime start) +{ + GstBus *bus; + GstMessage *msg = NULL; + gboolean running = TRUE; + + bus = gst_element_get_bus (bin); + + while (running) { + msg = gst_bus_poll (bus, + GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_WARNING, + -1); + + switch (GST_MESSAGE_TYPE (msg)) { + case GST_MESSAGE_STATE_CHANGED: + if (GST_MESSAGE_SRC (msg) == (GstObject *) bin) { + GstState old_state, new_state; + GstClockTime end; + + gst_message_parse_state_changed (msg, &old_state, &new_state, NULL); + + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " state change on the bin: %s -> %s\n", + GST_TIME_ARGS (end - start), + gst_element_state_get_name (old_state), + gst_element_state_get_name (new_state)); + + if (old_state == GST_STATE_READY && new_state == GST_STATE_PAUSED) { + running = FALSE; + } + } + break; + case GST_MESSAGE_WARNING:{ + GError *err = NULL; + gchar *dbg = NULL; + + gst_message_parse_warning (msg, &err, &dbg); + GST_WARNING_OBJECT (GST_MESSAGE_SRC (msg), "%s (%s)", err->message, + (dbg ? dbg : "no details")); + g_error_free (err); + g_free (dbg); + break; + } + case GST_MESSAGE_ERROR:{ + GError *err = NULL; + gchar *dbg = NULL; + + gst_message_parse_error (msg, &err, &dbg); + GST_ERROR_OBJECT (GST_MESSAGE_SRC (msg), "%s (%s)", err->message, + (dbg ? dbg : "no details")); + g_error_free (err); + g_free (dbg); + running = FALSE; + break; + } + default: + break; + } + gst_message_unref (msg); + } + gst_object_unref (bus); +} + + +gint +main (gint argc, gchar * argv[]) +{ + GstBin *bin; + GstClockTime start, end; + GstElement *sink, *new_sink; + + /* default parameters */ + gint depth = 4; + gint children = 3; + gint flavour = FLAVOUR_AUDIO; + const gchar *flavour_str = "audio"; + + gst_init (&argc, &argv); + + /* check command line options */ + if (argc) { + gint arg; + for (arg = 0; arg < argc; arg++) { + if (!strcmp (argv[arg], "-d")) { + arg++; + if (arg < argc) + depth = atoi (argv[arg]); + } else if (!strcmp (argv[arg], "-c")) { + arg++; + if (arg < argc) + children = atoi (argv[arg]); + } else if (!strcmp (argv[arg], "-f")) { + arg++; + if (arg < argc) { + flavour_str = argv[arg]; + switch (*flavour_str) { + case 'a': + flavour = FLAVOUR_AUDIO; + break; + case 'v': + flavour = FLAVOUR_VIDEO; + break; + default: + break; + } + } + } + } + } + + /* build pipeline */ + g_print ("building %s pipeline with depth = %d and children = %d\n", + flavour_str, depth, children); + start = gst_util_get_timestamp (); + bin = GST_BIN (gst_pipeline_new ("pipeline")); + sink = gst_element_factory_make ("fakesink", NULL); + gst_bin_add (bin, sink); + if (!create_node (bin, sink, "sink", &new_sink, children, flavour)) { + goto Error; + } + if (!create_nodes (bin, new_sink, depth, children, flavour)) { + goto Error; + } + end = gst_util_get_timestamp (); + /* num-threads = num-sources = pow (children, depth) */ + g_print ("%" GST_TIME_FORMAT " built pipeline with %d elements\n", + GST_TIME_ARGS (end - start), GST_BIN_NUMCHILDREN (bin)); + + /* measure */ + g_print ("starting pipeline\n"); + gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY); + GST_DEBUG_BIN_TO_DOT_FILE (bin, GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE, "capsnego"); + start = gst_util_get_timestamp (); + gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); + event_loop (GST_ELEMENT (bin), start); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " reached paused\n", + GST_TIME_ARGS (end - start)); + + /* clean up */ +Error: + gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); + gst_object_unref (bin); + return 0; +} diff --git a/tests/benchmarks/complexity.c b/tests/benchmarks/complexity.c new file mode 100644 index 0000000..3599a09 --- /dev/null +++ b/tests/benchmarks/complexity.c @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2004 Benjamin Otte <otte@gnome.org> + * Copyright (C) 2005 Andy Wingo <wingo@pobox.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. + */ + +#include <stdlib.h> +#include <gst/gst.h> + +#define BUFFER_COUNT (1000) + +gint +main (gint argc, gchar * argv[]) +{ + GstMessage *msg; + GstElement *pipeline, *src, *e; + GSList *saved_src_list, *src_list, *new_src_list; + guint complexity_order, n_elements, i, j, max_this_level; + GstClockTime start, end; + + gst_init (&argc, &argv); + + if (argc != 3) { + g_print ("usage: %s COMPLEXITY_ORDER N_ELEMENTS\n", argv[0]); + return 1; + } + + complexity_order = atoi (argv[1]); + n_elements = atoi (argv[2]); + + start = gst_util_get_timestamp (); + + pipeline = gst_element_factory_make ("pipeline", NULL); + g_assert (pipeline); + + e = gst_element_factory_make ("fakesrc", NULL); + g_object_set (e, "num-buffers", BUFFER_COUNT, NULL); + g_object_set (e, "silent", TRUE, NULL); + gst_bin_add (GST_BIN (pipeline), e); + src_list = saved_src_list = g_slist_append (NULL, e); + + new_src_list = NULL; + + max_this_level = 1; + for (i = 0, j = 0; i < n_elements; i++, j++) { + if (j >= max_this_level) { + g_slist_free (saved_src_list); + saved_src_list = g_slist_reverse (new_src_list); + new_src_list = NULL; + j = 0; + max_this_level *= complexity_order; + } + + if (!src_list) { + src_list = saved_src_list; + } + + src = (GstElement *) src_list->data; + src_list = src_list->next; + + if (i + max_this_level < n_elements) { + e = gst_element_factory_make ("tee", NULL); + } else { + e = gst_element_factory_make ("fakesink", NULL); + g_object_set (e, "preroll-queue-len", 1, NULL); + } + g_object_set (e, "silent", TRUE, NULL); + new_src_list = g_slist_prepend (new_src_list, e); + + gst_bin_add (GST_BIN (pipeline), e); + if (!gst_element_link (src, e)) + g_assert_not_reached (); + } + + g_slist_free (saved_src_list); + g_slist_free (new_src_list); + + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - creating and linking %d elements\n", + GST_TIME_ARGS (end - start), i); + + start = gst_util_get_timestamp (); + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + g_assert_not_reached (); + if (gst_element_get_state (pipeline, NULL, NULL, + GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_FAILURE) + g_assert_not_reached (); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", + GST_TIME_ARGS (end - start)); + + start = gst_util_get_timestamp (); + msg = gst_bus_poll (gst_element_get_bus (pipeline), + GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + end = gst_util_get_timestamp (); + gst_message_unref (msg); + g_print ("%" GST_TIME_FORMAT " - putting %u buffers through\n", + GST_TIME_ARGS (end - start), BUFFER_COUNT); + + start = gst_util_get_timestamp (); + if (gst_element_set_state (pipeline, + GST_STATE_NULL) != GST_STATE_CHANGE_SUCCESS) + g_assert_not_reached (); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - setting pipeline to NULL\n", + GST_TIME_ARGS (end - start)); + + start = gst_util_get_timestamp (); + g_object_unref (pipeline); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - unreffing pipeline\n", + GST_TIME_ARGS (end - start)); + + return 0; +} diff --git a/tests/benchmarks/controller.c b/tests/benchmarks/controller.c new file mode 100644 index 0000000..32eaff2 --- /dev/null +++ b/tests/benchmarks/controller.c @@ -0,0 +1,204 @@ +/* GStreamer + * Copyright (C) 2009 Stefan Kost <ensonic@users.sf.net> + * + * controller.c: benchmark for interpolation control-source + * + * 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 <gst/gst.h> +#include <gst/controller/gstcontroller.h> +#include <gst/controller/gstinterpolationcontrolsource.h> + +/* a song in buzztard can easily reach 30000 here */ +#define NUM_CP 15000 +#define BLOCK_SIZE 64 + +static void +event_loop (GstElement * pipe) +{ + GstBus *bus; + GstMessage *message = NULL; + gboolean running = TRUE; + + bus = gst_element_get_bus (GST_ELEMENT (pipe)); + + while (running) { + message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); + + g_assert (message != NULL); + + switch (message->type) { + case GST_MESSAGE_EOS: + running = FALSE; + break; + case GST_MESSAGE_WARNING:{ + GError *gerror; + gchar *debug; + + gst_message_parse_warning (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + break; + } + case GST_MESSAGE_ERROR:{ + GError *gerror; + gchar *debug; + + gst_message_parse_error (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + running = FALSE; + break; + } + default: + break; + } + gst_message_unref (message); + } + gst_object_unref (bus); +} + +gint +main (gint argc, gchar * argv[]) +{ + gint res = 1; + gint i, j; + GstElement *src, *sink; + GstElement *bin; + GstController *ctrl; + GstInterpolationControlSource *csource; + GValue freq = { 0, }; + GstClockTime bt, ct; + GstClockTimeDiff elapsed; + GstClockTime tick; + + gst_init (&argc, &argv); + gst_controller_init (&argc, &argv); + + /* build pipeline */ + bin = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("audiotestsrc", "gen_audio"); + if (!src) { + GST_WARNING ("need audiotestsrc from gst-plugins-base"); + goto Error; + } + sink = gst_element_factory_make ("fakesink", "swallow_audio"); + + gst_bin_add_many (GST_BIN (bin), src, sink, NULL); + if (!gst_element_link (src, sink)) { + GST_WARNING ("can't link elements"); + goto Error; + } + + g_object_set (G_OBJECT (src), "wave", 7, /* sine table - we don't want to benchmark the fpu */ + "num-buffers", NUM_CP, "samplesperbuffer", BLOCK_SIZE, NULL); + + tick = BLOCK_SIZE * GST_SECOND / 44100; + + /* add a controller to the source */ + if (!(ctrl = gst_controller_new (G_OBJECT (src), "freq", NULL))) { + GST_WARNING ("can't control source element"); + goto Error; + } + + /* create and configure control source */ + csource = gst_interpolation_control_source_new (); + gst_controller_set_control_source (ctrl, "freq", + GST_CONTROL_SOURCE (csource)); + gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_LINEAR); + g_value_init (&freq, G_TYPE_DOUBLE); + + + /* set control values, we set them in a linear order as we would when loading + * a stored project + */ + bt = gst_util_get_timestamp (); + + for (i = 0; i < NUM_CP; i++) { + g_value_set_double (&freq, g_random_double_range (50.0, 3000.0)); + gst_interpolation_control_source_set (csource, i * tick, &freq); + } + + ct = gst_util_get_timestamp (); + elapsed = GST_CLOCK_DIFF (bt, ct); + printf ("linear insert of control-points: %" GST_TIME_FORMAT "\n", + GST_TIME_ARGS (elapsed)); + + + /* set extra control values, we set them in arbitrary order to simulate + * the user editing a project from the ui + */ + bt = gst_util_get_timestamp (); + + for (i = 0; i < 100; i++) { + j = g_random_int_range (0, NUM_CP - 1); + g_value_set_double (&freq, g_random_double_range (50.0, 3000.0)); + gst_interpolation_control_source_set (csource, j * tick, &freq); + } + + ct = gst_util_get_timestamp (); + elapsed = GST_CLOCK_DIFF (bt, ct); + printf ("random insert of control-points: %" GST_TIME_FORMAT "\n", + GST_TIME_ARGS (elapsed)); + + { + GstClockTime sample_duration = + gst_util_uint64_scale_int (1, GST_SECOND, 44100); + GstValueArray va = { "freq", + BLOCK_SIZE * NUM_CP, + sample_duration, + NULL + }; + + gdouble *values = g_new0 (gdouble, BLOCK_SIZE * NUM_CP); + va.values = (gpointer *) values; + + bt = gst_util_get_timestamp (); + gst_control_source_get_value_array (GST_CONTROL_SOURCE (csource), 0, &va); + ct = gst_util_get_timestamp (); + g_free (values); + elapsed = GST_CLOCK_DIFF (bt, ct); + printf ("linear array for control-points: %" GST_TIME_FORMAT "\n", + GST_TIME_ARGS (elapsed)); + } + + g_object_unref (csource); + + /* play, this test sequential reads */ + bt = gst_util_get_timestamp (); + + if (gst_element_set_state (bin, GST_STATE_PLAYING)) { + /* wait for EOS */ + event_loop (bin); + gst_element_set_state (bin, GST_STATE_NULL); + } + + ct = gst_util_get_timestamp (); + elapsed = GST_CLOCK_DIFF (bt, ct); + printf ("linear read of control-points : %" GST_TIME_FORMAT "\n", + GST_TIME_ARGS (elapsed)); + + /* cleanup */ + g_object_unref (G_OBJECT (ctrl)); + gst_object_unref (G_OBJECT (bin)); + res = 0; +Error: + return res; +} diff --git a/tests/benchmarks/gstbufferstress.c b/tests/benchmarks/gstbufferstress.c new file mode 100644 index 0000000..e3f2912 --- /dev/null +++ b/tests/benchmarks/gstbufferstress.c @@ -0,0 +1,125 @@ +/* GStreamer + * Copyright (C) <2009> 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gst/gst.h> + +#define MAX_THREADS 1000 + +static guint64 nbbuffers; +static GMutex *mutex; + + +static void * +run_test (void *user_data) +{ + gint threadid = GPOINTER_TO_INT (user_data); + guint64 nb; + GstBuffer *buf; + GstClockTime start, end; + + g_mutex_lock (mutex); + g_mutex_unlock (mutex); + + start = gst_util_get_timestamp (); + + g_assert (nbbuffers > 0); + + for (nb = nbbuffers; nb; nb--) { + buf = gst_buffer_new (); + gst_buffer_unref (buf); + } + + end = gst_util_get_timestamp (); + g_print ("total %" GST_TIME_FORMAT " - average %" GST_TIME_FORMAT + " - Thread %d\n", GST_TIME_ARGS (end - start), + GST_TIME_ARGS ((end - start) / nbbuffers), threadid); + + + g_thread_exit (NULL); + return NULL; +} + +gint +main (gint argc, gchar * argv[]) +{ + GThread *threads[MAX_THREADS]; + gint num_threads; + gint t; + GstBuffer *tmp; + GstClockTime start, end; + + gst_init (&argc, &argv); + mutex = g_mutex_new (); + + if (argc != 3) { + g_print ("usage: %s <num_threads> <nbbuffers>\n", argv[0]); + exit (-1); + } + + num_threads = atoi (argv[1]); + nbbuffers = atoi (argv[2]); + + if (num_threads <= 0 || num_threads > MAX_THREADS) { + g_print ("number of threads must be between 0 and %d\n", MAX_THREADS); + exit (-2); + } + + if (nbbuffers <= 0) { + g_print ("number of buffers must be greater than 0\n"); + exit (-3); + } + + g_mutex_lock (mutex); + /* Let's just make sure the GstBufferClass is loaded ... */ + tmp = gst_buffer_new (); + + printf ("main(): Creating %d threads.\n", num_threads); + for (t = 0; t < num_threads; t++) { + GError *error = NULL; + + threads[t] = g_thread_create (run_test, GINT_TO_POINTER (t), TRUE, &error); + if (error) { + printf ("ERROR: g_thread_create() %s\n", error->message); + exit (-1); + } + } + + /* Signal all threads to start */ + start = gst_util_get_timestamp (); + g_mutex_unlock (mutex); + + for (t = 0; t < num_threads; t++) { + if (threads[t]) + g_thread_join (threads[t]); + } + + end = gst_util_get_timestamp (); + g_print ("*** total %" GST_TIME_FORMAT " - average %" GST_TIME_FORMAT + " - Done creating %" G_GUINT64_FORMAT " buffers\n", + GST_TIME_ARGS (end - start), + GST_TIME_ARGS ((end - start) / (num_threads * nbbuffers)), + num_threads * nbbuffers); + + + gst_buffer_unref (tmp); + + return 0; +} diff --git a/tests/benchmarks/gstclockstress.c b/tests/benchmarks/gstclockstress.c new file mode 100644 index 0000000..b0f721b --- /dev/null +++ b/tests/benchmarks/gstclockstress.c @@ -0,0 +1,92 @@ +/* GStreamer + * Copyright (C) <2009> Wim Taymans <wim taymans at gmail dot 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gst/gst.h> +#include <gst/glib-compat-private.h> + +#define MAX_THREADS 100 + +static gboolean running = TRUE; +static gint count = 0; + +static void * +run_test (void *user_data) +{ + gint prev; + GstClock *sysclock = GST_CLOCK_CAST (user_data); + + while (running) { + gst_clock_get_time (sysclock); + prev = G_ATOMIC_INT_ADD (&count, 1); + if (prev == G_MAXINT) + g_warning ("overflow"); + } + g_thread_exit (NULL); + return NULL; +} + +gint +main (gint argc, gchar * argv[]) +{ + GThread *threads[MAX_THREADS]; + gint num_threads; + gint t; + GstClock *sysclock; + + gst_init (&argc, &argv); + + if (argc != 2) { + g_print ("usage: %s <num_threads>\n", argv[0]); + exit (-1); + } + + num_threads = atoi (argv[1]); + + sysclock = gst_system_clock_obtain (); + + for (t = 0; t < num_threads; t++) { + GError *error = NULL; + + threads[t] = g_thread_create (run_test, sysclock, TRUE, &error); + if (error) { + printf ("ERROR: g_thread_create() %s\n", error->message); + exit (-1); + } + } + printf ("main(): Created %d threads.\n", t); + + /* run for 5 seconds */ + g_usleep (G_USEC_PER_SEC * 5); + + printf ("main(): Stopping threads...\n"); + + running = FALSE; + + for (t = 0; t < num_threads; t++) { + g_thread_join (threads[t]); + } + + g_print ("performed %d get_time operations\n", count); + + gst_object_unref (sysclock); + + return 0; +} diff --git a/tests/benchmarks/gstpollstress.c b/tests/benchmarks/gstpollstress.c new file mode 100644 index 0000000..bf0d548 --- /dev/null +++ b/tests/benchmarks/gstpollstress.c @@ -0,0 +1,177 @@ +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gst/gst.h> + +static GstPoll *set; +static GList *fds = NULL; +static GMutex *fdlock; +static GTimer *timer; + +#define MAX_THREADS 100 + +static void +mess_some_more (void) +{ + GList *walk; + gint random; + gint removed = 0; + + g_mutex_lock (fdlock); + + for (walk = fds; walk;) { + GstPollFD *fd = (GstPollFD *) walk->data; + + walk = g_list_next (walk); + + random = (gint) (10.0 * rand () / (RAND_MAX + 1.0)); + switch (random) { + case 0: + { + /* + GstPollFD *newfd = g_new0 (GstPollFD, 1); + + gst_poll_add_fd (set, newfd); + fds = g_list_prepend (fds, newfd); + */ + break; + } + case 1: + if ((gint) (10.0 * rand () / (RAND_MAX + 1.0)) < 2) { + gst_poll_remove_fd (set, fd); + fds = g_list_remove (fds, fd); + g_free (fd); + removed++; + } + break; + + case 2: + gst_poll_fd_ctl_write (set, fd, TRUE); + break; + case 3: + gst_poll_fd_ctl_write (set, fd, FALSE); + break; + case 4: + gst_poll_fd_ctl_read (set, fd, TRUE); + break; + case 5: + gst_poll_fd_ctl_read (set, fd, FALSE); + break; + + case 6: + gst_poll_fd_has_closed (set, fd); + break; + case 7: + gst_poll_fd_has_error (set, fd); + break; + case 8: + gst_poll_fd_can_read (set, fd); + break; + case 9: + gst_poll_fd_can_write (set, fd); + break; + default: + g_assert_not_reached (); + break; + } + } + if (g_list_length (fds) < 900) { + random = removed + (gint) (2.0 * rand () / (RAND_MAX + 1.0)); + while (random) { + GstPollFD *newfd = g_new0 (GstPollFD, 1); + + gst_poll_add_fd (set, newfd); + fds = g_list_prepend (fds, newfd); + random--; + } + } + + g_mutex_unlock (fdlock); +} + +static void * +run_test (void *threadid) +{ + gint id = GPOINTER_TO_INT (threadid); + + while (TRUE) { + if (id == 0) { + gint res = gst_poll_wait (set, 10); + + if (res < 0) { + g_print ("error %d %s\n", errno, g_strerror (errno)); + } + } else { + mess_some_more (); + if (g_timer_elapsed (timer, NULL) > 0.5) { + g_mutex_lock (fdlock); + g_print ("active fds :%d\n", g_list_length (fds)); + g_timer_start (timer); + g_mutex_unlock (fdlock); + } + g_usleep (1); + } + } + + return NULL; +} + +gint +main (gint argc, gchar * argv[]) +{ + GThread *threads[MAX_THREADS]; + gint num_threads; + gint t; + + gst_init (&argc, &argv); + + fdlock = g_mutex_new (); + timer = g_timer_new (); + + if (argc != 2) { + g_print ("usage: %s <num_threads>\n", argv[0]); + exit (-1); + } + + num_threads = atoi (argv[1]); + + set = gst_poll_new (TRUE); + + for (t = 0; t < num_threads; t++) { + GError *error = NULL; + + threads[t] = g_thread_create (run_test, GINT_TO_POINTER (t), TRUE, &error); + if (error) { + printf ("ERROR: g_thread_create() %s\n", error->message); + exit (-1); + } + } + printf ("main(): Created %d threads.\n", t); + + for (t = 0; t < num_threads; t++) { + g_thread_join (threads[t]); + } + + gst_poll_free (set); + + return 0; +} diff --git a/tests/benchmarks/init.c b/tests/benchmarks/init.c new file mode 100644 index 0000000..a03f666 --- /dev/null +++ b/tests/benchmarks/init.c @@ -0,0 +1,31 @@ +/* GStreamer + * Copyright (C) 2006 Stefan Kost <stefan.kost@nokia.com> + * + * init.c: benchmark gst initialisation + * + * 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 <gst/gst.h> + +gint +main (gint argc, gchar * argv[]) +{ + gst_init (&argc, &argv); + + return 0; +} diff --git a/tests/benchmarks/mass-elements.c b/tests/benchmarks/mass-elements.c new file mode 100644 index 0000000..826d3d0 --- /dev/null +++ b/tests/benchmarks/mass-elements.c @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2004 Benjamin Otte <otte@gnome.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. + */ + +#include <stdlib.h> +#include <gst/gst.h> + +#define IDENTITY_COUNT (1000) +#define BUFFER_COUNT (1000) +#define SRC_ELEMENT "fakesrc" +#define SINK_ELEMENT "fakesink" + + +gint +main (gint argc, gchar * argv[]) +{ + GstMessage *msg; + GstElement *pipeline, *src, *sink, *current, *last; + guint i, buffers = BUFFER_COUNT, identities = IDENTITY_COUNT; + GstClockTime start, end; + const gchar *src_name = SRC_ELEMENT, *sink_name = SINK_ELEMENT; + + gst_init (&argc, &argv); + + if (argc > 1) + identities = atoi (argv[1]); + if (argc > 2) + buffers = atoi (argv[2]); + if (argc > 3) + src_name = argv[3]; + if (argc > 4) + sink_name = argv[4]; + + g_print + ("*** benchmarking this pipeline: %s num-buffers=%u ! %u * identity ! %s\n", + src_name, buffers, identities, sink_name); + start = gst_util_get_timestamp (); + pipeline = gst_element_factory_make ("pipeline", NULL); + g_assert (pipeline); + src = gst_element_factory_make (src_name, NULL); + if (!src) { + g_print ("no element named \"%s\" found, aborting...\n", src_name); + return 1; + } + g_object_set (src, "num-buffers", buffers, NULL); + sink = gst_element_factory_make (sink_name, NULL); + if (!sink) { + g_print ("no element named \"%s\" found, aborting...\n", sink_name); + return 1; + } + last = src; + gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); + for (i = 0; i < identities; i++) { + current = gst_element_factory_make ("identity", NULL); + g_assert (current); + /* shut this element up (no g_strdup_printf please) */ + g_object_set (current, "silent", TRUE, NULL); + gst_bin_add (GST_BIN (pipeline), current); + if (!gst_element_link (last, current)) + g_assert_not_reached (); + last = current; + } + if (!gst_element_link (last, sink)) + g_assert_not_reached (); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - creating %u identity elements\n", + GST_TIME_ARGS (end - start), identities); + + start = gst_util_get_timestamp (); + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + g_assert_not_reached (); + if (gst_element_get_state (pipeline, NULL, NULL, + GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_FAILURE) + g_assert_not_reached (); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", + GST_TIME_ARGS (end - start)); + + start = gst_util_get_timestamp (); + msg = gst_bus_poll (gst_element_get_bus (pipeline), + GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + end = gst_util_get_timestamp (); + gst_message_unref (msg); + g_print ("%" GST_TIME_FORMAT " - putting %u buffers through\n", + GST_TIME_ARGS (end - start), buffers); + + start = gst_util_get_timestamp (); + if (gst_element_set_state (pipeline, + GST_STATE_NULL) != GST_STATE_CHANGE_SUCCESS) + g_assert_not_reached (); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - setting pipeline to NULL\n", + GST_TIME_ARGS (end - start)); + + start = gst_util_get_timestamp (); + g_object_unref (pipeline); + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT " - unreffing pipeline\n", + GST_TIME_ARGS (end - start)); + + return 0; +} diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am new file mode 100644 index 0000000..43aac86 --- /dev/null +++ b/tests/check/Makefile.am @@ -0,0 +1,276 @@ +include $(top_srcdir)/common/check.mak + +CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg + +GST_TOOLS_DIR = $(top_builddir)/tools + +REGISTRY_ENVIRONMENT = \ + GST_REGISTRY=$(CHECK_REGISTRY) + +TESTS_ENVIRONMENT = \ + GST_STATE_IGNORE_ELEMENTS="$(STATE_IGNORE_ELEMENTS)" \ + $(REGISTRY_ENVIRONMENT) \ + GST_PLUGIN_SCANNER=$(top_builddir)/libs/gst/helpers/gst-plugin-scanner \ + GST_PLUGIN_SYSTEM_PATH= \ + GST_PLUGIN_PATH=$(top_builddir)/plugins + +plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ + +# override to _not_ install the test plugins +install-pluginLTLIBRARIES: + +# the core dumps of some machines have PIDs appended, test registry and +# profiling data +CLEANFILES = core core.* test-registry.* *.gcno *.gcda + +SUPPRESSIONS = $(top_srcdir)/common/gst.supp + +clean-local: clean-local-check + +if GST_DISABLE_PARSE +PARSE_CHECKS = pipelines/parse-disabled +else +PARSE_CHECKS = pipelines/simple-launch-lines pipelines/cleanup pipelines/parse-launch +endif + +# Do not run the abi test in case any option which causes the API to change has +# been used +if FALSE +if !GST_DISABLE_REGISTRY +if !GST_DISABLE_TRACE +ABI_CHECKS = gst/gstabi +endif +endif +endif + +if FALSE +LIBSABI_CHECKS = libs/libsabi +endif + +if HAVE_CXX +CXX_CHECKS = gst/gstcpp libs/gstlibscpp +else +CXX_CHECKS = +endif + +# if it's calling gst_element_factory_make(), it will probably not work without +# a registry +if GST_DISABLE_REGISTRY +REGISTRY_CHECKS = +else +REGISTRY_CHECKS = \ + gst/gst \ + gst/gstbin \ + gst/gstchildproxy \ + gst/gstelement \ + gst/gstelementfactory \ + gst/gstevent \ + gst/gstghostpad \ + gst/gstindex \ + gst/gstplugin \ + gst/gstpreset \ + gst/gstquery \ + gst/gstregistry \ + gst/gsturi \ + gst/gstutils \ + generic/sinks \ + elements/capsfilter \ + elements/fakesink \ + elements/fakesrc \ + elements/fdsrc \ + elements/filesink \ + elements/filesrc \ + elements/funnel \ + elements/identity \ + elements/multiqueue \ + elements/selector \ + elements/tee \ + elements/queue \ + elements/queue2 \ + elements/valve \ + libs/basesrc \ + libs/basesink \ + libs/controller \ + libs/typefindhelper \ + pipelines/stress \ + pipelines/queue-error +endif + +check_PROGRAMS = \ + $(ABI_CHECKS) \ + gst/gstbuffer \ + gst/gstbufferlist \ + gst/gstmeta \ + gst/gstbus \ + gst/gstcaps \ + $(CXX_CHECKS) \ + gst/gstdatetime \ + gst/gstinfo \ + gst/gstiterator \ + gst/gstmessage \ + gst/gstminiobject \ + gst/gstobject \ + gst/gstpad \ + gst/gstparamspecs \ + gst/gstpoll \ + gst/gstsegment \ + gst/gstsystemclock \ + gst/gstclock \ + gst/gststructure \ + gst/gsttag \ + gst/gsttagsetter \ + gst/gsttask \ + gst/gstvalue \ + generic/states \ + $(PARSE_CHECKS) \ + $(REGISTRY_CHECKS) \ + $(LIBSABI_CHECKS) \ + libs/gdp \ + libs/adapter \ + libs/bitreader \ + libs/bytereader \ + libs/bytewriter \ + libs/gstnetclientclock \ + libs/gstnettimeprovider \ + libs/transform1 + +# failing tests +noinst_PROGRAMS = \ + gst/gstpipeline \ + libs/collectpads + +# elements to ignore for the state tests +# STATE_IGNORE_ELEMENTS = + +TESTS = $(check_PROGRAMS) + +noinst_HEADERS = \ + gst/capslist.h \ + gst/struct_arm.h \ + gst/struct_i386.h \ + gst/struct_hppa.h \ + gst/struct_ppc32.h \ + gst/struct_ppc64.h \ + gst/struct_sparc.h \ + gst/struct_x86_64.h \ + libs/struct_arm.h \ + libs/struct_i386.h \ + libs/struct_hppa.h \ + libs/struct_ppc32.h \ + libs/struct_ppc64.h \ + libs/struct_sparc.h \ + libs/struct_x86_64.h + +EXTRA_DIST = \ + libs/test_transform.c + +AM_CFLAGS = $(GST_OBJ_CFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS +AM_CXXFLAGS = $(GST_OBJ_CXXFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS +LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(GST_OBJ_LIBS) + +gst_gstcpp_SOURCES = gst/gstcpp.cc + +libs_gstlibscpp_SOURCES = libs/gstlibscpp.cc + +gst_gstutils_LDADD = $(LDADD) $(GSL_LIBS) $(GMP_LIBS) + +libs_gdp_SOURCES = \ + libs/gdp.c +libs_gdp_LDADD = \ + $(top_builddir)/libs/gst/dataprotocol/libgstdataprotocol-@GST_MAJORMINOR@.la \ + $(LDADD) + +elements_fdsrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \ + -DTESTFILE=\"$(top_srcdir)/configure.ac\" +elements_filesrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \ + -DTESTFILE=\"$(top_srcdir)/configure.ac\" + +libs_controller_LDADD = \ + $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ + $(LDADD) +libs_gstnetclientclock_LDADD = \ + $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ + $(LDADD) +libs_gstnettimeprovider_LDADD = \ + $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ + $(LDADD) + +# valgrind testing +# these just need valgrind fixing, period +VALGRIND_TO_FIX = \ + gst/gstinfo \ + libs/collectpads \ + pipelines/parse-launch + +VALGRIND_IGNORE = \ + pipelines/stress + +# these need fixing because the threads cause segfaults under valgrind +TESTS_THREADED = \ + gst/gstminiobject \ + gst/gstobject + +VALGRIND_TESTS_DISABLE = \ + $(TESTS_THREADED) \ + $(VALGRIND_IGNORE) \ + $(VALGRIND_TO_FIX) + +# indexers does not get tested yet +COVERAGE_DIRS = \ + gst \ + libs/gst/base \ + libs/gst/controller \ + libs/gst/check \ + libs/gst/dataprotocol \ + libs/gst/net \ + plugins/elements +COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov)) +COVERAGE_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_FILES)) +COVERAGE_OUT_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov.out)) +COVERAGE_OUT_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_OUT_FILES)) + +debug: + echo $(COVERAGE_FILES) + echo $(COVERAGE_FILES_REL) + +.PHONY: coverage +if GST_GCOV_ENABLED +# we rebuild a registry and do gst-inspect so that all the get/set codepaths +# are also covered +coverage: + for file in `find $(top_builddir) -name '*.gcda'`; do rm $$file; done + -rm $(CHECK_REGISTRY) + echo "Inspecting all elements" + for e in `$(GST_INSPECT) | head -n -2 | cut -d: -f2`; do $(GST_INSPECT) $$e > /dev/null 2>&1; done + make check + make coverage-report +else +coverage: + echo "You need to configure with --enable-gcov to get coverage data" + exit 1 +endif + +coverage-report: + rm -r coverage + for dir in $(COVERAGE_DIRS); do \ + mkdir -p coverage/$$dir; \ + make -C $(top_builddir)/$$dir gcov; \ + done + for dir in $(COVERAGE_DIRS); do \ + files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \ + if test ! -z "$$files"; then \ + perl $(top_srcdir)/common/coverage/coverage-report.pl \ + $(top_builddir)/$$dir/*.gcov.out > \ + coverage/$$dir/index.xml; \ + xsltproc $(top_srcdir)/common/coverage/coverage-report.xsl \ + coverage/$$dir/index.xml > coverage/$$dir/index.html; \ + fi; \ + done + + for file in $(COVERAGE_FILES_REL); do \ + echo Generating coverage/$$file.html; \ + perl $(top_srcdir)/common/coverage/coverage-report-entry.pl \ + $(top_builddir)/$$file > coverage/$$file.html; \ + done diff --git a/tests/check/Makefile.in b/tests/check/Makefile.in new file mode 100644 index 0000000..5451cbc --- /dev/null +++ b/tests/check/Makefile.in @@ -0,0 +1,3248 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/common/check.mak +check_PROGRAMS = gst/gstbuffer$(EXEEXT) gst/gstbufferlist$(EXEEXT) \ + gst/gstmeta$(EXEEXT) gst/gstbus$(EXEEXT) gst/gstcaps$(EXEEXT) \ + $(am__EXEEXT_1) gst/gstdatetime$(EXEEXT) gst/gstinfo$(EXEEXT) \ + gst/gstiterator$(EXEEXT) gst/gstmessage$(EXEEXT) \ + gst/gstminiobject$(EXEEXT) gst/gstobject$(EXEEXT) \ + gst/gstpad$(EXEEXT) gst/gstparamspecs$(EXEEXT) \ + gst/gstpoll$(EXEEXT) gst/gstsegment$(EXEEXT) \ + gst/gstsystemclock$(EXEEXT) gst/gstclock$(EXEEXT) \ + gst/gststructure$(EXEEXT) gst/gsttag$(EXEEXT) \ + gst/gsttagsetter$(EXEEXT) gst/gsttask$(EXEEXT) \ + gst/gstvalue$(EXEEXT) generic/states$(EXEEXT) $(am__EXEEXT_2) \ + $(am__EXEEXT_3) libs/gdp$(EXEEXT) libs/adapter$(EXEEXT) \ + libs/bitreader$(EXEEXT) libs/bytereader$(EXEEXT) \ + libs/bytewriter$(EXEEXT) libs/gstnetclientclock$(EXEEXT) \ + libs/gstnettimeprovider$(EXEEXT) libs/transform1$(EXEEXT) +noinst_PROGRAMS = gst/gstpipeline$(EXEEXT) libs/collectpads$(EXEEXT) +subdir = tests/check +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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +@HAVE_CXX_TRUE@am__EXEEXT_1 = gst/gstcpp$(EXEEXT) \ +@HAVE_CXX_TRUE@ libs/gstlibscpp$(EXEEXT) +@GST_DISABLE_PARSE_FALSE@am__EXEEXT_2 = pipelines/simple-launch-lines$(EXEEXT) \ +@GST_DISABLE_PARSE_FALSE@ pipelines/cleanup$(EXEEXT) \ +@GST_DISABLE_PARSE_FALSE@ pipelines/parse-launch$(EXEEXT) +@GST_DISABLE_PARSE_TRUE@am__EXEEXT_2 = \ +@GST_DISABLE_PARSE_TRUE@ pipelines/parse-disabled$(EXEEXT) +@GST_DISABLE_REGISTRY_FALSE@am__EXEEXT_3 = gst/gst$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstbin$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstchildproxy$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstelement$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstelementfactory$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstevent$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstghostpad$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstindex$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstplugin$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstpreset$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstquery$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstregistry$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gsturi$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstutils$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ generic/sinks$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/capsfilter$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/fakesink$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/fakesrc$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/fdsrc$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/filesink$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/filesrc$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/funnel$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/identity$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/multiqueue$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/selector$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/tee$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/queue$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/queue2$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ elements/valve$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ libs/basesrc$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ libs/basesink$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ libs/controller$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ libs/typefindhelper$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ pipelines/stress$(EXEEXT) \ +@GST_DISABLE_REGISTRY_FALSE@ pipelines/queue-error$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +elements_capsfilter_SOURCES = elements/capsfilter.c +elements_capsfilter_OBJECTS = capsfilter.$(OBJEXT) +elements_capsfilter_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +elements_capsfilter_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__dirstamp = $(am__leading_dot)dirstamp +elements_fakesink_SOURCES = elements/fakesink.c +elements_fakesink_OBJECTS = fakesink.$(OBJEXT) +elements_fakesink_LDADD = $(LDADD) +elements_fakesink_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_fakesrc_SOURCES = elements/fakesrc.c +elements_fakesrc_OBJECTS = fakesrc.$(OBJEXT) +elements_fakesrc_LDADD = $(LDADD) +elements_fakesrc_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_fdsrc_SOURCES = elements/fdsrc.c +elements_fdsrc_OBJECTS = elements_fdsrc-fdsrc.$(OBJEXT) +elements_fdsrc_LDADD = $(LDADD) +elements_fdsrc_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_fdsrc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(elements_fdsrc_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +elements_filesink_SOURCES = elements/filesink.c +elements_filesink_OBJECTS = filesink.$(OBJEXT) +elements_filesink_LDADD = $(LDADD) +elements_filesink_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_filesrc_SOURCES = elements/filesrc.c +elements_filesrc_OBJECTS = elements_filesrc-filesrc.$(OBJEXT) +elements_filesrc_LDADD = $(LDADD) +elements_filesrc_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_filesrc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(elements_filesrc_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +elements_funnel_SOURCES = elements/funnel.c +elements_funnel_OBJECTS = funnel.$(OBJEXT) +elements_funnel_LDADD = $(LDADD) +elements_funnel_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_identity_SOURCES = elements/identity.c +elements_identity_OBJECTS = identity.$(OBJEXT) +elements_identity_LDADD = $(LDADD) +elements_identity_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_multiqueue_SOURCES = elements/multiqueue.c +elements_multiqueue_OBJECTS = multiqueue.$(OBJEXT) +elements_multiqueue_LDADD = $(LDADD) +elements_multiqueue_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_queue_SOURCES = elements/queue.c +elements_queue_OBJECTS = queue.$(OBJEXT) +elements_queue_LDADD = $(LDADD) +elements_queue_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_queue2_SOURCES = elements/queue2.c +elements_queue2_OBJECTS = queue2.$(OBJEXT) +elements_queue2_LDADD = $(LDADD) +elements_queue2_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_selector_SOURCES = elements/selector.c +elements_selector_OBJECTS = selector.$(OBJEXT) +elements_selector_LDADD = $(LDADD) +elements_selector_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_tee_SOURCES = elements/tee.c +elements_tee_OBJECTS = tee.$(OBJEXT) +elements_tee_LDADD = $(LDADD) +elements_tee_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elements_valve_SOURCES = elements/valve.c +elements_valve_OBJECTS = valve.$(OBJEXT) +elements_valve_LDADD = $(LDADD) +elements_valve_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +generic_sinks_SOURCES = generic/sinks.c +generic_sinks_OBJECTS = sinks.$(OBJEXT) +generic_sinks_LDADD = $(LDADD) +generic_sinks_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +generic_states_SOURCES = generic/states.c +generic_states_OBJECTS = states.$(OBJEXT) +generic_states_LDADD = $(LDADD) +generic_states_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gst_SOURCES = gst/gst.c +gst_gst_OBJECTS = gst.$(OBJEXT) +gst_gst_LDADD = $(LDADD) +gst_gst_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstbin_SOURCES = gst/gstbin.c +gst_gstbin_OBJECTS = gstbin.$(OBJEXT) +gst_gstbin_LDADD = $(LDADD) +gst_gstbin_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstbuffer_SOURCES = gst/gstbuffer.c +gst_gstbuffer_OBJECTS = gstbuffer.$(OBJEXT) +gst_gstbuffer_LDADD = $(LDADD) +gst_gstbuffer_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstbufferlist_SOURCES = gst/gstbufferlist.c +gst_gstbufferlist_OBJECTS = gstbufferlist.$(OBJEXT) +gst_gstbufferlist_LDADD = $(LDADD) +gst_gstbufferlist_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstbus_SOURCES = gst/gstbus.c +gst_gstbus_OBJECTS = gstbus.$(OBJEXT) +gst_gstbus_LDADD = $(LDADD) +gst_gstbus_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstcaps_SOURCES = gst/gstcaps.c +gst_gstcaps_OBJECTS = gstcaps.$(OBJEXT) +gst_gstcaps_LDADD = $(LDADD) +gst_gstcaps_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstchildproxy_SOURCES = gst/gstchildproxy.c +gst_gstchildproxy_OBJECTS = gstchildproxy.$(OBJEXT) +gst_gstchildproxy_LDADD = $(LDADD) +gst_gstchildproxy_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstclock_SOURCES = gst/gstclock.c +gst_gstclock_OBJECTS = gstclock.$(OBJEXT) +gst_gstclock_LDADD = $(LDADD) +gst_gstclock_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +am_gst_gstcpp_OBJECTS = gstcpp.$(OBJEXT) +gst_gstcpp_OBJECTS = $(am_gst_gstcpp_OBJECTS) +gst_gstcpp_LDADD = $(LDADD) +gst_gstcpp_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstdatetime_SOURCES = gst/gstdatetime.c +gst_gstdatetime_OBJECTS = gstdatetime.$(OBJEXT) +gst_gstdatetime_LDADD = $(LDADD) +gst_gstdatetime_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstelement_SOURCES = gst/gstelement.c +gst_gstelement_OBJECTS = gstelement.$(OBJEXT) +gst_gstelement_LDADD = $(LDADD) +gst_gstelement_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstelementfactory_SOURCES = gst/gstelementfactory.c +gst_gstelementfactory_OBJECTS = gstelementfactory.$(OBJEXT) +gst_gstelementfactory_LDADD = $(LDADD) +gst_gstelementfactory_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstevent_SOURCES = gst/gstevent.c +gst_gstevent_OBJECTS = gstevent.$(OBJEXT) +gst_gstevent_LDADD = $(LDADD) +gst_gstevent_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstghostpad_SOURCES = gst/gstghostpad.c +gst_gstghostpad_OBJECTS = gstghostpad.$(OBJEXT) +gst_gstghostpad_LDADD = $(LDADD) +gst_gstghostpad_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstindex_SOURCES = gst/gstindex.c +gst_gstindex_OBJECTS = gstindex.$(OBJEXT) +gst_gstindex_LDADD = $(LDADD) +gst_gstindex_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstinfo_SOURCES = gst/gstinfo.c +gst_gstinfo_OBJECTS = gstinfo.$(OBJEXT) +gst_gstinfo_LDADD = $(LDADD) +gst_gstinfo_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstiterator_SOURCES = gst/gstiterator.c +gst_gstiterator_OBJECTS = gstiterator.$(OBJEXT) +gst_gstiterator_LDADD = $(LDADD) +gst_gstiterator_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstmessage_SOURCES = gst/gstmessage.c +gst_gstmessage_OBJECTS = gstmessage.$(OBJEXT) +gst_gstmessage_LDADD = $(LDADD) +gst_gstmessage_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstmeta_SOURCES = gst/gstmeta.c +gst_gstmeta_OBJECTS = gstmeta.$(OBJEXT) +gst_gstmeta_LDADD = $(LDADD) +gst_gstmeta_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstminiobject_SOURCES = gst/gstminiobject.c +gst_gstminiobject_OBJECTS = gstminiobject.$(OBJEXT) +gst_gstminiobject_LDADD = $(LDADD) +gst_gstminiobject_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstobject_SOURCES = gst/gstobject.c +gst_gstobject_OBJECTS = gstobject.$(OBJEXT) +gst_gstobject_LDADD = $(LDADD) +gst_gstobject_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstpad_SOURCES = gst/gstpad.c +gst_gstpad_OBJECTS = gstpad.$(OBJEXT) +gst_gstpad_LDADD = $(LDADD) +gst_gstpad_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstparamspecs_SOURCES = gst/gstparamspecs.c +gst_gstparamspecs_OBJECTS = gstparamspecs.$(OBJEXT) +gst_gstparamspecs_LDADD = $(LDADD) +gst_gstparamspecs_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstpipeline_SOURCES = gst/gstpipeline.c +gst_gstpipeline_OBJECTS = gstpipeline.$(OBJEXT) +gst_gstpipeline_LDADD = $(LDADD) +gst_gstpipeline_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstplugin_SOURCES = gst/gstplugin.c +gst_gstplugin_OBJECTS = gstplugin.$(OBJEXT) +gst_gstplugin_LDADD = $(LDADD) +gst_gstplugin_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstpoll_SOURCES = gst/gstpoll.c +gst_gstpoll_OBJECTS = gstpoll.$(OBJEXT) +gst_gstpoll_LDADD = $(LDADD) +gst_gstpoll_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstpreset_SOURCES = gst/gstpreset.c +gst_gstpreset_OBJECTS = gstpreset.$(OBJEXT) +gst_gstpreset_LDADD = $(LDADD) +gst_gstpreset_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstquery_SOURCES = gst/gstquery.c +gst_gstquery_OBJECTS = gstquery.$(OBJEXT) +gst_gstquery_LDADD = $(LDADD) +gst_gstquery_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstregistry_SOURCES = gst/gstregistry.c +gst_gstregistry_OBJECTS = gstregistry.$(OBJEXT) +gst_gstregistry_LDADD = $(LDADD) +gst_gstregistry_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstsegment_SOURCES = gst/gstsegment.c +gst_gstsegment_OBJECTS = gstsegment.$(OBJEXT) +gst_gstsegment_LDADD = $(LDADD) +gst_gstsegment_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gststructure_SOURCES = gst/gststructure.c +gst_gststructure_OBJECTS = gststructure.$(OBJEXT) +gst_gststructure_LDADD = $(LDADD) +gst_gststructure_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstsystemclock_SOURCES = gst/gstsystemclock.c +gst_gstsystemclock_OBJECTS = gstsystemclock.$(OBJEXT) +gst_gstsystemclock_LDADD = $(LDADD) +gst_gstsystemclock_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gsttag_SOURCES = gst/gsttag.c +gst_gsttag_OBJECTS = gsttag.$(OBJEXT) +gst_gsttag_LDADD = $(LDADD) +gst_gsttag_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gsttagsetter_SOURCES = gst/gsttagsetter.c +gst_gsttagsetter_OBJECTS = gsttagsetter.$(OBJEXT) +gst_gsttagsetter_LDADD = $(LDADD) +gst_gsttagsetter_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gsttask_SOURCES = gst/gsttask.c +gst_gsttask_OBJECTS = gsttask.$(OBJEXT) +gst_gsttask_LDADD = $(LDADD) +gst_gsttask_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gsturi_SOURCES = gst/gsturi.c +gst_gsturi_OBJECTS = gsturi.$(OBJEXT) +gst_gsturi_LDADD = $(LDADD) +gst_gsturi_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstutils_SOURCES = gst/gstutils.c +gst_gstutils_OBJECTS = gstutils.$(OBJEXT) +am__DEPENDENCIES_2 = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +gst_gstutils_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gst_gstvalue_SOURCES = gst/gstvalue.c +gst_gstvalue_OBJECTS = gstvalue.$(OBJEXT) +gst_gstvalue_LDADD = $(LDADD) +gst_gstvalue_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_adapter_SOURCES = libs/adapter.c +libs_adapter_OBJECTS = adapter.$(OBJEXT) +libs_adapter_LDADD = $(LDADD) +libs_adapter_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_basesink_SOURCES = libs/basesink.c +libs_basesink_OBJECTS = basesink.$(OBJEXT) +libs_basesink_LDADD = $(LDADD) +libs_basesink_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_basesrc_SOURCES = libs/basesrc.c +libs_basesrc_OBJECTS = basesrc.$(OBJEXT) +libs_basesrc_LDADD = $(LDADD) +libs_basesrc_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_bitreader_SOURCES = libs/bitreader.c +libs_bitreader_OBJECTS = bitreader.$(OBJEXT) +libs_bitreader_LDADD = $(LDADD) +libs_bitreader_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_bytereader_SOURCES = libs/bytereader.c +libs_bytereader_OBJECTS = bytereader.$(OBJEXT) +libs_bytereader_LDADD = $(LDADD) +libs_bytereader_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_bytewriter_SOURCES = libs/bytewriter.c +libs_bytewriter_OBJECTS = bytewriter.$(OBJEXT) +libs_bytewriter_LDADD = $(LDADD) +libs_bytewriter_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_collectpads_SOURCES = libs/collectpads.c +libs_collectpads_OBJECTS = collectpads.$(OBJEXT) +libs_collectpads_LDADD = $(LDADD) +libs_collectpads_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_controller_SOURCES = libs/controller.c +libs_controller_OBJECTS = controller.$(OBJEXT) +libs_controller_DEPENDENCIES = $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_2) +am_libs_gdp_OBJECTS = gdp.$(OBJEXT) +libs_gdp_OBJECTS = $(am_libs_gdp_OBJECTS) +libs_gdp_DEPENDENCIES = $(top_builddir)/libs/gst/dataprotocol/libgstdataprotocol-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_2) +am_libs_gstlibscpp_OBJECTS = gstlibscpp.$(OBJEXT) +libs_gstlibscpp_OBJECTS = $(am_libs_gstlibscpp_OBJECTS) +libs_gstlibscpp_LDADD = $(LDADD) +libs_gstlibscpp_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_gstnetclientclock_SOURCES = libs/gstnetclientclock.c +libs_gstnetclientclock_OBJECTS = gstnetclientclock.$(OBJEXT) +libs_gstnetclientclock_DEPENDENCIES = \ + $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_2) +libs_gstnettimeprovider_SOURCES = libs/gstnettimeprovider.c +libs_gstnettimeprovider_OBJECTS = gstnettimeprovider.$(OBJEXT) +libs_gstnettimeprovider_DEPENDENCIES = \ + $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_2) +libs_transform1_SOURCES = libs/transform1.c +libs_transform1_OBJECTS = transform1.$(OBJEXT) +libs_transform1_LDADD = $(LDADD) +libs_transform1_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +libs_typefindhelper_SOURCES = libs/typefindhelper.c +libs_typefindhelper_OBJECTS = typefindhelper.$(OBJEXT) +libs_typefindhelper_LDADD = $(LDADD) +libs_typefindhelper_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +pipelines_cleanup_SOURCES = pipelines/cleanup.c +pipelines_cleanup_OBJECTS = cleanup.$(OBJEXT) +pipelines_cleanup_LDADD = $(LDADD) +pipelines_cleanup_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +pipelines_parse_disabled_SOURCES = pipelines/parse-disabled.c +pipelines_parse_disabled_OBJECTS = parse-disabled.$(OBJEXT) +pipelines_parse_disabled_LDADD = $(LDADD) +pipelines_parse_disabled_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +pipelines_parse_launch_SOURCES = pipelines/parse-launch.c +pipelines_parse_launch_OBJECTS = parse-launch.$(OBJEXT) +pipelines_parse_launch_LDADD = $(LDADD) +pipelines_parse_launch_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +pipelines_queue_error_SOURCES = pipelines/queue-error.c +pipelines_queue_error_OBJECTS = queue-error.$(OBJEXT) +pipelines_queue_error_LDADD = $(LDADD) +pipelines_queue_error_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +pipelines_simple_launch_lines_SOURCES = \ + pipelines/simple-launch-lines.c +pipelines_simple_launch_lines_OBJECTS = simple-launch-lines.$(OBJEXT) +pipelines_simple_launch_lines_LDADD = $(LDADD) +pipelines_simple_launch_lines_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +pipelines_stress_SOURCES = pipelines/stress.c +pipelines_stress_OBJECTS = stress.$(OBJEXT) +pipelines_stress_LDADD = $(LDADD) +pipelines_stress_DEPENDENCIES = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_$(V)) +am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) +am__v_CXX_0 = @echo " CXX " $@; +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_$(V)) +am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CXXLD_0 = @echo " CXXLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = elements/capsfilter.c elements/fakesink.c elements/fakesrc.c \ + elements/fdsrc.c elements/filesink.c elements/filesrc.c \ + elements/funnel.c elements/identity.c elements/multiqueue.c \ + elements/queue.c elements/queue2.c elements/selector.c \ + elements/tee.c elements/valve.c generic/sinks.c \ + generic/states.c gst/gst.c gst/gstbin.c gst/gstbuffer.c \ + gst/gstbufferlist.c gst/gstbus.c gst/gstcaps.c \ + gst/gstchildproxy.c gst/gstclock.c $(gst_gstcpp_SOURCES) \ + gst/gstdatetime.c gst/gstelement.c gst/gstelementfactory.c \ + gst/gstevent.c gst/gstghostpad.c gst/gstindex.c gst/gstinfo.c \ + gst/gstiterator.c gst/gstmessage.c gst/gstmeta.c \ + gst/gstminiobject.c gst/gstobject.c gst/gstpad.c \ + gst/gstparamspecs.c gst/gstpipeline.c gst/gstplugin.c \ + gst/gstpoll.c gst/gstpreset.c gst/gstquery.c gst/gstregistry.c \ + gst/gstsegment.c gst/gststructure.c gst/gstsystemclock.c \ + gst/gsttag.c gst/gsttagsetter.c gst/gsttask.c gst/gsturi.c \ + gst/gstutils.c gst/gstvalue.c libs/adapter.c libs/basesink.c \ + libs/basesrc.c libs/bitreader.c libs/bytereader.c \ + libs/bytewriter.c libs/collectpads.c libs/controller.c \ + $(libs_gdp_SOURCES) $(libs_gstlibscpp_SOURCES) \ + libs/gstnetclientclock.c libs/gstnettimeprovider.c \ + libs/transform1.c libs/typefindhelper.c pipelines/cleanup.c \ + pipelines/parse-disabled.c pipelines/parse-launch.c \ + pipelines/queue-error.c pipelines/simple-launch-lines.c \ + pipelines/stress.c +DIST_SOURCES = elements/capsfilter.c elements/fakesink.c \ + elements/fakesrc.c elements/fdsrc.c elements/filesink.c \ + elements/filesrc.c elements/funnel.c elements/identity.c \ + elements/multiqueue.c elements/queue.c elements/queue2.c \ + elements/selector.c elements/tee.c elements/valve.c \ + generic/sinks.c generic/states.c gst/gst.c gst/gstbin.c \ + gst/gstbuffer.c gst/gstbufferlist.c gst/gstbus.c gst/gstcaps.c \ + gst/gstchildproxy.c gst/gstclock.c $(gst_gstcpp_SOURCES) \ + gst/gstdatetime.c gst/gstelement.c gst/gstelementfactory.c \ + gst/gstevent.c gst/gstghostpad.c gst/gstindex.c gst/gstinfo.c \ + gst/gstiterator.c gst/gstmessage.c gst/gstmeta.c \ + gst/gstminiobject.c gst/gstobject.c gst/gstpad.c \ + gst/gstparamspecs.c gst/gstpipeline.c gst/gstplugin.c \ + gst/gstpoll.c gst/gstpreset.c gst/gstquery.c gst/gstregistry.c \ + gst/gstsegment.c gst/gststructure.c gst/gstsystemclock.c \ + gst/gsttag.c gst/gsttagsetter.c gst/gsttask.c gst/gsturi.c \ + gst/gstutils.c gst/gstvalue.c libs/adapter.c libs/basesink.c \ + libs/basesrc.c libs/bitreader.c libs/bytereader.c \ + libs/bytewriter.c libs/collectpads.c libs/controller.c \ + $(libs_gdp_SOURCES) $(libs_gstlibscpp_SOURCES) \ + libs/gstnetclientclock.c libs/gstnettimeprovider.c \ + libs/transform1.c libs/typefindhelper.c pipelines/cleanup.c \ + pipelines/parse-disabled.c pipelines/parse-launch.c \ + pipelines/queue-error.c pipelines/simple-launch-lines.c \ + pipelines/stress.c +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ +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@ +LOOPS = 10 + +# inspect every plugin feature +GST_INSPECT = $(GST_TOOLS_DIR)/gst-inspect-$(GST_MAJORMINOR) +CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg +GST_TOOLS_DIR = $(top_builddir)/tools +REGISTRY_ENVIRONMENT = \ + GST_REGISTRY=$(CHECK_REGISTRY) + +TESTS_ENVIRONMENT = \ + GST_STATE_IGNORE_ELEMENTS="$(STATE_IGNORE_ELEMENTS)" \ + $(REGISTRY_ENVIRONMENT) \ + GST_PLUGIN_SCANNER=$(top_builddir)/libs/gst/helpers/gst-plugin-scanner \ + GST_PLUGIN_SYSTEM_PATH= \ + GST_PLUGIN_PATH=$(top_builddir)/plugins + + +# the core dumps of some machines have PIDs appended, test registry and +# profiling data +CLEANFILES = core core.* test-registry.* *.gcno *.gcda +SUPPRESSIONS = $(top_srcdir)/common/gst.supp +@GST_DISABLE_PARSE_FALSE@PARSE_CHECKS = pipelines/simple-launch-lines pipelines/cleanup pipelines/parse-launch +@GST_DISABLE_PARSE_TRUE@PARSE_CHECKS = pipelines/parse-disabled +@HAVE_CXX_FALSE@CXX_CHECKS = +@HAVE_CXX_TRUE@CXX_CHECKS = gst/gstcpp libs/gstlibscpp +@GST_DISABLE_REGISTRY_FALSE@REGISTRY_CHECKS = \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gst \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstbin \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstchildproxy \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstelement \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstelementfactory \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstevent \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstghostpad \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstindex \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstplugin \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstpreset \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstquery \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstregistry \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gsturi \ +@GST_DISABLE_REGISTRY_FALSE@ gst/gstutils \ +@GST_DISABLE_REGISTRY_FALSE@ generic/sinks \ +@GST_DISABLE_REGISTRY_FALSE@ elements/capsfilter \ +@GST_DISABLE_REGISTRY_FALSE@ elements/fakesink \ +@GST_DISABLE_REGISTRY_FALSE@ elements/fakesrc \ +@GST_DISABLE_REGISTRY_FALSE@ elements/fdsrc \ +@GST_DISABLE_REGISTRY_FALSE@ elements/filesink \ +@GST_DISABLE_REGISTRY_FALSE@ elements/filesrc \ +@GST_DISABLE_REGISTRY_FALSE@ elements/funnel \ +@GST_DISABLE_REGISTRY_FALSE@ elements/identity \ +@GST_DISABLE_REGISTRY_FALSE@ elements/multiqueue \ +@GST_DISABLE_REGISTRY_FALSE@ elements/selector \ +@GST_DISABLE_REGISTRY_FALSE@ elements/tee \ +@GST_DISABLE_REGISTRY_FALSE@ elements/queue \ +@GST_DISABLE_REGISTRY_FALSE@ elements/queue2 \ +@GST_DISABLE_REGISTRY_FALSE@ elements/valve \ +@GST_DISABLE_REGISTRY_FALSE@ libs/basesrc \ +@GST_DISABLE_REGISTRY_FALSE@ libs/basesink \ +@GST_DISABLE_REGISTRY_FALSE@ libs/controller \ +@GST_DISABLE_REGISTRY_FALSE@ libs/typefindhelper \ +@GST_DISABLE_REGISTRY_FALSE@ pipelines/stress \ +@GST_DISABLE_REGISTRY_FALSE@ pipelines/queue-error + + +# if it's calling gst_element_factory_make(), it will probably not work without +# a registry +@GST_DISABLE_REGISTRY_TRUE@REGISTRY_CHECKS = + +# elements to ignore for the state tests +# STATE_IGNORE_ELEMENTS = +TESTS = $(check_PROGRAMS) +noinst_HEADERS = \ + gst/capslist.h \ + gst/struct_arm.h \ + gst/struct_i386.h \ + gst/struct_hppa.h \ + gst/struct_ppc32.h \ + gst/struct_ppc64.h \ + gst/struct_sparc.h \ + gst/struct_x86_64.h \ + libs/struct_arm.h \ + libs/struct_i386.h \ + libs/struct_hppa.h \ + libs/struct_ppc32.h \ + libs/struct_ppc64.h \ + libs/struct_sparc.h \ + libs/struct_x86_64.h + +EXTRA_DIST = \ + libs/test_transform.c + +AM_CFLAGS = $(GST_OBJ_CFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS +AM_CXXFLAGS = $(GST_OBJ_CXXFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS +LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(GST_OBJ_LIBS) + +gst_gstcpp_SOURCES = gst/gstcpp.cc +libs_gstlibscpp_SOURCES = libs/gstlibscpp.cc +gst_gstutils_LDADD = $(LDADD) $(GSL_LIBS) $(GMP_LIBS) +libs_gdp_SOURCES = \ + libs/gdp.c + +libs_gdp_LDADD = \ + $(top_builddir)/libs/gst/dataprotocol/libgstdataprotocol-@GST_MAJORMINOR@.la \ + $(LDADD) + +elements_fdsrc_CFLAGS = $(GST_OBJ_CFLAGS) $(AM_CFLAGS) \ + -DTESTFILE=\"$(top_srcdir)/configure.ac\" + +elements_filesrc_CFLAGS = $(GST_OBJ_CFLAGS) $(AM_CFLAGS) \ + -DTESTFILE=\"$(top_srcdir)/configure.ac\" + +libs_controller_LDADD = \ + $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ + $(LDADD) + +libs_gstnetclientclock_LDADD = \ + $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ + $(LDADD) + +libs_gstnettimeprovider_LDADD = \ + $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ + $(LDADD) + + +# valgrind testing +# these just need valgrind fixing, period +VALGRIND_TO_FIX = \ + gst/gstinfo \ + libs/collectpads \ + pipelines/parse-launch + +VALGRIND_IGNORE = \ + pipelines/stress + + +# these need fixing because the threads cause segfaults under valgrind +TESTS_THREADED = \ + gst/gstminiobject \ + gst/gstobject + +VALGRIND_TESTS_DISABLE = \ + $(TESTS_THREADED) \ + $(VALGRIND_IGNORE) \ + $(VALGRIND_TO_FIX) + + +# indexers does not get tested yet +COVERAGE_DIRS = \ + gst \ + libs/gst/base \ + libs/gst/controller \ + libs/gst/check \ + libs/gst/dataprotocol \ + libs/gst/net \ + plugins/elements + +COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov)) +COVERAGE_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_FILES)) +COVERAGE_OUT_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov.out)) +COVERAGE_OUT_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_OUT_FILES)) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cc .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/common/check.mak $(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 tests/check/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/check/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): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +elements/$(am__dirstamp): + @$(MKDIR_P) elements + @: > elements/$(am__dirstamp) +elements/capsfilter$(EXEEXT): $(elements_capsfilter_OBJECTS) $(elements_capsfilter_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/capsfilter$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_capsfilter_OBJECTS) $(elements_capsfilter_LDADD) $(LIBS) +elements/fakesink$(EXEEXT): $(elements_fakesink_OBJECTS) $(elements_fakesink_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/fakesink$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_fakesink_OBJECTS) $(elements_fakesink_LDADD) $(LIBS) +elements/fakesrc$(EXEEXT): $(elements_fakesrc_OBJECTS) $(elements_fakesrc_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/fakesrc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_fakesrc_OBJECTS) $(elements_fakesrc_LDADD) $(LIBS) +elements/fdsrc$(EXEEXT): $(elements_fdsrc_OBJECTS) $(elements_fdsrc_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/fdsrc$(EXEEXT) + $(AM_V_CCLD)$(elements_fdsrc_LINK) $(elements_fdsrc_OBJECTS) $(elements_fdsrc_LDADD) $(LIBS) +elements/filesink$(EXEEXT): $(elements_filesink_OBJECTS) $(elements_filesink_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/filesink$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_filesink_OBJECTS) $(elements_filesink_LDADD) $(LIBS) +elements/filesrc$(EXEEXT): $(elements_filesrc_OBJECTS) $(elements_filesrc_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/filesrc$(EXEEXT) + $(AM_V_CCLD)$(elements_filesrc_LINK) $(elements_filesrc_OBJECTS) $(elements_filesrc_LDADD) $(LIBS) +elements/funnel$(EXEEXT): $(elements_funnel_OBJECTS) $(elements_funnel_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/funnel$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_funnel_OBJECTS) $(elements_funnel_LDADD) $(LIBS) +elements/identity$(EXEEXT): $(elements_identity_OBJECTS) $(elements_identity_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/identity$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_identity_OBJECTS) $(elements_identity_LDADD) $(LIBS) +elements/multiqueue$(EXEEXT): $(elements_multiqueue_OBJECTS) $(elements_multiqueue_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/multiqueue$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_multiqueue_OBJECTS) $(elements_multiqueue_LDADD) $(LIBS) +elements/queue$(EXEEXT): $(elements_queue_OBJECTS) $(elements_queue_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/queue$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_queue_OBJECTS) $(elements_queue_LDADD) $(LIBS) +elements/queue2$(EXEEXT): $(elements_queue2_OBJECTS) $(elements_queue2_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/queue2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_queue2_OBJECTS) $(elements_queue2_LDADD) $(LIBS) +elements/selector$(EXEEXT): $(elements_selector_OBJECTS) $(elements_selector_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/selector$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_selector_OBJECTS) $(elements_selector_LDADD) $(LIBS) +elements/tee$(EXEEXT): $(elements_tee_OBJECTS) $(elements_tee_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/tee$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_tee_OBJECTS) $(elements_tee_LDADD) $(LIBS) +elements/valve$(EXEEXT): $(elements_valve_OBJECTS) $(elements_valve_DEPENDENCIES) elements/$(am__dirstamp) + @rm -f elements/valve$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elements_valve_OBJECTS) $(elements_valve_LDADD) $(LIBS) +generic/$(am__dirstamp): + @$(MKDIR_P) generic + @: > generic/$(am__dirstamp) +generic/sinks$(EXEEXT): $(generic_sinks_OBJECTS) $(generic_sinks_DEPENDENCIES) generic/$(am__dirstamp) + @rm -f generic/sinks$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(generic_sinks_OBJECTS) $(generic_sinks_LDADD) $(LIBS) +generic/states$(EXEEXT): $(generic_states_OBJECTS) $(generic_states_DEPENDENCIES) generic/$(am__dirstamp) + @rm -f generic/states$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(generic_states_OBJECTS) $(generic_states_LDADD) $(LIBS) +gst/$(am__dirstamp): + @$(MKDIR_P) gst + @: > gst/$(am__dirstamp) +gst/gst$(EXEEXT): $(gst_gst_OBJECTS) $(gst_gst_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gst$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gst_OBJECTS) $(gst_gst_LDADD) $(LIBS) +gst/gstbin$(EXEEXT): $(gst_gstbin_OBJECTS) $(gst_gstbin_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstbin$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstbin_OBJECTS) $(gst_gstbin_LDADD) $(LIBS) +gst/gstbuffer$(EXEEXT): $(gst_gstbuffer_OBJECTS) $(gst_gstbuffer_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstbuffer$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstbuffer_OBJECTS) $(gst_gstbuffer_LDADD) $(LIBS) +gst/gstbufferlist$(EXEEXT): $(gst_gstbufferlist_OBJECTS) $(gst_gstbufferlist_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstbufferlist$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstbufferlist_OBJECTS) $(gst_gstbufferlist_LDADD) $(LIBS) +gst/gstbus$(EXEEXT): $(gst_gstbus_OBJECTS) $(gst_gstbus_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstbus$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstbus_OBJECTS) $(gst_gstbus_LDADD) $(LIBS) +gst/gstcaps$(EXEEXT): $(gst_gstcaps_OBJECTS) $(gst_gstcaps_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstcaps$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstcaps_OBJECTS) $(gst_gstcaps_LDADD) $(LIBS) +gst/gstchildproxy$(EXEEXT): $(gst_gstchildproxy_OBJECTS) $(gst_gstchildproxy_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstchildproxy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstchildproxy_OBJECTS) $(gst_gstchildproxy_LDADD) $(LIBS) +gst/gstclock$(EXEEXT): $(gst_gstclock_OBJECTS) $(gst_gstclock_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstclock$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstclock_OBJECTS) $(gst_gstclock_LDADD) $(LIBS) +gst/gstcpp$(EXEEXT): $(gst_gstcpp_OBJECTS) $(gst_gstcpp_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstcpp$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(gst_gstcpp_OBJECTS) $(gst_gstcpp_LDADD) $(LIBS) +gst/gstdatetime$(EXEEXT): $(gst_gstdatetime_OBJECTS) $(gst_gstdatetime_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstdatetime$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstdatetime_OBJECTS) $(gst_gstdatetime_LDADD) $(LIBS) +gst/gstelement$(EXEEXT): $(gst_gstelement_OBJECTS) $(gst_gstelement_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstelement$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstelement_OBJECTS) $(gst_gstelement_LDADD) $(LIBS) +gst/gstelementfactory$(EXEEXT): $(gst_gstelementfactory_OBJECTS) $(gst_gstelementfactory_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstelementfactory$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstelementfactory_OBJECTS) $(gst_gstelementfactory_LDADD) $(LIBS) +gst/gstevent$(EXEEXT): $(gst_gstevent_OBJECTS) $(gst_gstevent_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstevent$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstevent_OBJECTS) $(gst_gstevent_LDADD) $(LIBS) +gst/gstghostpad$(EXEEXT): $(gst_gstghostpad_OBJECTS) $(gst_gstghostpad_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstghostpad$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstghostpad_OBJECTS) $(gst_gstghostpad_LDADD) $(LIBS) +gst/gstindex$(EXEEXT): $(gst_gstindex_OBJECTS) $(gst_gstindex_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstindex$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstindex_OBJECTS) $(gst_gstindex_LDADD) $(LIBS) +gst/gstinfo$(EXEEXT): $(gst_gstinfo_OBJECTS) $(gst_gstinfo_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstinfo$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstinfo_OBJECTS) $(gst_gstinfo_LDADD) $(LIBS) +gst/gstiterator$(EXEEXT): $(gst_gstiterator_OBJECTS) $(gst_gstiterator_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstiterator$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstiterator_OBJECTS) $(gst_gstiterator_LDADD) $(LIBS) +gst/gstmessage$(EXEEXT): $(gst_gstmessage_OBJECTS) $(gst_gstmessage_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstmessage$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstmessage_OBJECTS) $(gst_gstmessage_LDADD) $(LIBS) +gst/gstmeta$(EXEEXT): $(gst_gstmeta_OBJECTS) $(gst_gstmeta_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstmeta$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstmeta_OBJECTS) $(gst_gstmeta_LDADD) $(LIBS) +gst/gstminiobject$(EXEEXT): $(gst_gstminiobject_OBJECTS) $(gst_gstminiobject_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstminiobject$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstminiobject_OBJECTS) $(gst_gstminiobject_LDADD) $(LIBS) +gst/gstobject$(EXEEXT): $(gst_gstobject_OBJECTS) $(gst_gstobject_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstobject$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstobject_OBJECTS) $(gst_gstobject_LDADD) $(LIBS) +gst/gstpad$(EXEEXT): $(gst_gstpad_OBJECTS) $(gst_gstpad_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstpad$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstpad_OBJECTS) $(gst_gstpad_LDADD) $(LIBS) +gst/gstparamspecs$(EXEEXT): $(gst_gstparamspecs_OBJECTS) $(gst_gstparamspecs_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstparamspecs$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstparamspecs_OBJECTS) $(gst_gstparamspecs_LDADD) $(LIBS) +gst/gstpipeline$(EXEEXT): $(gst_gstpipeline_OBJECTS) $(gst_gstpipeline_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstpipeline$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstpipeline_OBJECTS) $(gst_gstpipeline_LDADD) $(LIBS) +gst/gstplugin$(EXEEXT): $(gst_gstplugin_OBJECTS) $(gst_gstplugin_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstplugin$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstplugin_OBJECTS) $(gst_gstplugin_LDADD) $(LIBS) +gst/gstpoll$(EXEEXT): $(gst_gstpoll_OBJECTS) $(gst_gstpoll_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstpoll$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstpoll_OBJECTS) $(gst_gstpoll_LDADD) $(LIBS) +gst/gstpreset$(EXEEXT): $(gst_gstpreset_OBJECTS) $(gst_gstpreset_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstpreset$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstpreset_OBJECTS) $(gst_gstpreset_LDADD) $(LIBS) +gst/gstquery$(EXEEXT): $(gst_gstquery_OBJECTS) $(gst_gstquery_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstquery$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstquery_OBJECTS) $(gst_gstquery_LDADD) $(LIBS) +gst/gstregistry$(EXEEXT): $(gst_gstregistry_OBJECTS) $(gst_gstregistry_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstregistry$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstregistry_OBJECTS) $(gst_gstregistry_LDADD) $(LIBS) +gst/gstsegment$(EXEEXT): $(gst_gstsegment_OBJECTS) $(gst_gstsegment_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstsegment$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstsegment_OBJECTS) $(gst_gstsegment_LDADD) $(LIBS) +gst/gststructure$(EXEEXT): $(gst_gststructure_OBJECTS) $(gst_gststructure_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gststructure$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gststructure_OBJECTS) $(gst_gststructure_LDADD) $(LIBS) +gst/gstsystemclock$(EXEEXT): $(gst_gstsystemclock_OBJECTS) $(gst_gstsystemclock_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstsystemclock$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstsystemclock_OBJECTS) $(gst_gstsystemclock_LDADD) $(LIBS) +gst/gsttag$(EXEEXT): $(gst_gsttag_OBJECTS) $(gst_gsttag_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gsttag$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gsttag_OBJECTS) $(gst_gsttag_LDADD) $(LIBS) +gst/gsttagsetter$(EXEEXT): $(gst_gsttagsetter_OBJECTS) $(gst_gsttagsetter_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gsttagsetter$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gsttagsetter_OBJECTS) $(gst_gsttagsetter_LDADD) $(LIBS) +gst/gsttask$(EXEEXT): $(gst_gsttask_OBJECTS) $(gst_gsttask_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gsttask$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gsttask_OBJECTS) $(gst_gsttask_LDADD) $(LIBS) +gst/gsturi$(EXEEXT): $(gst_gsturi_OBJECTS) $(gst_gsturi_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gsturi$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gsturi_OBJECTS) $(gst_gsturi_LDADD) $(LIBS) +gst/gstutils$(EXEEXT): $(gst_gstutils_OBJECTS) $(gst_gstutils_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstutils$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstutils_OBJECTS) $(gst_gstutils_LDADD) $(LIBS) +gst/gstvalue$(EXEEXT): $(gst_gstvalue_OBJECTS) $(gst_gstvalue_DEPENDENCIES) gst/$(am__dirstamp) + @rm -f gst/gstvalue$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gst_gstvalue_OBJECTS) $(gst_gstvalue_LDADD) $(LIBS) +libs/$(am__dirstamp): + @$(MKDIR_P) libs + @: > libs/$(am__dirstamp) +libs/adapter$(EXEEXT): $(libs_adapter_OBJECTS) $(libs_adapter_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/adapter$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_adapter_OBJECTS) $(libs_adapter_LDADD) $(LIBS) +libs/basesink$(EXEEXT): $(libs_basesink_OBJECTS) $(libs_basesink_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/basesink$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_basesink_OBJECTS) $(libs_basesink_LDADD) $(LIBS) +libs/basesrc$(EXEEXT): $(libs_basesrc_OBJECTS) $(libs_basesrc_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/basesrc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_basesrc_OBJECTS) $(libs_basesrc_LDADD) $(LIBS) +libs/bitreader$(EXEEXT): $(libs_bitreader_OBJECTS) $(libs_bitreader_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/bitreader$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_bitreader_OBJECTS) $(libs_bitreader_LDADD) $(LIBS) +libs/bytereader$(EXEEXT): $(libs_bytereader_OBJECTS) $(libs_bytereader_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/bytereader$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_bytereader_OBJECTS) $(libs_bytereader_LDADD) $(LIBS) +libs/bytewriter$(EXEEXT): $(libs_bytewriter_OBJECTS) $(libs_bytewriter_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/bytewriter$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_bytewriter_OBJECTS) $(libs_bytewriter_LDADD) $(LIBS) +libs/collectpads$(EXEEXT): $(libs_collectpads_OBJECTS) $(libs_collectpads_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/collectpads$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_collectpads_OBJECTS) $(libs_collectpads_LDADD) $(LIBS) +libs/controller$(EXEEXT): $(libs_controller_OBJECTS) $(libs_controller_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/controller$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_controller_OBJECTS) $(libs_controller_LDADD) $(LIBS) +libs/gdp$(EXEEXT): $(libs_gdp_OBJECTS) $(libs_gdp_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/gdp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_gdp_OBJECTS) $(libs_gdp_LDADD) $(LIBS) +libs/gstlibscpp$(EXEEXT): $(libs_gstlibscpp_OBJECTS) $(libs_gstlibscpp_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/gstlibscpp$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(libs_gstlibscpp_OBJECTS) $(libs_gstlibscpp_LDADD) $(LIBS) +libs/gstnetclientclock$(EXEEXT): $(libs_gstnetclientclock_OBJECTS) $(libs_gstnetclientclock_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/gstnetclientclock$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_gstnetclientclock_OBJECTS) $(libs_gstnetclientclock_LDADD) $(LIBS) +libs/gstnettimeprovider$(EXEEXT): $(libs_gstnettimeprovider_OBJECTS) $(libs_gstnettimeprovider_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/gstnettimeprovider$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_gstnettimeprovider_OBJECTS) $(libs_gstnettimeprovider_LDADD) $(LIBS) +libs/transform1$(EXEEXT): $(libs_transform1_OBJECTS) $(libs_transform1_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/transform1$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_transform1_OBJECTS) $(libs_transform1_LDADD) $(LIBS) +libs/typefindhelper$(EXEEXT): $(libs_typefindhelper_OBJECTS) $(libs_typefindhelper_DEPENDENCIES) libs/$(am__dirstamp) + @rm -f libs/typefindhelper$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libs_typefindhelper_OBJECTS) $(libs_typefindhelper_LDADD) $(LIBS) +pipelines/$(am__dirstamp): + @$(MKDIR_P) pipelines + @: > pipelines/$(am__dirstamp) +pipelines/cleanup$(EXEEXT): $(pipelines_cleanup_OBJECTS) $(pipelines_cleanup_DEPENDENCIES) pipelines/$(am__dirstamp) + @rm -f pipelines/cleanup$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pipelines_cleanup_OBJECTS) $(pipelines_cleanup_LDADD) $(LIBS) +pipelines/parse-disabled$(EXEEXT): $(pipelines_parse_disabled_OBJECTS) $(pipelines_parse_disabled_DEPENDENCIES) pipelines/$(am__dirstamp) + @rm -f pipelines/parse-disabled$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pipelines_parse_disabled_OBJECTS) $(pipelines_parse_disabled_LDADD) $(LIBS) +pipelines/parse-launch$(EXEEXT): $(pipelines_parse_launch_OBJECTS) $(pipelines_parse_launch_DEPENDENCIES) pipelines/$(am__dirstamp) + @rm -f pipelines/parse-launch$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pipelines_parse_launch_OBJECTS) $(pipelines_parse_launch_LDADD) $(LIBS) +pipelines/queue-error$(EXEEXT): $(pipelines_queue_error_OBJECTS) $(pipelines_queue_error_DEPENDENCIES) pipelines/$(am__dirstamp) + @rm -f pipelines/queue-error$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pipelines_queue_error_OBJECTS) $(pipelines_queue_error_LDADD) $(LIBS) +pipelines/simple-launch-lines$(EXEEXT): $(pipelines_simple_launch_lines_OBJECTS) $(pipelines_simple_launch_lines_DEPENDENCIES) pipelines/$(am__dirstamp) + @rm -f pipelines/simple-launch-lines$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pipelines_simple_launch_lines_OBJECTS) $(pipelines_simple_launch_lines_LDADD) $(LIBS) +pipelines/stress$(EXEEXT): $(pipelines_stress_OBJECTS) $(pipelines_stress_DEPENDENCIES) pipelines/$(am__dirstamp) + @rm -f pipelines/stress$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pipelines_stress_OBJECTS) $(pipelines_stress_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adapter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basesink.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basesrc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitreader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bytereader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bytewriter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capsfilter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectpads.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elements_fdsrc-fdsrc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elements_filesrc-filesrc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fakesink.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fakesrc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filesink.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funnel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gst.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstbin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstbuffer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstbufferlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstbus.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstcaps.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstchildproxy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstclock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstcpp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstdatetime.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstelement.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstelementfactory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstevent.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstghostpad.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstindex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstiterator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstlibscpp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstmessage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstmeta.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstminiobject.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstnetclientclock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstnettimeprovider.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstobject.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstpad.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstparamspecs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstpipeline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstplugin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstpoll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstpreset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstquery.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstregistry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstsegment.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gststructure.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstsystemclock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsttag.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsttagsetter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsttask.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsturi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstutils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstvalue.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/identity.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multiqueue.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse-disabled.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse-launch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue-error.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple-launch-lines.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/states.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stress.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tee.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transform1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/typefindhelper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/valve.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +capsfilter.o: elements/capsfilter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT capsfilter.o -MD -MP -MF $(DEPDIR)/capsfilter.Tpo -c -o capsfilter.o `test -f 'elements/capsfilter.c' || echo '$(srcdir)/'`elements/capsfilter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/capsfilter.Tpo $(DEPDIR)/capsfilter.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/capsfilter.c' object='capsfilter.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o capsfilter.o `test -f 'elements/capsfilter.c' || echo '$(srcdir)/'`elements/capsfilter.c + +capsfilter.obj: elements/capsfilter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT capsfilter.obj -MD -MP -MF $(DEPDIR)/capsfilter.Tpo -c -o capsfilter.obj `if test -f 'elements/capsfilter.c'; then $(CYGPATH_W) 'elements/capsfilter.c'; else $(CYGPATH_W) '$(srcdir)/elements/capsfilter.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/capsfilter.Tpo $(DEPDIR)/capsfilter.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/capsfilter.c' object='capsfilter.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o capsfilter.obj `if test -f 'elements/capsfilter.c'; then $(CYGPATH_W) 'elements/capsfilter.c'; else $(CYGPATH_W) '$(srcdir)/elements/capsfilter.c'; fi` + +fakesink.o: elements/fakesink.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fakesink.o -MD -MP -MF $(DEPDIR)/fakesink.Tpo -c -o fakesink.o `test -f 'elements/fakesink.c' || echo '$(srcdir)/'`elements/fakesink.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fakesink.Tpo $(DEPDIR)/fakesink.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/fakesink.c' object='fakesink.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fakesink.o `test -f 'elements/fakesink.c' || echo '$(srcdir)/'`elements/fakesink.c + +fakesink.obj: elements/fakesink.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fakesink.obj -MD -MP -MF $(DEPDIR)/fakesink.Tpo -c -o fakesink.obj `if test -f 'elements/fakesink.c'; then $(CYGPATH_W) 'elements/fakesink.c'; else $(CYGPATH_W) '$(srcdir)/elements/fakesink.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fakesink.Tpo $(DEPDIR)/fakesink.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/fakesink.c' object='fakesink.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fakesink.obj `if test -f 'elements/fakesink.c'; then $(CYGPATH_W) 'elements/fakesink.c'; else $(CYGPATH_W) '$(srcdir)/elements/fakesink.c'; fi` + +fakesrc.o: elements/fakesrc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fakesrc.o -MD -MP -MF $(DEPDIR)/fakesrc.Tpo -c -o fakesrc.o `test -f 'elements/fakesrc.c' || echo '$(srcdir)/'`elements/fakesrc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fakesrc.Tpo $(DEPDIR)/fakesrc.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/fakesrc.c' object='fakesrc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fakesrc.o `test -f 'elements/fakesrc.c' || echo '$(srcdir)/'`elements/fakesrc.c + +fakesrc.obj: elements/fakesrc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fakesrc.obj -MD -MP -MF $(DEPDIR)/fakesrc.Tpo -c -o fakesrc.obj `if test -f 'elements/fakesrc.c'; then $(CYGPATH_W) 'elements/fakesrc.c'; else $(CYGPATH_W) '$(srcdir)/elements/fakesrc.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fakesrc.Tpo $(DEPDIR)/fakesrc.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/fakesrc.c' object='fakesrc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fakesrc.obj `if test -f 'elements/fakesrc.c'; then $(CYGPATH_W) 'elements/fakesrc.c'; else $(CYGPATH_W) '$(srcdir)/elements/fakesrc.c'; fi` + +elements_fdsrc-fdsrc.o: elements/fdsrc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_fdsrc_CFLAGS) $(CFLAGS) -MT elements_fdsrc-fdsrc.o -MD -MP -MF $(DEPDIR)/elements_fdsrc-fdsrc.Tpo -c -o elements_fdsrc-fdsrc.o `test -f 'elements/fdsrc.c' || echo '$(srcdir)/'`elements/fdsrc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elements_fdsrc-fdsrc.Tpo $(DEPDIR)/elements_fdsrc-fdsrc.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/fdsrc.c' object='elements_fdsrc-fdsrc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_fdsrc_CFLAGS) $(CFLAGS) -c -o elements_fdsrc-fdsrc.o `test -f 'elements/fdsrc.c' || echo '$(srcdir)/'`elements/fdsrc.c + +elements_fdsrc-fdsrc.obj: elements/fdsrc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_fdsrc_CFLAGS) $(CFLAGS) -MT elements_fdsrc-fdsrc.obj -MD -MP -MF $(DEPDIR)/elements_fdsrc-fdsrc.Tpo -c -o elements_fdsrc-fdsrc.obj `if test -f 'elements/fdsrc.c'; then $(CYGPATH_W) 'elements/fdsrc.c'; else $(CYGPATH_W) '$(srcdir)/elements/fdsrc.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elements_fdsrc-fdsrc.Tpo $(DEPDIR)/elements_fdsrc-fdsrc.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/fdsrc.c' object='elements_fdsrc-fdsrc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_fdsrc_CFLAGS) $(CFLAGS) -c -o elements_fdsrc-fdsrc.obj `if test -f 'elements/fdsrc.c'; then $(CYGPATH_W) 'elements/fdsrc.c'; else $(CYGPATH_W) '$(srcdir)/elements/fdsrc.c'; fi` + +filesink.o: elements/filesink.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT filesink.o -MD -MP -MF $(DEPDIR)/filesink.Tpo -c -o filesink.o `test -f 'elements/filesink.c' || echo '$(srcdir)/'`elements/filesink.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/filesink.Tpo $(DEPDIR)/filesink.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/filesink.c' object='filesink.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o filesink.o `test -f 'elements/filesink.c' || echo '$(srcdir)/'`elements/filesink.c + +filesink.obj: elements/filesink.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT filesink.obj -MD -MP -MF $(DEPDIR)/filesink.Tpo -c -o filesink.obj `if test -f 'elements/filesink.c'; then $(CYGPATH_W) 'elements/filesink.c'; else $(CYGPATH_W) '$(srcdir)/elements/filesink.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/filesink.Tpo $(DEPDIR)/filesink.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/filesink.c' object='filesink.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o filesink.obj `if test -f 'elements/filesink.c'; then $(CYGPATH_W) 'elements/filesink.c'; else $(CYGPATH_W) '$(srcdir)/elements/filesink.c'; fi` + +elements_filesrc-filesrc.o: elements/filesrc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_filesrc_CFLAGS) $(CFLAGS) -MT elements_filesrc-filesrc.o -MD -MP -MF $(DEPDIR)/elements_filesrc-filesrc.Tpo -c -o elements_filesrc-filesrc.o `test -f 'elements/filesrc.c' || echo '$(srcdir)/'`elements/filesrc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elements_filesrc-filesrc.Tpo $(DEPDIR)/elements_filesrc-filesrc.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/filesrc.c' object='elements_filesrc-filesrc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_filesrc_CFLAGS) $(CFLAGS) -c -o elements_filesrc-filesrc.o `test -f 'elements/filesrc.c' || echo '$(srcdir)/'`elements/filesrc.c + +elements_filesrc-filesrc.obj: elements/filesrc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_filesrc_CFLAGS) $(CFLAGS) -MT elements_filesrc-filesrc.obj -MD -MP -MF $(DEPDIR)/elements_filesrc-filesrc.Tpo -c -o elements_filesrc-filesrc.obj `if test -f 'elements/filesrc.c'; then $(CYGPATH_W) 'elements/filesrc.c'; else $(CYGPATH_W) '$(srcdir)/elements/filesrc.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/elements_filesrc-filesrc.Tpo $(DEPDIR)/elements_filesrc-filesrc.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/filesrc.c' object='elements_filesrc-filesrc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_filesrc_CFLAGS) $(CFLAGS) -c -o elements_filesrc-filesrc.obj `if test -f 'elements/filesrc.c'; then $(CYGPATH_W) 'elements/filesrc.c'; else $(CYGPATH_W) '$(srcdir)/elements/filesrc.c'; fi` + +funnel.o: elements/funnel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT funnel.o -MD -MP -MF $(DEPDIR)/funnel.Tpo -c -o funnel.o `test -f 'elements/funnel.c' || echo '$(srcdir)/'`elements/funnel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/funnel.Tpo $(DEPDIR)/funnel.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/funnel.c' object='funnel.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o funnel.o `test -f 'elements/funnel.c' || echo '$(srcdir)/'`elements/funnel.c + +funnel.obj: elements/funnel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT funnel.obj -MD -MP -MF $(DEPDIR)/funnel.Tpo -c -o funnel.obj `if test -f 'elements/funnel.c'; then $(CYGPATH_W) 'elements/funnel.c'; else $(CYGPATH_W) '$(srcdir)/elements/funnel.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/funnel.Tpo $(DEPDIR)/funnel.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/funnel.c' object='funnel.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o funnel.obj `if test -f 'elements/funnel.c'; then $(CYGPATH_W) 'elements/funnel.c'; else $(CYGPATH_W) '$(srcdir)/elements/funnel.c'; fi` + +identity.o: elements/identity.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT identity.o -MD -MP -MF $(DEPDIR)/identity.Tpo -c -o identity.o `test -f 'elements/identity.c' || echo '$(srcdir)/'`elements/identity.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/identity.Tpo $(DEPDIR)/identity.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/identity.c' object='identity.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o identity.o `test -f 'elements/identity.c' || echo '$(srcdir)/'`elements/identity.c + +identity.obj: elements/identity.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT identity.obj -MD -MP -MF $(DEPDIR)/identity.Tpo -c -o identity.obj `if test -f 'elements/identity.c'; then $(CYGPATH_W) 'elements/identity.c'; else $(CYGPATH_W) '$(srcdir)/elements/identity.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/identity.Tpo $(DEPDIR)/identity.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/identity.c' object='identity.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o identity.obj `if test -f 'elements/identity.c'; then $(CYGPATH_W) 'elements/identity.c'; else $(CYGPATH_W) '$(srcdir)/elements/identity.c'; fi` + +multiqueue.o: elements/multiqueue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT multiqueue.o -MD -MP -MF $(DEPDIR)/multiqueue.Tpo -c -o multiqueue.o `test -f 'elements/multiqueue.c' || echo '$(srcdir)/'`elements/multiqueue.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/multiqueue.Tpo $(DEPDIR)/multiqueue.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/multiqueue.c' object='multiqueue.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o multiqueue.o `test -f 'elements/multiqueue.c' || echo '$(srcdir)/'`elements/multiqueue.c + +multiqueue.obj: elements/multiqueue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT multiqueue.obj -MD -MP -MF $(DEPDIR)/multiqueue.Tpo -c -o multiqueue.obj `if test -f 'elements/multiqueue.c'; then $(CYGPATH_W) 'elements/multiqueue.c'; else $(CYGPATH_W) '$(srcdir)/elements/multiqueue.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/multiqueue.Tpo $(DEPDIR)/multiqueue.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/multiqueue.c' object='multiqueue.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o multiqueue.obj `if test -f 'elements/multiqueue.c'; then $(CYGPATH_W) 'elements/multiqueue.c'; else $(CYGPATH_W) '$(srcdir)/elements/multiqueue.c'; fi` + +queue.o: elements/queue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT queue.o -MD -MP -MF $(DEPDIR)/queue.Tpo -c -o queue.o `test -f 'elements/queue.c' || echo '$(srcdir)/'`elements/queue.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/queue.Tpo $(DEPDIR)/queue.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/queue.c' object='queue.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o queue.o `test -f 'elements/queue.c' || echo '$(srcdir)/'`elements/queue.c + +queue.obj: elements/queue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT queue.obj -MD -MP -MF $(DEPDIR)/queue.Tpo -c -o queue.obj `if test -f 'elements/queue.c'; then $(CYGPATH_W) 'elements/queue.c'; else $(CYGPATH_W) '$(srcdir)/elements/queue.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/queue.Tpo $(DEPDIR)/queue.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/queue.c' object='queue.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o queue.obj `if test -f 'elements/queue.c'; then $(CYGPATH_W) 'elements/queue.c'; else $(CYGPATH_W) '$(srcdir)/elements/queue.c'; fi` + +queue2.o: elements/queue2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT queue2.o -MD -MP -MF $(DEPDIR)/queue2.Tpo -c -o queue2.o `test -f 'elements/queue2.c' || echo '$(srcdir)/'`elements/queue2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/queue2.Tpo $(DEPDIR)/queue2.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/queue2.c' object='queue2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o queue2.o `test -f 'elements/queue2.c' || echo '$(srcdir)/'`elements/queue2.c + +queue2.obj: elements/queue2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT queue2.obj -MD -MP -MF $(DEPDIR)/queue2.Tpo -c -o queue2.obj `if test -f 'elements/queue2.c'; then $(CYGPATH_W) 'elements/queue2.c'; else $(CYGPATH_W) '$(srcdir)/elements/queue2.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/queue2.Tpo $(DEPDIR)/queue2.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/queue2.c' object='queue2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o queue2.obj `if test -f 'elements/queue2.c'; then $(CYGPATH_W) 'elements/queue2.c'; else $(CYGPATH_W) '$(srcdir)/elements/queue2.c'; fi` + +selector.o: elements/selector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT selector.o -MD -MP -MF $(DEPDIR)/selector.Tpo -c -o selector.o `test -f 'elements/selector.c' || echo '$(srcdir)/'`elements/selector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/selector.Tpo $(DEPDIR)/selector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/selector.c' object='selector.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o selector.o `test -f 'elements/selector.c' || echo '$(srcdir)/'`elements/selector.c + +selector.obj: elements/selector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT selector.obj -MD -MP -MF $(DEPDIR)/selector.Tpo -c -o selector.obj `if test -f 'elements/selector.c'; then $(CYGPATH_W) 'elements/selector.c'; else $(CYGPATH_W) '$(srcdir)/elements/selector.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/selector.Tpo $(DEPDIR)/selector.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/selector.c' object='selector.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o selector.obj `if test -f 'elements/selector.c'; then $(CYGPATH_W) 'elements/selector.c'; else $(CYGPATH_W) '$(srcdir)/elements/selector.c'; fi` + +tee.o: elements/tee.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tee.o -MD -MP -MF $(DEPDIR)/tee.Tpo -c -o tee.o `test -f 'elements/tee.c' || echo '$(srcdir)/'`elements/tee.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tee.Tpo $(DEPDIR)/tee.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/tee.c' object='tee.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tee.o `test -f 'elements/tee.c' || echo '$(srcdir)/'`elements/tee.c + +tee.obj: elements/tee.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tee.obj -MD -MP -MF $(DEPDIR)/tee.Tpo -c -o tee.obj `if test -f 'elements/tee.c'; then $(CYGPATH_W) 'elements/tee.c'; else $(CYGPATH_W) '$(srcdir)/elements/tee.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tee.Tpo $(DEPDIR)/tee.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/tee.c' object='tee.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tee.obj `if test -f 'elements/tee.c'; then $(CYGPATH_W) 'elements/tee.c'; else $(CYGPATH_W) '$(srcdir)/elements/tee.c'; fi` + +valve.o: elements/valve.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valve.o -MD -MP -MF $(DEPDIR)/valve.Tpo -c -o valve.o `test -f 'elements/valve.c' || echo '$(srcdir)/'`elements/valve.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/valve.Tpo $(DEPDIR)/valve.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/valve.c' object='valve.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valve.o `test -f 'elements/valve.c' || echo '$(srcdir)/'`elements/valve.c + +valve.obj: elements/valve.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT valve.obj -MD -MP -MF $(DEPDIR)/valve.Tpo -c -o valve.obj `if test -f 'elements/valve.c'; then $(CYGPATH_W) 'elements/valve.c'; else $(CYGPATH_W) '$(srcdir)/elements/valve.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/valve.Tpo $(DEPDIR)/valve.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='elements/valve.c' object='valve.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o valve.obj `if test -f 'elements/valve.c'; then $(CYGPATH_W) 'elements/valve.c'; else $(CYGPATH_W) '$(srcdir)/elements/valve.c'; fi` + +sinks.o: generic/sinks.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sinks.o -MD -MP -MF $(DEPDIR)/sinks.Tpo -c -o sinks.o `test -f 'generic/sinks.c' || echo '$(srcdir)/'`generic/sinks.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sinks.Tpo $(DEPDIR)/sinks.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='generic/sinks.c' object='sinks.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sinks.o `test -f 'generic/sinks.c' || echo '$(srcdir)/'`generic/sinks.c + +sinks.obj: generic/sinks.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sinks.obj -MD -MP -MF $(DEPDIR)/sinks.Tpo -c -o sinks.obj `if test -f 'generic/sinks.c'; then $(CYGPATH_W) 'generic/sinks.c'; else $(CYGPATH_W) '$(srcdir)/generic/sinks.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sinks.Tpo $(DEPDIR)/sinks.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='generic/sinks.c' object='sinks.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sinks.obj `if test -f 'generic/sinks.c'; then $(CYGPATH_W) 'generic/sinks.c'; else $(CYGPATH_W) '$(srcdir)/generic/sinks.c'; fi` + +states.o: generic/states.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT states.o -MD -MP -MF $(DEPDIR)/states.Tpo -c -o states.o `test -f 'generic/states.c' || echo '$(srcdir)/'`generic/states.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/states.Tpo $(DEPDIR)/states.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='generic/states.c' object='states.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o states.o `test -f 'generic/states.c' || echo '$(srcdir)/'`generic/states.c + +states.obj: generic/states.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT states.obj -MD -MP -MF $(DEPDIR)/states.Tpo -c -o states.obj `if test -f 'generic/states.c'; then $(CYGPATH_W) 'generic/states.c'; else $(CYGPATH_W) '$(srcdir)/generic/states.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/states.Tpo $(DEPDIR)/states.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='generic/states.c' object='states.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o states.obj `if test -f 'generic/states.c'; then $(CYGPATH_W) 'generic/states.c'; else $(CYGPATH_W) '$(srcdir)/generic/states.c'; fi` + +gst.o: gst/gst.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gst.o -MD -MP -MF $(DEPDIR)/gst.Tpo -c -o gst.o `test -f 'gst/gst.c' || echo '$(srcdir)/'`gst/gst.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gst.Tpo $(DEPDIR)/gst.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gst.c' object='gst.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gst.o `test -f 'gst/gst.c' || echo '$(srcdir)/'`gst/gst.c + +gst.obj: gst/gst.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gst.obj -MD -MP -MF $(DEPDIR)/gst.Tpo -c -o gst.obj `if test -f 'gst/gst.c'; then $(CYGPATH_W) 'gst/gst.c'; else $(CYGPATH_W) '$(srcdir)/gst/gst.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gst.Tpo $(DEPDIR)/gst.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gst.c' object='gst.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gst.obj `if test -f 'gst/gst.c'; then $(CYGPATH_W) 'gst/gst.c'; else $(CYGPATH_W) '$(srcdir)/gst/gst.c'; fi` + +gstbin.o: gst/gstbin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstbin.o -MD -MP -MF $(DEPDIR)/gstbin.Tpo -c -o gstbin.o `test -f 'gst/gstbin.c' || echo '$(srcdir)/'`gst/gstbin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstbin.Tpo $(DEPDIR)/gstbin.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstbin.c' object='gstbin.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstbin.o `test -f 'gst/gstbin.c' || echo '$(srcdir)/'`gst/gstbin.c + +gstbin.obj: gst/gstbin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstbin.obj -MD -MP -MF $(DEPDIR)/gstbin.Tpo -c -o gstbin.obj `if test -f 'gst/gstbin.c'; then $(CYGPATH_W) 'gst/gstbin.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstbin.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstbin.Tpo $(DEPDIR)/gstbin.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstbin.c' object='gstbin.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstbin.obj `if test -f 'gst/gstbin.c'; then $(CYGPATH_W) 'gst/gstbin.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstbin.c'; fi` + +gstbuffer.o: gst/gstbuffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstbuffer.o -MD -MP -MF $(DEPDIR)/gstbuffer.Tpo -c -o gstbuffer.o `test -f 'gst/gstbuffer.c' || echo '$(srcdir)/'`gst/gstbuffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstbuffer.Tpo $(DEPDIR)/gstbuffer.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstbuffer.c' object='gstbuffer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstbuffer.o `test -f 'gst/gstbuffer.c' || echo '$(srcdir)/'`gst/gstbuffer.c + +gstbuffer.obj: gst/gstbuffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstbuffer.obj -MD -MP -MF $(DEPDIR)/gstbuffer.Tpo -c -o gstbuffer.obj `if test -f 'gst/gstbuffer.c'; then $(CYGPATH_W) 'gst/gstbuffer.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstbuffer.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstbuffer.Tpo $(DEPDIR)/gstbuffer.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstbuffer.c' object='gstbuffer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstbuffer.obj `if test -f 'gst/gstbuffer.c'; then $(CYGPATH_W) 'gst/gstbuffer.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstbuffer.c'; fi` + +gstbufferlist.o: gst/gstbufferlist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstbufferlist.o -MD -MP -MF $(DEPDIR)/gstbufferlist.Tpo -c -o gstbufferlist.o `test -f 'gst/gstbufferlist.c' || echo '$(srcdir)/'`gst/gstbufferlist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstbufferlist.Tpo $(DEPDIR)/gstbufferlist.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstbufferlist.c' object='gstbufferlist.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstbufferlist.o `test -f 'gst/gstbufferlist.c' || echo '$(srcdir)/'`gst/gstbufferlist.c + +gstbufferlist.obj: gst/gstbufferlist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstbufferlist.obj -MD -MP -MF $(DEPDIR)/gstbufferlist.Tpo -c -o gstbufferlist.obj `if test -f 'gst/gstbufferlist.c'; then $(CYGPATH_W) 'gst/gstbufferlist.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstbufferlist.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstbufferlist.Tpo $(DEPDIR)/gstbufferlist.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstbufferlist.c' object='gstbufferlist.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstbufferlist.obj `if test -f 'gst/gstbufferlist.c'; then $(CYGPATH_W) 'gst/gstbufferlist.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstbufferlist.c'; fi` + +gstbus.o: gst/gstbus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstbus.o -MD -MP -MF $(DEPDIR)/gstbus.Tpo -c -o gstbus.o `test -f 'gst/gstbus.c' || echo '$(srcdir)/'`gst/gstbus.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstbus.Tpo $(DEPDIR)/gstbus.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstbus.c' object='gstbus.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstbus.o `test -f 'gst/gstbus.c' || echo '$(srcdir)/'`gst/gstbus.c + +gstbus.obj: gst/gstbus.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstbus.obj -MD -MP -MF $(DEPDIR)/gstbus.Tpo -c -o gstbus.obj `if test -f 'gst/gstbus.c'; then $(CYGPATH_W) 'gst/gstbus.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstbus.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstbus.Tpo $(DEPDIR)/gstbus.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstbus.c' object='gstbus.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstbus.obj `if test -f 'gst/gstbus.c'; then $(CYGPATH_W) 'gst/gstbus.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstbus.c'; fi` + +gstcaps.o: gst/gstcaps.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstcaps.o -MD -MP -MF $(DEPDIR)/gstcaps.Tpo -c -o gstcaps.o `test -f 'gst/gstcaps.c' || echo '$(srcdir)/'`gst/gstcaps.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstcaps.Tpo $(DEPDIR)/gstcaps.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstcaps.c' object='gstcaps.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstcaps.o `test -f 'gst/gstcaps.c' || echo '$(srcdir)/'`gst/gstcaps.c + +gstcaps.obj: gst/gstcaps.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstcaps.obj -MD -MP -MF $(DEPDIR)/gstcaps.Tpo -c -o gstcaps.obj `if test -f 'gst/gstcaps.c'; then $(CYGPATH_W) 'gst/gstcaps.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstcaps.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstcaps.Tpo $(DEPDIR)/gstcaps.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstcaps.c' object='gstcaps.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstcaps.obj `if test -f 'gst/gstcaps.c'; then $(CYGPATH_W) 'gst/gstcaps.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstcaps.c'; fi` + +gstchildproxy.o: gst/gstchildproxy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstchildproxy.o -MD -MP -MF $(DEPDIR)/gstchildproxy.Tpo -c -o gstchildproxy.o `test -f 'gst/gstchildproxy.c' || echo '$(srcdir)/'`gst/gstchildproxy.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstchildproxy.Tpo $(DEPDIR)/gstchildproxy.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstchildproxy.c' object='gstchildproxy.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstchildproxy.o `test -f 'gst/gstchildproxy.c' || echo '$(srcdir)/'`gst/gstchildproxy.c + +gstchildproxy.obj: gst/gstchildproxy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstchildproxy.obj -MD -MP -MF $(DEPDIR)/gstchildproxy.Tpo -c -o gstchildproxy.obj `if test -f 'gst/gstchildproxy.c'; then $(CYGPATH_W) 'gst/gstchildproxy.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstchildproxy.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstchildproxy.Tpo $(DEPDIR)/gstchildproxy.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstchildproxy.c' object='gstchildproxy.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstchildproxy.obj `if test -f 'gst/gstchildproxy.c'; then $(CYGPATH_W) 'gst/gstchildproxy.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstchildproxy.c'; fi` + +gstclock.o: gst/gstclock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstclock.o -MD -MP -MF $(DEPDIR)/gstclock.Tpo -c -o gstclock.o `test -f 'gst/gstclock.c' || echo '$(srcdir)/'`gst/gstclock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstclock.Tpo $(DEPDIR)/gstclock.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstclock.c' object='gstclock.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstclock.o `test -f 'gst/gstclock.c' || echo '$(srcdir)/'`gst/gstclock.c + +gstclock.obj: gst/gstclock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstclock.obj -MD -MP -MF $(DEPDIR)/gstclock.Tpo -c -o gstclock.obj `if test -f 'gst/gstclock.c'; then $(CYGPATH_W) 'gst/gstclock.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstclock.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstclock.Tpo $(DEPDIR)/gstclock.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstclock.c' object='gstclock.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstclock.obj `if test -f 'gst/gstclock.c'; then $(CYGPATH_W) 'gst/gstclock.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstclock.c'; fi` + +gstdatetime.o: gst/gstdatetime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstdatetime.o -MD -MP -MF $(DEPDIR)/gstdatetime.Tpo -c -o gstdatetime.o `test -f 'gst/gstdatetime.c' || echo '$(srcdir)/'`gst/gstdatetime.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstdatetime.Tpo $(DEPDIR)/gstdatetime.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstdatetime.c' object='gstdatetime.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstdatetime.o `test -f 'gst/gstdatetime.c' || echo '$(srcdir)/'`gst/gstdatetime.c + +gstdatetime.obj: gst/gstdatetime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstdatetime.obj -MD -MP -MF $(DEPDIR)/gstdatetime.Tpo -c -o gstdatetime.obj `if test -f 'gst/gstdatetime.c'; then $(CYGPATH_W) 'gst/gstdatetime.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstdatetime.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstdatetime.Tpo $(DEPDIR)/gstdatetime.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstdatetime.c' object='gstdatetime.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstdatetime.obj `if test -f 'gst/gstdatetime.c'; then $(CYGPATH_W) 'gst/gstdatetime.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstdatetime.c'; fi` + +gstelement.o: gst/gstelement.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstelement.o -MD -MP -MF $(DEPDIR)/gstelement.Tpo -c -o gstelement.o `test -f 'gst/gstelement.c' || echo '$(srcdir)/'`gst/gstelement.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstelement.Tpo $(DEPDIR)/gstelement.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstelement.c' object='gstelement.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstelement.o `test -f 'gst/gstelement.c' || echo '$(srcdir)/'`gst/gstelement.c + +gstelement.obj: gst/gstelement.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstelement.obj -MD -MP -MF $(DEPDIR)/gstelement.Tpo -c -o gstelement.obj `if test -f 'gst/gstelement.c'; then $(CYGPATH_W) 'gst/gstelement.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstelement.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstelement.Tpo $(DEPDIR)/gstelement.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstelement.c' object='gstelement.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstelement.obj `if test -f 'gst/gstelement.c'; then $(CYGPATH_W) 'gst/gstelement.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstelement.c'; fi` + +gstelementfactory.o: gst/gstelementfactory.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstelementfactory.o -MD -MP -MF $(DEPDIR)/gstelementfactory.Tpo -c -o gstelementfactory.o `test -f 'gst/gstelementfactory.c' || echo '$(srcdir)/'`gst/gstelementfactory.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstelementfactory.Tpo $(DEPDIR)/gstelementfactory.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstelementfactory.c' object='gstelementfactory.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstelementfactory.o `test -f 'gst/gstelementfactory.c' || echo '$(srcdir)/'`gst/gstelementfactory.c + +gstelementfactory.obj: gst/gstelementfactory.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstelementfactory.obj -MD -MP -MF $(DEPDIR)/gstelementfactory.Tpo -c -o gstelementfactory.obj `if test -f 'gst/gstelementfactory.c'; then $(CYGPATH_W) 'gst/gstelementfactory.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstelementfactory.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstelementfactory.Tpo $(DEPDIR)/gstelementfactory.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstelementfactory.c' object='gstelementfactory.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstelementfactory.obj `if test -f 'gst/gstelementfactory.c'; then $(CYGPATH_W) 'gst/gstelementfactory.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstelementfactory.c'; fi` + +gstevent.o: gst/gstevent.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstevent.o -MD -MP -MF $(DEPDIR)/gstevent.Tpo -c -o gstevent.o `test -f 'gst/gstevent.c' || echo '$(srcdir)/'`gst/gstevent.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstevent.Tpo $(DEPDIR)/gstevent.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstevent.c' object='gstevent.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstevent.o `test -f 'gst/gstevent.c' || echo '$(srcdir)/'`gst/gstevent.c + +gstevent.obj: gst/gstevent.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstevent.obj -MD -MP -MF $(DEPDIR)/gstevent.Tpo -c -o gstevent.obj `if test -f 'gst/gstevent.c'; then $(CYGPATH_W) 'gst/gstevent.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstevent.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstevent.Tpo $(DEPDIR)/gstevent.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstevent.c' object='gstevent.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstevent.obj `if test -f 'gst/gstevent.c'; then $(CYGPATH_W) 'gst/gstevent.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstevent.c'; fi` + +gstghostpad.o: gst/gstghostpad.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstghostpad.o -MD -MP -MF $(DEPDIR)/gstghostpad.Tpo -c -o gstghostpad.o `test -f 'gst/gstghostpad.c' || echo '$(srcdir)/'`gst/gstghostpad.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstghostpad.Tpo $(DEPDIR)/gstghostpad.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstghostpad.c' object='gstghostpad.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstghostpad.o `test -f 'gst/gstghostpad.c' || echo '$(srcdir)/'`gst/gstghostpad.c + +gstghostpad.obj: gst/gstghostpad.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstghostpad.obj -MD -MP -MF $(DEPDIR)/gstghostpad.Tpo -c -o gstghostpad.obj `if test -f 'gst/gstghostpad.c'; then $(CYGPATH_W) 'gst/gstghostpad.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstghostpad.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstghostpad.Tpo $(DEPDIR)/gstghostpad.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstghostpad.c' object='gstghostpad.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstghostpad.obj `if test -f 'gst/gstghostpad.c'; then $(CYGPATH_W) 'gst/gstghostpad.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstghostpad.c'; fi` + +gstindex.o: gst/gstindex.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstindex.o -MD -MP -MF $(DEPDIR)/gstindex.Tpo -c -o gstindex.o `test -f 'gst/gstindex.c' || echo '$(srcdir)/'`gst/gstindex.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstindex.Tpo $(DEPDIR)/gstindex.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstindex.c' object='gstindex.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstindex.o `test -f 'gst/gstindex.c' || echo '$(srcdir)/'`gst/gstindex.c + +gstindex.obj: gst/gstindex.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstindex.obj -MD -MP -MF $(DEPDIR)/gstindex.Tpo -c -o gstindex.obj `if test -f 'gst/gstindex.c'; then $(CYGPATH_W) 'gst/gstindex.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstindex.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstindex.Tpo $(DEPDIR)/gstindex.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstindex.c' object='gstindex.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstindex.obj `if test -f 'gst/gstindex.c'; then $(CYGPATH_W) 'gst/gstindex.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstindex.c'; fi` + +gstinfo.o: gst/gstinfo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstinfo.o -MD -MP -MF $(DEPDIR)/gstinfo.Tpo -c -o gstinfo.o `test -f 'gst/gstinfo.c' || echo '$(srcdir)/'`gst/gstinfo.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstinfo.Tpo $(DEPDIR)/gstinfo.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstinfo.c' object='gstinfo.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstinfo.o `test -f 'gst/gstinfo.c' || echo '$(srcdir)/'`gst/gstinfo.c + +gstinfo.obj: gst/gstinfo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstinfo.obj -MD -MP -MF $(DEPDIR)/gstinfo.Tpo -c -o gstinfo.obj `if test -f 'gst/gstinfo.c'; then $(CYGPATH_W) 'gst/gstinfo.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstinfo.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstinfo.Tpo $(DEPDIR)/gstinfo.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstinfo.c' object='gstinfo.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstinfo.obj `if test -f 'gst/gstinfo.c'; then $(CYGPATH_W) 'gst/gstinfo.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstinfo.c'; fi` + +gstiterator.o: gst/gstiterator.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstiterator.o -MD -MP -MF $(DEPDIR)/gstiterator.Tpo -c -o gstiterator.o `test -f 'gst/gstiterator.c' || echo '$(srcdir)/'`gst/gstiterator.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstiterator.Tpo $(DEPDIR)/gstiterator.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstiterator.c' object='gstiterator.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstiterator.o `test -f 'gst/gstiterator.c' || echo '$(srcdir)/'`gst/gstiterator.c + +gstiterator.obj: gst/gstiterator.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstiterator.obj -MD -MP -MF $(DEPDIR)/gstiterator.Tpo -c -o gstiterator.obj `if test -f 'gst/gstiterator.c'; then $(CYGPATH_W) 'gst/gstiterator.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstiterator.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstiterator.Tpo $(DEPDIR)/gstiterator.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstiterator.c' object='gstiterator.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstiterator.obj `if test -f 'gst/gstiterator.c'; then $(CYGPATH_W) 'gst/gstiterator.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstiterator.c'; fi` + +gstmessage.o: gst/gstmessage.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstmessage.o -MD -MP -MF $(DEPDIR)/gstmessage.Tpo -c -o gstmessage.o `test -f 'gst/gstmessage.c' || echo '$(srcdir)/'`gst/gstmessage.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstmessage.Tpo $(DEPDIR)/gstmessage.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstmessage.c' object='gstmessage.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstmessage.o `test -f 'gst/gstmessage.c' || echo '$(srcdir)/'`gst/gstmessage.c + +gstmessage.obj: gst/gstmessage.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstmessage.obj -MD -MP -MF $(DEPDIR)/gstmessage.Tpo -c -o gstmessage.obj `if test -f 'gst/gstmessage.c'; then $(CYGPATH_W) 'gst/gstmessage.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstmessage.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstmessage.Tpo $(DEPDIR)/gstmessage.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstmessage.c' object='gstmessage.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstmessage.obj `if test -f 'gst/gstmessage.c'; then $(CYGPATH_W) 'gst/gstmessage.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstmessage.c'; fi` + +gstmeta.o: gst/gstmeta.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstmeta.o -MD -MP -MF $(DEPDIR)/gstmeta.Tpo -c -o gstmeta.o `test -f 'gst/gstmeta.c' || echo '$(srcdir)/'`gst/gstmeta.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstmeta.Tpo $(DEPDIR)/gstmeta.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstmeta.c' object='gstmeta.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstmeta.o `test -f 'gst/gstmeta.c' || echo '$(srcdir)/'`gst/gstmeta.c + +gstmeta.obj: gst/gstmeta.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstmeta.obj -MD -MP -MF $(DEPDIR)/gstmeta.Tpo -c -o gstmeta.obj `if test -f 'gst/gstmeta.c'; then $(CYGPATH_W) 'gst/gstmeta.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstmeta.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstmeta.Tpo $(DEPDIR)/gstmeta.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstmeta.c' object='gstmeta.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstmeta.obj `if test -f 'gst/gstmeta.c'; then $(CYGPATH_W) 'gst/gstmeta.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstmeta.c'; fi` + +gstminiobject.o: gst/gstminiobject.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstminiobject.o -MD -MP -MF $(DEPDIR)/gstminiobject.Tpo -c -o gstminiobject.o `test -f 'gst/gstminiobject.c' || echo '$(srcdir)/'`gst/gstminiobject.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstminiobject.Tpo $(DEPDIR)/gstminiobject.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstminiobject.c' object='gstminiobject.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstminiobject.o `test -f 'gst/gstminiobject.c' || echo '$(srcdir)/'`gst/gstminiobject.c + +gstminiobject.obj: gst/gstminiobject.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstminiobject.obj -MD -MP -MF $(DEPDIR)/gstminiobject.Tpo -c -o gstminiobject.obj `if test -f 'gst/gstminiobject.c'; then $(CYGPATH_W) 'gst/gstminiobject.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstminiobject.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstminiobject.Tpo $(DEPDIR)/gstminiobject.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstminiobject.c' object='gstminiobject.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstminiobject.obj `if test -f 'gst/gstminiobject.c'; then $(CYGPATH_W) 'gst/gstminiobject.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstminiobject.c'; fi` + +gstobject.o: gst/gstobject.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstobject.o -MD -MP -MF $(DEPDIR)/gstobject.Tpo -c -o gstobject.o `test -f 'gst/gstobject.c' || echo '$(srcdir)/'`gst/gstobject.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstobject.Tpo $(DEPDIR)/gstobject.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstobject.c' object='gstobject.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstobject.o `test -f 'gst/gstobject.c' || echo '$(srcdir)/'`gst/gstobject.c + +gstobject.obj: gst/gstobject.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstobject.obj -MD -MP -MF $(DEPDIR)/gstobject.Tpo -c -o gstobject.obj `if test -f 'gst/gstobject.c'; then $(CYGPATH_W) 'gst/gstobject.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstobject.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstobject.Tpo $(DEPDIR)/gstobject.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstobject.c' object='gstobject.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstobject.obj `if test -f 'gst/gstobject.c'; then $(CYGPATH_W) 'gst/gstobject.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstobject.c'; fi` + +gstpad.o: gst/gstpad.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstpad.o -MD -MP -MF $(DEPDIR)/gstpad.Tpo -c -o gstpad.o `test -f 'gst/gstpad.c' || echo '$(srcdir)/'`gst/gstpad.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstpad.Tpo $(DEPDIR)/gstpad.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstpad.c' object='gstpad.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstpad.o `test -f 'gst/gstpad.c' || echo '$(srcdir)/'`gst/gstpad.c + +gstpad.obj: gst/gstpad.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstpad.obj -MD -MP -MF $(DEPDIR)/gstpad.Tpo -c -o gstpad.obj `if test -f 'gst/gstpad.c'; then $(CYGPATH_W) 'gst/gstpad.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstpad.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstpad.Tpo $(DEPDIR)/gstpad.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstpad.c' object='gstpad.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstpad.obj `if test -f 'gst/gstpad.c'; then $(CYGPATH_W) 'gst/gstpad.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstpad.c'; fi` + +gstparamspecs.o: gst/gstparamspecs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstparamspecs.o -MD -MP -MF $(DEPDIR)/gstparamspecs.Tpo -c -o gstparamspecs.o `test -f 'gst/gstparamspecs.c' || echo '$(srcdir)/'`gst/gstparamspecs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstparamspecs.Tpo $(DEPDIR)/gstparamspecs.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstparamspecs.c' object='gstparamspecs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstparamspecs.o `test -f 'gst/gstparamspecs.c' || echo '$(srcdir)/'`gst/gstparamspecs.c + +gstparamspecs.obj: gst/gstparamspecs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstparamspecs.obj -MD -MP -MF $(DEPDIR)/gstparamspecs.Tpo -c -o gstparamspecs.obj `if test -f 'gst/gstparamspecs.c'; then $(CYGPATH_W) 'gst/gstparamspecs.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstparamspecs.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstparamspecs.Tpo $(DEPDIR)/gstparamspecs.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstparamspecs.c' object='gstparamspecs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstparamspecs.obj `if test -f 'gst/gstparamspecs.c'; then $(CYGPATH_W) 'gst/gstparamspecs.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstparamspecs.c'; fi` + +gstpipeline.o: gst/gstpipeline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstpipeline.o -MD -MP -MF $(DEPDIR)/gstpipeline.Tpo -c -o gstpipeline.o `test -f 'gst/gstpipeline.c' || echo '$(srcdir)/'`gst/gstpipeline.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstpipeline.Tpo $(DEPDIR)/gstpipeline.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstpipeline.c' object='gstpipeline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstpipeline.o `test -f 'gst/gstpipeline.c' || echo '$(srcdir)/'`gst/gstpipeline.c + +gstpipeline.obj: gst/gstpipeline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstpipeline.obj -MD -MP -MF $(DEPDIR)/gstpipeline.Tpo -c -o gstpipeline.obj `if test -f 'gst/gstpipeline.c'; then $(CYGPATH_W) 'gst/gstpipeline.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstpipeline.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstpipeline.Tpo $(DEPDIR)/gstpipeline.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstpipeline.c' object='gstpipeline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstpipeline.obj `if test -f 'gst/gstpipeline.c'; then $(CYGPATH_W) 'gst/gstpipeline.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstpipeline.c'; fi` + +gstplugin.o: gst/gstplugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstplugin.o -MD -MP -MF $(DEPDIR)/gstplugin.Tpo -c -o gstplugin.o `test -f 'gst/gstplugin.c' || echo '$(srcdir)/'`gst/gstplugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstplugin.Tpo $(DEPDIR)/gstplugin.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstplugin.c' object='gstplugin.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstplugin.o `test -f 'gst/gstplugin.c' || echo '$(srcdir)/'`gst/gstplugin.c + +gstplugin.obj: gst/gstplugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstplugin.obj -MD -MP -MF $(DEPDIR)/gstplugin.Tpo -c -o gstplugin.obj `if test -f 'gst/gstplugin.c'; then $(CYGPATH_W) 'gst/gstplugin.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstplugin.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstplugin.Tpo $(DEPDIR)/gstplugin.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstplugin.c' object='gstplugin.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstplugin.obj `if test -f 'gst/gstplugin.c'; then $(CYGPATH_W) 'gst/gstplugin.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstplugin.c'; fi` + +gstpoll.o: gst/gstpoll.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstpoll.o -MD -MP -MF $(DEPDIR)/gstpoll.Tpo -c -o gstpoll.o `test -f 'gst/gstpoll.c' || echo '$(srcdir)/'`gst/gstpoll.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstpoll.Tpo $(DEPDIR)/gstpoll.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstpoll.c' object='gstpoll.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstpoll.o `test -f 'gst/gstpoll.c' || echo '$(srcdir)/'`gst/gstpoll.c + +gstpoll.obj: gst/gstpoll.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstpoll.obj -MD -MP -MF $(DEPDIR)/gstpoll.Tpo -c -o gstpoll.obj `if test -f 'gst/gstpoll.c'; then $(CYGPATH_W) 'gst/gstpoll.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstpoll.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstpoll.Tpo $(DEPDIR)/gstpoll.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstpoll.c' object='gstpoll.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstpoll.obj `if test -f 'gst/gstpoll.c'; then $(CYGPATH_W) 'gst/gstpoll.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstpoll.c'; fi` + +gstpreset.o: gst/gstpreset.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstpreset.o -MD -MP -MF $(DEPDIR)/gstpreset.Tpo -c -o gstpreset.o `test -f 'gst/gstpreset.c' || echo '$(srcdir)/'`gst/gstpreset.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstpreset.Tpo $(DEPDIR)/gstpreset.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstpreset.c' object='gstpreset.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstpreset.o `test -f 'gst/gstpreset.c' || echo '$(srcdir)/'`gst/gstpreset.c + +gstpreset.obj: gst/gstpreset.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstpreset.obj -MD -MP -MF $(DEPDIR)/gstpreset.Tpo -c -o gstpreset.obj `if test -f 'gst/gstpreset.c'; then $(CYGPATH_W) 'gst/gstpreset.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstpreset.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstpreset.Tpo $(DEPDIR)/gstpreset.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstpreset.c' object='gstpreset.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstpreset.obj `if test -f 'gst/gstpreset.c'; then $(CYGPATH_W) 'gst/gstpreset.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstpreset.c'; fi` + +gstquery.o: gst/gstquery.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstquery.o -MD -MP -MF $(DEPDIR)/gstquery.Tpo -c -o gstquery.o `test -f 'gst/gstquery.c' || echo '$(srcdir)/'`gst/gstquery.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstquery.Tpo $(DEPDIR)/gstquery.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstquery.c' object='gstquery.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstquery.o `test -f 'gst/gstquery.c' || echo '$(srcdir)/'`gst/gstquery.c + +gstquery.obj: gst/gstquery.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstquery.obj -MD -MP -MF $(DEPDIR)/gstquery.Tpo -c -o gstquery.obj `if test -f 'gst/gstquery.c'; then $(CYGPATH_W) 'gst/gstquery.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstquery.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstquery.Tpo $(DEPDIR)/gstquery.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstquery.c' object='gstquery.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstquery.obj `if test -f 'gst/gstquery.c'; then $(CYGPATH_W) 'gst/gstquery.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstquery.c'; fi` + +gstregistry.o: gst/gstregistry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstregistry.o -MD -MP -MF $(DEPDIR)/gstregistry.Tpo -c -o gstregistry.o `test -f 'gst/gstregistry.c' || echo '$(srcdir)/'`gst/gstregistry.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstregistry.Tpo $(DEPDIR)/gstregistry.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstregistry.c' object='gstregistry.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstregistry.o `test -f 'gst/gstregistry.c' || echo '$(srcdir)/'`gst/gstregistry.c + +gstregistry.obj: gst/gstregistry.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstregistry.obj -MD -MP -MF $(DEPDIR)/gstregistry.Tpo -c -o gstregistry.obj `if test -f 'gst/gstregistry.c'; then $(CYGPATH_W) 'gst/gstregistry.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstregistry.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstregistry.Tpo $(DEPDIR)/gstregistry.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstregistry.c' object='gstregistry.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstregistry.obj `if test -f 'gst/gstregistry.c'; then $(CYGPATH_W) 'gst/gstregistry.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstregistry.c'; fi` + +gstsegment.o: gst/gstsegment.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstsegment.o -MD -MP -MF $(DEPDIR)/gstsegment.Tpo -c -o gstsegment.o `test -f 'gst/gstsegment.c' || echo '$(srcdir)/'`gst/gstsegment.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstsegment.Tpo $(DEPDIR)/gstsegment.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstsegment.c' object='gstsegment.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstsegment.o `test -f 'gst/gstsegment.c' || echo '$(srcdir)/'`gst/gstsegment.c + +gstsegment.obj: gst/gstsegment.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstsegment.obj -MD -MP -MF $(DEPDIR)/gstsegment.Tpo -c -o gstsegment.obj `if test -f 'gst/gstsegment.c'; then $(CYGPATH_W) 'gst/gstsegment.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstsegment.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstsegment.Tpo $(DEPDIR)/gstsegment.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstsegment.c' object='gstsegment.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstsegment.obj `if test -f 'gst/gstsegment.c'; then $(CYGPATH_W) 'gst/gstsegment.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstsegment.c'; fi` + +gststructure.o: gst/gststructure.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gststructure.o -MD -MP -MF $(DEPDIR)/gststructure.Tpo -c -o gststructure.o `test -f 'gst/gststructure.c' || echo '$(srcdir)/'`gst/gststructure.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gststructure.Tpo $(DEPDIR)/gststructure.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gststructure.c' object='gststructure.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gststructure.o `test -f 'gst/gststructure.c' || echo '$(srcdir)/'`gst/gststructure.c + +gststructure.obj: gst/gststructure.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gststructure.obj -MD -MP -MF $(DEPDIR)/gststructure.Tpo -c -o gststructure.obj `if test -f 'gst/gststructure.c'; then $(CYGPATH_W) 'gst/gststructure.c'; else $(CYGPATH_W) '$(srcdir)/gst/gststructure.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gststructure.Tpo $(DEPDIR)/gststructure.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gststructure.c' object='gststructure.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gststructure.obj `if test -f 'gst/gststructure.c'; then $(CYGPATH_W) 'gst/gststructure.c'; else $(CYGPATH_W) '$(srcdir)/gst/gststructure.c'; fi` + +gstsystemclock.o: gst/gstsystemclock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstsystemclock.o -MD -MP -MF $(DEPDIR)/gstsystemclock.Tpo -c -o gstsystemclock.o `test -f 'gst/gstsystemclock.c' || echo '$(srcdir)/'`gst/gstsystemclock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstsystemclock.Tpo $(DEPDIR)/gstsystemclock.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstsystemclock.c' object='gstsystemclock.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstsystemclock.o `test -f 'gst/gstsystemclock.c' || echo '$(srcdir)/'`gst/gstsystemclock.c + +gstsystemclock.obj: gst/gstsystemclock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstsystemclock.obj -MD -MP -MF $(DEPDIR)/gstsystemclock.Tpo -c -o gstsystemclock.obj `if test -f 'gst/gstsystemclock.c'; then $(CYGPATH_W) 'gst/gstsystemclock.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstsystemclock.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstsystemclock.Tpo $(DEPDIR)/gstsystemclock.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstsystemclock.c' object='gstsystemclock.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstsystemclock.obj `if test -f 'gst/gstsystemclock.c'; then $(CYGPATH_W) 'gst/gstsystemclock.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstsystemclock.c'; fi` + +gsttag.o: gst/gsttag.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gsttag.o -MD -MP -MF $(DEPDIR)/gsttag.Tpo -c -o gsttag.o `test -f 'gst/gsttag.c' || echo '$(srcdir)/'`gst/gsttag.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsttag.Tpo $(DEPDIR)/gsttag.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gsttag.c' object='gsttag.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gsttag.o `test -f 'gst/gsttag.c' || echo '$(srcdir)/'`gst/gsttag.c + +gsttag.obj: gst/gsttag.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gsttag.obj -MD -MP -MF $(DEPDIR)/gsttag.Tpo -c -o gsttag.obj `if test -f 'gst/gsttag.c'; then $(CYGPATH_W) 'gst/gsttag.c'; else $(CYGPATH_W) '$(srcdir)/gst/gsttag.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsttag.Tpo $(DEPDIR)/gsttag.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gsttag.c' object='gsttag.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gsttag.obj `if test -f 'gst/gsttag.c'; then $(CYGPATH_W) 'gst/gsttag.c'; else $(CYGPATH_W) '$(srcdir)/gst/gsttag.c'; fi` + +gsttagsetter.o: gst/gsttagsetter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gsttagsetter.o -MD -MP -MF $(DEPDIR)/gsttagsetter.Tpo -c -o gsttagsetter.o `test -f 'gst/gsttagsetter.c' || echo '$(srcdir)/'`gst/gsttagsetter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsttagsetter.Tpo $(DEPDIR)/gsttagsetter.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gsttagsetter.c' object='gsttagsetter.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gsttagsetter.o `test -f 'gst/gsttagsetter.c' || echo '$(srcdir)/'`gst/gsttagsetter.c + +gsttagsetter.obj: gst/gsttagsetter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gsttagsetter.obj -MD -MP -MF $(DEPDIR)/gsttagsetter.Tpo -c -o gsttagsetter.obj `if test -f 'gst/gsttagsetter.c'; then $(CYGPATH_W) 'gst/gsttagsetter.c'; else $(CYGPATH_W) '$(srcdir)/gst/gsttagsetter.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsttagsetter.Tpo $(DEPDIR)/gsttagsetter.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gsttagsetter.c' object='gsttagsetter.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gsttagsetter.obj `if test -f 'gst/gsttagsetter.c'; then $(CYGPATH_W) 'gst/gsttagsetter.c'; else $(CYGPATH_W) '$(srcdir)/gst/gsttagsetter.c'; fi` + +gsttask.o: gst/gsttask.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gsttask.o -MD -MP -MF $(DEPDIR)/gsttask.Tpo -c -o gsttask.o `test -f 'gst/gsttask.c' || echo '$(srcdir)/'`gst/gsttask.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsttask.Tpo $(DEPDIR)/gsttask.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gsttask.c' object='gsttask.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gsttask.o `test -f 'gst/gsttask.c' || echo '$(srcdir)/'`gst/gsttask.c + +gsttask.obj: gst/gsttask.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gsttask.obj -MD -MP -MF $(DEPDIR)/gsttask.Tpo -c -o gsttask.obj `if test -f 'gst/gsttask.c'; then $(CYGPATH_W) 'gst/gsttask.c'; else $(CYGPATH_W) '$(srcdir)/gst/gsttask.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsttask.Tpo $(DEPDIR)/gsttask.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gsttask.c' object='gsttask.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gsttask.obj `if test -f 'gst/gsttask.c'; then $(CYGPATH_W) 'gst/gsttask.c'; else $(CYGPATH_W) '$(srcdir)/gst/gsttask.c'; fi` + +gsturi.o: gst/gsturi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gsturi.o -MD -MP -MF $(DEPDIR)/gsturi.Tpo -c -o gsturi.o `test -f 'gst/gsturi.c' || echo '$(srcdir)/'`gst/gsturi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsturi.Tpo $(DEPDIR)/gsturi.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gsturi.c' object='gsturi.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gsturi.o `test -f 'gst/gsturi.c' || echo '$(srcdir)/'`gst/gsturi.c + +gsturi.obj: gst/gsturi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gsturi.obj -MD -MP -MF $(DEPDIR)/gsturi.Tpo -c -o gsturi.obj `if test -f 'gst/gsturi.c'; then $(CYGPATH_W) 'gst/gsturi.c'; else $(CYGPATH_W) '$(srcdir)/gst/gsturi.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsturi.Tpo $(DEPDIR)/gsturi.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gsturi.c' object='gsturi.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gsturi.obj `if test -f 'gst/gsturi.c'; then $(CYGPATH_W) 'gst/gsturi.c'; else $(CYGPATH_W) '$(srcdir)/gst/gsturi.c'; fi` + +gstutils.o: gst/gstutils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstutils.o -MD -MP -MF $(DEPDIR)/gstutils.Tpo -c -o gstutils.o `test -f 'gst/gstutils.c' || echo '$(srcdir)/'`gst/gstutils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstutils.Tpo $(DEPDIR)/gstutils.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstutils.c' object='gstutils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstutils.o `test -f 'gst/gstutils.c' || echo '$(srcdir)/'`gst/gstutils.c + +gstutils.obj: gst/gstutils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstutils.obj -MD -MP -MF $(DEPDIR)/gstutils.Tpo -c -o gstutils.obj `if test -f 'gst/gstutils.c'; then $(CYGPATH_W) 'gst/gstutils.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstutils.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstutils.Tpo $(DEPDIR)/gstutils.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstutils.c' object='gstutils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstutils.obj `if test -f 'gst/gstutils.c'; then $(CYGPATH_W) 'gst/gstutils.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstutils.c'; fi` + +gstvalue.o: gst/gstvalue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstvalue.o -MD -MP -MF $(DEPDIR)/gstvalue.Tpo -c -o gstvalue.o `test -f 'gst/gstvalue.c' || echo '$(srcdir)/'`gst/gstvalue.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstvalue.Tpo $(DEPDIR)/gstvalue.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstvalue.c' object='gstvalue.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstvalue.o `test -f 'gst/gstvalue.c' || echo '$(srcdir)/'`gst/gstvalue.c + +gstvalue.obj: gst/gstvalue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstvalue.obj -MD -MP -MF $(DEPDIR)/gstvalue.Tpo -c -o gstvalue.obj `if test -f 'gst/gstvalue.c'; then $(CYGPATH_W) 'gst/gstvalue.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstvalue.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstvalue.Tpo $(DEPDIR)/gstvalue.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gst/gstvalue.c' object='gstvalue.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstvalue.obj `if test -f 'gst/gstvalue.c'; then $(CYGPATH_W) 'gst/gstvalue.c'; else $(CYGPATH_W) '$(srcdir)/gst/gstvalue.c'; fi` + +adapter.o: libs/adapter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT adapter.o -MD -MP -MF $(DEPDIR)/adapter.Tpo -c -o adapter.o `test -f 'libs/adapter.c' || echo '$(srcdir)/'`libs/adapter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adapter.Tpo $(DEPDIR)/adapter.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/adapter.c' object='adapter.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adapter.o `test -f 'libs/adapter.c' || echo '$(srcdir)/'`libs/adapter.c + +adapter.obj: libs/adapter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT adapter.obj -MD -MP -MF $(DEPDIR)/adapter.Tpo -c -o adapter.obj `if test -f 'libs/adapter.c'; then $(CYGPATH_W) 'libs/adapter.c'; else $(CYGPATH_W) '$(srcdir)/libs/adapter.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adapter.Tpo $(DEPDIR)/adapter.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/adapter.c' object='adapter.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adapter.obj `if test -f 'libs/adapter.c'; then $(CYGPATH_W) 'libs/adapter.c'; else $(CYGPATH_W) '$(srcdir)/libs/adapter.c'; fi` + +basesink.o: libs/basesink.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT basesink.o -MD -MP -MF $(DEPDIR)/basesink.Tpo -c -o basesink.o `test -f 'libs/basesink.c' || echo '$(srcdir)/'`libs/basesink.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/basesink.Tpo $(DEPDIR)/basesink.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/basesink.c' object='basesink.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o basesink.o `test -f 'libs/basesink.c' || echo '$(srcdir)/'`libs/basesink.c + +basesink.obj: libs/basesink.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT basesink.obj -MD -MP -MF $(DEPDIR)/basesink.Tpo -c -o basesink.obj `if test -f 'libs/basesink.c'; then $(CYGPATH_W) 'libs/basesink.c'; else $(CYGPATH_W) '$(srcdir)/libs/basesink.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/basesink.Tpo $(DEPDIR)/basesink.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/basesink.c' object='basesink.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o basesink.obj `if test -f 'libs/basesink.c'; then $(CYGPATH_W) 'libs/basesink.c'; else $(CYGPATH_W) '$(srcdir)/libs/basesink.c'; fi` + +basesrc.o: libs/basesrc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT basesrc.o -MD -MP -MF $(DEPDIR)/basesrc.Tpo -c -o basesrc.o `test -f 'libs/basesrc.c' || echo '$(srcdir)/'`libs/basesrc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/basesrc.Tpo $(DEPDIR)/basesrc.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/basesrc.c' object='basesrc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o basesrc.o `test -f 'libs/basesrc.c' || echo '$(srcdir)/'`libs/basesrc.c + +basesrc.obj: libs/basesrc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT basesrc.obj -MD -MP -MF $(DEPDIR)/basesrc.Tpo -c -o basesrc.obj `if test -f 'libs/basesrc.c'; then $(CYGPATH_W) 'libs/basesrc.c'; else $(CYGPATH_W) '$(srcdir)/libs/basesrc.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/basesrc.Tpo $(DEPDIR)/basesrc.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/basesrc.c' object='basesrc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o basesrc.obj `if test -f 'libs/basesrc.c'; then $(CYGPATH_W) 'libs/basesrc.c'; else $(CYGPATH_W) '$(srcdir)/libs/basesrc.c'; fi` + +bitreader.o: libs/bitreader.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitreader.o -MD -MP -MF $(DEPDIR)/bitreader.Tpo -c -o bitreader.o `test -f 'libs/bitreader.c' || echo '$(srcdir)/'`libs/bitreader.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bitreader.Tpo $(DEPDIR)/bitreader.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/bitreader.c' object='bitreader.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitreader.o `test -f 'libs/bitreader.c' || echo '$(srcdir)/'`libs/bitreader.c + +bitreader.obj: libs/bitreader.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bitreader.obj -MD -MP -MF $(DEPDIR)/bitreader.Tpo -c -o bitreader.obj `if test -f 'libs/bitreader.c'; then $(CYGPATH_W) 'libs/bitreader.c'; else $(CYGPATH_W) '$(srcdir)/libs/bitreader.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bitreader.Tpo $(DEPDIR)/bitreader.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/bitreader.c' object='bitreader.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bitreader.obj `if test -f 'libs/bitreader.c'; then $(CYGPATH_W) 'libs/bitreader.c'; else $(CYGPATH_W) '$(srcdir)/libs/bitreader.c'; fi` + +bytereader.o: libs/bytereader.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytereader.o -MD -MP -MF $(DEPDIR)/bytereader.Tpo -c -o bytereader.o `test -f 'libs/bytereader.c' || echo '$(srcdir)/'`libs/bytereader.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bytereader.Tpo $(DEPDIR)/bytereader.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/bytereader.c' object='bytereader.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytereader.o `test -f 'libs/bytereader.c' || echo '$(srcdir)/'`libs/bytereader.c + +bytereader.obj: libs/bytereader.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytereader.obj -MD -MP -MF $(DEPDIR)/bytereader.Tpo -c -o bytereader.obj `if test -f 'libs/bytereader.c'; then $(CYGPATH_W) 'libs/bytereader.c'; else $(CYGPATH_W) '$(srcdir)/libs/bytereader.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bytereader.Tpo $(DEPDIR)/bytereader.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/bytereader.c' object='bytereader.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytereader.obj `if test -f 'libs/bytereader.c'; then $(CYGPATH_W) 'libs/bytereader.c'; else $(CYGPATH_W) '$(srcdir)/libs/bytereader.c'; fi` + +bytewriter.o: libs/bytewriter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytewriter.o -MD -MP -MF $(DEPDIR)/bytewriter.Tpo -c -o bytewriter.o `test -f 'libs/bytewriter.c' || echo '$(srcdir)/'`libs/bytewriter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bytewriter.Tpo $(DEPDIR)/bytewriter.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/bytewriter.c' object='bytewriter.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytewriter.o `test -f 'libs/bytewriter.c' || echo '$(srcdir)/'`libs/bytewriter.c + +bytewriter.obj: libs/bytewriter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bytewriter.obj -MD -MP -MF $(DEPDIR)/bytewriter.Tpo -c -o bytewriter.obj `if test -f 'libs/bytewriter.c'; then $(CYGPATH_W) 'libs/bytewriter.c'; else $(CYGPATH_W) '$(srcdir)/libs/bytewriter.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bytewriter.Tpo $(DEPDIR)/bytewriter.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/bytewriter.c' object='bytewriter.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bytewriter.obj `if test -f 'libs/bytewriter.c'; then $(CYGPATH_W) 'libs/bytewriter.c'; else $(CYGPATH_W) '$(srcdir)/libs/bytewriter.c'; fi` + +collectpads.o: libs/collectpads.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT collectpads.o -MD -MP -MF $(DEPDIR)/collectpads.Tpo -c -o collectpads.o `test -f 'libs/collectpads.c' || echo '$(srcdir)/'`libs/collectpads.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/collectpads.Tpo $(DEPDIR)/collectpads.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/collectpads.c' object='collectpads.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o collectpads.o `test -f 'libs/collectpads.c' || echo '$(srcdir)/'`libs/collectpads.c + +collectpads.obj: libs/collectpads.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT collectpads.obj -MD -MP -MF $(DEPDIR)/collectpads.Tpo -c -o collectpads.obj `if test -f 'libs/collectpads.c'; then $(CYGPATH_W) 'libs/collectpads.c'; else $(CYGPATH_W) '$(srcdir)/libs/collectpads.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/collectpads.Tpo $(DEPDIR)/collectpads.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/collectpads.c' object='collectpads.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o collectpads.obj `if test -f 'libs/collectpads.c'; then $(CYGPATH_W) 'libs/collectpads.c'; else $(CYGPATH_W) '$(srcdir)/libs/collectpads.c'; fi` + +controller.o: libs/controller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT controller.o -MD -MP -MF $(DEPDIR)/controller.Tpo -c -o controller.o `test -f 'libs/controller.c' || echo '$(srcdir)/'`libs/controller.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/controller.Tpo $(DEPDIR)/controller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/controller.c' object='controller.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o controller.o `test -f 'libs/controller.c' || echo '$(srcdir)/'`libs/controller.c + +controller.obj: libs/controller.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT controller.obj -MD -MP -MF $(DEPDIR)/controller.Tpo -c -o controller.obj `if test -f 'libs/controller.c'; then $(CYGPATH_W) 'libs/controller.c'; else $(CYGPATH_W) '$(srcdir)/libs/controller.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/controller.Tpo $(DEPDIR)/controller.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/controller.c' object='controller.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o controller.obj `if test -f 'libs/controller.c'; then $(CYGPATH_W) 'libs/controller.c'; else $(CYGPATH_W) '$(srcdir)/libs/controller.c'; fi` + +gdp.o: libs/gdp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gdp.o -MD -MP -MF $(DEPDIR)/gdp.Tpo -c -o gdp.o `test -f 'libs/gdp.c' || echo '$(srcdir)/'`libs/gdp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gdp.Tpo $(DEPDIR)/gdp.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/gdp.c' object='gdp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gdp.o `test -f 'libs/gdp.c' || echo '$(srcdir)/'`libs/gdp.c + +gdp.obj: libs/gdp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gdp.obj -MD -MP -MF $(DEPDIR)/gdp.Tpo -c -o gdp.obj `if test -f 'libs/gdp.c'; then $(CYGPATH_W) 'libs/gdp.c'; else $(CYGPATH_W) '$(srcdir)/libs/gdp.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gdp.Tpo $(DEPDIR)/gdp.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/gdp.c' object='gdp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gdp.obj `if test -f 'libs/gdp.c'; then $(CYGPATH_W) 'libs/gdp.c'; else $(CYGPATH_W) '$(srcdir)/libs/gdp.c'; fi` + +gstnetclientclock.o: libs/gstnetclientclock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstnetclientclock.o -MD -MP -MF $(DEPDIR)/gstnetclientclock.Tpo -c -o gstnetclientclock.o `test -f 'libs/gstnetclientclock.c' || echo '$(srcdir)/'`libs/gstnetclientclock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstnetclientclock.Tpo $(DEPDIR)/gstnetclientclock.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/gstnetclientclock.c' object='gstnetclientclock.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstnetclientclock.o `test -f 'libs/gstnetclientclock.c' || echo '$(srcdir)/'`libs/gstnetclientclock.c + +gstnetclientclock.obj: libs/gstnetclientclock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstnetclientclock.obj -MD -MP -MF $(DEPDIR)/gstnetclientclock.Tpo -c -o gstnetclientclock.obj `if test -f 'libs/gstnetclientclock.c'; then $(CYGPATH_W) 'libs/gstnetclientclock.c'; else $(CYGPATH_W) '$(srcdir)/libs/gstnetclientclock.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstnetclientclock.Tpo $(DEPDIR)/gstnetclientclock.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/gstnetclientclock.c' object='gstnetclientclock.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstnetclientclock.obj `if test -f 'libs/gstnetclientclock.c'; then $(CYGPATH_W) 'libs/gstnetclientclock.c'; else $(CYGPATH_W) '$(srcdir)/libs/gstnetclientclock.c'; fi` + +gstnettimeprovider.o: libs/gstnettimeprovider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstnettimeprovider.o -MD -MP -MF $(DEPDIR)/gstnettimeprovider.Tpo -c -o gstnettimeprovider.o `test -f 'libs/gstnettimeprovider.c' || echo '$(srcdir)/'`libs/gstnettimeprovider.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstnettimeprovider.Tpo $(DEPDIR)/gstnettimeprovider.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/gstnettimeprovider.c' object='gstnettimeprovider.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstnettimeprovider.o `test -f 'libs/gstnettimeprovider.c' || echo '$(srcdir)/'`libs/gstnettimeprovider.c + +gstnettimeprovider.obj: libs/gstnettimeprovider.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gstnettimeprovider.obj -MD -MP -MF $(DEPDIR)/gstnettimeprovider.Tpo -c -o gstnettimeprovider.obj `if test -f 'libs/gstnettimeprovider.c'; then $(CYGPATH_W) 'libs/gstnettimeprovider.c'; else $(CYGPATH_W) '$(srcdir)/libs/gstnettimeprovider.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstnettimeprovider.Tpo $(DEPDIR)/gstnettimeprovider.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/gstnettimeprovider.c' object='gstnettimeprovider.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gstnettimeprovider.obj `if test -f 'libs/gstnettimeprovider.c'; then $(CYGPATH_W) 'libs/gstnettimeprovider.c'; else $(CYGPATH_W) '$(srcdir)/libs/gstnettimeprovider.c'; fi` + +transform1.o: libs/transform1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT transform1.o -MD -MP -MF $(DEPDIR)/transform1.Tpo -c -o transform1.o `test -f 'libs/transform1.c' || echo '$(srcdir)/'`libs/transform1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/transform1.Tpo $(DEPDIR)/transform1.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/transform1.c' object='transform1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transform1.o `test -f 'libs/transform1.c' || echo '$(srcdir)/'`libs/transform1.c + +transform1.obj: libs/transform1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT transform1.obj -MD -MP -MF $(DEPDIR)/transform1.Tpo -c -o transform1.obj `if test -f 'libs/transform1.c'; then $(CYGPATH_W) 'libs/transform1.c'; else $(CYGPATH_W) '$(srcdir)/libs/transform1.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/transform1.Tpo $(DEPDIR)/transform1.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/transform1.c' object='transform1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transform1.obj `if test -f 'libs/transform1.c'; then $(CYGPATH_W) 'libs/transform1.c'; else $(CYGPATH_W) '$(srcdir)/libs/transform1.c'; fi` + +typefindhelper.o: libs/typefindhelper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT typefindhelper.o -MD -MP -MF $(DEPDIR)/typefindhelper.Tpo -c -o typefindhelper.o `test -f 'libs/typefindhelper.c' || echo '$(srcdir)/'`libs/typefindhelper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/typefindhelper.Tpo $(DEPDIR)/typefindhelper.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/typefindhelper.c' object='typefindhelper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o typefindhelper.o `test -f 'libs/typefindhelper.c' || echo '$(srcdir)/'`libs/typefindhelper.c + +typefindhelper.obj: libs/typefindhelper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT typefindhelper.obj -MD -MP -MF $(DEPDIR)/typefindhelper.Tpo -c -o typefindhelper.obj `if test -f 'libs/typefindhelper.c'; then $(CYGPATH_W) 'libs/typefindhelper.c'; else $(CYGPATH_W) '$(srcdir)/libs/typefindhelper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/typefindhelper.Tpo $(DEPDIR)/typefindhelper.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libs/typefindhelper.c' object='typefindhelper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o typefindhelper.obj `if test -f 'libs/typefindhelper.c'; then $(CYGPATH_W) 'libs/typefindhelper.c'; else $(CYGPATH_W) '$(srcdir)/libs/typefindhelper.c'; fi` + +cleanup.o: pipelines/cleanup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cleanup.o -MD -MP -MF $(DEPDIR)/cleanup.Tpo -c -o cleanup.o `test -f 'pipelines/cleanup.c' || echo '$(srcdir)/'`pipelines/cleanup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cleanup.Tpo $(DEPDIR)/cleanup.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/cleanup.c' object='cleanup.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cleanup.o `test -f 'pipelines/cleanup.c' || echo '$(srcdir)/'`pipelines/cleanup.c + +cleanup.obj: pipelines/cleanup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cleanup.obj -MD -MP -MF $(DEPDIR)/cleanup.Tpo -c -o cleanup.obj `if test -f 'pipelines/cleanup.c'; then $(CYGPATH_W) 'pipelines/cleanup.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/cleanup.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cleanup.Tpo $(DEPDIR)/cleanup.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/cleanup.c' object='cleanup.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cleanup.obj `if test -f 'pipelines/cleanup.c'; then $(CYGPATH_W) 'pipelines/cleanup.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/cleanup.c'; fi` + +parse-disabled.o: pipelines/parse-disabled.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT parse-disabled.o -MD -MP -MF $(DEPDIR)/parse-disabled.Tpo -c -o parse-disabled.o `test -f 'pipelines/parse-disabled.c' || echo '$(srcdir)/'`pipelines/parse-disabled.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parse-disabled.Tpo $(DEPDIR)/parse-disabled.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/parse-disabled.c' object='parse-disabled.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o parse-disabled.o `test -f 'pipelines/parse-disabled.c' || echo '$(srcdir)/'`pipelines/parse-disabled.c + +parse-disabled.obj: pipelines/parse-disabled.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT parse-disabled.obj -MD -MP -MF $(DEPDIR)/parse-disabled.Tpo -c -o parse-disabled.obj `if test -f 'pipelines/parse-disabled.c'; then $(CYGPATH_W) 'pipelines/parse-disabled.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/parse-disabled.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parse-disabled.Tpo $(DEPDIR)/parse-disabled.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/parse-disabled.c' object='parse-disabled.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o parse-disabled.obj `if test -f 'pipelines/parse-disabled.c'; then $(CYGPATH_W) 'pipelines/parse-disabled.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/parse-disabled.c'; fi` + +parse-launch.o: pipelines/parse-launch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT parse-launch.o -MD -MP -MF $(DEPDIR)/parse-launch.Tpo -c -o parse-launch.o `test -f 'pipelines/parse-launch.c' || echo '$(srcdir)/'`pipelines/parse-launch.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parse-launch.Tpo $(DEPDIR)/parse-launch.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/parse-launch.c' object='parse-launch.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o parse-launch.o `test -f 'pipelines/parse-launch.c' || echo '$(srcdir)/'`pipelines/parse-launch.c + +parse-launch.obj: pipelines/parse-launch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT parse-launch.obj -MD -MP -MF $(DEPDIR)/parse-launch.Tpo -c -o parse-launch.obj `if test -f 'pipelines/parse-launch.c'; then $(CYGPATH_W) 'pipelines/parse-launch.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/parse-launch.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parse-launch.Tpo $(DEPDIR)/parse-launch.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/parse-launch.c' object='parse-launch.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o parse-launch.obj `if test -f 'pipelines/parse-launch.c'; then $(CYGPATH_W) 'pipelines/parse-launch.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/parse-launch.c'; fi` + +queue-error.o: pipelines/queue-error.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT queue-error.o -MD -MP -MF $(DEPDIR)/queue-error.Tpo -c -o queue-error.o `test -f 'pipelines/queue-error.c' || echo '$(srcdir)/'`pipelines/queue-error.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/queue-error.Tpo $(DEPDIR)/queue-error.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/queue-error.c' object='queue-error.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o queue-error.o `test -f 'pipelines/queue-error.c' || echo '$(srcdir)/'`pipelines/queue-error.c + +queue-error.obj: pipelines/queue-error.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT queue-error.obj -MD -MP -MF $(DEPDIR)/queue-error.Tpo -c -o queue-error.obj `if test -f 'pipelines/queue-error.c'; then $(CYGPATH_W) 'pipelines/queue-error.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/queue-error.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/queue-error.Tpo $(DEPDIR)/queue-error.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/queue-error.c' object='queue-error.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o queue-error.obj `if test -f 'pipelines/queue-error.c'; then $(CYGPATH_W) 'pipelines/queue-error.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/queue-error.c'; fi` + +simple-launch-lines.o: pipelines/simple-launch-lines.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT simple-launch-lines.o -MD -MP -MF $(DEPDIR)/simple-launch-lines.Tpo -c -o simple-launch-lines.o `test -f 'pipelines/simple-launch-lines.c' || echo '$(srcdir)/'`pipelines/simple-launch-lines.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/simple-launch-lines.Tpo $(DEPDIR)/simple-launch-lines.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/simple-launch-lines.c' object='simple-launch-lines.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o simple-launch-lines.o `test -f 'pipelines/simple-launch-lines.c' || echo '$(srcdir)/'`pipelines/simple-launch-lines.c + +simple-launch-lines.obj: pipelines/simple-launch-lines.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT simple-launch-lines.obj -MD -MP -MF $(DEPDIR)/simple-launch-lines.Tpo -c -o simple-launch-lines.obj `if test -f 'pipelines/simple-launch-lines.c'; then $(CYGPATH_W) 'pipelines/simple-launch-lines.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/simple-launch-lines.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/simple-launch-lines.Tpo $(DEPDIR)/simple-launch-lines.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/simple-launch-lines.c' object='simple-launch-lines.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o simple-launch-lines.obj `if test -f 'pipelines/simple-launch-lines.c'; then $(CYGPATH_W) 'pipelines/simple-launch-lines.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/simple-launch-lines.c'; fi` + +stress.o: pipelines/stress.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stress.o -MD -MP -MF $(DEPDIR)/stress.Tpo -c -o stress.o `test -f 'pipelines/stress.c' || echo '$(srcdir)/'`pipelines/stress.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stress.Tpo $(DEPDIR)/stress.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/stress.c' object='stress.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stress.o `test -f 'pipelines/stress.c' || echo '$(srcdir)/'`pipelines/stress.c + +stress.obj: pipelines/stress.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stress.obj -MD -MP -MF $(DEPDIR)/stress.Tpo -c -o stress.obj `if test -f 'pipelines/stress.c'; then $(CYGPATH_W) 'pipelines/stress.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/stress.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stress.Tpo $(DEPDIR)/stress.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pipelines/stress.c' object='stress.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stress.obj `if test -f 'pipelines/stress.c'; then $(CYGPATH_W) 'pipelines/stress.c'; else $(CYGPATH_W) '$(srcdir)/pipelines/stress.c'; fi` + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +gstcpp.o: gst/gstcpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gstcpp.o -MD -MP -MF $(DEPDIR)/gstcpp.Tpo -c -o gstcpp.o `test -f 'gst/gstcpp.cc' || echo '$(srcdir)/'`gst/gstcpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstcpp.Tpo $(DEPDIR)/gstcpp.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gst/gstcpp.cc' object='gstcpp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gstcpp.o `test -f 'gst/gstcpp.cc' || echo '$(srcdir)/'`gst/gstcpp.cc + +gstcpp.obj: gst/gstcpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gstcpp.obj -MD -MP -MF $(DEPDIR)/gstcpp.Tpo -c -o gstcpp.obj `if test -f 'gst/gstcpp.cc'; then $(CYGPATH_W) 'gst/gstcpp.cc'; else $(CYGPATH_W) '$(srcdir)/gst/gstcpp.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstcpp.Tpo $(DEPDIR)/gstcpp.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gst/gstcpp.cc' object='gstcpp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gstcpp.obj `if test -f 'gst/gstcpp.cc'; then $(CYGPATH_W) 'gst/gstcpp.cc'; else $(CYGPATH_W) '$(srcdir)/gst/gstcpp.cc'; fi` + +gstlibscpp.o: libs/gstlibscpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gstlibscpp.o -MD -MP -MF $(DEPDIR)/gstlibscpp.Tpo -c -o gstlibscpp.o `test -f 'libs/gstlibscpp.cc' || echo '$(srcdir)/'`libs/gstlibscpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstlibscpp.Tpo $(DEPDIR)/gstlibscpp.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libs/gstlibscpp.cc' object='gstlibscpp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gstlibscpp.o `test -f 'libs/gstlibscpp.cc' || echo '$(srcdir)/'`libs/gstlibscpp.cc + +gstlibscpp.obj: libs/gstlibscpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gstlibscpp.obj -MD -MP -MF $(DEPDIR)/gstlibscpp.Tpo -c -o gstlibscpp.obj `if test -f 'libs/gstlibscpp.cc'; then $(CYGPATH_W) 'libs/gstlibscpp.cc'; else $(CYGPATH_W) '$(srcdir)/libs/gstlibscpp.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gstlibscpp.Tpo $(DEPDIR)/gstlibscpp.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libs/gstlibscpp.cc' object='gstlibscpp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gstlibscpp.obj `if test -f 'libs/gstlibscpp.cc'; then $(CYGPATH_W) 'libs/gstlibscpp.cc'; else $(CYGPATH_W) '$(srcdir)/libs/gstlibscpp.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf elements/.libs elements/_libs + -rm -rf generic/.libs generic/_libs + -rm -rf gst/.libs gst/_libs + -rm -rf libs/.libs libs/_libs + -rm -rf pipelines/.libs pipelines/_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 + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +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 + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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) + -rm -f elements/$(am__dirstamp) + -rm -f generic/$(am__dirstamp) + -rm -f gst/$(am__dirstamp) + -rm -f libs/$(am__dirstamp) + -rm -f pipelines/$(am__dirstamp) + +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-checkPROGRAMS clean-generic clean-libtool clean-local \ + clean-noinstPROGRAMS 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-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: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool clean-local \ + clean-noinstPROGRAMS 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-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 + + +# keep target around, since it's referenced in the modules' Makefiles +clean-local-check: + @echo + +# hangs spectacularly on some machines, so let's not do this by default yet +@HAVE_VALGRIND_TRUE@check-valgrind: +@HAVE_VALGRIND_TRUE@ $(MAKE) valgrind +@HAVE_VALGRIND_FALSE@check-valgrind: +@HAVE_VALGRIND_FALSE@ @true + +# run any given test by running make test.check +# if the test fails, run it again at at least debug level 2 +%.check: % + @$(TESTS_ENVIRONMENT) \ + CK_DEFAULT_TIMEOUT=20 \ + $* || \ + $(TESTS_ENVIRONMENT) \ + GST_DEBUG=$$GST_DEBUG,*:2 \ + CK_DEFAULT_TIMEOUT=20 \ + $* + +# run any given test in a loop +%.torture: % + @for i in `seq 1 $(LOOPS)`; do \ + $(TESTS_ENVIRONMENT) \ + CK_DEFAULT_TIMEOUT=20 \ + $*; done + +# run any given test in an infinite loop +%.forever: % + @while true; do \ + $(TESTS_ENVIRONMENT) \ + CK_DEFAULT_TIMEOUT=20 \ + $* || break; done + +# valgrind any given test by running make test.valgrind +%.valgrind: % + @$(TESTS_ENVIRONMENT) \ + CK_DEFAULT_TIMEOUT=360 \ + G_SLICE=always-malloc \ + $(LIBTOOL) --mode=execute \ + $(VALGRIND_PATH) -q \ + $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \ + --tool=memcheck --leak-check=full --trace-children=yes \ + --leak-resolution=high --num-callers=20 \ + ./$* 2>&1 | tee valgrind.log + @if grep "==" valgrind.log > /dev/null 2>&1; then \ + rm valgrind.log; \ + exit 1; \ + fi + @rm valgrind.log + +# valgrind any given test and generate suppressions for it +%.valgrind.gen-suppressions: % + @$(TESTS_ENVIRONMENT) \ + CK_DEFAULT_TIMEOUT=360 \ + G_SLICE=always-malloc \ + $(LIBTOOL) --mode=execute \ + $(VALGRIND_PATH) -q \ + $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \ + --tool=memcheck --leak-check=full --trace-children=yes \ + --leak-resolution=high --num-callers=20 \ + --gen-suppressions=all \ + ./$* 2>&1 | tee suppressions.log + +# valgrind any given test until failure by running make test.valgrind-forever +%.valgrind-forever: % + @while $(MAKE) $*.valgrind; do \ + true; done + +# gdb any given test by running make test.gdb +%.gdb: % + @$(TESTS_ENVIRONMENT) \ + CK_FORK=no \ + $(LIBTOOL) --mode=execute \ + gdb $* + +# torture tests +torture: $(TESTS) + -rm test-registry.xml + @echo "Torturing tests ..." + @for i in `seq 1 $(LOOPS)`; do \ + $(MAKE) check || \ + (echo "Failure after $$i runs"; exit 1) || \ + exit 1; \ + done + @banner="All $(LOOPS) loops passed"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo $$dashes; echo $$banner; echo $$dashes + +# forever tests +forever: $(TESTS) + -rm test-registry.xml + @echo "Forever tests ..." + @while true; do \ + $(MAKE) check || \ + (echo "Failure"; exit 1) || \ + exit 1; \ + done + +# valgrind all tests +valgrind: $(TESTS) + @echo "Valgrinding tests ..." + @failed=0; \ + for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \ + $(MAKE) $$t.valgrind; \ + if test "$$?" -ne 0; then \ + echo "Valgrind error for test $$t"; \ + failed=`expr $$failed + 1`; \ + whicht="$$whicht $$t"; \ + fi; \ + done; \ + if test "$$failed" -ne 0; then \ + echo "$$failed tests had leaks or errors under valgrind:"; \ + echo "$$whicht"; \ + false; \ + fi + +# valgrind all tests and generate suppressions +valgrind.gen-suppressions: $(TESTS) + @echo "Valgrinding tests ..." + @failed=0; \ + for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \ + $(MAKE) $$t.valgrind.gen-suppressions; \ + if test "$$?" -ne 0; then \ + echo "Valgrind error for test $$t"; \ + failed=`expr $$failed + 1`; \ + whicht="$$whicht $$t"; \ + fi; \ + done; \ + if test "$$failed" -ne 0; then \ + echo "$$failed tests had leaks or errors under valgrind:"; \ + echo "$$whicht"; \ + false; \ + fi +inspect: + @echo "Inspecting features ..." + @for e in `$(TESTS_ENVIRONMENT) $(GST_INSPECT) | head -n -2 \ + | cut -d: -f2`; \ + do echo Inspecting $$e; \ + $(GST_INSPECT) $$e > /dev/null 2>&1; done + +help: + @echo + @echo "make check -- run all checks" + @echo "make torture -- run all checks $(LOOPS) times" + @echo "make (dir)/(test).check -- run the given check once" + @echo "make (dir)/(test).forever -- run the given check forever" + @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times" + @echo + @echo "make (dir)/(test).gdb -- start up gdb for the given test" + @echo + @echo "make valgrind -- valgrind all tests" + @echo "make valgrind.gen-suppressions -- generate suppressions for all tests" + @echo " and save to suppressions.log" + @echo "make (dir)/(test).valgrind -- valgrind the given test" + @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever" + @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions" + @echo " and save to suppressions.log" + @echo "make inspect -- inspect all plugin features" + @echo + @echo + @echo "Additionally, you can use the GST_CHECKS environment variable to" + @echo "specify which test(s) should be run. This is useful if you are" + @echo "debugging a failure in one particular test, or want to reproduce" + @echo "a race condition in a single test." + @echo + @echo "Examples:" + @echo + @echo " GST_CHECKS=test_this,test_that make element/foobar.check" + @echo " GST_CHECKS=test_many_threads make element/foobar.forever" + @echo + +# override to _not_ install the test plugins +install-pluginLTLIBRARIES: + +clean-local: clean-local-check + +debug: + echo $(COVERAGE_FILES) + echo $(COVERAGE_FILES_REL) + +.PHONY: coverage +# we rebuild a registry and do gst-inspect so that all the get/set codepaths +# are also covered +@GST_GCOV_ENABLED_TRUE@coverage: +@GST_GCOV_ENABLED_TRUE@ for file in `find $(top_builddir) -name '*.gcda'`; do rm $$file; done +@GST_GCOV_ENABLED_TRUE@ -rm $(CHECK_REGISTRY) +@GST_GCOV_ENABLED_TRUE@ echo "Inspecting all elements" +@GST_GCOV_ENABLED_TRUE@ for e in `$(GST_INSPECT) | head -n -2 | cut -d: -f2`; do $(GST_INSPECT) $$e > /dev/null 2>&1; done +@GST_GCOV_ENABLED_TRUE@ make check +@GST_GCOV_ENABLED_TRUE@ make coverage-report +@GST_GCOV_ENABLED_FALSE@coverage: +@GST_GCOV_ENABLED_FALSE@ echo "You need to configure with --enable-gcov to get coverage data" +@GST_GCOV_ENABLED_FALSE@ exit 1 + +coverage-report: + rm -r coverage + for dir in $(COVERAGE_DIRS); do \ + mkdir -p coverage/$$dir; \ + make -C $(top_builddir)/$$dir gcov; \ + done + for dir in $(COVERAGE_DIRS); do \ + files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \ + if test ! -z "$$files"; then \ + perl $(top_srcdir)/common/coverage/coverage-report.pl \ + $(top_builddir)/$$dir/*.gcov.out > \ + coverage/$$dir/index.xml; \ + xsltproc $(top_srcdir)/common/coverage/coverage-report.xsl \ + coverage/$$dir/index.xml > coverage/$$dir/index.html; \ + fi; \ + done + + for file in $(COVERAGE_FILES_REL); do \ + echo Generating coverage/$$file.html; \ + perl $(top_srcdir)/common/coverage/coverage-report-entry.pl \ + $(top_builddir)/$$file > coverage/$$file.html; \ + done + +# 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/tests/check/elements/capsfilter.c b/tests/check/elements/capsfilter.c new file mode 100644 index 0000000..97a6f09 --- /dev/null +++ b/tests/check/elements/capsfilter.c @@ -0,0 +1,93 @@ +/* GStreamer unit test for capsfilter + * Copyright (C) <2008> Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> + +#define CAPS_TEMPLATE_STRING \ + "audio/x-raw-int, " \ + "channels = (int) [ 1, 2], " \ + "rate = (int) [ 1, MAX ]" + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (CAPS_TEMPLATE_STRING) + ); + +GST_START_TEST (test_unfixed_downstream_caps) +{ + GstElement *pipe, *src, *filter; + GstCaps *filter_caps; + GstPad *mysinkpad; + GstMessage *msg; + + pipe = gst_check_setup_element ("pipeline"); + + src = gst_check_setup_element ("fakesrc"); + g_object_set (src, "sizetype", 2, "sizemax", 1024, "num-buffers", 1, NULL); + + filter = gst_check_setup_element ("capsfilter"); + filter_caps = gst_caps_from_string ("audio/x-raw-int, rate=(int)44100"); + fail_unless (filter_caps != NULL); + g_object_set (filter, "caps", filter_caps, NULL); + + gst_bin_add_many (GST_BIN (pipe), src, filter, NULL); + fail_unless (gst_element_link (src, filter)); + + mysinkpad = gst_check_setup_sink_pad (filter, &sinktemplate, NULL); + gst_pad_set_active (mysinkpad, TRUE); + + fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PLAYING), + GST_STATE_CHANGE_SUCCESS); + + /* wait for error on bus */ + msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), + GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + + fail_if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR, + "Expected ERROR message, got EOS message"); + gst_message_unref (msg); + + /* We don't expect any output buffers unless the check fails */ + fail_unless (buffers == NULL); + + /* cleanup */ + GST_DEBUG ("cleanup"); + + gst_pad_set_active (mysinkpad, FALSE); + gst_check_teardown_sink_pad (filter); + gst_check_teardown_element (pipe); + gst_caps_unref (filter_caps); +} + +GST_END_TEST; + +static Suite * +capsfilter_suite (void) +{ + Suite *s = suite_create ("capsfilter"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_unfixed_downstream_caps); + + return s; +} + +GST_CHECK_MAIN (capsfilter) diff --git a/tests/check/elements/fakesink.c b/tests/check/elements/fakesink.c new file mode 100644 index 0000000..ab61e10 --- /dev/null +++ b/tests/check/elements/fakesink.c @@ -0,0 +1,1002 @@ +/* GStreamer + * + * unit test for fakesink + * + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * <2007> Wim Taymans <wim@fluendo.com> + * <2009> Tim-Philipp Müller <tim centricular net> + * + * 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 <unistd.h> + +#include <gst/base/gstpushsrc.h> +#include <gst/check/gstcheck.h> + +typedef struct +{ + GstPad *pad; + GstBuffer *buffer; + GThread *thread; + GstFlowReturn ret; +} ChainData; + +static gpointer +chain_async_buffer (gpointer data) +{ + ChainData *chain_data = (ChainData *) data; + + chain_data->ret = gst_pad_chain (chain_data->pad, chain_data->buffer); + + return chain_data; +} + +static ChainData * +chain_async (GstPad * pad, GstBuffer * buffer) +{ + GThread *thread; + ChainData *chain_data; + GError *error = NULL; + + chain_data = g_new (ChainData, 1); + chain_data->pad = pad; + chain_data->buffer = buffer; + chain_data->ret = GST_FLOW_ERROR; + + thread = g_thread_create (chain_async_buffer, chain_data, TRUE, &error); + if (error != NULL) { + g_warning ("could not create thread reason: %s", error->message); + g_free (chain_data); + return NULL; + } + chain_data->thread = thread; + + return chain_data; +} + +static GstFlowReturn +chain_async_return (ChainData * data) +{ + GstFlowReturn ret; + + g_thread_join (data->thread); + ret = data->ret; + g_free (data); + + return ret; +} + +GST_START_TEST (test_clipping) +{ + GstElement *sink; + GstPad *sinkpad; + GstStateChangeReturn ret; + + /* create sink */ + sink = gst_element_factory_make ("fakesink", "sink"); + fail_if (sink == NULL); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + fail_if (sinkpad == NULL); + + /* make element ready to accept data */ + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* send segment */ + { + GstEvent *event; + GstSegment segment; + gboolean eret; + + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 1 * GST_SECOND; + segment.stop = 5 * GST_SECOND; + segment.time = 1 * GST_SECOND; + + event = gst_event_new_segment (&segment); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* new segment should not have finished preroll */ + ret = gst_element_get_state (sink, NULL, NULL, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* send buffer that should be dropped */ + { + GstBuffer *buffer; + GstFlowReturn fret; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 0; + GST_BUFFER_DURATION (buffer) = 1 * GST_MSECOND; + + GST_DEBUG ("sending buffer to be dropped"); + fret = gst_pad_chain (sinkpad, buffer); + fail_if (fret != GST_FLOW_OK); + } + /* dropped buffer should not have finished preroll */ + ret = gst_element_get_state (sink, NULL, NULL, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* send buffer that should be dropped */ + { + GstBuffer *buffer; + GstFlowReturn fret; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 5 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_MSECOND; + + GST_DEBUG ("sending buffer to be dropped"); + fret = gst_pad_chain (sinkpad, buffer); + fail_if (fret != GST_FLOW_OK); + } + /* dropped buffer should not have finished preroll */ + ret = gst_element_get_state (sink, NULL, NULL, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* send buffer that should block and finish preroll */ + { + GstBuffer *buffer; + GstFlowReturn fret; + ChainData *data; + GstState current, pending; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_MSECOND; + + GST_DEBUG ("sending buffer to finish preroll"); + data = chain_async (sinkpad, buffer); + fail_if (data == NULL); + + /* state should now eventually change to PAUSED */ + ret = gst_element_get_state (sink, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + fail_unless (current == GST_STATE_PAUSED); + fail_unless (pending == GST_STATE_VOID_PENDING); + + /* playing should render the buffer */ + ret = gst_element_set_state (sink, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* and we should get a success return value */ + fret = chain_async_return (data); + fail_if (fret != GST_FLOW_OK); + } + + /* send some buffer that will be dropped or clipped, this can + * only be observed in the debug log. */ + { + GstBuffer *buffer; + GstFlowReturn fret; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 6 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_MSECOND; + + /* should be dropped */ + GST_DEBUG ("sending buffer to drop"); + fret = gst_pad_chain (sinkpad, buffer); + fail_if (fret != GST_FLOW_OK); + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 0 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 2 * GST_SECOND; + + /* should be clipped */ + GST_DEBUG ("sending buffer to clip"); + fret = gst_pad_chain (sinkpad, buffer); + fail_if (fret != GST_FLOW_OK); + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 4 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 2 * GST_SECOND; + + /* should be clipped */ + GST_DEBUG ("sending buffer to clip"); + fret = gst_pad_chain (sinkpad, buffer); + fail_if (fret != GST_FLOW_OK); + } + + gst_element_set_state (sink, GST_STATE_NULL); + gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE); + gst_object_unref (sinkpad); + gst_object_unref (sink); +} + +GST_END_TEST; + +static gint num_preroll = 0; + +static void +preroll_count (GstElement * sink) +{ + num_preroll++; + GST_DEBUG ("got preroll handoff %d", num_preroll); +} + +GST_START_TEST (test_preroll_sync) +{ + GstElement *pipeline, *sink; + GstPad *sinkpad; + GstStateChangeReturn ret; + + /* create sink */ + pipeline = gst_pipeline_new ("pipeline"); + fail_if (pipeline == NULL); + + sink = gst_element_factory_make ("fakesink", "sink"); + fail_if (sink == NULL); + g_object_set (G_OBJECT (sink), "sync", TRUE, NULL); + g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL); + g_signal_connect (sink, "preroll-handoff", G_CALLBACK (preroll_count), NULL); + + fail_unless (num_preroll == 0); + + gst_bin_add (GST_BIN (pipeline), sink); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + fail_if (sinkpad == NULL); + + /* make pipeline and element ready to accept data */ + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* send segment */ + { + GstEvent *event; + GstSegment segment; + gboolean eret; + + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 0 * GST_SECOND; + segment.stop = 102 * GST_SECOND; + segment.time = 0 * GST_SECOND; + + event = gst_event_new_segment (&segment); + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* send buffer that should block and finish preroll */ + { + GstBuffer *buffer; + GstFlowReturn fret; + ChainData *data; + GstState current, pending; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + + GST_DEBUG ("sending buffer to finish preroll"); + data = chain_async (sinkpad, buffer); + fail_if (data == NULL); + + /* state should now eventually change to PAUSED */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, + GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + fail_unless (current == GST_STATE_PAUSED); + fail_unless (pending == GST_STATE_VOID_PENDING); + + fail_unless (num_preroll == 1); + + /* playing should render the buffer */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* and we should get a success return value */ + fret = chain_async_return (data); + fail_if (fret != GST_FLOW_OK); + + /* now we are playing no new preroll was done */ + fail_unless (num_preroll == 1); + + buffer = gst_buffer_new (); + /* far in the future to make sure we block */ + GST_BUFFER_TIMESTAMP (buffer) = 100 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 100 * GST_SECOND; + data = chain_async (sinkpad, buffer); + fail_if (data == NULL); + + g_usleep (1000000); + + /* pause again. Since the buffer has a humongous timestamp we likely + * interrupt the clock_wait and we should preroll on this buffer again */ + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + ret = + gst_element_get_state (pipeline, ¤t, &pending, + GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + fail_unless (current == GST_STATE_PAUSED); + fail_unless (pending == GST_STATE_VOID_PENDING); + + fail_unless (num_preroll == 2); + + /* shutdown */ + ret = gst_element_set_state (pipeline, GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* should be wrong state now */ + fret = chain_async_return (data); + fail_if (fret != GST_FLOW_WRONG_STATE); + } + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + gst_object_unref (sinkpad); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* after EOS, we refuse everything */ +GST_START_TEST (test_eos) +{ + GstElement *pipeline, *sink; + GstPad *sinkpad; + GstStateChangeReturn ret; + GstMessage *message; + GstBus *bus; + + /* create sink */ + pipeline = gst_pipeline_new ("pipeline"); + fail_if (pipeline == NULL); + + bus = gst_pipeline_get_bus (GST_PIPELINE_CAST (pipeline)); + fail_if (bus == NULL); + + sink = gst_element_factory_make ("fakesink", "sink"); + fail_if (sink == NULL); + g_object_set (G_OBJECT (sink), "sync", TRUE, NULL); + + gst_bin_add (GST_BIN (pipeline), sink); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + fail_if (sinkpad == NULL); + + /* make pipeline and element ready to accept data */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* send EOS, this should work fine */ + { + GstEvent *eos; + gboolean eret; + + GST_DEBUG ("sending EOS"); + eos = gst_event_new_eos (); + + eret = gst_pad_send_event (sinkpad, eos); + fail_if (eret == FALSE); + } + + /* wait for preroll */ + gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + + /* EOS should be on the bus at some point */ + while (TRUE) { + GstMessageType type; + + /* blocking wait for messages */ + message = gst_bus_timed_pop (bus, GST_CLOCK_TIME_NONE); + type = GST_MESSAGE_TYPE (message); + gst_message_unref (message); + + GST_DEBUG ("got message %s", gst_message_type_get_name (type)); + + if (type == GST_MESSAGE_EOS) + break; + } + gst_object_unref (bus); + + /* send another EOS, this should fail */ + { + GstEvent *eos; + gboolean eret; + + GST_DEBUG ("sending second EOS"); + eos = gst_event_new_eos (); + + eret = gst_pad_send_event (sinkpad, eos); + fail_if (eret == TRUE); + } + + /* send segment, this should fail */ + { + GstEvent *event; + GstSegment segment; + gboolean eret; + + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 0 * GST_SECOND; + segment.stop = 2 * GST_SECOND; + segment.time = 0 * GST_SECOND; + event = gst_event_new_segment (&segment); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == TRUE); + } + + /* send buffer that should fail after EOS */ + { + GstBuffer *buffer; + GstFlowReturn fret; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + + GST_DEBUG ("sending buffer"); + + /* buffer after EOS is not UNEXPECTED */ + fret = gst_pad_chain (sinkpad, buffer); + fail_unless (fret == GST_FLOW_UNEXPECTED); + } + + /* flush, EOS state is flushed again. */ + { + GstEvent *event; + gboolean eret; + + GST_DEBUG ("sending FLUSH_START"); + event = gst_event_new_flush_start (); + eret = gst_pad_send_event (sinkpad, event); + fail_unless (eret == TRUE); + + GST_DEBUG ("sending FLUSH_STOP"); + event = gst_event_new_flush_stop (TRUE); + eret = gst_pad_send_event (sinkpad, event); + fail_unless (eret == TRUE); + } + + /* send segment, this should now work again */ + { + GstEvent *event; + GstSegment segment; + gboolean eret; + + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 0 * GST_SECOND; + segment.stop = 2 * GST_SECOND; + segment.time = 0 * GST_SECOND; + event = gst_event_new_segment (&segment); + + eret = gst_pad_send_event (sinkpad, event); + fail_unless (eret == TRUE); + } + + /* send buffer that should work and block */ + { + GstBuffer *buffer; + GstFlowReturn fret; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + + GST_DEBUG ("sending buffer"); + + fret = gst_pad_chain (sinkpad, buffer); + fail_unless (fret == GST_FLOW_OK); + } + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + gst_object_unref (sinkpad); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* test EOS triggered by the element */ +GST_START_TEST (test_eos2) +{ + GstElement *pipeline, *sink; + GstPad *sinkpad; + GstStateChangeReturn ret; + + /* create sink */ + pipeline = gst_pipeline_new ("pipeline"); + fail_if (pipeline == NULL); + + sink = gst_element_factory_make ("fakesink", "sink"); + fail_if (sink == NULL); + g_object_set (G_OBJECT (sink), "sync", TRUE, NULL); + g_object_set (G_OBJECT (sink), "num-buffers", 1, NULL); + + gst_bin_add (GST_BIN (pipeline), sink); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + fail_if (sinkpad == NULL); + + /* make pipeline and element ready to accept data */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* send segment, this should work */ + { + GstEvent *event; + GstSegment segment; + gboolean eret; + + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 0 * GST_SECOND; + segment.stop = 2 * GST_SECOND; + segment.time = 0 * GST_SECOND; + event = gst_event_new_segment (&segment); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* send buffer that should return UNEXPECTED */ + { + GstBuffer *buffer; + GstFlowReturn fret; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + + GST_DEBUG ("sending buffer"); + + /* this buffer will generate UNEXPECTED */ + fret = gst_pad_chain (sinkpad, buffer); + fail_unless (fret == GST_FLOW_UNEXPECTED); + } + + /* send buffer that should return UNEXPECTED */ + { + GstBuffer *buffer; + GstFlowReturn fret; + + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + + GST_DEBUG ("sending buffer"); + + fret = gst_pad_chain (sinkpad, buffer); + fail_unless (fret == GST_FLOW_UNEXPECTED); + } + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + gst_object_unref (sinkpad); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* test position reporting before, during and after flush + * in PAUSED and PLAYING */ +GST_START_TEST (test_position) +{ + GstElement *pipeline, *sink; + GstPad *sinkpad; + GstStateChangeReturn ret; + gboolean qret; + gint64 qcur; + GstBuffer *buffer; + GstFlowReturn fret; + ChainData *data; + GstEvent *event; + gboolean eret; + gint i; + + /* create sink */ + pipeline = gst_pipeline_new ("pipeline"); + fail_if (pipeline == NULL); + + sink = gst_element_factory_make ("fakesink", "sink"); + fail_if (sink == NULL); + g_object_set (G_OBJECT (sink), "sync", TRUE, NULL); + g_object_set (G_OBJECT (sink), "num-buffers", 2, NULL); + + gst_bin_add (GST_BIN (pipeline), sink); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + fail_if (sinkpad == NULL); + + /* do position query, this should fail, we have nothing received yet */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == FALSE); + + ret = gst_element_set_state (pipeline, GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* do position query, this should fail, we have nothing received yet */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == FALSE); + + /* make pipeline and element ready to accept data */ + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* do position query, this should fail, we have nothing received yet */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == FALSE); + + /* send segment, this should work */ + { + GstSegment segment; + + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 1 * GST_SECOND; + segment.stop = 3 * GST_SECOND; + segment.time = 1 * GST_SECOND; + event = gst_event_new_segment (&segment); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* FIXME, do position query, this should succeed with the time value from the + * segment. */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur == 1 * GST_SECOND); + + /* send buffer that we will flush out */ + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + + GST_DEBUG ("sending buffer"); + + /* this buffer causes the sink to preroll */ + data = chain_async (sinkpad, buffer); + fail_if (data == NULL); + + /* wait for preroll */ + ret = gst_element_get_state (pipeline, NULL, NULL, -1); + + /* do position query, this should succeed with the time value from the + * segment. */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur == 1 * GST_SECOND); + + /* start flushing, no timing is affected yet */ + { + GST_DEBUG ("sending flush_start"); + event = gst_event_new_flush_start (); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* preroll buffer is flushed out */ + fret = chain_async_return (data); + fail_unless (fret == GST_FLOW_WRONG_STATE); + + /* do position query, this should succeed with the time value from the + * segment before the flush. */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur == 1 * GST_SECOND); + + /* stop flushing, timing is affected now */ + { + GST_DEBUG ("sending flush_stop"); + event = gst_event_new_flush_stop (TRUE); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* do position query, this should fail, the segment is flushed */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == FALSE); + + /* send segment, this should work */ + { + GstSegment segment; + + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 2 * GST_SECOND; + segment.stop = 4 * GST_SECOND; + segment.time = 1 * GST_SECOND; + event = gst_event_new_segment (&segment); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* send buffer that should return OK */ + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 3 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + + GST_DEBUG ("sending buffer"); + + /* this buffer causes the sink to preroll */ + data = chain_async (sinkpad, buffer); + fail_if (data == NULL); + + /* wait for preroll */ + ret = gst_element_get_state (pipeline, NULL, NULL, -1); + + /* do position query, this should succeed with the time value from the + * segment. */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur == 1 * GST_SECOND); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* position now is increasing but never exceeds the boundaries of the segment */ + for (i = 0; i < 5; i++) { + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + GST_DEBUG ("position %" GST_TIME_FORMAT, GST_TIME_ARGS (qcur)); + fail_unless (qret == TRUE); + fail_unless (qcur >= 1 * GST_SECOND && qcur <= 3 * GST_SECOND); + g_usleep (1000 * 250); + } + + /* preroll buffer is rendered, we expect one more buffer after this one */ + fret = chain_async_return (data); + fail_unless (fret == GST_FLOW_OK); + + /* after rendering the position must be bigger then the stream_time of the + * buffer */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur >= 2 * GST_SECOND && qcur <= 3 * GST_SECOND); + + /* start flushing in PLAYING */ + { + GST_DEBUG ("sending flush_start"); + event = gst_event_new_flush_start (); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* this should now just report the stream time of the last buffer */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur == 2 * GST_SECOND); + + { + GST_DEBUG ("sending flush_stop"); + event = gst_event_new_flush_stop (TRUE); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* do position query, this should fail, the segment is flushed */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == FALSE); + + /* send segment, this should work */ + { + GstSegment segment; + + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 2 * GST_SECOND; + segment.stop = 4 * GST_SECOND; + segment.time = 1 * GST_SECOND; + event = gst_event_new_segment (&segment); + + eret = gst_pad_send_event (sinkpad, event); + fail_if (eret == FALSE); + } + + /* send buffer that should return UNEXPECTED */ + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 3 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + + GST_DEBUG ("sending buffer"); + + /* this buffer causes the sink to preroll */ + data = chain_async (sinkpad, buffer); + fail_if (data == NULL); + + /* wait for preroll */ + ret = gst_element_get_state (pipeline, NULL, NULL, -1); + + /* preroll buffer is rendered, we expect no more buffer after this one */ + fret = chain_async_return (data); + fail_unless (fret == GST_FLOW_UNEXPECTED); + + /* do position query, this should succeed with the stream time of the buffer + * against the clock. Since the buffer is synced against the clock, the time + * should be at least the stream time of the buffer. */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur >= 2 * GST_SECOND && qcur <= 3 * GST_SECOND); + + /* wait 2 more seconds, enough to test if the position was clipped correctly + * against the segment */ + g_usleep (2 * G_USEC_PER_SEC); + + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur == 3 * GST_SECOND); + + GST_DEBUG ("going to PAUSED"); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* we report the time of the last start of the buffer. This is slightly + * incorrect, we should report the exact time when we paused but there is no + * record of that anywhere */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == TRUE); + fail_unless (qcur >= 4 * GST_SECOND); + + ret = gst_element_set_state (pipeline, GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* fails again because we are in the wrong state */ + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == FALSE); + + gst_element_set_state (pipeline, GST_STATE_NULL); + + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur); + fail_unless (qret == FALSE); + + gst_object_unref (sinkpad); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* like fakesrc, but also pushes an OOB event after each buffer */ +typedef GstPushSrc OOBSource; +typedef GstPushSrcClass OOBSourceClass; + +GType oob_source_get_type (void); +G_DEFINE_TYPE (OOBSource, oob_source, GST_TYPE_PUSH_SRC); + +static GstFlowReturn +oob_source_create (GstPushSrc * src, GstBuffer ** p_buf) +{ + *p_buf = gst_buffer_new (); + + gst_pad_push_event (GST_BASE_SRC_PAD (src), + gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, NULL)); + + return GST_FLOW_OK; +} + +static void +oob_source_class_init (OOBSourceClass * klass) +{ + static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sinktemplate)); + + pushsrc_class->create = GST_DEBUG_FUNCPTR (oob_source_create); +} + +static void +oob_source_init (OOBSource * src) +{ + /* nothing to do */ +} + +#define NOTIFY_RACE_NUM_PIPELINES 10 + +typedef struct +{ + GstElement *src; + GstElement *queue; + GstElement *sink; + GstElement *pipe; +} NotifyRacePipeline; + +static void +test_notify_race_setup_pipeline (NotifyRacePipeline * p) +{ + GST_DEBUG ("Creating pipeline"); + p->pipe = gst_pipeline_new ("pipeline"); + p->src = g_object_new (oob_source_get_type (), NULL); + + p->queue = gst_element_factory_make ("queue", NULL); + g_object_set (p->queue, "max-size-buffers", 2, NULL); + + p->sink = gst_element_factory_make ("fakesink", NULL); + gst_bin_add (GST_BIN (p->pipe), p->src); + gst_bin_add (GST_BIN (p->pipe), p->queue); + gst_bin_add (GST_BIN (p->pipe), p->sink); + gst_element_link_many (p->src, p->queue, p->sink, NULL); + + GST_DEBUG ("Setting pipeline to PLAYING"); + fail_unless_equals_int (gst_element_set_state (p->pipe, GST_STATE_PLAYING), + GST_STATE_CHANGE_ASYNC); + GST_DEBUG ("Getting state"); + fail_unless_equals_int (gst_element_get_state (p->pipe, NULL, NULL, -1), + GST_STATE_CHANGE_SUCCESS); +} + +static void +test_notify_race_cleanup_pipeline (NotifyRacePipeline * p) +{ + gst_element_set_state (p->pipe, GST_STATE_NULL); + gst_object_unref (p->pipe); + memset (p, 0, sizeof (NotifyRacePipeline)); +} + +/* we create N pipelines to make sure the notify race isn't per-class, but + * only per instance */ +GST_START_TEST (test_notify_race) +{ + NotifyRacePipeline pipelines[NOTIFY_RACE_NUM_PIPELINES]; + int i; + + for (i = 0; i < G_N_ELEMENTS (pipelines); ++i) { + GST_DEBUG ("Starting up pipeline %d", i); + test_notify_race_setup_pipeline (&pipelines[i]); + } + + g_usleep (2 * G_USEC_PER_SEC); + + for (i = 0; i < G_N_ELEMENTS (pipelines); ++i) { + GST_DEBUG ("Cleaning up pipeline %d", i); + test_notify_race_cleanup_pipeline (&pipelines[i]); + } +} + +GST_END_TEST; + +static Suite * +fakesink_suite (void) +{ + Suite *s = suite_create ("fakesink"); + TCase *tc_chain = tcase_create ("general"); + + tcase_set_timeout (tc_chain, 20); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_clipping); + tcase_add_test (tc_chain, test_preroll_sync); + tcase_add_test (tc_chain, test_eos); + tcase_add_test (tc_chain, test_eos2); + tcase_add_test (tc_chain, test_position); + tcase_add_test (tc_chain, test_notify_race); + + return s; +} + +GST_CHECK_MAIN (fakesink); diff --git a/tests/check/elements/fakesrc.c b/tests/check/elements/fakesrc.c new file mode 100644 index 0000000..4df128a --- /dev/null +++ b/tests/check/elements/fakesrc.c @@ -0,0 +1,256 @@ +/* GStreamer + * + * unit test for fakesrc + * + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart 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. + */ + +#include <unistd.h> + +#include <gst/check/gstcheck.h> + +static gboolean have_eos = FALSE; + +static GstPad *mysinkpad; + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static gboolean +event_func (GstPad * pad, GstEvent * event) +{ + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + have_eos = TRUE; + gst_event_unref (event); + return TRUE; + } + + gst_event_unref (event); + return FALSE; +} + +static GstElement * +setup_fakesrc (void) +{ + GstElement *fakesrc; + + GST_DEBUG ("setup_fakesrc"); + fakesrc = gst_check_setup_element ("fakesrc"); + mysinkpad = gst_check_setup_sink_pad (fakesrc, &sinktemplate, NULL); + gst_pad_set_event_function (mysinkpad, event_func); + gst_pad_set_active (mysinkpad, TRUE); + have_eos = FALSE; + return fakesrc; +} + +static void +cleanup_fakesrc (GstElement * fakesrc) +{ + gst_pad_set_active (mysinkpad, FALSE); + gst_check_teardown_sink_pad (fakesrc); + gst_check_teardown_element (fakesrc); +} + +GST_START_TEST (test_num_buffers) +{ + GstElement *src; + + src = setup_fakesrc (); + g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless_equals_int (g_list_length (buffers), 3); + gst_check_drop_buffers (); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_sizetype_empty) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 1, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless_equals_int (g_list_length (buffers), 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_unless (gst_buffer_get_size (buf) == 0); + l = l->next; + } + gst_check_drop_buffers (); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_sizetype_fixed) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 2, NULL); + g_object_set (G_OBJECT (src), "sizemax", 8192, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless (g_list_length (buffers) == 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_unless (gst_buffer_get_size (buf) == 8192); + l = l->next; + } + gst_check_drop_buffers (); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_sizetype_random) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 3, NULL); + g_object_set (G_OBJECT (src), "sizemin", 4096, NULL); + g_object_set (G_OBJECT (src), "sizemax", 8192, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless (g_list_length (buffers) == 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_if (gst_buffer_get_size (buf) > 8192); + fail_if (gst_buffer_get_size (buf) < 4096); + l = l->next; + } + gst_check_drop_buffers (); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_no_preroll) +{ + GstElement *src; + GstStateChangeReturn ret; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + + ret = gst_element_set_state (src, GST_STATE_PAUSED); + + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "error going to paused the first time"); + + ret = gst_element_set_state (src, GST_STATE_PAUSED); + + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "error going to paused the second time"); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + +static Suite * +fakesrc_suite (void) +{ + Suite *s = suite_create ("fakesrc"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_num_buffers); + tcase_add_test (tc_chain, test_sizetype_empty); + tcase_add_test (tc_chain, test_sizetype_fixed); + tcase_add_test (tc_chain, test_sizetype_random); + tcase_add_test (tc_chain, test_no_preroll); + + return s; +} + +GST_CHECK_MAIN (fakesrc); diff --git a/tests/check/elements/fdsrc.c b/tests/check/elements/fdsrc.c new file mode 100644 index 0000000..6c92f6d --- /dev/null +++ b/tests/check/elements/fdsrc.c @@ -0,0 +1,205 @@ +/* GStreamer + * + * unit test for fdsrc + * + * Copyright (C) <2005> Jan Schmidt <thaytan at mad dot scientist dot 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. + */ + +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include <gst/check/gstcheck.h> + +static gboolean have_eos = FALSE; + +static GstPad *mysinkpad; + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static gboolean +event_func (GstPad * pad, GstEvent * event) +{ + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + have_eos = TRUE; + gst_event_unref (event); + return TRUE; + } + + gst_event_unref (event); + return FALSE; +} + +static GstElement * +setup_fdsrc (void) +{ + GstElement *fdsrc; + + GST_DEBUG ("setup_fdsrc"); + fdsrc = gst_check_setup_element ("fdsrc"); + mysinkpad = gst_check_setup_sink_pad (fdsrc, &sinktemplate, NULL); + gst_pad_set_event_function (mysinkpad, event_func); + gst_pad_set_active (mysinkpad, TRUE); + return fdsrc; +} + +static void +cleanup_fdsrc (GstElement * fdsrc) +{ + gst_pad_set_active (mysinkpad, FALSE); + gst_check_teardown_sink_pad (fdsrc); + gst_check_teardown_element (fdsrc); +} + +GST_START_TEST (test_num_buffers) +{ + GstElement *src; + gint pipe_fd[2]; + gchar data[4096]; + +#ifndef G_OS_WIN32 + fail_if (pipe (pipe_fd) < 0); +#else + fail_if (_pipe (pipe_fd, 2048, _O_BINARY) < 0); +#endif + + src = setup_fdsrc (); + g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); + g_object_set (G_OBJECT (src), "fd", pipe_fd[0], NULL); + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + memset (data, 0, 4096); + while (!have_eos) { + fail_if (write (pipe_fd[1], data, 4096) < 0); + g_usleep (100); + } + + fail_unless (g_list_length (buffers) == 3); + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_fdsrc (src); + close (pipe_fd[0]); + close (pipe_fd[1]); + g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (buffers); +} + +GST_END_TEST; + +GST_START_TEST (test_nonseeking) +{ + GstElement *src; + GstQuery *seeking_query; + gint pipe_fd[2]; + gchar data[4096]; + gboolean seekable; + +#ifndef G_OS_WIN32 + fail_if (pipe (pipe_fd) < 0); +#else + fail_if (_pipe (pipe_fd, 2048, _O_BINARY) < 0); +#endif + + src = setup_fdsrc (); + g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); + g_object_set (G_OBJECT (src), "fd", pipe_fd[0], NULL); + fail_unless (gst_element_set_state (src, + GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS, + "could not set to paused"); + + memset (data, 0, 4096); + fail_if (write (pipe_fd[1], data, 4096) < 0); + + /* Test that fdsrc is non-seekable with a pipe */ + fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) + != NULL); + fail_unless (gst_element_query (src, seeking_query) == TRUE); + gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); + fail_unless (seekable == FALSE); + gst_query_unref (seeking_query); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_fdsrc (src); + close (pipe_fd[0]); + close (pipe_fd[1]); +} + +GST_END_TEST; + +GST_START_TEST (test_seeking) +{ + GstElement *src; + gint in_fd; + GstQuery *seeking_query; + gboolean seekable; + +#ifndef TESTFILE +#error TESTFILE not defined +#endif + fail_if ((in_fd = open (TESTFILE, O_RDONLY)) < 0); + src = setup_fdsrc (); + + g_object_set (G_OBJECT (src), "fd", in_fd, NULL); + fail_unless (gst_element_set_state (src, + GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS, + "could not set to paused"); + + /* Test that fdsrc is seekable with a file fd */ + fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) + != NULL); + fail_unless (gst_element_query (src, seeking_query) == TRUE); + gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); + fail_unless (seekable == TRUE); + gst_query_unref (seeking_query); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_fdsrc (src); + close (in_fd); +} + +GST_END_TEST; + +static Suite * +fdsrc_suite (void) +{ + Suite *s = suite_create ("fdsrc"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_num_buffers); + tcase_add_test (tc_chain, test_nonseeking); + tcase_add_test (tc_chain, test_seeking); + + return s; +} + +GST_CHECK_MAIN (fdsrc); diff --git a/tests/check/elements/filesink.c b/tests/check/elements/filesink.c new file mode 100644 index 0000000..fa1d3f9 --- /dev/null +++ b/tests/check/elements/filesink.c @@ -0,0 +1,324 @@ +/* GStreamer unit test for the filesink element + * + * Copyright (C) 2006 Thomas Vander Stichele <thomas at apestaart dot org> + * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net> + * + * 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 <stdio.h> + +#include <glib.h> +#include <glib/gstdio.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> /* for close() */ +#endif + +#include <gst/check/gstcheck.h> + +static GstPad *mysrcpad; + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstElement * +setup_filesink (void) +{ + GstElement *filesink; + + GST_DEBUG ("setup_filesink"); + filesink = gst_check_setup_element ("filesink"); + mysrcpad = gst_check_setup_src_pad (filesink, &srctemplate, NULL); + gst_pad_set_active (mysrcpad, TRUE); + return filesink; +} + +static void +cleanup_filesink (GstElement * filesink) +{ + gst_pad_set_active (mysrcpad, FALSE); + gst_check_teardown_src_pad (filesink); + gst_check_teardown_element (filesink); +} + +#if 0 +/* this queries via the element vfunc, which is currently not implemented */ +#define CHECK_QUERY_POSITION(filesink,format,position) \ + G_STMT_START { \ + gint64 pos; \ + fail_unless (gst_element_query_position (filesink, format, &pos)); \ + fail_unless_equals_int (pos, position); \ + } G_STMT_END +#else +#define CHECK_QUERY_POSITION(filesink,format,position) \ + G_STMT_START { \ + GstPad *pad; \ + gint64 pos; \ + pad = gst_element_get_static_pad (filesink, "sink"); \ + fail_unless (gst_pad_query_position (pad, format, &pos)); \ + fail_unless_equals_int (pos, position); \ + gst_object_unref (pad); \ + } G_STMT_END +#endif + +#define PUSH_BYTES(num_bytes) \ + G_STMT_START { \ + GstBuffer *buf = gst_buffer_new_and_alloc(num_bytes); \ + GRand *rand = g_rand_new_with_seed (num_bytes); \ + guint8 *data; \ + guint i; \ + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); \ + for (i = 0; i < num_bytes; ++i) \ + data[i] = (g_rand_int (rand) >> 24) & 0xff; \ + gst_buffer_unmap (buf, data, num_bytes); \ + fail_unless_equals_int (gst_pad_push (mysrcpad, buf), GST_FLOW_OK); \ + g_rand_free (rand); \ + } G_STMT_END + +/* TODO: we don't check that the data is actually written to the right + * position after a seek */ +GST_START_TEST (test_seeking) +{ + const gchar *tmpdir; + GstElement *filesink; + gchar *tmp_fn; + gint fd; + GstSegment segment; + + tmpdir = g_get_tmp_dir (); + if (tmpdir == NULL) + return; + + /* this is just silly, but gcc warns if we try to use tpmnam() */ + tmp_fn = g_build_filename (tmpdir, "gstreamer-filesink-test-XXXXXX", NULL); + fd = g_mkstemp (tmp_fn); + if (fd < 0) { + GST_ERROR ("can't create temp file %s: %s", tmp_fn, g_strerror (errno)); + g_free (tmp_fn); + return; + } + /* don't want the file, just a filename (hence silly, see above) */ + close (fd); + g_remove (tmp_fn); + + filesink = setup_filesink (); + + GST_LOG ("using temp file '%s'", tmp_fn); + g_object_set (filesink, "location", tmp_fn, NULL); + + fail_unless_equals_int (gst_element_set_state (filesink, GST_STATE_PLAYING), + GST_STATE_CHANGE_ASYNC); + +#if 0 + /* Test that filesink is seekable with a file fd */ + /* filesink doesn't implement seekable query at the moment */ + GstQuery *seeking_query; + gboolean seekable; + + fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) + != NULL); + fail_unless (gst_element_query (filesink, seeking_query) == TRUE); + gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); + fail_unless (seekable == TRUE); + gst_query_unref (seeking_query); +#endif + + gst_segment_init (&segment, GST_FORMAT_BYTES); + fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment))); + + CHECK_QUERY_POSITION (filesink, GST_FORMAT_BYTES, 0); + + /* push buffer with size 0 and NULL data */ + PUSH_BYTES (0); + CHECK_QUERY_POSITION (filesink, GST_FORMAT_BYTES, 0); + + PUSH_BYTES (1); + CHECK_QUERY_POSITION (filesink, GST_FORMAT_BYTES, 1); + + PUSH_BYTES (99); + CHECK_QUERY_POSITION (filesink, GST_FORMAT_BYTES, 100); + + PUSH_BYTES (8800); + CHECK_QUERY_POSITION (filesink, GST_FORMAT_BYTES, 8900); + + segment.start = 8800; + if (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment))) { + GST_LOG ("seek ok"); + /* make sure that new position is reported immediately */ + CHECK_QUERY_POSITION (filesink, GST_FORMAT_BYTES, 8800); + PUSH_BYTES (1); + CHECK_QUERY_POSITION (filesink, GST_FORMAT_BYTES, 8801); + PUSH_BYTES (9256); + CHECK_QUERY_POSITION (filesink, GST_FORMAT_BYTES, 18057); + } else { + GST_INFO ("seeking not supported for tempfile?!"); + } + + fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ())); + + fail_unless_equals_int (gst_element_set_state (filesink, GST_STATE_NULL), + GST_STATE_CHANGE_SUCCESS); + + /* cleanup */ + cleanup_filesink (filesink); + + /* check that we wrote data to the right position after the seek */ + { + gchar *data = NULL; + gsize len; + + fail_unless (g_file_get_contents (tmp_fn, &data, &len, NULL), + "Failed to read in newly-created file '%s'", tmp_fn); + fail_unless_equals_int (len, 18057); + { + /* we wrote 9256 bytes at position 8801 */ + GRand *rand = g_rand_new_with_seed (9256); + guint i; + + for (i = 0; i < 9256; ++i) { + guint8 byte_written = *(((guint8 *) data) + 8801 + i); + + fail_unless_equals_int (byte_written, g_rand_int (rand) >> 24); + } + g_rand_free (rand); + } + g_free (data); + } + + /* remove file */ + g_remove (tmp_fn); + g_free (tmp_fn); +} + +GST_END_TEST; + +GST_START_TEST (test_coverage) +{ + GstElement *filesink; + gchar *location; + GstBus *bus; + GstMessage *message; + + filesink = setup_filesink (); + bus = gst_bus_new (); + + gst_element_set_bus (filesink, bus); + + g_object_set (filesink, "location", "/i/do/not/exist", NULL); + g_object_get (filesink, "location", &location, NULL); + fail_unless_equals_string (location, "/i/do/not/exist"); + g_free (location); + + fail_unless_equals_int (gst_element_set_state (filesink, GST_STATE_PLAYING), + GST_STATE_CHANGE_FAILURE); + + /* a state change and an error */ + fail_if ((message = gst_bus_pop (bus)) == NULL); + fail_unless_message_error (message, RESOURCE, OPEN_WRITE); + gst_message_unref (message); + + g_object_set (filesink, "location", NULL, NULL); + g_object_get (filesink, "location", &location, NULL); + fail_if (location); + + /* cleanup */ + gst_element_set_bus (filesink, NULL); + gst_object_unref (GST_OBJECT (bus)); + cleanup_filesink (filesink); +} + +GST_END_TEST; + +GST_START_TEST (test_uri_interface) +{ + GstElement *filesink; + gchar *location; + GstBus *bus; + + filesink = setup_filesink (); + bus = gst_bus_new (); + + gst_element_set_bus (filesink, bus); + + g_object_set (G_OBJECT (filesink), "location", "/i/do/not/exist", NULL); + g_object_get (G_OBJECT (filesink), "location", &location, NULL); + fail_unless_equals_string (location, "/i/do/not/exist"); + g_free (location); + + location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (filesink)); + fail_unless_equals_string (location, "file:///i/do/not/exist"); + + /* should accept file:///foo/bar URIs */ + fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (filesink), + "file:///foo/bar")); + location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (filesink)); + fail_unless_equals_string (location, "file:///foo/bar"); + g_object_get (G_OBJECT (filesink), "location", &location, NULL); + fail_unless_equals_string (location, "/foo/bar"); + g_free (location); + + /* should accept file://localhost/foo/bar URIs */ + fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (filesink), + "file://localhost/foo/baz")); + location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (filesink)); + fail_unless_equals_string (location, "file:///foo/baz"); + g_object_get (G_OBJECT (filesink), "location", &location, NULL); + fail_unless_equals_string (location, "/foo/baz"); + g_free (location); + + /* should escape non-uri characters for the URI but not for the location */ + g_object_set (G_OBJECT (filesink), "location", "/foo/b?r", NULL); + g_object_get (G_OBJECT (filesink), "location", &location, NULL); + fail_unless_equals_string (location, "/foo/b?r"); + g_free (location); + location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (filesink)); + fail_unless_equals_string (location, "file:///foo/b%3Fr"); + + /* should fail with other hostnames */ + fail_if (gst_uri_handler_set_uri (GST_URI_HANDLER (filesink), + "file://hostname/foo/foo")); + + /* cleanup */ + gst_element_set_bus (filesink, NULL); + gst_object_unref (GST_OBJECT (bus)); + cleanup_filesink (filesink); +} + +GST_END_TEST; + +static Suite * +filesink_suite (void) +{ + Suite *s = suite_create ("filesink"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + + tcase_add_test (tc_chain, test_coverage); + tcase_add_test (tc_chain, test_uri_interface); + tcase_add_test (tc_chain, test_seeking); + + return s; +} + +GST_CHECK_MAIN (filesink); diff --git a/tests/check/elements/filesrc.c b/tests/check/elements/filesrc.c new file mode 100644 index 0000000..eddee15 --- /dev/null +++ b/tests/check/elements/filesrc.c @@ -0,0 +1,506 @@ +/* GStreamer + * + * Copyright (C) 2006 Thomas Vander Stichele <thomas at apestaart 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. + */ + +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include <gst/check/gstcheck.h> + +static gboolean have_eos = FALSE; +static GCond *eos_cond; +static GMutex *event_mutex; + +static GstPad *mysinkpad; + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static gboolean +event_func (GstPad * pad, GstEvent * event) +{ + gboolean res = TRUE; + + g_mutex_lock (event_mutex); + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + have_eos = TRUE; + GST_DEBUG ("signal EOS"); + g_cond_broadcast (eos_cond); + } + g_mutex_unlock (event_mutex); + + gst_event_unref (event); + + return res; +} + +static void +wait_eos (void) +{ + g_mutex_lock (event_mutex); + GST_DEBUG ("waiting for EOS"); + while (!have_eos) { + g_cond_wait (eos_cond, event_mutex); + } + GST_DEBUG ("received EOS"); + g_mutex_unlock (event_mutex); +} + +static GstElement * +setup_filesrc (void) +{ + GstElement *filesrc; + + GST_DEBUG ("setup_filesrc"); + filesrc = gst_check_setup_element ("filesrc"); + mysinkpad = gst_check_setup_sink_pad (filesrc, &sinktemplate, NULL); + gst_pad_set_event_function (mysinkpad, event_func); + gst_pad_set_active (mysinkpad, TRUE); + + eos_cond = g_cond_new (); + event_mutex = g_mutex_new (); + + return filesrc; +} + +static void +cleanup_filesrc (GstElement * filesrc) +{ + gst_pad_set_active (mysinkpad, FALSE); + gst_check_teardown_sink_pad (filesrc); + gst_check_teardown_element (filesrc); + + g_cond_free (eos_cond); + g_mutex_free (event_mutex); +} + +GST_START_TEST (test_seeking) +{ + GstElement *src; + GstQuery *seeking_query; + gboolean seekable; + +#ifndef TESTFILE +#error TESTFILE not defined +#endif + src = setup_filesrc (); + + g_object_set (G_OBJECT (src), "location", TESTFILE, NULL); + fail_unless (gst_element_set_state (src, + GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS, + "could not set to paused"); + + /* Test that filesrc is seekable with a file fd */ + fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) + != NULL); + fail_unless (gst_element_query (src, seeking_query) == TRUE); + gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); + fail_unless (seekable == TRUE); + gst_query_unref (seeking_query); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_filesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_reverse) +{ + GstElement *src; + +#ifndef TESTFILE +#error TESTFILE not defined +#endif + src = setup_filesrc (); + + g_object_set (G_OBJECT (src), "location", TESTFILE, NULL); + /* we're going to perform the seek in ready */ + fail_unless (gst_element_set_state (src, + GST_STATE_READY) == GST_STATE_CHANGE_SUCCESS, + "could not set to ready"); + + /* reverse seek from end to start */ + gst_element_seek (src, -1.0, GST_FORMAT_BYTES, 0, GST_SEEK_TYPE_SET, 100, + GST_SEEK_TYPE_SET, -1); + + fail_unless (gst_element_set_state (src, + GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS, + "could not set to paused"); + + /* wait for EOS */ + wait_eos (); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + cleanup_filesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_pull) +{ + GstElement *src; + GstQuery *seeking_query; + gboolean res, seekable; + gint64 start, stop; + GstPad *pad; + GstFlowReturn ret; + GstBuffer *buffer1, *buffer2; + guint8 *data1, *data2; + gsize size1, size2; + + src = setup_filesrc (); + + g_object_set (G_OBJECT (src), "location", TESTFILE, NULL); + fail_unless (gst_element_set_state (src, + GST_STATE_READY) == GST_STATE_CHANGE_SUCCESS, + "could not set to ready"); + + /* get the source pad */ + pad = gst_element_get_static_pad (src, "src"); + fail_unless (pad != NULL); + + /* activate the pad in pull mode */ + res = gst_pad_activate_pull (pad, TRUE); + fail_unless (res == TRUE); + + /* not start playing */ + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to paused"); + + /* Test that filesrc is seekable with a file fd */ + fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) + != NULL); + fail_unless (gst_element_query (src, seeking_query) == TRUE); + + /* get the seeking capabilities */ + gst_query_parse_seeking (seeking_query, NULL, &seekable, &start, &stop); + fail_unless (seekable == TRUE); + fail_unless (start == 0); + fail_unless (start != -1); + gst_query_unref (seeking_query); + + /* do some pulls */ + ret = gst_pad_get_range (pad, 0, 100, &buffer1); + fail_unless (ret == GST_FLOW_OK); + fail_unless (buffer1 != NULL); + fail_unless (gst_buffer_get_size (buffer1) == 100); + + ret = gst_pad_get_range (pad, 0, 50, &buffer2); + fail_unless (ret == GST_FLOW_OK); + fail_unless (buffer2 != NULL); + fail_unless (gst_buffer_get_size (buffer2) == 50); + + /* this should be the same */ + data1 = gst_buffer_map (buffer1, &size1, NULL, GST_MAP_READ); + data2 = gst_buffer_map (buffer2, &size2, NULL, GST_MAP_READ); + fail_unless (memcmp (data1, data2, 50) == 0); + gst_buffer_unmap (buffer2, data2, size2); + + gst_buffer_unref (buffer2); + + /* read next 50 bytes */ + ret = gst_pad_get_range (pad, 50, 50, &buffer2); + fail_unless (ret == GST_FLOW_OK); + fail_unless (buffer2 != NULL); + fail_unless (gst_buffer_get_size (buffer2) == 50); + + /* compare with previously read data */ + data2 = gst_buffer_map (buffer2, &size2, NULL, GST_MAP_READ); + fail_unless (memcmp (data1 + 50, data2, 50) == 0); + gst_buffer_unmap (buffer2, data2, size2); + + gst_buffer_unmap (buffer1, data1, size1); + gst_buffer_unref (buffer1); + gst_buffer_unref (buffer2); + + /* read 10 bytes at end-10 should give exactly 10 bytes */ + ret = gst_pad_get_range (pad, stop - 10, 10, &buffer1); + fail_unless (ret == GST_FLOW_OK); + fail_unless (buffer1 != NULL); + fail_unless (gst_buffer_get_size (buffer1) == 10); + gst_buffer_unref (buffer1); + + /* read 20 bytes at end-10 should give exactly 10 bytes */ + ret = gst_pad_get_range (pad, stop - 10, 20, &buffer1); + fail_unless (ret == GST_FLOW_OK); + fail_unless (buffer1 != NULL); + fail_unless (gst_buffer_get_size (buffer1) == 10); + gst_buffer_unref (buffer1); + + /* read 0 bytes at end-1 should return 0 bytes */ + ret = gst_pad_get_range (pad, stop - 1, 0, &buffer1); + fail_unless (ret == GST_FLOW_OK); + fail_unless (buffer1 != NULL); + fail_unless (gst_buffer_get_size (buffer1) == 0); + gst_buffer_unref (buffer1); + + /* read 10 bytes at end-1 should return 1 byte */ + ret = gst_pad_get_range (pad, stop - 1, 10, &buffer1); + fail_unless (ret == GST_FLOW_OK); + fail_unless (buffer1 != NULL); + fail_unless (gst_buffer_get_size (buffer1) == 1); + gst_buffer_unref (buffer1); + + /* read 0 bytes at end should EOS */ + ret = gst_pad_get_range (pad, stop, 0, &buffer1); + fail_unless (ret == GST_FLOW_UNEXPECTED); + + /* read 10 bytes before end should EOS */ + ret = gst_pad_get_range (pad, stop, 10, &buffer1); + fail_unless (ret == GST_FLOW_UNEXPECTED); + + /* read 0 bytes after end should EOS */ + ret = gst_pad_get_range (pad, stop + 10, 0, &buffer1); + fail_unless (ret == GST_FLOW_UNEXPECTED); + + /* read 10 bytes after end should EOS too */ + ret = gst_pad_get_range (pad, stop + 10, 10, &buffer1); + fail_unless (ret == GST_FLOW_UNEXPECTED); + + fail_unless (gst_element_set_state (src, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup */ + gst_object_unref (pad); + cleanup_filesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_coverage) +{ + GstElement *src; + gchar *location; + GstBus *bus; + GstMessage *message; + + src = setup_filesrc (); + bus = gst_bus_new (); + + gst_element_set_bus (src, bus); + + g_object_set (G_OBJECT (src), "location", "/i/do/not/exist", NULL); + g_object_get (G_OBJECT (src), "location", &location, NULL); + fail_unless_equals_string (location, "/i/do/not/exist"); + g_free (location); + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE, + "could set to playing with wrong location"); + + /* a state change and an error */ + fail_if ((message = gst_bus_pop (bus)) == NULL); + gst_message_unref (message); + fail_if ((message = gst_bus_pop (bus)) == NULL); + fail_unless_message_error (message, RESOURCE, NOT_FOUND); + gst_message_unref (message); + + g_object_set (G_OBJECT (src), "location", NULL, NULL); + g_object_get (G_OBJECT (src), "location", &location, NULL); + fail_if (location); + + /* cleanup */ + gst_element_set_bus (src, NULL); + gst_object_unref (GST_OBJECT (bus)); + cleanup_filesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_uri_interface) +{ + GstElement *src; + gchar *location; + GstBus *bus; + + src = setup_filesrc (); + bus = gst_bus_new (); + + gst_element_set_bus (src, bus); + + g_object_set (G_OBJECT (src), "location", "/i/do/not/exist", NULL); + g_object_get (G_OBJECT (src), "location", &location, NULL); + fail_unless_equals_string (location, "/i/do/not/exist"); + g_free (location); + + location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (src)); + fail_unless_equals_string (location, "file:///i/do/not/exist"); + + /* should accept file:///foo/bar URIs */ + fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (src), + "file:///foo/bar")); + location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (src)); + fail_unless_equals_string (location, "file:///foo/bar"); + g_object_get (G_OBJECT (src), "location", &location, NULL); + fail_unless_equals_string (location, "/foo/bar"); + g_free (location); + + /* should accept file://localhost/foo/bar URIs */ + fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (src), + "file://localhost/foo/baz")); + location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (src)); + fail_unless_equals_string (location, "file:///foo/baz"); + g_object_get (G_OBJECT (src), "location", &location, NULL); + fail_unless_equals_string (location, "/foo/baz"); + g_free (location); + + /* should escape non-uri characters for the URI but not for the location */ + g_object_set (G_OBJECT (src), "location", "/foo/b?r", NULL); + g_object_get (G_OBJECT (src), "location", &location, NULL); + fail_unless_equals_string (location, "/foo/b?r"); + g_free (location); + location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (src)); + fail_unless_equals_string (location, "file:///foo/b%3Fr"); + + /* should fail with other hostnames */ + fail_if (gst_uri_handler_set_uri (GST_URI_HANDLER (src), + "file://hostname/foo/foo")); + + /* cleanup */ + gst_element_set_bus (src, NULL); + gst_object_unref (GST_OBJECT (bus)); + cleanup_filesrc (src); +} + +GST_END_TEST; + +static void +check_uri_for_uri (GstElement * e, const gchar * in_uri, const gchar * uri) +{ + GstQuery *query; + gchar *query_uri = NULL; + + gst_uri_handler_set_uri (GST_URI_HANDLER (e), in_uri); + + query = gst_query_new_uri (); + fail_unless (gst_element_query (e, query)); + gst_query_parse_uri (query, &query_uri); + gst_query_unref (query); + + if (uri != NULL) { + fail_unless_equals_string (query_uri, uri); + } else { + gchar *fn; + + fail_unless (gst_uri_is_valid (query_uri)); + fn = g_filename_from_uri (query_uri, NULL, NULL); + fail_unless (g_path_is_absolute (fn)); + fail_unless (fn != NULL); + g_free (fn); + } + + g_free (query_uri); +} + +static void +check_uri_for_location (GstElement * e, const gchar * location, + const gchar * uri) +{ + GstQuery *query; + gchar *query_uri = NULL; + + g_object_set (e, "location", location, NULL); + query = gst_query_new_uri (); + fail_unless (gst_element_query (e, query)); + gst_query_parse_uri (query, &query_uri); + gst_query_unref (query); + + if (uri != NULL) { + fail_unless_equals_string (query_uri, uri); + } else { + gchar *fn; + + fail_unless (gst_uri_is_valid (query_uri)); + fn = g_filename_from_uri (query_uri, NULL, NULL); + fail_unless (g_path_is_absolute (fn)); + fail_unless (fn != NULL); + g_free (fn); + } + + g_free (query_uri); +} + +GST_START_TEST (test_uri_query) +{ + GstElement *src; + + src = setup_filesrc (); + +#ifdef G_OS_UNIX + { + GST_INFO ("*nix"); + check_uri_for_location (src, "/i/do/not/exist", "file:///i/do/not/exist"); + check_uri_for_location (src, "/i/do/not/../exist", "file:///i/do/exist"); + check_uri_for_location (src, "/i/do/not/.././exist", "file:///i/do/exist"); + check_uri_for_location (src, "/i/./do/not/../exist", "file:///i/do/exist"); + check_uri_for_location (src, "/i/do/./not/../exist", "file:///i/do/exist"); + check_uri_for_location (src, "/i/do/not/./../exist", "file:///i/do/exist"); + check_uri_for_location (src, "/i/./do/./././././exist", + "file:///i/do/exist"); + check_uri_for_location (src, "/i/do/not/../../exist", "file:///i/exist"); + check_uri_for_location (src, "/i/../not/../exist", "file:///exist"); + /* hard to test relative URIs, just make sure it returns an URI of sorts */ + check_uri_for_location (src, "foo", NULL); + check_uri_for_location (src, "foo/../bar", NULL); + check_uri_for_location (src, "./foo", NULL); + check_uri_for_location (src, "../foo", NULL); + check_uri_for_location (src, "foo/./bar", NULL); + /* make sure non-ASCII characters are escaped properly (U+00F6 here) */ + check_uri_for_location (src, "/i/./d\303\266/not/../exist", + "file:///i/d%C3%B6/exist"); + /* let's see what happens if we set a malformed URI with ISO-8859-1 chars, + * i.e. one that the input characters haven't been escaped properly. We + * should get back a properly escaped URI */ + check_uri_for_uri (src, "file:///M\366t\366r", "file:///M%F6t%F6r"); + } +#endif + + cleanup_filesrc (src); +} + +GST_END_TEST; + +static Suite * +filesrc_suite (void) +{ + Suite *s = suite_create ("filesrc"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_seeking); + tcase_add_test (tc_chain, test_reverse); + tcase_add_test (tc_chain, test_pull); + tcase_add_test (tc_chain, test_coverage); + tcase_add_test (tc_chain, test_uri_interface); + tcase_add_test (tc_chain, test_uri_query); + + return s; +} + +GST_CHECK_MAIN (filesrc); diff --git a/tests/check/elements/funnel.c b/tests/check/elements/funnel.c new file mode 100644 index 0000000..5703dd3 --- /dev/null +++ b/tests/check/elements/funnel.c @@ -0,0 +1,171 @@ +/* GStreamer unit tests for the funnel + * + * Copyright (C) 2008 Collabora, Nokia + * @author: Olivier Crete <olivier.crete@collabora.co.uk> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <gst/check/gstcheck.h> + +struct TestData +{ + GstElement *funnel; + GstPad *funnelsrc, *funnelsink11, *funnelsink22; + GstPad *mysink, *mysrc1, *mysrc2; + GstCaps *mycaps; +}; + +static void +setup_test_objects (struct TestData *td, GstPadChainFunction chain_func) +{ + td->mycaps = gst_caps_new_simple ("test/test", NULL); + + td->funnel = gst_element_factory_make ("funnel", NULL); + + td->funnelsrc = gst_element_get_static_pad (td->funnel, "src"); + fail_unless (td->funnelsrc != NULL); + + td->funnelsink11 = gst_element_get_request_pad (td->funnel, "sink11"); + fail_unless (td->funnelsink11 != NULL); + fail_unless (!strcmp (GST_OBJECT_NAME (td->funnelsink11), "sink11")); + + td->funnelsink22 = gst_element_get_request_pad (td->funnel, "sink22"); + fail_unless (td->funnelsink22 != NULL); + fail_unless (!strcmp (GST_OBJECT_NAME (td->funnelsink22), "sink22")); + + fail_unless (gst_element_set_state (td->funnel, GST_STATE_PLAYING) == + GST_STATE_CHANGE_SUCCESS); + + td->mysink = gst_pad_new ("sink", GST_PAD_SINK); + gst_pad_set_chain_function (td->mysink, chain_func); + gst_pad_set_active (td->mysink, TRUE); + gst_pad_set_caps (td->mysink, td->mycaps); + + td->mysrc1 = gst_pad_new ("src1", GST_PAD_SRC); + gst_pad_set_active (td->mysrc1, TRUE); + gst_pad_set_caps (td->mysrc1, td->mycaps); + + td->mysrc2 = gst_pad_new ("src2", GST_PAD_SRC); + gst_pad_set_active (td->mysrc2, TRUE); + gst_pad_set_caps (td->mysrc2, td->mycaps); + + fail_unless (GST_PAD_LINK_SUCCESSFUL (gst_pad_link (td->funnelsrc, + td->mysink))); + + fail_unless (GST_PAD_LINK_SUCCESSFUL (gst_pad_link (td->mysrc1, + td->funnelsink11))); + + fail_unless (GST_PAD_LINK_SUCCESSFUL (gst_pad_link (td->mysrc2, + td->funnelsink22))); + +} + +static void +release_test_objects (struct TestData *td) +{ + gst_pad_set_active (td->mysink, FALSE); + gst_pad_set_active (td->mysrc1, FALSE); + gst_pad_set_active (td->mysrc1, FALSE); + + gst_object_unref (td->mysink); + gst_object_unref (td->mysrc1); + gst_object_unref (td->mysrc2); + + fail_unless (gst_element_set_state (td->funnel, GST_STATE_NULL) == + GST_STATE_CHANGE_SUCCESS); + + gst_object_unref (td->funnelsrc); + gst_object_unref (td->funnelsink11); + gst_element_release_request_pad (td->funnel, td->funnelsink11); + gst_object_unref (td->funnelsink22); + gst_element_release_request_pad (td->funnel, td->funnelsink22); + + gst_caps_unref (td->mycaps); + gst_object_unref (td->funnel); +} + +static gint bufcount = 0; +static gint alloccount = 0; + +static GstFlowReturn +chain_ok (GstPad * pad, GstBuffer * buffer) +{ + bufcount++; + + gst_buffer_unref (buffer); + + return GST_FLOW_OK; +} + +GST_START_TEST (test_funnel_simple) +{ + struct TestData td; +#if 0 + GstBuffer *buf1 = NULL; + GstBuffer *buf2 = NULL; +#endif + + setup_test_objects (&td, chain_ok); + + bufcount = 0; + alloccount = 0; + + fail_unless (gst_pad_push (td.mysrc1, gst_buffer_new ()) == GST_FLOW_OK); + fail_unless (gst_pad_push (td.mysrc2, gst_buffer_new ()) == GST_FLOW_OK); + + fail_unless (bufcount == 2); + +#if 0 + fail_unless (gst_pad_alloc_buffer (td.mysrc1, 0, 1024, td.mycaps, + &buf1) == GST_FLOW_OK); + fail_unless (gst_pad_alloc_buffer (td.mysrc2, 1024, 1024, td.mycaps, + &buf2) == GST_FLOW_OK); + + fail_unless (alloccount == 2); + + gst_buffer_unref (buf1); + gst_buffer_unref (buf2); +#endif + + release_test_objects (&td); +} + +GST_END_TEST; + +static Suite * +funnel_suite (void) +{ + Suite *s = suite_create ("funnel"); + TCase *tc_chain; + GLogLevelFlags fatal_mask; + + fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); + fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; + g_log_set_always_fatal (fatal_mask); + + tc_chain = tcase_create ("funnel simple"); + tcase_add_test (tc_chain, test_funnel_simple); + suite_add_tcase (s, tc_chain); + + return s; +} + +GST_CHECK_MAIN (funnel); diff --git a/tests/check/elements/identity.c b/tests/check/elements/identity.c new file mode 100644 index 0000000..abf428c --- /dev/null +++ b/tests/check/elements/identity.c @@ -0,0 +1,131 @@ +/* GStreamer + * + * unit test for identity + * + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart 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. + */ + +#include <unistd.h> + +#include <gst/check/gstcheck.h> + +static gboolean have_eos = FALSE; + +/* For ease of programming we use globals to keep refs for our floating + * src and sink pads we create; otherwise we always have to do get_pad, + * get_peer, and then remove references in every test function */ +static GstPad *mysrcpad, *mysinkpad; + + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static gboolean +event_func (GstPad * pad, GstEvent * event) +{ + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + have_eos = TRUE; + gst_event_unref (event); + return TRUE; + } + + gst_event_unref (event); + return FALSE; +} + +static GstElement * +setup_identity (void) +{ + GstElement *identity; + + GST_DEBUG ("setup_identity"); + + identity = gst_check_setup_element ("identity"); + mysrcpad = gst_check_setup_src_pad (identity, &srctemplate, NULL); + mysinkpad = gst_check_setup_sink_pad (identity, &sinktemplate, NULL); + gst_pad_set_event_function (mysinkpad, event_func); + gst_pad_set_active (mysrcpad, TRUE); + gst_pad_set_active (mysinkpad, TRUE); + + return identity; +} + +static void +cleanup_identity (GstElement * identity) +{ + GST_DEBUG ("cleanup_identity"); + + gst_pad_set_active (mysrcpad, FALSE); + gst_pad_set_active (mysinkpad, FALSE); + gst_check_teardown_src_pad (identity); + gst_check_teardown_sink_pad (identity); + gst_check_teardown_element (identity); +} + +GST_START_TEST (test_one_buffer) +{ + GstElement *identity; + GstBuffer *buffer; + gpointer data; + + identity = setup_identity (); + fail_unless (gst_element_set_state (identity, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + buffer = gst_buffer_new_and_alloc (4); + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + + data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE); + memcpy (data, "data", 4); + gst_buffer_unmap (buffer, data, 4); + + /* pushing gives away my reference ... */ + fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK, + "Failed pushing buffer to identity"); + + /* ... but it should end up being collected on the global buffer list */ + fail_unless (g_list_length (buffers) == 1); + fail_unless ((GstBuffer *) (g_list_first (buffers)->data) == buffer); + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + + /* cleanup */ + cleanup_identity (identity); +} + +GST_END_TEST; + +static Suite * +identity_suite (void) +{ + Suite *s = suite_create ("identity"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_one_buffer); + + return s; +} + +GST_CHECK_MAIN (identity); diff --git a/tests/check/elements/multiqueue.c b/tests/check/elements/multiqueue.c new file mode 100644 index 0000000..34a3380 --- /dev/null +++ b/tests/check/elements/multiqueue.c @@ -0,0 +1,727 @@ +/* GStreamer unit tests for multiqueue + * + * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net> + * + * 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 <unistd.h> + +#include <gst/check/gstcheck.h> + +static GStaticMutex _check_lock = G_STATIC_MUTEX_INIT; + +static GstElement * +setup_multiqueue (GstElement * pipe, GstElement * inputs[], + GstElement * outputs[], guint num) +{ + GstElement *mq; + guint i; + + mq = gst_element_factory_make ("multiqueue", NULL); + fail_unless (mq != NULL, "failed to create 'multiqueue' element"); + + gst_bin_add (GST_BIN (pipe), mq); + + for (i = 0; i < num; ++i) { + GstPad *sinkpad = NULL; + GstPad *srcpad = NULL; + + /* create multiqueue sink (and source) pad */ + sinkpad = gst_element_get_request_pad (mq, "sink%d"); + fail_unless (sinkpad != NULL, + "failed to create multiqueue request pad #%u", i); + + /* link input element N to the N-th multiqueue sink pad we just created */ + if (inputs != NULL && inputs[i] != NULL) { + gst_bin_add (GST_BIN (pipe), inputs[i]); + + srcpad = gst_element_get_static_pad (inputs[i], "src"); + fail_unless (srcpad != NULL, "failed to find src pad for input #%u", i); + + fail_unless_equals_int (GST_PAD_LINK_OK, gst_pad_link (srcpad, sinkpad)); + + gst_object_unref (srcpad); + srcpad = NULL; + } + gst_object_unref (sinkpad); + sinkpad = NULL; + + /* link output element N to the N-th multiqueue src pad */ + if (outputs != NULL && outputs[i] != NULL) { + gchar padname[10]; + + /* only the sink pads are by request, the source pads are sometimes pads, + * so this should return NULL */ + srcpad = gst_element_get_request_pad (mq, "src%d"); + fail_unless (srcpad == NULL); + + g_snprintf (padname, sizeof (padname), "src%d", i); + srcpad = gst_element_get_static_pad (mq, padname); + fail_unless (srcpad != NULL, "failed to get multiqueue src pad #%u", i); + fail_unless (GST_PAD_IS_SRC (srcpad), + "%s:%s is not a source pad?!", GST_DEBUG_PAD_NAME (srcpad)); + + gst_bin_add (GST_BIN (pipe), outputs[i]); + + sinkpad = gst_element_get_static_pad (outputs[i], "sink"); + fail_unless (sinkpad != NULL, "failed to find sink pad of output #%u", i); + fail_unless (GST_PAD_IS_SINK (sinkpad)); + + fail_unless_equals_int (GST_PAD_LINK_OK, gst_pad_link (srcpad, sinkpad)); + + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + } + } + + return mq; +} + +GST_START_TEST (test_simple_pipeline) +{ + GstElement *pipe; + GstElement *inputs[1]; + GstElement *outputs[1]; + GstMessage *msg; + + pipe = gst_pipeline_new ("pipeline"); + + inputs[0] = gst_element_factory_make ("fakesrc", NULL); + fail_unless (inputs[0] != NULL, "failed to create 'fakesrc' element"); + g_object_set (inputs[0], "num-buffers", 256, NULL); + + outputs[0] = gst_element_factory_make ("fakesink", NULL); + fail_unless (outputs[0] != NULL, "failed to create 'fakesink' element"); + + setup_multiqueue (pipe, inputs, outputs, 1); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + + msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), + GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + + fail_if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR, + "Expected EOS message, got ERROR message"); + gst_message_unref (msg); + + GST_LOG ("Got EOS, cleaning up"); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); +} + +GST_END_TEST; + +GST_START_TEST (test_simple_shutdown_while_running) +{ + GstElement *pipe; + GstElement *inputs[1]; + GstElement *outputs[1]; + GstMessage *msg; + + pipe = gst_pipeline_new ("pipeline"); + + inputs[0] = gst_element_factory_make ("fakesrc", NULL); + fail_unless (inputs[0] != NULL, "failed to create 'fakesrc' element"); + + outputs[0] = gst_element_factory_make ("fakesink", NULL); + fail_unless (outputs[0] != NULL, "failed to create 'fakesink' element"); + + setup_multiqueue (pipe, inputs, outputs, 1); + + gst_element_set_state (pipe, GST_STATE_PAUSED); + + /* wait until pipeline is up and running */ + msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), + GST_MESSAGE_ERROR | GST_MESSAGE_ASYNC_DONE, -1); + fail_if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR, "Got ERROR message"); + gst_message_unref (msg); + + GST_LOG ("pipeline is running now"); + gst_element_set_state (pipe, GST_STATE_PAUSED); + + /* wait a bit to accumulate some buffers in the queue (while it's blocking + * in the sink) */ + msg = + gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, GST_SECOND / 4); + if (msg) + g_error ("Got ERROR message"); + + /* now shut down only the sink, so the queue gets a wrong-state flow return */ + gst_element_set_state (outputs[0], GST_STATE_NULL); + msg = + gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, GST_SECOND / 2); + if (msg) + g_error ("Got ERROR message"); + + GST_LOG ("Cleaning up"); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); +} + +GST_END_TEST; + +GST_START_TEST (test_simple_create_destroy) +{ + GstElement *mq; + + mq = gst_element_factory_make ("multiqueue", NULL); + gst_object_unref (mq); +} + +GST_END_TEST; + +GST_START_TEST (test_request_pads) +{ + GstElement *mq; + GstPad *sink1, *sink2; + + mq = gst_element_factory_make ("multiqueue", NULL); + + sink1 = gst_element_get_request_pad (mq, "foo%d"); + fail_unless (sink1 == NULL, + "Expected NULL pad, as there is no request pad template for 'foo%%d'"); + + sink1 = gst_element_get_request_pad (mq, "src%d"); + fail_unless (sink1 == NULL, + "Expected NULL pad, as there is no request pad template for 'src%%d'"); + + sink1 = gst_element_get_request_pad (mq, "sink%d"); + fail_unless (sink1 != NULL); + fail_unless (GST_IS_PAD (sink1)); + fail_unless (GST_PAD_IS_SINK (sink1)); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink1)); + + sink2 = gst_element_get_request_pad (mq, "sink%d"); + fail_unless (sink2 != NULL); + fail_unless (GST_IS_PAD (sink2)); + fail_unless (GST_PAD_IS_SINK (sink2)); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink2)); + + fail_unless (sink1 != sink2); + + GST_LOG ("Cleaning up"); + gst_object_unref (sink1); + gst_object_unref (sink2); + gst_object_unref (mq); +} + +GST_END_TEST; + +static GstPad * +mq_sinkpad_to_srcpad (GstElement * mq, GstPad * sink) +{ + GstPad *srcpad = NULL; + + gchar *mq_sinkpad_name; + gchar *mq_srcpad_name; + + mq_sinkpad_name = gst_pad_get_name (sink); + fail_unless (g_str_has_prefix (mq_sinkpad_name, "sink")); + mq_srcpad_name = g_strdup_printf ("src%s", mq_sinkpad_name + 4); + srcpad = gst_element_get_static_pad (mq, mq_srcpad_name); + fail_unless (srcpad != NULL); + + g_free (mq_sinkpad_name); + g_free (mq_srcpad_name); + + return srcpad; +} + +GST_START_TEST (test_request_pads_named) +{ + GstElement *mq; + GstPad *sink1, *sink2, *sink3, *sink4; + + mq = gst_element_factory_make ("multiqueue", NULL); + + sink1 = gst_element_get_request_pad (mq, "sink1"); + fail_unless (sink1 != NULL); + fail_unless (GST_IS_PAD (sink1)); + fail_unless (GST_PAD_IS_SINK (sink1)); + fail_unless_equals_string (GST_PAD_NAME (sink1), "sink1"); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink1)); + + sink3 = gst_element_get_request_pad (mq, "sink3"); + fail_unless (sink3 != NULL); + fail_unless (GST_IS_PAD (sink3)); + fail_unless (GST_PAD_IS_SINK (sink3)); + fail_unless_equals_string (GST_PAD_NAME (sink3), "sink3"); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink3)); + + sink2 = gst_element_get_request_pad (mq, "sink2"); + fail_unless (sink2 != NULL); + fail_unless (GST_IS_PAD (sink2)); + fail_unless (GST_PAD_IS_SINK (sink2)); + fail_unless_equals_string (GST_PAD_NAME (sink2), "sink2"); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink2)); + + /* This gets us the first unused id, sink0 */ + sink4 = gst_element_get_request_pad (mq, "sink%d"); + fail_unless (sink4 != NULL); + fail_unless (GST_IS_PAD (sink4)); + fail_unless (GST_PAD_IS_SINK (sink4)); + fail_unless_equals_string (GST_PAD_NAME (sink4), "sink0"); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink4)); + + GST_LOG ("Cleaning up"); + gst_object_unref (sink1); + gst_object_unref (sink2); + gst_object_unref (sink3); + gst_object_unref (sink4); + gst_object_unref (mq); +} + +GST_END_TEST; + +static GstCaps * +mq_dummypad_getcaps (GstPad * sinkpad, GstCaps * filter) +{ + return (filter ? gst_caps_ref (filter) : gst_caps_new_any ()); +} + +struct PadData +{ + guint8 pad_num; + guint32 *max_linked_id_ptr; + guint32 *eos_count_ptr; + gboolean is_linked; + gboolean first_buf; + gint n_linked; + + GMutex *mutex; + GCond *cond; +}; + +static GstFlowReturn +mq_dummypad_chain (GstPad * sinkpad, GstBuffer * buf) +{ + guint32 cur_id; + struct PadData *pad_data; + guint8 *data; + gsize size; + + pad_data = gst_pad_get_element_private (sinkpad); + + g_static_mutex_lock (&_check_lock); + fail_if (pad_data == NULL); + /* Read an ID from the first 4 bytes of the buffer data and check it's + * what we expect */ + data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ); + fail_unless (size >= 4); + g_static_mutex_unlock (&_check_lock); + cur_id = GST_READ_UINT32_BE (data); + gst_buffer_unmap (buf, data, size); + + g_mutex_lock (pad_data->mutex); + + /* For not-linked pads, ensure that we're not running ahead of the 'linked' + * pads. The first buffer is allowed to get ahead, because otherwise things can't + * always pre-roll correctly */ + if (!pad_data->is_linked) { + /* If there are no linked pads, we can't track a max_id for them :) */ + if (pad_data->n_linked > 0 && !pad_data->first_buf) { + g_static_mutex_lock (&_check_lock); + fail_unless (cur_id <= *(pad_data->max_linked_id_ptr) + 1, + "Got buffer %u on pad %u before buffer %u was seen on a " + "linked pad (max: %u)", cur_id, pad_data->pad_num, cur_id - 1, + *(pad_data->max_linked_id_ptr)); + g_static_mutex_unlock (&_check_lock); + } + } else { + /* Update the max_id value */ + if (cur_id > *(pad_data->max_linked_id_ptr)) + *(pad_data->max_linked_id_ptr) = cur_id; + } + pad_data->first_buf = FALSE; + + g_mutex_unlock (pad_data->mutex); + + /* Unref the buffer */ + gst_buffer_unref (buf); + + /* Return OK or not-linked as indicated */ + return pad_data->is_linked ? GST_FLOW_OK : GST_FLOW_NOT_LINKED; +} + +static gboolean +mq_dummypad_event (GstPad * sinkpad, GstEvent * event) +{ + struct PadData *pad_data; + + pad_data = gst_pad_get_element_private (sinkpad); + g_static_mutex_lock (&_check_lock); + fail_if (pad_data == NULL); + g_static_mutex_unlock (&_check_lock); + + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + g_mutex_lock (pad_data->mutex); + + /* Accumulate that we've seen the EOS and signal the main thread */ + *(pad_data->eos_count_ptr) += 1; + + GST_DEBUG ("EOS on pad %u", pad_data->pad_num); + + g_cond_broadcast (pad_data->cond); + g_mutex_unlock (pad_data->mutex); + } + + gst_event_unref (event); + return TRUE; +} + +static void +run_output_order_test (gint n_linked) +{ + /* This test creates a multiqueue with 2 linked output, and 3 outputs that + * return 'not-linked' when data is pushed, then verifies that all buffers + * are received on not-linked pads only after earlier buffers on the + * 'linked' pads are made */ + GstElement *pipe; + GstElement *mq; + GstPad *inputpads[5]; + GstPad *sinkpads[5]; + struct PadData pad_data[5]; + guint32 max_linked_id; + guint32 eos_seen; + GMutex *mutex; + GCond *cond; + gint i; + const gint NPADS = 5; + const gint NBUFFERS = 1000; + + mutex = g_mutex_new (); + cond = g_cond_new (); + + pipe = gst_bin_new ("testbin"); + + mq = gst_element_factory_make ("multiqueue", NULL); + fail_unless (mq != NULL); + gst_bin_add (GST_BIN (pipe), mq); + + /* No limits */ + g_object_set (mq, + "max-size-bytes", (guint) 0, + "max-size-buffers", (guint) 0, + "max-size-time", (guint64) 0, + "extra-size-bytes", (guint) 0, + "extra-size-buffers", (guint) 0, "extra-size-time", (guint64) 0, NULL); + + /* Construct NPADS dummy output pads. The first 'n_linked' return FLOW_OK, the rest + * return NOT_LINKED. The not-linked ones check the expected ordering of + * output buffers */ + for (i = 0; i < NPADS; i++) { + GstPad *mq_srcpad, *mq_sinkpad; + gchar *name; + + name = g_strdup_printf ("dummysrc%d", i); + inputpads[i] = gst_pad_new (name, GST_PAD_SRC); + g_free (name); + gst_pad_set_getcaps_function (inputpads[i], mq_dummypad_getcaps); + + mq_sinkpad = gst_element_get_request_pad (mq, "sink%d"); + fail_unless (mq_sinkpad != NULL); + gst_pad_link (inputpads[i], mq_sinkpad); + + gst_pad_set_active (inputpads[i], TRUE); + + mq_srcpad = mq_sinkpad_to_srcpad (mq, mq_sinkpad); + + name = g_strdup_printf ("dummysink%d", i); + sinkpads[i] = gst_pad_new (name, GST_PAD_SINK); + g_free (name); + gst_pad_set_chain_function (sinkpads[i], mq_dummypad_chain); + gst_pad_set_event_function (sinkpads[i], mq_dummypad_event); + gst_pad_set_getcaps_function (sinkpads[i], mq_dummypad_getcaps); + + pad_data[i].pad_num = i; + pad_data[i].max_linked_id_ptr = &max_linked_id; + pad_data[i].eos_count_ptr = &eos_seen; + pad_data[i].is_linked = (i < n_linked ? TRUE : FALSE); + pad_data[i].n_linked = n_linked; + pad_data[i].cond = cond; + pad_data[i].mutex = mutex; + pad_data[i].first_buf = TRUE; + gst_pad_set_element_private (sinkpads[i], pad_data + i); + + gst_pad_link (mq_srcpad, sinkpads[i]); + gst_pad_set_active (sinkpads[i], TRUE); + + gst_object_unref (mq_sinkpad); + gst_object_unref (mq_srcpad); + } + + /* Run the test. Push 1000 buffers through the multiqueue in a pattern */ + + max_linked_id = 0; + eos_seen = 0; + gst_element_set_state (pipe, GST_STATE_PLAYING); + + for (i = 0; i < NBUFFERS; i++) { + const guint8 pad_pattern[] = + { 0, 0, 0, 0, 1, 1, 2, 1, 0, 2, 3, 2, 3, 1, 4 }; + const guint n = sizeof (pad_pattern) / sizeof (guint8); + guint8 cur_pad; + GstBuffer *buf; + GstFlowReturn ret; + gpointer data; + + cur_pad = pad_pattern[i % n]; + + buf = gst_buffer_new_and_alloc (4); + g_static_mutex_lock (&_check_lock); + fail_if (buf == NULL); + g_static_mutex_unlock (&_check_lock); + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + GST_WRITE_UINT32_BE (data, i + 1); + gst_buffer_unmap (buf, data, 4); + GST_BUFFER_TIMESTAMP (buf) = (i + 1) * GST_SECOND; + + ret = gst_pad_push (inputpads[cur_pad], buf); + g_static_mutex_lock (&_check_lock); + if (pad_data[cur_pad].is_linked) { + fail_unless (ret == GST_FLOW_OK, + "Push on pad %d returned %d when FLOW_OK was expected", cur_pad, ret); + } else { + /* Expect OK initially, then NOT_LINKED when the srcpad starts pushing */ + fail_unless (ret == GST_FLOW_OK || ret == GST_FLOW_NOT_LINKED, + "Push on pad %d returned %d when FLOW_OK or NOT_LINKED was expected", + cur_pad, ret); + } + g_static_mutex_unlock (&_check_lock); + } + for (i = 0; i < NPADS; i++) { + gst_pad_push_event (inputpads[i], gst_event_new_eos ()); + } + + /* Wait while the buffers are processed */ + g_mutex_lock (mutex); + /* We wait until EOS has been pushed on all linked pads */ + while (eos_seen < n_linked) { + g_cond_wait (cond, mutex); + } + g_mutex_unlock (mutex); + + /* Clean up */ + for (i = 0; i < NPADS; i++) { + GstPad *mq_input = gst_pad_get_peer (inputpads[i]); + + gst_pad_unlink (inputpads[i], mq_input); + gst_element_release_request_pad (mq, mq_input); + gst_object_unref (mq_input); + gst_object_unref (inputpads[i]); + + gst_object_unref (sinkpads[i]); + } + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); + + g_cond_free (cond); + g_mutex_free (mutex); +} + +GST_START_TEST (test_output_order) +{ + run_output_order_test (2); + run_output_order_test (0); +} + +GST_END_TEST; + +GST_START_TEST (test_sparse_stream) +{ + /* This test creates a multiqueue with 2 streams. One receives + * a constant flow of buffers, the other only gets one buffer, and then + * new-segment events, and returns not-linked. The multiqueue should not fill. + */ + GstElement *pipe; + GstElement *mq; + GstPad *inputpads[2]; + GstPad *sinkpads[2]; + GstEvent *event; + struct PadData pad_data[2]; + guint32 eos_seen, max_linked_id; + GMutex *mutex; + GCond *cond; + gint i; + const gint NBUFFERS = 100; + GstSegment segment; + + mutex = g_mutex_new (); + cond = g_cond_new (); + + pipe = gst_pipeline_new ("testbin"); + mq = gst_element_factory_make ("multiqueue", NULL); + fail_unless (mq != NULL); + gst_bin_add (GST_BIN (pipe), mq); + + /* 1 second limit */ + g_object_set (mq, + "max-size-bytes", (guint) 0, + "max-size-buffers", (guint) 0, + "max-size-time", (guint64) GST_SECOND, + "extra-size-bytes", (guint) 0, + "extra-size-buffers", (guint) 0, "extra-size-time", (guint64) 0, NULL); + + /* Construct 2 dummy output pads. */ + for (i = 0; i < 2; i++) { + GstPad *mq_srcpad, *mq_sinkpad; + gchar *name; + + name = g_strdup_printf ("dummysrc%d", i); + inputpads[i] = gst_pad_new (name, GST_PAD_SRC); + g_free (name); + gst_pad_set_getcaps_function (inputpads[i], mq_dummypad_getcaps); + + mq_sinkpad = gst_element_get_request_pad (mq, "sink%d"); + fail_unless (mq_sinkpad != NULL); + gst_pad_link (inputpads[i], mq_sinkpad); + + gst_pad_set_active (inputpads[i], TRUE); + + mq_srcpad = mq_sinkpad_to_srcpad (mq, mq_sinkpad); + + name = g_strdup_printf ("dummysink%d", i); + sinkpads[i] = gst_pad_new (name, GST_PAD_SINK); + g_free (name); + gst_pad_set_chain_function (sinkpads[i], mq_dummypad_chain); + gst_pad_set_event_function (sinkpads[i], mq_dummypad_event); + gst_pad_set_getcaps_function (sinkpads[i], mq_dummypad_getcaps); + + pad_data[i].pad_num = i; + pad_data[i].max_linked_id_ptr = &max_linked_id; + pad_data[i].eos_count_ptr = &eos_seen; + pad_data[i].is_linked = (i == 0) ? TRUE : FALSE; + pad_data[i].n_linked = 1; + pad_data[i].cond = cond; + pad_data[i].mutex = mutex; + pad_data[i].first_buf = TRUE; + gst_pad_set_element_private (sinkpads[i], pad_data + i); + + gst_pad_link (mq_srcpad, sinkpads[i]); + gst_pad_set_active (sinkpads[i], TRUE); + + gst_object_unref (mq_sinkpad); + gst_object_unref (mq_srcpad); + } + + /* Run the test. Push 100 buffers through the multiqueue */ + max_linked_id = 0; + eos_seen = 0; + + gst_element_set_state (pipe, GST_STATE_PLAYING); + + /* Push 2 new segment events */ + gst_segment_init (&segment, GST_FORMAT_TIME); + event = gst_event_new_segment (&segment); + gst_pad_push_event (inputpads[0], gst_event_ref (event)); + gst_pad_push_event (inputpads[1], event); + + for (i = 0; i < NBUFFERS; i++) { + GstBuffer *buf; + GstFlowReturn ret; + GstClockTime ts; + gpointer data; + + ts = gst_util_uint64_scale_int (GST_SECOND, i, 10); + + buf = gst_buffer_new_and_alloc (4); + g_static_mutex_lock (&_check_lock); + fail_if (buf == NULL); + g_static_mutex_unlock (&_check_lock); + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + GST_WRITE_UINT32_BE (data, i + 1); + gst_buffer_unmap (buf, data, 4); + + GST_BUFFER_TIMESTAMP (buf) = gst_util_uint64_scale_int (GST_SECOND, i, 10); + + /* If i == 0, also push the buffer to the 2nd pad */ + if (i == 0) + ret = gst_pad_push (inputpads[1], gst_buffer_ref (buf)); + + ret = gst_pad_push (inputpads[0], buf); + g_static_mutex_lock (&_check_lock); + fail_unless (ret == GST_FLOW_OK, + "Push on pad %d returned %d when FLOW_OK was expected", 0, ret); + g_static_mutex_unlock (&_check_lock); + + /* Push a new segment update on the 2nd pad */ + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = ts; + segment.time = ts; + event = gst_event_new_segment (&segment); + gst_pad_push_event (inputpads[1], event); + } + + event = gst_event_new_eos (); + gst_pad_push_event (inputpads[0], gst_event_ref (event)); + gst_pad_push_event (inputpads[1], event); + + /* Wait while the buffers are processed */ + g_mutex_lock (mutex); + /* We wait until EOS has been pushed on all pads */ + while (eos_seen < 2) { + g_cond_wait (cond, mutex); + } + g_mutex_unlock (mutex); + + /* Clean up */ + for (i = 0; i < 2; i++) { + GstPad *mq_input = gst_pad_get_peer (inputpads[i]); + + gst_pad_unlink (inputpads[i], mq_input); + gst_element_release_request_pad (mq, mq_input); + gst_object_unref (mq_input); + gst_object_unref (inputpads[i]); + + gst_object_unref (sinkpads[i]); + } + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); + + g_cond_free (cond); + g_mutex_free (mutex); +} + +GST_END_TEST; + +static Suite * +multiqueue_suite (void) +{ + Suite *s = suite_create ("multiqueue"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_simple_create_destroy); + tcase_add_test (tc_chain, test_simple_pipeline); + tcase_add_test (tc_chain, test_simple_shutdown_while_running); + + tcase_add_test (tc_chain, test_request_pads); + tcase_add_test (tc_chain, test_request_pads_named); + + tcase_add_test (tc_chain, test_output_order); + + tcase_add_test (tc_chain, test_sparse_stream); + return s; +} + +GST_CHECK_MAIN (multiqueue) diff --git a/tests/check/elements/queue.c b/tests/check/elements/queue.c new file mode 100644 index 0000000..7ccfec7 --- /dev/null +++ b/tests/check/elements/queue.c @@ -0,0 +1,726 @@ +/* GStreamer + * + * unit test for queue + * + * Copyright (C) <2006> Stefan Kost <ensonic@users.sf.net> + * + * 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 <unistd.h> + +#include <gst/check/gstcheck.h> + +#define UNDERRUN_LOCK() (g_mutex_lock (underrun_mutex)) +#define UNDERRUN_UNLOCK() (g_mutex_unlock (underrun_mutex)) +#define UNDERRUN_SIGNAL() (g_cond_signal (underrun_cond)) +#define UNDERRUN_WAIT() (g_cond_wait (underrun_cond, underrun_mutex)) + +static GstElement *queue; + +/* For ease of programming we use globals to keep refs for our floating + * src and sink pads we create; otherwise we always have to do get_pad, + * get_peer, and then remove references in every test function */ +static GstPad *mysrcpad; +static GstPad *mysinkpad; + +static gint overrun_count; + +static GMutex *underrun_mutex; +static GCond *underrun_cond; +static gint underrun_count; + +static GList *events; + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static void +queue_overrun (GstElement * queue, gpointer user_data) +{ + GST_DEBUG ("queue overrun"); + overrun_count++; +} + +static void +queue_underrun (GstElement * queue, gpointer user_data) +{ + GST_DEBUG ("queue underrun"); + UNDERRUN_LOCK (); + underrun_count++; + UNDERRUN_SIGNAL (); + UNDERRUN_UNLOCK (); +} + +static gboolean +event_func (GstPad * pad, GstEvent * event) +{ + GST_DEBUG ("%s event", gst_event_type_get_name (GST_EVENT_TYPE (event))); + events = g_list_append (events, event); + + return TRUE; +} + +static void +drop_events (void) +{ + while (events != NULL) { + gst_event_unref (GST_EVENT (events->data)); + events = g_list_delete_link (events, events); + } +} + +static void +setup (void) +{ + GST_DEBUG ("setup_queue"); + + queue = gst_check_setup_element ("queue"); + g_signal_connect (queue, "underrun", G_CALLBACK (queue_underrun), NULL); + + mysrcpad = gst_check_setup_src_pad (queue, &srctemplate, NULL); + gst_pad_set_active (mysrcpad, TRUE); + + mysinkpad = NULL; + + overrun_count = 0; + + underrun_mutex = g_mutex_new (); + underrun_cond = g_cond_new (); + underrun_count = 0; + + events = NULL; +} + +static void +cleanup (void) +{ + GST_DEBUG ("cleanup_queue"); + + gst_check_drop_buffers (); + + drop_events (); + + g_cond_free (underrun_cond); + underrun_cond = NULL; + g_mutex_free (underrun_mutex); + underrun_mutex = NULL; + + if (mysinkpad != NULL) { + gst_pad_set_active (mysinkpad, FALSE); + gst_check_teardown_sink_pad (queue); + } + + gst_pad_set_active (mysrcpad, FALSE); + gst_check_teardown_src_pad (queue); + + gst_check_teardown_element (queue); + queue = NULL; +} + +/* setup the sinkpad on a playing queue element. gst_check_setup_sink_pad() + * does not work in this case since it does not activate the pad before linking + * it. */ +static GstPad * +setup_sink_pad (GstElement * element, GstStaticPadTemplate * tmpl) +{ + GstPad *srcpad; + GstPad *sinkpad; + + sinkpad = gst_pad_new_from_static_template (tmpl, "sink"); + fail_if (sinkpad == NULL); + srcpad = gst_element_get_static_pad (element, "src"); + fail_if (srcpad == NULL); + gst_pad_set_chain_function (sinkpad, gst_check_chain_func); + gst_pad_set_event_function (sinkpad, event_func); + gst_pad_set_active (sinkpad, TRUE); + fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK); + gst_object_unref (srcpad); + + return sinkpad; +} + +/* set queue size to 2 buffers + * pull 1 buffer + * check over/underuns + */ +GST_START_TEST (test_non_leaky_underrun) +{ + g_signal_connect (queue, "overrun", G_CALLBACK (queue_overrun), NULL); + g_object_set (G_OBJECT (queue), "max-size-buffers", 2, NULL); + mysinkpad = gst_check_setup_sink_pad (queue, &sinktemplate, NULL); + gst_pad_set_active (mysinkpad, TRUE); + + GST_DEBUG ("starting"); + + UNDERRUN_LOCK (); + fail_unless (gst_element_set_state (queue, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + UNDERRUN_WAIT (); + UNDERRUN_UNLOCK (); + + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 1); + + GST_DEBUG ("stopping"); + fail_unless (gst_element_set_state (queue, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); +} + +GST_END_TEST; + +static void +queue_overrun_link_and_activate (GstElement * queue, gpointer user_data) +{ + GST_DEBUG ("queue overrun"); + overrun_count++; + + /* link the src pad of the queue to make it dequeue buffers */ + mysinkpad = setup_sink_pad (queue, &sinktemplate); +} + +/* set queue size to 2 buffers + * push 2 buffers + * check over/underuns + * push 1 more buffer + * check over/underuns again + */ +GST_START_TEST (test_non_leaky_overrun) +{ + GstBuffer *buffer1; + GstBuffer *buffer2; + GstBuffer *buffer3; + GstBuffer *buffer; + + g_signal_connect (queue, "overrun", + G_CALLBACK (queue_overrun_link_and_activate), NULL); + g_object_set (G_OBJECT (queue), "max-size-buffers", 2, NULL); + + GST_DEBUG ("starting"); + + fail_unless (gst_element_set_state (queue, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer1 = gst_buffer_new_and_alloc (4); + /* pushing gives away my reference */ + gst_pad_push (mysrcpad, buffer1); + + GST_DEBUG ("added 1st"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer2 = gst_buffer_new_and_alloc (4); + gst_pad_push (mysrcpad, buffer2); + + GST_DEBUG ("added 2nd"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer3 = gst_buffer_new_and_alloc (4); + /* lock the check_mutex to block the first buffer pushed to mysinkpad */ + g_mutex_lock (check_mutex); + /* the next call to gst_pad_push will emit the overrun signal. The signal + * handler queue_overrun_link_and_activate() (above) increases overrun_count, + * activates and links mysinkpad. The queue task then dequeues a buffer and + * gst_pad_push() will return. */ + gst_pad_push (mysrcpad, buffer3); + + GST_DEBUG ("added 3rd"); + fail_unless (overrun_count == 1); + fail_unless (underrun_count == 0); + + /* now let the queue push all buffers */ + while (g_list_length (buffers) < 3) { + g_cond_wait (check_cond, check_mutex); + } + g_mutex_unlock (check_mutex); + + fail_unless (overrun_count == 1); + /* make sure we get the underrun signal before we check underrun_count */ + UNDERRUN_LOCK (); + while (underrun_count < 1) { + UNDERRUN_WAIT (); + } + UNDERRUN_UNLOCK (); + fail_unless (underrun_count == 1); + + buffer = g_list_nth (buffers, 0)->data; + fail_unless (buffer == buffer1); + + buffer = g_list_nth (buffers, 1)->data; + fail_unless (buffer == buffer2); + + buffer = g_list_nth (buffers, 2)->data; + fail_unless (buffer == buffer3); + + GST_DEBUG ("stopping"); + fail_unless (gst_element_set_state (queue, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); +} + +GST_END_TEST; + +/* set queue size to 2 buffers + * push 2 buffers + * check over/underuns + * push 1 more buffer + * check over/underuns again + * check which buffer was leaked + */ +GST_START_TEST (test_leaky_upstream) +{ + GstBuffer *buffer1; + GstBuffer *buffer2; + GstBuffer *buffer3; + GstBuffer *buffer; + + g_signal_connect (queue, "overrun", G_CALLBACK (queue_overrun), NULL); + g_object_set (G_OBJECT (queue), "max-size-buffers", 2, "leaky", 1, NULL); + + GST_DEBUG ("starting"); + + fail_unless (gst_element_set_state (queue, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer1 = gst_buffer_new_and_alloc (4); + /* pushing gives away my reference */ + gst_pad_push (mysrcpad, buffer1); + + GST_DEBUG ("added 1st"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer2 = gst_buffer_new_and_alloc (4); + gst_pad_push (mysrcpad, buffer2); + + GST_DEBUG ("added 2nd"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer3 = gst_buffer_new_and_alloc (4); + /* buffer3 will be leaked, keep a ref so refcount can be checked below */ + gst_buffer_ref (buffer3); + gst_pad_push (mysrcpad, buffer3); + + GST_DEBUG ("added 3rd"); + /* it still triggers overrun when leaking */ + fail_unless (overrun_count == 1); + fail_unless (underrun_count == 0); + + /* wait for underrun and check that we got buffer1 and buffer2 only */ + UNDERRUN_LOCK (); + mysinkpad = setup_sink_pad (queue, &sinktemplate); + UNDERRUN_WAIT (); + UNDERRUN_UNLOCK (); + + fail_unless (overrun_count == 1); + fail_unless (underrun_count == 1); + + fail_unless (g_list_length (buffers) == 2); + + buffer = g_list_nth (buffers, 0)->data; + fail_unless (buffer == buffer1); + + buffer = g_list_nth (buffers, 1)->data; + fail_unless (buffer == buffer2); + + ASSERT_BUFFER_REFCOUNT (buffer3, "buffer", 1); + gst_buffer_unref (buffer3); + + GST_DEBUG ("stopping"); + fail_unless (gst_element_set_state (queue, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); +} + +GST_END_TEST; + +/* set queue size to 2 buffers + * push 2 buffers + * check over/underuns + * push 1 more buffer + * check over/underuns again + * check which buffer was leaked + */ +GST_START_TEST (test_leaky_downstream) +{ + GstBuffer *buffer1; + GstBuffer *buffer2; + GstBuffer *buffer3; + GstBuffer *buffer; + + g_signal_connect (queue, "overrun", G_CALLBACK (queue_overrun), NULL); + g_object_set (G_OBJECT (queue), "max-size-buffers", 2, "leaky", 2, NULL); + + GST_DEBUG ("starting"); + + fail_unless (gst_element_set_state (queue, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer1 = gst_buffer_new_and_alloc (4); + /* buffer1 will be leaked, keep a ref so refcount can be checked below */ + gst_buffer_ref (buffer1); + /* pushing gives away one reference */ + gst_pad_push (mysrcpad, buffer1); + + GST_DEBUG ("added 1st"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer2 = gst_buffer_new_and_alloc (4); + gst_pad_push (mysrcpad, buffer2); + + GST_DEBUG ("added 2nd"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer3 = gst_buffer_new_and_alloc (4); + gst_pad_push (mysrcpad, buffer3); + + GST_DEBUG ("added 3rd"); + /* it still triggers overrun when leaking */ + fail_unless (overrun_count == 1); + fail_unless (underrun_count == 0); + + /* wait for underrun and check that we got buffer1 and buffer2 only */ + UNDERRUN_LOCK (); + mysinkpad = setup_sink_pad (queue, &sinktemplate); + UNDERRUN_WAIT (); + UNDERRUN_UNLOCK (); + + fail_unless (overrun_count == 1); + fail_unless (underrun_count == 1); + + fail_unless (g_list_length (buffers) == 2); + + ASSERT_BUFFER_REFCOUNT (buffer1, "buffer", 1); + gst_buffer_unref (buffer1); + + buffer = g_list_nth (buffers, 0)->data; + fail_unless (buffer == buffer2); + + buffer = g_list_nth (buffers, 1)->data; + fail_unless (buffer == buffer3); + + GST_DEBUG ("stopping"); + fail_unless (gst_element_set_state (queue, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); +} + +GST_END_TEST; + +/* set queue size to 6 buffers and 7 seconds + * push 7 buffers with and without duration + * check current-level-time + */ +GST_START_TEST (test_time_level) +{ + GstBuffer *buffer = NULL; + GstClockTime time; + + g_signal_connect (queue, "overrun", + G_CALLBACK (queue_overrun_link_and_activate), NULL); + g_object_set (G_OBJECT (queue), "max-size-buffers", 6, NULL); + g_object_set (G_OBJECT (queue), "max-size-time", 7 * GST_SECOND, NULL); + + GST_DEBUG ("starting"); + + fail_unless (gst_element_set_state (queue, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + /* push buffer without duration */ + buffer = gst_buffer_new_and_alloc (4); + GST_BUFFER_TIMESTAMP (buffer) = GST_SECOND; + /* pushing gives away my reference */ + gst_pad_push (mysrcpad, buffer); + + /* level should be 1 seconds because buffer has no duration and starts at 1 + * SECOND (sparse stream). */ + g_object_get (G_OBJECT (queue), "current-level-time", &time, NULL); + fail_if (time != GST_SECOND); + + /* second push should set the level to 2 second */ + buffer = gst_buffer_new_and_alloc (4); + GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND; + gst_pad_push (mysrcpad, buffer); + + g_object_get (G_OBJECT (queue), "current-level-time", &time, NULL); + fail_if (time != 2 * GST_SECOND); + + /* third push should set the level to 4 seconds, the 1 second diff with the + * previous buffer (without duration) and the 1 second duration of this + * buffer. */ + buffer = gst_buffer_new_and_alloc (4); + GST_BUFFER_TIMESTAMP (buffer) = 3 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + gst_pad_push (mysrcpad, buffer); + + g_object_get (G_OBJECT (queue), "current-level-time", &time, NULL); + fail_if (time != 4 * GST_SECOND); + + /* fourth push should set the level to 6 seconds, the 2 second diff with the + * previous buffer, same duration. */ + buffer = gst_buffer_new_and_alloc (4); + GST_BUFFER_TIMESTAMP (buffer) = 5 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + gst_pad_push (mysrcpad, buffer); + + g_object_get (G_OBJECT (queue), "current-level-time", &time, NULL); + fail_if (time != 6 * GST_SECOND); + + /* fifth push should not adjust the level, the timestamp and duration are the + * same, meaning the previous buffer did not really have a duration. */ + buffer = gst_buffer_new_and_alloc (4); + GST_BUFFER_TIMESTAMP (buffer) = 5 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; + gst_pad_push (mysrcpad, buffer); + + g_object_get (G_OBJECT (queue), "current-level-time", &time, NULL); + fail_if (time != 6 * GST_SECOND); + + /* sixth push should adjust the level with 1 second, we now know the + * previous buffer actually had a duration of 2 SECONDS */ + buffer = gst_buffer_new_and_alloc (4); + GST_BUFFER_TIMESTAMP (buffer) = 7 * GST_SECOND; + gst_pad_push (mysrcpad, buffer); + + g_object_get (G_OBJECT (queue), "current-level-time", &time, NULL); + fail_if (time != 7 * GST_SECOND); + + /* eighth push should cause overrun */ + fail_unless (overrun_count == 0); + buffer = gst_buffer_new_and_alloc (4); + GST_BUFFER_TIMESTAMP (buffer) = 8 * GST_SECOND; + /* the next call to gst_pad_push will emit the overrun signal. The signal + * handler queue_overrun_link_and_activate() (above) increases overrun_count, + * activates and links mysinkpad. The queue task then dequeues a buffer and + * gst_pad_push() will return. */ + gst_pad_push (mysrcpad, buffer); + + fail_unless (overrun_count == 1); + + GST_DEBUG ("stopping"); + fail_unless (gst_element_set_state (queue, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); +} + +GST_END_TEST; + +GST_START_TEST (test_time_level_task_not_started) +{ + GstEvent *event; + GstClockTime time; + GstSegment segment; + + GST_DEBUG ("starting"); + + fail_unless (gst_element_set_state (queue, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.start = 1 * GST_SECOND; + segment.stop = 5 * GST_SECOND; + segment.time = 0; + segment.position = 1 * GST_SECOND; + + event = gst_event_new_segment (&segment); + gst_pad_push_event (mysrcpad, event); + + g_object_get (G_OBJECT (queue), "current-level-time", &time, NULL); + fail_if (time != 0 * GST_SECOND); + + segment.base = 4 * GST_SECOND; + event = gst_event_new_segment (&segment); + gst_pad_push_event (mysrcpad, event); + + g_object_get (G_OBJECT (queue), "current-level-time", &time, NULL); + GST_DEBUG ("time now %" GST_TIME_FORMAT, GST_TIME_ARGS (time)); + fail_if (time != 4 * GST_SECOND); + + GST_DEBUG ("stopping"); + fail_unless (gst_element_set_state (queue, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); +} + +GST_END_TEST; + +#if 0 +static gboolean +event_equals_newsegment (GstEvent * event, gboolean update, gdouble rate, + GstFormat format, gint64 start, gint64 stop, gint64 position) +{ + gboolean ns_update; + gdouble ns_rate, ns_arate; + GstFormat ns_format; + gint64 ns_start; + gint64 ns_stop; + gint64 ns_position; + + if (GST_EVENT_TYPE (event) != GST_EVENT_SEGMENT) { + return FALSE; + } + + gst_event_parse_new_segment (event, &ns_update, &ns_rate, &ns_arate, + &ns_format, &ns_start, &ns_stop, &ns_position); + + GST_DEBUG ("update %d, rate %lf, format %s, start %" GST_TIME_FORMAT + ", stop %" GST_TIME_FORMAT ", position %" GST_TIME_FORMAT, ns_update, + ns_rate, gst_format_get_name (ns_format), GST_TIME_ARGS (ns_start), + GST_TIME_ARGS (ns_stop), GST_TIME_ARGS (ns_position)); + + return (ns_update == update && ns_rate == rate && ns_format == format && + ns_start == start && ns_stop == stop && ns_position == position); +} + +GST_START_TEST (test_newsegment) +{ + GstEvent *event; + GstBuffer *buffer1; + GstBuffer *buffer2; + GstBuffer *buffer; + + g_signal_connect (queue, "overrun", G_CALLBACK (queue_overrun), NULL); + g_object_set (G_OBJECT (queue), "max-size-buffers", 1, "max-size-time", + (guint64) 0, "leaky", 2, NULL); + + GST_DEBUG ("starting"); + + fail_unless (gst_element_set_state (queue, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + event = gst_event_new_new_segment (FALSE, 2.0, 1.0, GST_FORMAT_TIME, 0, + 2 * GST_SECOND, 0); + gst_pad_push_event (mysrcpad, event); + + GST_DEBUG ("added 1st newsegment"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + event = gst_event_new_new_segment (FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, + 3 * GST_SECOND, 0); + gst_pad_push_event (mysrcpad, event); + + GST_DEBUG ("added 2nd newsegment"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + event = gst_event_new_new_segment (FALSE, 1.0, 1.0, GST_FORMAT_TIME, + 4 * GST_SECOND, 5 * GST_SECOND, 4 * GST_SECOND); + gst_pad_push_event (mysrcpad, event); + + GST_DEBUG ("added 3rd newsegment"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer1 = gst_buffer_new_and_alloc (4); + /* buffer1 will be leaked, keep a ref so refcount can be checked below */ + gst_buffer_ref (buffer1); + /* pushing gives away one reference */ + gst_pad_push (mysrcpad, buffer1); + + GST_DEBUG ("added 1st buffer"); + fail_unless (overrun_count == 0); + fail_unless (underrun_count == 0); + + buffer2 = gst_buffer_new_and_alloc (4); + /* next push will cause overrun and leak all newsegment events and buffer1 */ + gst_pad_push (mysrcpad, buffer2); + + GST_DEBUG ("added 2nd buffer"); + /* it still triggers overrun when leaking */ + fail_unless (overrun_count == 1); + fail_unless (underrun_count == 0); + + /* wait for underrun and check that we got one accumulated newsegment event, + * one real newsegment event and buffer2 only */ + UNDERRUN_LOCK (); + mysinkpad = setup_sink_pad (queue, &sinktemplate); + UNDERRUN_WAIT (); + UNDERRUN_UNLOCK (); + + fail_unless (overrun_count == 1); + fail_unless (underrun_count == 1); + + fail_unless (g_list_length (events) == 2); + + event = g_list_nth (events, 0)->data; + fail_unless (event_equals_newsegment (event, FALSE, 1.0, GST_FORMAT_TIME, 0, + 4 * GST_SECOND, 0)); + + event = g_list_nth (events, 1)->data; + fail_unless (event_equals_newsegment (event, FALSE, 1.0, GST_FORMAT_TIME, + 4 * GST_SECOND, 5 * GST_SECOND, 4 * GST_SECOND)); + + fail_unless (g_list_length (buffers) == 1); + + ASSERT_BUFFER_REFCOUNT (buffer1, "buffer", 1); + gst_buffer_unref (buffer1); + + buffer = g_list_nth (buffers, 0)->data; + fail_unless (buffer == buffer2); + + GST_DEBUG ("stopping"); + fail_unless (gst_element_set_state (queue, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); +} + +GST_END_TEST; +#endif + +static Suite * +queue_suite (void) +{ + Suite *s = suite_create ("queue"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_checked_fixture (tc_chain, setup, cleanup); + tcase_add_test (tc_chain, test_non_leaky_underrun); + tcase_add_test (tc_chain, test_non_leaky_overrun); + tcase_add_test (tc_chain, test_leaky_upstream); + tcase_add_test (tc_chain, test_leaky_downstream); + tcase_add_test (tc_chain, test_time_level); + tcase_add_test (tc_chain, test_time_level_task_not_started); +#if 0 + tcase_add_test (tc_chain, test_newsegment); +#endif + + return s; +} + +GST_CHECK_MAIN (queue); diff --git a/tests/check/elements/queue2.c b/tests/check/elements/queue2.c new file mode 100644 index 0000000..f74b3ea --- /dev/null +++ b/tests/check/elements/queue2.c @@ -0,0 +1,225 @@ +/* GStreamer unit tests for queue2 + * + * Copyright (C) 2011 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> + +static GstElement * +setup_queue2 (GstElement * pipe, GstElement * input, GstElement * output) +{ + GstElement *queue2; + GstPad *sinkpad, *srcpad; + + queue2 = gst_element_factory_make ("queue2", NULL); + fail_unless (queue2 != NULL, "failed to create 'queue2' element"); + + gst_bin_add (GST_BIN (pipe), queue2); + gst_bin_add (GST_BIN (pipe), input); + gst_bin_add (GST_BIN (pipe), output); + + sinkpad = gst_element_get_static_pad (queue2, "sink"); + fail_unless (sinkpad != NULL, "failed to get queue2 sink pad"); + + srcpad = gst_element_get_static_pad (input, "src"); + fail_unless (srcpad != NULL, "failed to find src pad for input element"); + + fail_unless_equals_int (GST_PAD_LINK_OK, gst_pad_link (srcpad, sinkpad)); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + srcpad = gst_element_get_static_pad (queue2, "src"); + fail_unless (srcpad != NULL); + + sinkpad = gst_element_get_static_pad (output, "sink"); + fail_unless (sinkpad != NULL, "failed to find sink pad of output element"); + + fail_unless_equals_int (GST_PAD_LINK_OK, gst_pad_link (srcpad, sinkpad)); + + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + return queue2; +} + +GST_START_TEST (test_simple_pipeline) +{ + GstElement *pipe, *input, *output; + GstMessage *msg; + + pipe = gst_pipeline_new ("pipeline"); + + input = gst_element_factory_make ("fakesrc", NULL); + fail_unless (input != NULL, "failed to create 'fakesrc' element"); + g_object_set (input, "num-buffers", 256, "sizetype", 3, NULL); + + output = gst_element_factory_make ("fakesink", NULL); + fail_unless (output != NULL, "failed to create 'fakesink' element"); + + setup_queue2 (pipe, input, output); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + + msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), + GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + + fail_if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR, + "Expected EOS message, got ERROR message"); + gst_message_unref (msg); + + GST_LOG ("Got EOS, cleaning up"); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); +} + +GST_END_TEST; + +GST_START_TEST (test_simple_pipeline_ringbuffer) +{ + GstElement *pipe, *queue2, *input, *output; + GstMessage *msg; + + pipe = gst_pipeline_new ("pipeline"); + + input = gst_element_factory_make ("fakesrc", NULL); + fail_unless (input != NULL, "failed to create 'fakesrc' element"); + g_object_set (input, "num-buffers", 256, "sizetype", 3, NULL); + + output = gst_element_factory_make ("fakesink", NULL); + fail_unless (output != NULL, "failed to create 'fakesink' element"); + + queue2 = setup_queue2 (pipe, input, output); + g_object_set (queue2, "ring-buffer-max-size", (guint64) 1024 * 50, NULL); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + + msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), + GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + + fail_if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR, + "Expected EOS message, got ERROR message"); + gst_message_unref (msg); + + GST_LOG ("Got EOS, cleaning up"); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); +} + +GST_END_TEST; + +static void +do_test_simple_shutdown_while_running (guint64 ring_buffer_max_size) +{ + GstElement *pipe, *q2; + GstElement *input; + GstElement *output; + GstMessage *msg; + + pipe = gst_pipeline_new ("pipeline"); + + input = gst_element_factory_make ("fakesrc", NULL); + fail_unless (input != NULL, "failed to create 'fakesrc' element"); + g_object_set (input, "format", GST_FORMAT_TIME, "sizetype", 2, + "sizemax", 10, NULL); + + output = gst_element_factory_make ("fakesink", NULL); + fail_unless (output != NULL, "failed to create 'fakesink' element"); + + q2 = setup_queue2 (pipe, input, output); + + if (ring_buffer_max_size > 0) { + g_object_set (q2, "ring-buffer-max-size", ring_buffer_max_size, + "temp-template", NULL, NULL); + } + + gst_element_set_state (pipe, GST_STATE_PAUSED); + + /* wait until pipeline is up and running */ + msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), + GST_MESSAGE_ERROR | GST_MESSAGE_ASYNC_DONE, -1); + fail_if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR, "Got ERROR message"); + gst_message_unref (msg); + + GST_LOG ("pipeline is running now"); + gst_element_set_state (pipe, GST_STATE_PLAYING); + g_usleep (G_USEC_PER_SEC / 20); + + /* now shut down only the sink, so the queue gets a wrong-state flow return */ + gst_element_set_state (output, GST_STATE_NULL); + GST_LOG ("Cleaning up"); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); +} + +GST_START_TEST (test_simple_shutdown_while_running) +{ + int i; + + /* run a couple of iterations, gives higher chance of different code paths + * being executed at time the flush is detected (esp. useful to make sure + * things are cleaned up properly when running under valgrind) */ + for (i = 0; i < 10; ++i) { + do_test_simple_shutdown_while_running (0); + } +} + +GST_END_TEST; + +GST_START_TEST (test_simple_shutdown_while_running_ringbuffer) +{ + int i; + + /* run a couple of iterations, gives higher chance of different code paths + * being executed at time the flush is detected (esp. useful to make sure + * things are cleaned up properly when running under valgrind) */ + for (i = 0; i < 10; ++i) { + do_test_simple_shutdown_while_running (1024 * 1024); + } +} + +GST_END_TEST; + +GST_START_TEST (test_simple_create_destroy) +{ + GstElement *queue2; + + queue2 = gst_element_factory_make ("queue2", NULL); + gst_object_unref (queue2); +} + +GST_END_TEST; + +static Suite * +queue2_suite (void) +{ + Suite *s = suite_create ("queue2"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_simple_create_destroy); + tcase_add_test (tc_chain, test_simple_pipeline); + tcase_add_test (tc_chain, test_simple_pipeline_ringbuffer); + tcase_add_test (tc_chain, test_simple_shutdown_while_running); + tcase_add_test (tc_chain, test_simple_shutdown_while_running_ringbuffer); + return s; +} + +GST_CHECK_MAIN (queue2) diff --git a/tests/check/elements/selector.c b/tests/check/elements/selector.c new file mode 100644 index 0000000..b4fee5d --- /dev/null +++ b/tests/check/elements/selector.c @@ -0,0 +1,596 @@ +/* GStreamer + * + * Unit test for selector plugin + * Copyright (C) 2008 Nokia Corporation. (contact <stefan.kost@nokia.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. + */ + +#include <gst/check/gstcheck.h> + +#define NUM_SELECTOR_PADS 4 +#define NUM_INPUT_BUFFERS 4 // buffers to send per each selector pad + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +/* Data probe cb to drop everything but count buffers and events */ +static GstProbeReturn +probe_cb (GstPad * pad, GstProbeType type, GstMiniObject * obj, + gpointer user_data) +{ + gint count = 0; + const gchar *count_type = NULL; + + GST_LOG_OBJECT (pad, "got data"); + + if (GST_IS_BUFFER (obj)) { + count_type = "buffer_count"; + } else if (GST_IS_EVENT (obj)) { + count_type = "event_count"; + } else { + g_assert_not_reached (); + } + + /* increment and store count */ + count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (pad), count_type)); + count++; + g_object_set_data (G_OBJECT (pad), count_type, GINT_TO_POINTER (count)); + + /* drop everything */ + return GST_PROBE_DROP; +} + +/* Create and link output pad: selector:src%d ! output_pad */ +static GstPad * +setup_output_pad (GstElement * element, GstStaticPadTemplate * tmpl) +{ + GstPad *srcpad = NULL, *output_pad = NULL; + gulong probe_id = 0; + + if (tmpl == NULL) + tmpl = &sinktemplate; + + /* create output_pad */ + output_pad = gst_pad_new_from_static_template (tmpl, "sink"); + fail_if (output_pad == NULL, "Could not create a output_pad"); + + /* add probe */ + probe_id = + gst_pad_add_probe (output_pad, GST_PROBE_TYPE_DATA, + (GstPadProbeCallback) probe_cb, NULL, NULL); + g_object_set_data (G_OBJECT (output_pad), "probe_id", + GINT_TO_POINTER (probe_id)); + + /* request src pad */ + srcpad = gst_element_get_request_pad (element, "src%d"); + fail_if (srcpad == NULL, "Could not get source pad from %s", + GST_ELEMENT_NAME (element)); + + /* link pads and activate */ + fail_unless (gst_pad_link (srcpad, output_pad) == GST_PAD_LINK_OK, + "Could not link %s source and output pad", GST_ELEMENT_NAME (element)); + + gst_pad_set_active (output_pad, TRUE); + + GST_DEBUG_OBJECT (output_pad, "set up %" GST_PTR_FORMAT " ! %" GST_PTR_FORMAT, + srcpad, output_pad); + + gst_object_unref (srcpad); + ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1); + + return output_pad; +} + +/* Clean up output/input pad and respective selector request pad */ +static void +cleanup_pad (GstPad * pad, GstElement * element) +{ + GstPad *selpad = NULL; + guint probe_id = 0; + + fail_if (pad == NULL, "pad doesn't exist"); + + /* remove probe if necessary */ + probe_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (pad), "probe_id")); + if (probe_id) + gst_pad_remove_probe (pad, probe_id); + + /* unlink */ + selpad = gst_pad_get_peer (pad); + if (GST_PAD_DIRECTION (selpad) == GST_PAD_SRC) { + gst_pad_unlink (selpad, pad); + } else { + gst_pad_unlink (pad, selpad); + } + + GST_DEBUG_OBJECT (pad, "clean up %" GST_PTR_FORMAT " and %" GST_PTR_FORMAT, + selpad, pad); + + /* cleanup the pad */ + gst_pad_set_active (pad, FALSE); + ASSERT_OBJECT_REFCOUNT (pad, "pad", 1); + gst_object_unref (pad); + + /* cleanup selector pad, reffed by this function (_get_peer) and creator */ + gst_element_release_request_pad (element, selpad); + gst_object_unref (selpad); +} + +/* Duplicate and push given buffer many times to all input_pads */ +static void +push_input_buffers (GList * input_pads, GstBuffer * buf, gint num_buffers) +{ + GstBuffer *buf_in = NULL; + GList *l = input_pads; + GstPad *input_pad; + gint i = 0; + + while (l != NULL) { + input_pad = l->data; + GST_DEBUG_OBJECT (input_pad, "pushing %d buffers to %" GST_PTR_FORMAT, + num_buffers, input_pad); + for (i = 0; i < num_buffers; i++) { + buf_in = gst_buffer_copy (buf); + fail_unless (gst_pad_push (input_pad, buf_in) == GST_FLOW_OK, + "pushing buffer failed"); + } + l = g_list_next (l); + } +} + +/* Check that received buffers count match to expected buffers */ +static void +count_output_buffers (GList * output_pads, gint expected_buffers) +{ + gint count = 0; + GList *l = output_pads; + GstPad *output_pad = NULL; + + while (l != NULL) { + output_pad = l->data; + count = + GPOINTER_TO_INT (g_object_get_data (G_OBJECT (output_pad), + "buffer_count")); + GST_DEBUG_OBJECT (output_pad, "received %d buffers", count); + fail_unless (count == expected_buffers, + "received/expected buffer count doesn't match %d/%d", count, + expected_buffers); + count = + GPOINTER_TO_INT (g_object_get_data (G_OBJECT (output_pad), + "event_count")); + GST_DEBUG_OBJECT (output_pad, "received %d events", count); + l = g_list_next (l); + } +} + +/* Set selector active pad */ +static void +selector_set_active_pad (GstElement * elem, GstPad * selpad) +{ + gchar *padname = NULL; + + if (selpad) { + padname = gst_pad_get_name (selpad); + } + + g_object_set (G_OBJECT (elem), "active-pad", selpad, NULL); + GST_DEBUG_OBJECT (elem, "activated selector pad: %s", GST_STR_NULL (padname)); + g_free (padname); +} + +/* Push buffers and switch for each selector pad */ +static void +push_switched_buffers (GList * input_pads, + GstElement * elem, GList * peer_pads, gint num_buffers) +{ + GstBuffer *buf = NULL; + GstCaps *caps = NULL; + GList *l = peer_pads; + GstPad *selpad = NULL; + + /* setup dummy buffer */ + caps = gst_caps_from_string ("application/x-unknown"); + buf = gst_buffer_new_and_alloc (1); + + while (l != NULL) { + /* set selector pad */ + selpad = gst_pad_get_peer (GST_PAD (l->data)); + selector_set_active_pad (elem, selpad); + if (selpad) { + gst_object_unref (selpad); + } + /* push buffers */ + push_input_buffers (input_pads, buf, num_buffers); + /* switch to next selector pad */ + l = g_list_next (l); + } + + /* cleanup buffer */ + gst_buffer_unref (buf); + gst_caps_unref (caps); +} + +/* Create output-selector with given number of src pads and switch + given number of input buffers to each src pad. + */ +static void +run_output_selector_buffer_count (gint num_output_pads, + gint num_buffers_per_output) +{ + /* setup input_pad ! selector ! output_pads */ + gint i = 0; + GList *output_pads = NULL, *input_pads = NULL; + GstElement *sel = gst_check_setup_element ("output-selector"); + GstPad *input_pad = gst_check_setup_src_pad (sel, &srctemplate, NULL); + + input_pads = g_list_append (input_pads, input_pad); + gst_pad_set_active (input_pad, TRUE); + for (i = 0; i < num_output_pads; i++) { + output_pads = g_list_append (output_pads, setup_output_pad (sel, NULL)); + } + + /* run the test */ + fail_unless (gst_element_set_state (sel, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + push_switched_buffers (input_pads, sel, output_pads, num_buffers_per_output); + count_output_buffers (output_pads, num_buffers_per_output); + fail_unless (gst_element_set_state (sel, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* cleanup input_pad, selector and output_pads */ + gst_pad_set_active (input_pad, FALSE); + gst_check_teardown_src_pad (sel); + g_list_foreach (output_pads, (GFunc) cleanup_pad, sel); + g_list_free (output_pads); + g_list_free (input_pads); + gst_check_teardown_element (sel); +} + +/* Create and link input pad: input_pad ! selector:sink%d */ +static GstPad * +setup_input_pad (GstElement * element) +{ + GstPad *sinkpad = NULL, *input_pad = NULL; + + /* create input_pad */ + input_pad = gst_pad_new_from_static_template (&srctemplate, "src"); + fail_if (input_pad == NULL, "Could not create a input_pad"); + + /* request sink pad */ + sinkpad = gst_element_get_request_pad (element, "sink%d"); + fail_if (sinkpad == NULL, "Could not get sink pad from %s", + GST_ELEMENT_NAME (element)); + + /* link pads and activate */ + fail_unless (gst_pad_link (input_pad, sinkpad) == GST_PAD_LINK_OK, + "Could not link input_pad and %s sink", GST_ELEMENT_NAME (element)); + + gst_pad_set_active (input_pad, TRUE); + + GST_DEBUG_OBJECT (input_pad, "set up %" GST_PTR_FORMAT " ! %" GST_PTR_FORMAT, + input_pad, sinkpad); + + gst_object_unref (sinkpad); + ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1); + + return input_pad; +} + +/* Create input-selector with given number of sink pads and switch + given number of input buffers to each sink pad. + */ +static void +run_input_selector_buffer_count (gint num_input_pads, + gint num_buffers_per_input) +{ + /* set up input_pads ! selector ! output_pad */ + gint i = 0, probe_id = 0; + GList *input_pads = NULL, *output_pads = NULL; + GstElement *sel = gst_check_setup_element ("input-selector"); + GstPad *output_pad = gst_check_setup_sink_pad (sel, &sinktemplate, NULL); + + output_pads = g_list_append (output_pads, output_pad); + gst_pad_set_active (output_pad, TRUE); + for (i = 0; i < num_input_pads; i++) { + input_pads = g_list_append (input_pads, setup_input_pad (sel)); + } + /* add probe */ + probe_id = + gst_pad_add_probe (output_pad, GST_PROBE_TYPE_DATA, + (GstPadProbeCallback) probe_cb, NULL, NULL); + g_object_set_data (G_OBJECT (output_pad), "probe_id", + GINT_TO_POINTER (probe_id)); + + /* run the test */ + fail_unless (gst_element_set_state (sel, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + push_switched_buffers (input_pads, sel, input_pads, num_buffers_per_input); + count_output_buffers (output_pads, (num_input_pads * num_buffers_per_input)); + fail_unless (gst_element_set_state (sel, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + + /* clean up */ + gst_pad_remove_probe (output_pad, probe_id); + gst_pad_set_active (output_pad, FALSE); + gst_check_teardown_sink_pad (sel); + GST_DEBUG ("setting selector pad to NULL"); + selector_set_active_pad (sel, NULL); // unref input-selector active pad + g_list_foreach (input_pads, (GFunc) cleanup_pad, sel); + g_list_free (input_pads); + g_list_free (output_pads); + gst_check_teardown_element (sel); +} + +/* Push buffers to input pad and check the + amount of buffers arrived to output pads */ +GST_START_TEST (test_output_selector_buffer_count); +{ + gint i, j; + + for (i = 0; i < NUM_SELECTOR_PADS; i++) { + for (j = 0; j < NUM_INPUT_BUFFERS; j++) { + run_output_selector_buffer_count (i, j); + } + } +} + +GST_END_TEST; + +/* Push buffers to input pads and check the + amount of buffers arrived to output pad */ +GST_START_TEST (test_input_selector_buffer_count); +{ + gint i, j; + + for (i = 0; i < NUM_SELECTOR_PADS; i++) { + for (j = 0; j < NUM_INPUT_BUFFERS; j++) { + run_input_selector_buffer_count (i, j); + } + } +} + +GST_END_TEST; + + +GST_START_TEST (test_output_selector_no_srcpad_negotiation); +{ + GstElement *sel; + GstCaps *caps; + GstPad *pad; + gint i; + + sel = gst_element_factory_make ("output-selector", NULL); + fail_unless (sel != NULL); + + pad = gst_element_get_static_pad (sel, "sink"); + fail_unless (pad != NULL); + + fail_unless (gst_element_set_state (sel, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + for (i = 0; i <= 2; i++) { + + /* regardless of pad-negotiation-mode, getcaps should return ANY and + * setcaps should accept any caps when there are no srcpads */ + g_object_set (sel, "pad-negotiation-mode", i, NULL); + + caps = gst_pad_get_caps (pad, NULL); + fail_unless (gst_caps_is_any (caps)); + + gst_caps_unref (caps); + + caps = gst_caps_new_simple ("mymedia/mycaps", NULL); + fail_unless (gst_pad_set_caps (pad, caps)); + gst_caps_unref (caps); + } + + fail_unless (gst_element_set_state (sel, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + gst_object_unref (pad); + gst_object_unref (sel); +} + +GST_END_TEST; + + +GstElement *sel; +GstPad *input_pad; +GList *output_pads = NULL; /* list of sinkpads linked to output-selector */ +#define OUTPUT_SELECTOR_NUM_PADS 2 + +static GstStaticPadTemplate sinktmpl_nego_a = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("format/abc; format/xyz")); +static GstStaticPadTemplate sinktmpl_nego_b = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("format/abc")); + +static void +setup_output_selector (void) +{ + sel = gst_check_setup_element ("output-selector"); + input_pad = gst_check_setup_src_pad (sel, &srctemplate, NULL); + gst_pad_set_active (input_pad, TRUE); + + output_pads = g_list_append (output_pads, setup_output_pad (sel, + &sinktmpl_nego_a)); + output_pads = g_list_append (output_pads, setup_output_pad (sel, + &sinktmpl_nego_b)); +} + +static void +teardown_output_selector (void) +{ + gst_pad_set_active (input_pad, FALSE); + gst_object_unref (input_pad); + gst_check_teardown_src_pad (sel); + g_list_foreach (output_pads, (GFunc) cleanup_pad, sel); + g_list_free (output_pads); + gst_check_teardown_element (sel); + output_pads = NULL; +} + +GST_START_TEST (test_output_selector_getcaps_none); +{ + GList *walker; + + /* set pad negotiation mode to none */ + g_object_set (sel, "pad-negotiation-mode", 0, NULL); + + fail_unless (gst_element_set_state (sel, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + for (walker = output_pads; walker; walker = g_list_next (walker)) { + GstCaps *caps; + GstPad *pad; + + pad = gst_pad_get_peer ((GstPad *) walker->data); + + g_object_set (sel, "active-pad", pad, NULL); + + caps = gst_pad_peer_get_caps (input_pad, NULL); + + /* in 'none' mode, the getcaps returns the template, which is ANY */ + g_assert (gst_caps_is_any (caps)); + gst_caps_unref (caps); + gst_object_unref (pad); + } + + fail_unless (gst_element_set_state (sel, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + +} + +GST_END_TEST; + + +GST_START_TEST (test_output_selector_getcaps_all); +{ + GList *walker; + GstCaps *expected; + + /* set pad negotiation mode to 'all' */ + g_object_set (sel, "pad-negotiation-mode", 1, NULL); + + fail_unless (gst_element_set_state (sel, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + /* in 'all' mode, the intersection of the srcpad caps should be returned on + * the sinkpad's getcaps */ + expected = gst_caps_new_simple ("format/abc", NULL); + + for (walker = output_pads; walker; walker = g_list_next (walker)) { + GstCaps *caps; + GstPad *pad; + + pad = gst_pad_get_peer ((GstPad *) walker->data); + + g_object_set (sel, "active-pad", pad, NULL); + + caps = gst_pad_peer_get_caps (input_pad, NULL); + + g_assert (gst_caps_is_equal (caps, expected)); + gst_caps_unref (caps); + gst_object_unref (pad); + } + gst_caps_unref (expected); + + fail_unless (gst_element_set_state (sel, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + +} + +GST_END_TEST; + + +GST_START_TEST (test_output_selector_getcaps_active); +{ + GList *walker; + GstCaps *expected; + + /* set pad negotiation mode to 'active' */ + g_object_set (sel, "pad-negotiation-mode", 2, NULL); + + fail_unless (gst_element_set_state (sel, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + for (walker = output_pads; walker; walker = g_list_next (walker)) { + GstCaps *caps; + GstPad *pad; + + pad = gst_pad_get_peer ((GstPad *) walker->data); + + g_object_set (sel, "active-pad", pad, NULL); + + /* in 'active' mode, the active srcpad peer's caps should be returned on + * the sinkpad's getcaps */ + + expected = gst_pad_template_get_caps (gst_pad_get_pad_template ((GstPad *) + walker->data)); + caps = gst_pad_peer_get_caps (input_pad, NULL); + + g_assert (gst_caps_is_equal (caps, expected)); + gst_caps_unref (caps); + gst_caps_unref (expected); + gst_object_unref (pad); + } + + fail_unless (gst_element_set_state (sel, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + +} + +GST_END_TEST; + + +static Suite * +selector_suite (void) +{ + Suite *s = suite_create ("selector"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_output_selector_buffer_count); + tcase_add_test (tc_chain, test_input_selector_buffer_count); + tcase_add_test (tc_chain, test_output_selector_no_srcpad_negotiation); + + tc_chain = tcase_create ("output-selector-negotiation"); + tcase_add_checked_fixture (tc_chain, setup_output_selector, + teardown_output_selector); + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_output_selector_getcaps_none); + tcase_add_test (tc_chain, test_output_selector_getcaps_all); + tcase_add_test (tc_chain, test_output_selector_getcaps_active); + + return s; +} + +GST_CHECK_MAIN (selector); diff --git a/tests/check/elements/tee.c b/tests/check/elements/tee.c new file mode 100644 index 0000000..dc0847f --- /dev/null +++ b/tests/check/elements/tee.c @@ -0,0 +1,619 @@ +/* GStreamer + * + * unit test for tee + * + * Copyright (C) <2007> Wim Taymans <wim dot taymans at gmail dot com> + * Copyright (C) <2008> Ole André Vadla RavnÃ¥s <ole.andre.ravnas@tandberg.com> + * Copyright (C) <2008> Christian Berentsen <christian.berentsen@tandberg.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. + */ + +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include <gst/check/gstcheck.h> + +static void +handoff (GstElement * fakesink, GstBuffer * buf, GstPad * pad, guint * count) +{ + *count = *count + 1; +} + +/* construct fakesrc num-buffers=3 ! tee name=t ! queue ! fakesink t. ! queue ! + * fakesink. Each fakesink should exactly receive 3 buffers. + */ +GST_START_TEST (test_num_buffers) +{ +#define NUM_SUBSTREAMS 15 +#define NUM_BUFFERS 3 + GstElement *pipeline, *src, *tee; + GstElement *queues[NUM_SUBSTREAMS]; + GstElement *sinks[NUM_SUBSTREAMS]; + GstPad *req_pads[NUM_SUBSTREAMS]; + guint counts[NUM_SUBSTREAMS]; + GstBus *bus; + GstMessage *msg; + gint i; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_check_setup_element ("fakesrc"); + g_object_set (src, "num-buffers", NUM_BUFFERS, NULL); + tee = gst_check_setup_element ("tee"); + fail_unless (gst_bin_add (GST_BIN (pipeline), src)); + fail_unless (gst_bin_add (GST_BIN (pipeline), tee)); + fail_unless (gst_element_link (src, tee)); + + for (i = 0; i < NUM_SUBSTREAMS; ++i) { + GstPad *qpad; + gchar name[32]; + + counts[i] = 0; + + queues[i] = gst_check_setup_element ("queue"); + g_snprintf (name, 32, "queue%d", i); + gst_object_set_name (GST_OBJECT (queues[i]), name); + fail_unless (gst_bin_add (GST_BIN (pipeline), queues[i])); + + sinks[i] = gst_check_setup_element ("fakesink"); + g_snprintf (name, 32, "sink%d", i); + gst_object_set_name (GST_OBJECT (sinks[i]), name); + fail_unless (gst_bin_add (GST_BIN (pipeline), sinks[i])); + fail_unless (gst_element_link (queues[i], sinks[i])); + g_object_set (sinks[i], "signal-handoffs", TRUE, NULL); + g_signal_connect (sinks[i], "handoff", (GCallback) handoff, &counts[i]); + + req_pads[i] = gst_element_get_request_pad (tee, "src%d"); + fail_unless (req_pads[i] != NULL); + + qpad = gst_element_get_static_pad (queues[i], "sink"); + fail_unless_equals_int (gst_pad_link (req_pads[i], qpad), GST_PAD_LINK_OK); + gst_object_unref (qpad); + } + + bus = gst_element_get_bus (pipeline); + fail_if (bus == NULL); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_EOS); + gst_message_unref (msg); + + for (i = 0; i < NUM_SUBSTREAMS; ++i) { + fail_unless_equals_int (counts[i], NUM_BUFFERS); + } + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (bus); + + for (i = 0; i < NUM_SUBSTREAMS; ++i) { + gst_element_release_request_pad (tee, req_pads[i]); + gst_object_unref (req_pads[i]); + } + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* we use fakesrc ! tee ! fakesink and then randomly request/release and link + * some pads from tee. This should happily run without any errors. */ +GST_START_TEST (test_stress) +{ + GstElement *pipeline; + GstElement *tee; + const gchar *desc; + GstBus *bus; + GstMessage *msg; + gint i; + + /* Pump 1000 buffers (10 bytes each) per second through tee for 5 secs */ + desc = "fakesrc datarate=10000 sizemin=10 sizemax=10 num-buffers=5000 ! " + "video/x-raw-rgb,framerate=25/1 ! tee name=t ! " + "queue max-size-buffers=2 ! fakesink sync=true"; + + pipeline = gst_parse_launch (desc, NULL); + fail_if (pipeline == NULL); + + tee = gst_bin_get_by_name (GST_BIN (pipeline), "t"); + fail_if (tee == NULL); + + /* bring the pipeline to PLAYING, then start switching */ + bus = gst_element_get_bus (pipeline); + fail_if (bus == NULL); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + /* Wait for the pipeline to hit playing so that parse_launch can do the + * initial link, otherwise we perform linking from multiple threads and cause + * trouble */ + gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + + for (i = 0; i < 50000; i++) { + GstPad *pad; + + pad = gst_element_get_request_pad (tee, "src%d"); + gst_element_release_request_pad (tee, pad); + gst_object_unref (pad); + + if ((msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, 0))) + break; + } + + /* now wait for completion or error */ + if (msg == NULL) + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_EOS); + gst_message_unref (msg); + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (tee); + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +typedef struct +{ + GstElement *tee; + GstCaps *caps; + GstPad *start_srcpad; + GstPad *tee_sinkpad; + GstPad *tee_srcpad; + GstPad *final_sinkpad; + GThread *app_thread; + gint countdown; + gboolean app_thread_prepped; + gboolean bufferalloc_blocked; +} BufferAllocHarness; + +static void +buffer_alloc_harness_setup (BufferAllocHarness * h, gint countdown) +{ + h->tee = gst_check_setup_element ("tee"); + fail_if (h->tee == NULL); + + h->countdown = countdown; + + fail_unless_equals_int (gst_element_set_state (h->tee, GST_STATE_PLAYING), + TRUE); + + h->caps = gst_caps_new_simple ("video/x-raw-yuv", NULL); + + h->start_srcpad = gst_pad_new ("src", GST_PAD_SRC); + fail_if (h->start_srcpad == NULL); + fail_unless (gst_pad_set_active (h->start_srcpad, TRUE) == TRUE); + fail_unless (gst_pad_set_caps (h->start_srcpad, h->caps) == TRUE); + + h->tee_sinkpad = gst_element_get_static_pad (h->tee, "sink"); + fail_if (h->tee_sinkpad == NULL); + + h->tee_srcpad = gst_element_get_request_pad (h->tee, "src%d"); + fail_if (h->tee_srcpad == NULL); + + h->final_sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + fail_if (h->final_sinkpad == NULL); + fail_unless (gst_pad_set_active (h->final_sinkpad, TRUE) == TRUE); + fail_unless (gst_pad_set_caps (h->final_sinkpad, h->caps) == TRUE); + g_object_set_qdata (G_OBJECT (h->final_sinkpad), + g_quark_from_static_string ("buffer-alloc-harness"), h); + + fail_unless_equals_int (gst_pad_link (h->start_srcpad, h->tee_sinkpad), + GST_PAD_LINK_OK); + fail_unless_equals_int (gst_pad_link (h->tee_srcpad, h->final_sinkpad), + GST_PAD_LINK_OK); +} + +static void +buffer_alloc_harness_teardown (BufferAllocHarness * h) +{ + if (h->app_thread) + g_thread_join (h->app_thread); + + gst_pad_set_active (h->final_sinkpad, FALSE); + gst_object_unref (h->final_sinkpad); + gst_object_unref (h->tee_srcpad); + gst_object_unref (h->tee_sinkpad); + gst_pad_set_active (h->start_srcpad, FALSE); + gst_object_unref (h->start_srcpad); + gst_caps_unref (h->caps); + gst_check_teardown_element (h->tee); +} + +#if 0 +static gpointer +app_thread_func (gpointer data) +{ + BufferAllocHarness *h = data; + + /* Signal that we are about to call release_request_pad(). */ + g_mutex_lock (check_mutex); + h->app_thread_prepped = TRUE; + g_cond_signal (check_cond); + g_mutex_unlock (check_mutex); + + /* Simulate that the app releases the pad while the streaming thread is in + * buffer_alloc below. */ + gst_element_release_request_pad (h->tee, h->tee_srcpad); + + /* Signal the bufferalloc function below if it's still waiting. */ + g_mutex_lock (check_mutex); + h->bufferalloc_blocked = FALSE; + g_cond_signal (check_cond); + g_mutex_unlock (check_mutex); + + return NULL; +} +#endif + +#if 0 +static GstFlowReturn +final_sinkpad_bufferalloc (GstPad * pad, guint64 offset, guint size, + GstCaps * caps, GstBuffer ** buf) +{ + BufferAllocHarness *h; + GTimeVal deadline; + + h = g_object_get_qdata (G_OBJECT (pad), + g_quark_from_static_string ("buffer-alloc-harness")); + g_assert (h != NULL); + + if (--(h->countdown) == 0) { + /* Time to make the app release the pad. */ + h->app_thread_prepped = FALSE; + h->bufferalloc_blocked = TRUE; + + h->app_thread = g_thread_create (app_thread_func, h, TRUE, NULL); + fail_if (h->app_thread == NULL); + + /* Wait for the app thread to get ready to call release_request_pad(). */ + g_mutex_lock (check_mutex); + while (!h->app_thread_prepped) + g_cond_wait (check_cond, check_mutex); + g_mutex_unlock (check_mutex); + + /* Now wait for it to do that within a second, to avoid deadlocking + * in the event of future changes to the locking semantics. */ + g_mutex_lock (check_mutex); + g_get_current_time (&deadline); + deadline.tv_sec += 1; + while (h->bufferalloc_blocked) { + if (!g_cond_timed_wait (check_cond, check_mutex, &deadline)) + break; + } + g_mutex_unlock (check_mutex); + } + + *buf = gst_buffer_new_and_alloc (size); + gst_buffer_set_caps (*buf, caps); + + return GST_FLOW_OK; +} +#endif + +/* Simulate an app releasing the pad while the first alloc_buffer() is in + * progress. */ +GST_START_TEST (test_release_while_buffer_alloc) +{ + BufferAllocHarness h; + + buffer_alloc_harness_setup (&h, 1); + + buffer_alloc_harness_teardown (&h); +} + +GST_END_TEST; + +/* Simulate an app releasing the pad while the second alloc_buffer() is in + * progress. */ +GST_START_TEST (test_release_while_second_buffer_alloc) +{ + BufferAllocHarness h; + + buffer_alloc_harness_setup (&h, 2); + + buffer_alloc_harness_teardown (&h); +} + +GST_END_TEST; + +/* Check the internal pads of tee */ +GST_START_TEST (test_internal_links) +{ + GstElement *tee; + GstPad *sinkpad, *srcpad1, *srcpad2; + GstIterator *it; + GstIteratorResult res; + GValue val1 = { 0, } + , val2 = { + 0,}; + + tee = gst_check_setup_element ("tee"); + + sinkpad = gst_element_get_static_pad (tee, "sink"); + fail_unless (sinkpad != NULL); + it = gst_pad_iterate_internal_links (sinkpad); + fail_unless (it != NULL); + + /* iterator should not return anything */ + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_DONE); + fail_unless (g_value_get_object (&val1) == NULL); + + srcpad1 = gst_element_get_request_pad (tee, "src%d"); + fail_unless (srcpad1 != NULL); + + /* iterator should resync */ + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_RESYNC); + fail_unless (g_value_get_object (&val1) == NULL); + gst_iterator_resync (it); + + /* we should get something now */ + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_OK); + fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == srcpad1); + + g_value_reset (&val1); + + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_DONE); + fail_unless (g_value_get_object (&val1) == NULL); + + srcpad2 = gst_element_get_request_pad (tee, "src%d"); + fail_unless (srcpad2 != NULL); + + /* iterator should resync */ + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_RESYNC); + fail_unless (g_value_get_object (&val1) == NULL); + gst_iterator_resync (it); + + /* we should get one of the 2 pads now */ + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_OK); + fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == srcpad1 + || GST_PAD_CAST (g_value_get_object (&val1)) == srcpad2); + + /* and the other */ + res = gst_iterator_next (it, &val2); + fail_unless (res == GST_ITERATOR_OK); + fail_unless (GST_PAD_CAST (g_value_get_object (&val2)) == srcpad1 + || GST_PAD_CAST (g_value_get_object (&val2)) == srcpad2); + fail_unless (g_value_get_object (&val1) != g_value_get_object (&val2)); + g_value_reset (&val1); + g_value_reset (&val2); + + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_DONE); + fail_unless (g_value_get_object (&val1) == NULL); + + gst_iterator_free (it); + + /* get an iterator for the other direction */ + it = gst_pad_iterate_internal_links (srcpad1); + fail_unless (it != NULL); + + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_OK); + fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == sinkpad); + g_value_reset (&val1); + + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_DONE); + gst_iterator_free (it); + + it = gst_pad_iterate_internal_links (srcpad2); + fail_unless (it != NULL); + + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_OK); + fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == sinkpad); + g_value_reset (&val1); + + res = gst_iterator_next (it, &val1); + fail_unless (res == GST_ITERATOR_DONE); + + g_value_unset (&val1); + g_value_unset (&val2); + gst_iterator_free (it); + gst_object_unref (srcpad1); + gst_object_unref (srcpad2); + gst_object_unref (sinkpad); + gst_object_unref (tee); +} + +GST_END_TEST; + +static GstFlowReturn +_fake_chain (GstPad * pad, GstBuffer * buffer) +{ + gst_buffer_unref (buffer); + return GST_FLOW_OK; +} + +static GstFlowReturn +_fake_chain_error (GstPad * pad, GstBuffer * buffer) +{ + gst_buffer_unref (buffer); + return GST_FLOW_ERROR; +} + +GST_START_TEST (test_flow_aggregation) +{ + GstPad *mysrc, *mysink1, *mysink2; + GstPad *teesink, *teesrc1, *teesrc2; + GstElement *tee; + GstBuffer *buffer; + GstCaps *caps; + + caps = gst_caps_new_simple ("test/test", NULL); + + tee = gst_element_factory_make ("tee", NULL); + fail_unless (tee != NULL); + teesink = gst_element_get_static_pad (tee, "sink"); + fail_unless (teesink != NULL); + teesrc1 = gst_element_get_request_pad (tee, "src%d"); + fail_unless (teesrc1 != NULL); + teesrc2 = gst_element_get_request_pad (tee, "src%d"); + fail_unless (teesrc2 != NULL); + + GST_DEBUG ("Creating mysink1"); + mysink1 = gst_pad_new ("mysink1", GST_PAD_SINK); + gst_pad_set_chain_function (mysink1, _fake_chain); + gst_pad_set_active (mysink1, TRUE); + gst_pad_set_caps (mysink1, caps); + + GST_DEBUG ("Creating mysink2"); + mysink2 = gst_pad_new ("mysink2", GST_PAD_SINK); + gst_pad_set_chain_function (mysink2, _fake_chain); + gst_pad_set_active (mysink2, TRUE); + gst_pad_set_caps (mysink2, caps); + + GST_DEBUG ("Creating mysrc"); + mysrc = gst_pad_new ("mysrc", GST_PAD_SRC); + gst_pad_set_active (mysrc, TRUE); + gst_pad_set_caps (mysrc, caps); + + + fail_unless (gst_pad_link (mysrc, teesink) == GST_PAD_LINK_OK); + fail_unless (gst_pad_link (teesrc1, mysink1) == GST_PAD_LINK_OK); + fail_unless (gst_pad_link (teesrc2, mysink2) == GST_PAD_LINK_OK); + + fail_unless (gst_element_set_state (tee, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS); + + buffer = gst_buffer_new (); +#if 0 + gst_buffer_set_caps (buffer, caps); +#endif + + GST_DEBUG ("Try to push a buffer"); + /* First check if everything works in normal state */ + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK); + + /* One pad being in wrong state must result in wrong state */ + GST_DEBUG ("Trying to push with mysink2 disabled"); + gst_pad_set_active (mysink2, FALSE); + fail_unless (gst_pad_push (mysrc, + gst_buffer_ref (buffer)) == GST_FLOW_WRONG_STATE); + + GST_DEBUG ("Trying to push with mysink2 disabled"); + gst_pad_set_active (mysink1, FALSE); + gst_pad_set_active (mysink2, TRUE); + gst_pad_set_caps (mysink2, caps); + fail_unless (gst_pad_push (mysrc, + gst_buffer_ref (buffer)) == GST_FLOW_WRONG_STATE); + + GST_DEBUG ("Trying to push with mysink2 and mysink1 disabled"); + gst_pad_set_active (mysink2, FALSE); + fail_unless (gst_pad_push (mysrc, + gst_buffer_ref (buffer)) == GST_FLOW_WRONG_STATE); + + /* Test if everything still works in normal state */ + GST_DEBUG ("Reactivate both pads and try pushing"); + gst_pad_set_active (mysink1, TRUE); + gst_pad_set_caps (mysink1, caps); + gst_pad_set_active (mysink2, TRUE); + gst_pad_set_caps (mysink2, caps); + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK); + + /* One unlinked pad must return OK, two unlinked pads must return NOT_LINKED */ + GST_DEBUG ("Pushing with mysink1 unlinked"); + fail_unless (gst_pad_unlink (teesrc1, mysink1) == TRUE); + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK); + + GST_DEBUG ("Pushing with mysink2 unlinked"); + fail_unless (gst_pad_link (teesrc1, mysink1) == GST_PAD_LINK_OK); + fail_unless (gst_pad_unlink (teesrc2, mysink2) == TRUE); + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK); + + GST_DEBUG ("Pushing with mysink1 AND mysink2 unlinked"); + fail_unless (gst_pad_unlink (teesrc1, mysink1) == TRUE); + fail_unless (gst_pad_push (mysrc, + gst_buffer_ref (buffer)) == GST_FLOW_NOT_LINKED); + + /* Test if everything still works in normal state */ + GST_DEBUG ("Relink both pads and try pushing"); + fail_unless (gst_pad_link (teesrc1, mysink1) == GST_PAD_LINK_OK); + fail_unless (gst_pad_link (teesrc2, mysink2) == GST_PAD_LINK_OK); + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK); + + /* One pad returning ERROR should result in ERROR */ + GST_DEBUG ("Pushing with mysink1 returning GST_FLOW_ERROR"); + gst_pad_set_chain_function (mysink1, _fake_chain_error); + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_ERROR); + + GST_DEBUG ("Pushing with mysink2 returning GST_FLOW_ERROR"); + gst_pad_set_chain_function (mysink1, _fake_chain); + gst_pad_set_chain_function (mysink2, _fake_chain_error); + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_ERROR); + + GST_DEBUG ("Pushing with mysink1 AND mysink2 returning GST_FLOW_ERROR"); + gst_pad_set_chain_function (mysink1, _fake_chain_error); + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_ERROR); + + /* And now everything still needs to work */ + GST_DEBUG ("Try pushing with everything ok"); + gst_pad_set_chain_function (mysink1, _fake_chain); + gst_pad_set_chain_function (mysink2, _fake_chain); + fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK); + + fail_unless (gst_element_set_state (tee, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS); + + fail_unless (gst_pad_unlink (mysrc, teesink) == TRUE); + fail_unless (gst_pad_unlink (teesrc1, mysink1) == TRUE); + fail_unless (gst_pad_unlink (teesrc2, mysink2) == TRUE); + + + gst_object_unref (teesink); + gst_object_unref (teesrc1); + gst_object_unref (teesrc2); + gst_element_release_request_pad (tee, teesrc1); + gst_element_release_request_pad (tee, teesrc2); + gst_object_unref (tee); + + gst_object_unref (mysink1); + gst_object_unref (mysink2); + gst_object_unref (mysrc); + gst_caps_unref (caps); + gst_buffer_unref (buffer); +} + +GST_END_TEST; + +static Suite * +tee_suite (void) +{ + Suite *s = suite_create ("tee"); + TCase *tc_chain = tcase_create ("general"); + + /* Set the timeout to a much larger time - 3 minutes */ + tcase_set_timeout (tc_chain, 180); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_num_buffers); + tcase_add_test (tc_chain, test_stress); + tcase_add_test (tc_chain, test_release_while_buffer_alloc); + tcase_add_test (tc_chain, test_release_while_second_buffer_alloc); + tcase_add_test (tc_chain, test_internal_links); + tcase_add_test (tc_chain, test_flow_aggregation); + + return s; +} + +GST_CHECK_MAIN (tee); diff --git a/tests/check/elements/valve.c b/tests/check/elements/valve.c new file mode 100644 index 0000000..24976fe --- /dev/null +++ b/tests/check/elements/valve.c @@ -0,0 +1,116 @@ +/* GStreamer + * + * unit test for the valve element + * + * Copyright 2009 Collabora Ltd. + * @author: Olivier Crete <olivier.crete@collabora.co.uk> + * Copyright 2009 Nokia Corp. + * + * 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 <gst/check/gstcheck.h> +#include <gst/gst.h> + + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int")); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int")); + +gboolean event_received = FALSE; +gboolean buffer_allocated = FALSE; + +static gboolean +event_func (GstPad * pad, GstEvent * event) +{ + event_received = TRUE; + gst_event_unref (event); + return TRUE; +} + +GST_START_TEST (test_valve_basic) +{ + GstElement *valve; + GstPad *sink; + GstPad *src; + GstCaps *caps, *templ_caps; + + valve = gst_check_setup_element ("valve"); + + sink = gst_check_setup_sink_pad_by_name (valve, &sinktemplate, "src"); + src = gst_check_setup_src_pad_by_name (valve, &srctemplate, "sink"); + gst_pad_set_event_function (sink, event_func); + gst_pad_set_active (src, TRUE); + gst_pad_set_active (sink, TRUE); + gst_element_set_state (valve, GST_STATE_PLAYING); + + g_object_set (valve, "drop", FALSE, NULL); + + fail_unless (gst_pad_push_event (src, gst_event_new_eos ()) == TRUE); + fail_unless (event_received == TRUE); + fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK); + fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK); + fail_unless (g_list_length (buffers) == 2); + caps = gst_pad_get_caps (src, NULL); + templ_caps = gst_pad_get_pad_template_caps (src); + fail_unless (caps && gst_caps_is_equal (caps, templ_caps)); + gst_caps_unref (templ_caps); + gst_caps_unref (caps); + + gst_check_drop_buffers (); + event_received = buffer_allocated = FALSE; + + g_object_set (valve, "drop", TRUE, NULL); + fail_unless (gst_pad_push_event (src, gst_event_new_eos ()) == TRUE); + fail_unless (event_received == FALSE); + fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK); + fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK); + fail_unless (buffers == NULL); + caps = gst_pad_get_caps (src, NULL); + templ_caps = gst_pad_get_pad_template_caps (src); + fail_unless (caps && gst_caps_is_equal (caps, templ_caps)); + gst_caps_unref (templ_caps); + gst_caps_unref (caps); + + gst_pad_set_active (src, FALSE); + gst_pad_set_active (sink, FALSE); + gst_check_teardown_src_pad (valve); + gst_check_teardown_sink_pad (valve); + gst_check_teardown_element (valve); +} + +GST_END_TEST; + +static Suite * +valve_suite (void) +{ + Suite *s = suite_create ("valve"); + TCase *tc_chain; + + tc_chain = tcase_create ("valve_basic"); + tcase_add_test (tc_chain, test_valve_basic); + suite_add_tcase (s, tc_chain); + + return s; +} + +GST_CHECK_MAIN (valve) diff --git a/tests/check/generic/sinks.c b/tests/check/generic/sinks.c new file mode 100644 index 0000000..c647441 --- /dev/null +++ b/tests/check/generic/sinks.c @@ -0,0 +1,1413 @@ +/* GStreamer + * + * unit test for sinks + * + * Copyright (C) <2005> Wim Taymans <wim at fluendo dot 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. + */ + +#include <gst/check/gstcheck.h> + +static void +pop_state_change_message (GstBus * bus, GstElement * src, GstState old, + GstState new, GstState pending) +{ + GstMessage *message = NULL; + GstState _old, _new, _pending; + + message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); + fail_unless (message != NULL, + "Expected state change message, but got nothing"); + + gst_message_parse_state_changed (message, &_old, &_new, &_pending); + + fail_unless (GST_MESSAGE_SRC (message) == (GstObject *) src, + "Unexpected state change order"); + fail_unless (old == _old, "Unexpected old state"); + fail_unless (new == _new, "Unexpected new state"); + fail_unless (pending == _pending, "Unexpected pending state"); + + gst_message_unref (message); +} + +/* a sink should go ASYNC to PAUSE. forcing PLAYING is possible */ +GST_START_TEST (test_sink) +{ + GstElement *sink; + GstStateChangeReturn ret; + GstState current, pending; + + sink = gst_element_factory_make ("fakesink", "sink"); + + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); + + ret = gst_element_set_state (sink, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no forced async state change"); + + ret = gst_element_get_state (sink, ¤t, &pending, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async"); + fail_unless (current == GST_STATE_READY, "bad current state"); + fail_unless (pending == GST_STATE_PLAYING, "bad pending state"); + + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async going back to paused"); + + ret = gst_element_set_state (sink, GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to ready"); + + ret = gst_element_set_state (sink, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null"); + + gst_object_unref (sink); +} + +GST_END_TEST +/* a sink should go ASYNC to PAUSE and PLAYING, when linking a src, it + * should complete the state change. */ +GST_START_TEST (test_sink_completion) +{ + GstElement *sink, *src; + GstStateChangeReturn ret; + GstState current, pending; + + sink = gst_element_factory_make ("fakesink", "sink"); + g_object_set (G_OBJECT (sink), "sync", TRUE, NULL); + + ret = gst_element_set_state (sink, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); + + ret = gst_element_get_state (sink, ¤t, &pending, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async"); + fail_unless (current == GST_STATE_READY, "bad current state"); + fail_unless (pending == GST_STATE_PLAYING, "bad pending state"); + + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "datarate", 200, "sizetype", 2, NULL); + gst_element_link (src, sink); + + ret = gst_element_set_state (src, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); + + /* now wait for final state */ + ret = gst_element_get_state (sink, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to change state"); + fail_unless (current == GST_STATE_PLAYING, "bad current state"); + fail_unless (pending == GST_STATE_VOID_PENDING, "bad pending state"); + + ret = gst_element_set_state (sink, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null"); + + ret = gst_element_set_state (src, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null"); + + gst_object_unref (sink); + gst_object_unref (src); +} + +GST_END_TEST +/* a sink should go ASYNC to PAUSE. PAUSE should complete when + * prerolled. */ +GST_START_TEST (test_src_sink) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + sink = gst_element_factory_make ("fakesink", "sink"); + + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); + ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot start play"); + + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); + fail_unless (current == GST_STATE_PLAYING, "not playing"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot null pipeline"); + + gst_object_unref (pipeline); + +} + +GST_END_TEST +/* a pipeline with live source should return NO_PREROLL in + * PAUSE. When removing the live source it should return ASYNC + * from the sink */ +GST_START_TEST (test_livesrc_remove) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + gst_object_ref (src); + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no no_preroll state return"); + + ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); + + gst_bin_remove (GST_BIN (pipeline), src); + + ret = gst_element_set_state (src, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "async going to null"); + gst_object_unref (src); + + ret = gst_element_get_state (pipeline, ¤t, &pending, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_PAUSED, "not paused"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "async going to null"); + gst_object_unref (pipeline); +} + +GST_END_TEST +/* the sink should go ASYNC to PAUSE. The live source should go + * NO_PREROLL to PAUSE. the pipeline returns NO_PREROLL. An + * attempt to go to PLAYING will return ASYNC. polling state + * completion should return SUCCESS when the sink is gone to + * PLAYING. */ +GST_START_TEST (test_livesrc_sink) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + GstBus *bus; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + bus = gst_element_get_bus (pipeline); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no no_preroll state return"); + + pop_state_change_message (bus, sink, GST_STATE_NULL, GST_STATE_READY, + GST_STATE_VOID_PENDING); + pop_state_change_message (bus, src, GST_STATE_NULL, GST_STATE_READY, + GST_STATE_VOID_PENDING); + pop_state_change_message (bus, pipeline, GST_STATE_NULL, GST_STATE_READY, + GST_STATE_PAUSED); + + /* this order only holds true for live sources because they do not push + buffers in PAUSED */ + pop_state_change_message (bus, src, GST_STATE_READY, GST_STATE_PAUSED, + GST_STATE_VOID_PENDING); + pop_state_change_message (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, + GST_STATE_VOID_PENDING); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no no_preroll state return the second time"); + + ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); + + /* don't block here */ + ret = gst_element_get_state (sink, ¤t, &pending, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); + fail_unless (current == GST_STATE_READY, "not ready"); + fail_unless (pending == GST_STATE_PAUSED, "not paused"); + + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); + fail_unless (current == GST_STATE_PLAYING, "not playing"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); + + /* now we have four messages on the bus: src from paused to playing, sink from + ready to paused and paused to playing, and pipeline from paused to playing. + the pipeline message should be last, and the sink messages should go in + order, but the src message can be interleaved with the sink one. */ + { + GstMessage *m; + GstState old, new, pending; + gint n_src = 1, n_sink = 2; + + while (n_src + n_sink > 0) { + m = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); + fail_unless (m != NULL, "expected state change message"); + gst_message_parse_state_changed (m, &old, &new, &pending); + if (GST_MESSAGE_SRC (m) == (GstObject *) src) { + fail_unless (n_src == 1, "already got one message from the src"); + n_src--; + fail_unless (old == GST_STATE_PAUSED, "unexpected old"); + fail_unless (new == GST_STATE_PLAYING, "unexpected new (got %d)", new); + fail_unless (pending == GST_STATE_VOID_PENDING, "unexpected pending"); + } else if (GST_MESSAGE_SRC (m) == (GstObject *) sink) { + if (n_sink == 2) { + fail_unless (old == GST_STATE_READY, "unexpected old"); + fail_unless (new == GST_STATE_PAUSED, "unexpected new"); + fail_unless (pending == GST_STATE_VOID_PENDING, "unexpected pending"); + } else if (n_sink == 1) { + fail_unless (old == GST_STATE_PAUSED, "unexpected old"); + fail_unless (new == GST_STATE_PLAYING, "unexpected new"); + fail_unless (pending == GST_STATE_VOID_PENDING, "unexpected pending"); + } else { + g_assert_not_reached (); + } + n_sink--; + } else { + g_critical + ("Unexpected state change message src %s (%d src %d sink pending)", + GST_OBJECT_NAME (GST_MESSAGE_SRC (m)), n_src, n_sink); + } + gst_message_unref (m); + } + } + + pop_state_change_message (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, + GST_STATE_VOID_PENDING); + + gst_object_unref (bus); + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* The sink should go ASYNC to PLAYING. The source should go + * to PLAYING with SUCCESS. The pipeline returns ASYNC. */ +GST_START_TEST (test_livesrc2_sink) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); + + ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); + fail_unless (current == GST_STATE_PLAYING, "not playing"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); + + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); + fail_unless (current == GST_STATE_PLAYING, "not playing"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); + + /* and back down */ + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no no_preroll state return"); + + ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not no_preroll"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not paused"); + + /* sink state is not known.. it might be prerolled or not */ + + /* and to READY */ + ret = gst_element_set_state (pipeline, GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); + + ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not success"); + fail_unless (current == GST_STATE_READY, "not ready"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not ready"); + + ret = gst_element_get_state (sink, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not success"); + fail_unless (current == GST_STATE_READY, "not ready"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not ready"); + + /* And destroy. Must be NULL */ + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_livesrc3_sink) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); + + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); + fail_unless (current == GST_STATE_PLAYING, "not playing"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); + + /* and back down */ + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_locked_sink) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + + /* we don't link the elements */ + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no NO_PREROLL state return"); + + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not no_preroll"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have pending"); + + /* the sink is now async going from ready to paused */ + ret = gst_element_get_state (sink, ¤t, &pending, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); + fail_unless (current == GST_STATE_READY, "not ready"); + fail_unless (pending == GST_STATE_PAUSED, "not paused"); + + /* lock the sink */ + gst_element_set_locked_state (sink, TRUE); + + /* move to PlAYING, the sink should remain ASYNC. The pipeline + * returns ASYNC */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* back to PAUSED, we should get NO_PREROLL again */ + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no NO_PREROLL state return"); + + /* unlock the sink */ + gst_element_set_locked_state (sink, FALSE); + + /* and now everything back down */ + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_unlinked_live) +{ + GstElement *sink, *src, *lsrc, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + lsrc = gst_element_factory_make ("fakesrc", "lsrc"); + g_object_set (G_OBJECT (lsrc), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), lsrc); + gst_bin_add (GST_BIN (pipeline), sink); + + /* link non live source to sink */ + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + /* we don't link the srcpad of the live source, it will not contribute to the + * NO_PREROLL. */ + + /* set state to PAUSED, this should return NO_PREROLL because there is a live + * source. since the only sink in this pipeline is linked to a non-live + * source, it will preroll eventually. */ + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no NO_PREROLL state return"); + + /* wait till the sink is prerolled */ + ret = gst_element_get_state (sink, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not success"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have playing"); + + /* the pipeline should still return NO_PREROLL */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not no_preroll"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have playing"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not SUCCESS"); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_delayed_async) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + /* add source, don't add sink yet */ + gst_bin_add (GST_BIN (pipeline), src); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no NO_PREROLL state return"); + + /* add sink now and set to PAUSED */ + gst_bin_add (GST_BIN (pipeline), sink); + + /* This will make the bin notice an ASYNC element. */ + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* we should still be NO_PREROLL now although there is an async element in the + * pipeline. */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not NO_PREROLL"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have pending"); + + /* link live source to sink */ + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* we should get SUCCESS now */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not NO_PREROLL"); + fail_unless (current == GST_STATE_PLAYING, "not PLAYING"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have pending"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not SUCCESS"); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_added_async) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + /* add source, don't add sink yet */ + gst_bin_add (GST_BIN (pipeline), src); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no NO_PREROLL state return"); + + /* set sink to PAUSED without adding it to the pipeline */ + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* add sink now, pipeline should notice the async element */ + gst_bin_add (GST_BIN (pipeline), sink); + + /* we should still be NO_PREROLL now although there is an async element in the + * pipeline. */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not NO_PREROLL"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have pending"); + + /* link live source to sink */ + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* we should get SUCCESS now */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not NO_PREROLL"); + fail_unless (current == GST_STATE_PLAYING, "not PLAYING"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have pending"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not SUCCESS"); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_added_async2) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + sink = gst_element_factory_make ("fakesink", "sink"); + + /* add source, don't add sink yet */ + gst_bin_add (GST_BIN (pipeline), src); + /* need to lock state here or the pipeline might go in error */ + gst_element_set_locked_state (src, TRUE); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no SUCCESS state return"); + + /* set sink to PAUSED without adding it to the pipeline */ + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* add sink now, pipeline should notice the async element */ + gst_bin_add (GST_BIN (pipeline), sink); + + /* we should be ASYNC now because there is an async element in the + * pipeline. */ + ret = gst_element_get_state (pipeline, ¤t, &pending, 0); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not ASYNC"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_PAUSED, "not paused"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not SUCCESS"); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_add_live) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + /* add sink, don't add sourc3 yet */ + gst_bin_add (GST_BIN (pipeline), sink); + + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* set source to PAUSED without adding it to the pipeline */ + ret = gst_element_set_state (src, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no NO_PREROLL state return"); + + /* add source now, pipeline should notice the NO_PREROLL element */ + gst_bin_add (GST_BIN (pipeline), src); + + /* we should be NO_PREROLL now because there is a NO_PREROLL element in the + * pipeline. */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not NO_PREROLL"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have pending"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not SUCCESS"); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static GMutex *blocked_lock; +static GCond *blocked_cond; + +static GstProbeReturn +pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer user_data) +{ + g_mutex_lock (blocked_lock); + GST_DEBUG ("srcpad blocked: %d, sending signal", type); + g_cond_signal (blocked_cond); + g_mutex_unlock (blocked_lock); + + return GST_PROBE_OK; +} + +GST_START_TEST (test_add_live2) +{ + GstElement *sink, *src, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + gulong id; + + blocked_lock = g_mutex_new (); + blocked_cond = g_cond_new (); + + pipeline = gst_pipeline_new ("pipeline"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + /* add sink, don't add source yet */ + gst_bin_add (GST_BIN (pipeline), sink); + + /* set the pipeline to PLAYING. This will return ASYNC on READY->PAUSED */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + g_mutex_lock (blocked_lock); + + GST_DEBUG ("blocking srcpad"); + /* block source pad */ + srcpad = gst_element_get_static_pad (src, "src"); + id = gst_pad_add_probe (srcpad, GST_PROBE_TYPE_BLOCK, pad_blocked_cb, NULL, + NULL); + + /* set source to PAUSED without adding it to the pipeline */ + ret = gst_element_set_state (src, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no NO_PREROLL state return"); + + /* add source now, pipeline should notice the NO_PREROLL element. This + * should trigger as commit of the ASYNC pipeline and make it continue + * to PLAYING. We blocked the source pad so that we don't get an unlinked + * error. */ + gst_bin_add (GST_BIN (pipeline), src); + + /* wait for pad blocked, this means the source is now PLAYING. */ + g_cond_wait (blocked_cond, blocked_lock); + g_mutex_unlock (blocked_lock); + + GST_DEBUG ("linking pads"); + + /* link to sink */ + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + GST_DEBUG ("unblocking srcpad"); + + /* and unblock */ + gst_pad_remove_probe (srcpad, id); + + GST_DEBUG ("getting state"); + + /* we should be SUCCESS now and PLAYING */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not SUCCESS"); + fail_unless (current == GST_STATE_PLAYING, "not PLAYING"); + fail_unless (pending == GST_STATE_VOID_PENDING, "have pending"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not SUCCESS"); + + g_cond_free (blocked_cond); + g_mutex_free (blocked_lock); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_bin_live) +{ + GstElement *sink, *src, *pipeline, *bin; + GstStateChangeReturn ret; + GstState current, pending; + GstPad *srcpad, *sinkpad; + + pipeline = gst_pipeline_new ("pipeline"); + bin = gst_bin_new ("bin"); + src = gst_element_factory_make ("fakesrc", "src"); + g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); + sink = gst_element_factory_make ("fakesink", "sink"); + + gst_bin_add (GST_BIN (bin), src); + gst_bin_add (GST_BIN (bin), sink); + gst_bin_add (GST_BIN (pipeline), bin); + + srcpad = gst_element_get_static_pad (src, "src"); + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_pad_link (srcpad, sinkpad); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + /* PAUSED returns NO_PREROLL because of the live source */ + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no NO_PREROLL state return"); + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not NO_PREROLL"); + fail_unless (current == GST_STATE_PAUSED, "not paused"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not void pending"); + + /* when going to PLAYING, the sink should go to PLAYING ASYNC */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not ASYNC"); + + /* now wait for PLAYING to complete */ + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); + fail_unless (current == GST_STATE_PLAYING, "not playing"); + fail_unless (pending == GST_STATE_VOID_PENDING, "not void pending"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot null pipeline"); + + gst_object_unref (pipeline); +} + +GST_END_TEST static gpointer +send_eos (GstPad * sinkpad) +{ + gboolean ret; + + ret = gst_pad_send_event (sinkpad, gst_event_new_eos ()); + + return GINT_TO_POINTER (ret); +} + +/* push a buffer with a very long duration in a fakesink, then push an EOS + * event. fakesink should emit EOS after the duration of the buffer expired. + * Going to PAUSED, however should not return ASYNC while processing the + * buffer. */ +GST_START_TEST (test_fake_eos) +{ + GstElement *sink, *pipeline; + GstBuffer *buffer; + GstStateChangeReturn ret; + GstPad *sinkpad; + GstFlowReturn res; + GThread *thread; + + pipeline = gst_pipeline_new ("pipeline"); + + sink = gst_element_factory_make ("fakesink", "sink"); + g_object_set (G_OBJECT (sink), "sync", TRUE, NULL); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + + gst_bin_add (GST_BIN_CAST (pipeline), sink); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* push buffer of 100 seconds, since it has a timestamp of 0, it should be + * rendered immediately and the chain function should return immediately */ + buffer = gst_buffer_new_and_alloc (10); + GST_BUFFER_TIMESTAMP (buffer) = 0; + GST_BUFFER_DURATION (buffer) = 100 * GST_SECOND; + res = gst_pad_chain (sinkpad, buffer); + fail_unless (res == GST_FLOW_OK, "no OK flow return"); + + /* wait for preroll, this should happen really soon. */ + ret = gst_element_get_state (pipeline, NULL, NULL, -1); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no SUCCESS state return"); + + /* push EOS, this will block for up to 100 seconds, until the previous + * buffer has finished. We therefore push it in another thread so we can do + * something else while it blocks. */ + thread = g_thread_create ((GThreadFunc) send_eos, sinkpad, TRUE, NULL); + fail_if (thread == NULL, "no thread"); + + /* wait a while so that the thread manages to start and push the EOS */ + g_usleep (G_USEC_PER_SEC); + + /* this should cancel rendering of the EOS event and should return SUCCESS + * because the sink is now prerolled on the EOS. */ + ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no SUCCESS state return"); + + /* we can unref the sinkpad now, we're done with it */ + gst_object_unref (sinkpad); + + /* wait for a second, use the debug log to see that basesink does not discard + * the EOS */ + g_usleep (G_USEC_PER_SEC); + + /* go back to PLAYING, which means waiting some more in EOS, check debug log + * to see this happen. */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no SUCCESS state return"); + g_usleep (G_USEC_PER_SEC); + + /* teardown and cleanup */ + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no SUCCESS state return"); + + /* we can join now */ + g_thread_join (thread); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* this variable is updated in the same thread, first it is set by the + * handoff-preroll signal, then it is checked when the ASYNC_DONE is posted on + * the bus */ +static gboolean have_preroll = FALSE; + +static void +async_done_handoff (GstElement * element, GstBuffer * buf, GstPad * pad, + GstElement * sink) +{ + GST_DEBUG ("we have the preroll buffer"); + have_preroll = TRUE; +} + +/* when we get the ASYNC_DONE, query the position */ +static GstBusSyncReply +async_done_func (GstBus * bus, GstMessage * msg, GstElement * sink) +{ + if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ASYNC_DONE) { + gint64 position; + + GST_DEBUG ("we have ASYNC_DONE now"); + fail_unless (have_preroll == TRUE, "no preroll buffer received"); + + /* get the position now */ + gst_element_query_position (sink, GST_FORMAT_TIME, &position); + + GST_DEBUG ("we have position %" GST_TIME_FORMAT, GST_TIME_ARGS (position)); + + fail_unless (position == 10 * GST_SECOND, "position is wrong"); + } + + /* we must unref the message if we return DROP */ + gst_message_unref (msg); + + /* we can drop the message, nothing is listening for it. */ + return GST_BUS_DROP; +} + +static void +send_buffer (GstPad * sinkpad) +{ + GstBuffer *buffer; + GstFlowReturn ret; + + /* push a second buffer */ + GST_DEBUG ("pushing last buffer"); + buffer = gst_buffer_new_and_alloc (10); + GST_BUFFER_TIMESTAMP (buffer) = 200 * GST_SECOND; + GST_BUFFER_DURATION (buffer) = 100 * GST_SECOND; + + /* this function will initially block */ + ret = gst_pad_chain (sinkpad, buffer); + fail_unless (ret == GST_FLOW_OK, "no OK flow return"); +} + +/* when we get the ASYNC_DONE message from a sink, we want the sink to be able + * to report the duration and position. The sink should also have called the + * render method. */ +GST_START_TEST (test_async_done) +{ + GstElement *sink; + GstEvent *event; + GstStateChangeReturn ret; + GstPad *sinkpad; + GstFlowReturn res; + GstBus *bus; + GThread *thread; + gint64 position; + gboolean qret; + GstSegment segment; + + sink = gst_element_factory_make ("fakesink", "sink"); + g_object_set (G_OBJECT (sink), "sync", TRUE, NULL); + g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL); + + g_signal_connect (sink, "preroll-handoff", (GCallback) async_done_handoff, + sink); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* set bus on element synchronously listen for ASYNC_DONE */ + bus = gst_bus_new (); + gst_element_set_bus (sink, bus); + gst_bus_set_sync_handler (bus, (GstBusSyncHandler) async_done_func, sink); + + /* make newsegment, this sets the position to 10sec when the buffer prerolls */ + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.time = 10 * GST_SECOND; + + event = gst_event_new_segment (&segment); + res = gst_pad_send_event (sinkpad, event); + + /* We have not yet received any buffers so we are still in the READY state, + * the position is therefore still not queryable. */ + position = -1; + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &position); + fail_unless (qret == TRUE, "position wrong"); + fail_unless (position == 10 * GST_SECOND, "position is wrong"); + + /* last buffer, blocks because preroll queue is filled. Start the push in a + * new thread so that we can check the position */ + GST_DEBUG ("starting thread"); + thread = g_thread_create ((GThreadFunc) send_buffer, sinkpad, TRUE, NULL); + fail_if (thread == NULL, "no thread"); + + GST_DEBUG ("waiting 1 second"); + g_usleep (G_USEC_PER_SEC); + GST_DEBUG ("waiting done"); + + /* check if position is still 10 seconds. This is racy because the above + * thread might not yet have started the push, because of the above sleep, + * this is very unlikely, though. */ + gst_element_query_position (sink, GST_FORMAT_TIME, &position); + GST_DEBUG ("second buffer position %" GST_TIME_FORMAT, + GST_TIME_ARGS (position)); + fail_unless (position == 10 * GST_SECOND, "position is wrong"); + + /* now we go to playing. This should unlock and stop the above thread. */ + GST_DEBUG ("going to PLAYING"); + ret = gst_element_set_state (sink, GST_STATE_PLAYING); + + /* join the thread. At this point we know the sink processed the last buffer + * and the position should now be 210 seconds; the time of the last buffer we + * pushed */ + GST_DEBUG ("joining thread"); + g_thread_join (thread); + + gst_element_query_position (sink, GST_FORMAT_TIME, &position); + GST_DEBUG ("last buffer position %" GST_TIME_FORMAT, + GST_TIME_ARGS (position)); + fail_unless (position == 310 * GST_SECOND, "position is wrong"); + + gst_object_unref (sinkpad); + + gst_element_set_state (sink, GST_STATE_NULL); + gst_object_unref (sink); + gst_object_unref (bus); +} + +GST_END_TEST; + +/* when we get the ASYNC_DONE, query the position */ +static GstBusSyncReply +async_done_eos_func (GstBus * bus, GstMessage * msg, GstElement * sink) +{ + if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ASYNC_DONE) { + gint64 position; + + GST_DEBUG ("we have ASYNC_DONE now"); + + /* get the position now */ + gst_element_query_position (sink, GST_FORMAT_TIME, &position); + + GST_DEBUG ("we have position %" GST_TIME_FORMAT, GST_TIME_ARGS (position)); + + fail_unless (position == 10 * GST_SECOND, "position is wrong"); + } + /* we must unref the message if we return DROP */ + gst_message_unref (msg); + /* we can drop the message, nothing is listening for it. */ + return GST_BUS_DROP; +} + +/* when we get the ASYNC_DONE message from a sink, we want the sink to be able + * to report the duration and position. The sink should also have called the + * render method. */ +GST_START_TEST (test_async_done_eos) +{ + GstElement *sink; + GstEvent *event; + GstStateChangeReturn ret; + GstPad *sinkpad; + gboolean res; + GstBus *bus; + gboolean qret; + GstSegment segment; + gint64 position; + GThread *thread; + + sink = gst_element_factory_make ("fakesink", "sink"); + g_object_set (G_OBJECT (sink), "sync", TRUE, NULL); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + + ret = gst_element_set_state (sink, GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no ASYNC state return"); + + /* set bus on element synchronously listen for ASYNC_DONE */ + bus = gst_bus_new (); + gst_element_set_bus (sink, bus); + gst_bus_set_sync_handler (bus, (GstBusSyncHandler) async_done_eos_func, sink); + + /* make newsegment, this sets the position to 10sec when the buffer prerolls */ + GST_DEBUG ("sending segment"); + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.time = 10 * GST_SECOND; + event = gst_event_new_segment (&segment); + res = gst_pad_send_event (sinkpad, event); + + /* We have not yet received any buffers so we are still in the READY state, + * the position is therefore still not queryable. */ + position = -1; + qret = gst_element_query_position (sink, GST_FORMAT_TIME, &position); + fail_unless (qret == TRUE, "position wrong"); + fail_unless (position == 10 * GST_SECOND, "position is wrong"); + + /* Since we are paused and the preroll queue has a length of 1, this function + * will return immediately. The EOS will complete the preroll and the + * position should now be 10 seconds. */ + GST_DEBUG ("pushing EOS"); + GST_DEBUG ("starting thread"); + thread = g_thread_create ((GThreadFunc) send_eos, sinkpad, TRUE, NULL); + fail_if (thread == NULL, "no thread"); + + /* wait for preroll */ + gst_element_get_state (sink, NULL, NULL, -1); + + /* check if position is still 10 seconds */ + gst_element_query_position (sink, GST_FORMAT_TIME, &position); + GST_DEBUG ("EOS position %" GST_TIME_FORMAT, GST_TIME_ARGS (position)); + fail_unless (position == 10 * GST_SECOND, "position is wrong"); + + gst_element_set_state (sink, GST_STATE_NULL); + g_thread_join (thread); + + gst_object_unref (sinkpad); + gst_object_unref (sink); + gst_object_unref (bus); +} + +GST_END_TEST; + +static GMutex *preroll_lock; +static GCond *preroll_cond; + +static void +test_async_false_seek_preroll (GstElement * elem, GstBuffer * buf, + GstPad * pad, gpointer data) +{ + g_mutex_lock (preroll_lock); + GST_DEBUG ("Got preroll buffer %p", buf); + g_cond_signal (preroll_cond); + g_mutex_unlock (preroll_lock); +} + +static void +test_async_false_seek_handoff (GstElement * elem, GstBuffer * buf, + GstPad * pad, gpointer data) +{ + /* should never be reached, we never go to PLAYING */ + GST_DEBUG ("Got handoff buffer %p", buf); + fail_unless (FALSE); +} + +GST_START_TEST (test_async_false_seek) +{ + GstElement *pipeline, *source, *sink; + + preroll_lock = g_mutex_new (); + preroll_cond = g_cond_new (); + + /* Create gstreamer elements */ + pipeline = gst_pipeline_new ("test-pipeline"); + source = gst_element_factory_make ("fakesrc", "file-source"); + sink = gst_element_factory_make ("fakesink", "audio-output"); + + g_object_set (G_OBJECT (sink), "async", FALSE, NULL); + g_object_set (G_OBJECT (sink), "num-buffers", 10, NULL); + g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL); + + g_signal_connect (sink, "handoff", G_CALLBACK (test_async_false_seek_handoff), + NULL); + g_signal_connect (sink, "preroll-handoff", + G_CALLBACK (test_async_false_seek_preroll), NULL); + + /* we add all elements into the pipeline */ + gst_bin_add_many (GST_BIN (pipeline), source, sink, NULL); + + /* we link the elements together */ + gst_element_link (source, sink); + + GST_DEBUG ("Now pausing"); + g_mutex_lock (preroll_lock); + gst_element_set_state (pipeline, GST_STATE_PAUSED); + + /* wait for preroll */ + GST_DEBUG ("wait for preroll"); + g_cond_wait (preroll_cond, preroll_lock); + g_mutex_unlock (preroll_lock); + + g_mutex_lock (preroll_lock); + GST_DEBUG ("Seeking"); + fail_unless (gst_element_seek (pipeline, 1.0, GST_FORMAT_BYTES, + GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, -1)); + + GST_DEBUG ("wait for new preroll"); + /* this either prerolls or fails */ + g_cond_wait (preroll_cond, preroll_lock); + g_mutex_unlock (preroll_lock); + + GST_DEBUG ("bring pipe to state NULL"); + gst_element_set_state (pipeline, GST_STATE_NULL); + + GST_DEBUG ("Deleting pipeline"); + gst_object_unref (GST_OBJECT (pipeline)); + + g_mutex_free (preroll_lock); + g_cond_free (preroll_cond); +} + +GST_END_TEST; + +static GMutex *handoff_lock; +static GCond *handoff_cond; + +static void +test_async_false_seek_in_playing_handoff (GstElement * elem, GstBuffer * buf, + GstPad * pad, gpointer data) +{ + g_mutex_lock (handoff_lock); + GST_DEBUG ("Got handoff buffer %p", buf); + g_cond_signal (handoff_cond); + g_mutex_unlock (handoff_lock); +} + +GST_START_TEST (test_async_false_seek_in_playing) +{ + GstElement *pipeline, *source, *sink; + + handoff_lock = g_mutex_new (); + handoff_cond = g_cond_new (); + + /* Create gstreamer elements */ + pipeline = gst_pipeline_new ("test-pipeline"); + source = gst_element_factory_make ("fakesrc", "fake-source"); + sink = gst_element_factory_make ("fakesink", "fake-output"); + + g_object_set (G_OBJECT (sink), "async", FALSE, NULL); + g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL); + + g_signal_connect (sink, "handoff", + G_CALLBACK (test_async_false_seek_in_playing_handoff), NULL); + + /* we add all elements into the pipeline */ + gst_bin_add_many (GST_BIN (pipeline), source, sink, NULL); + + /* we link the elements together */ + gst_element_link (source, sink); + + GST_DEBUG ("Now playing"); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + g_mutex_lock (handoff_lock); + GST_DEBUG ("wait for handoff buffer"); + g_cond_wait (handoff_cond, handoff_lock); + g_mutex_unlock (handoff_lock); + + GST_DEBUG ("Seeking"); + fail_unless (gst_element_seek (source, 1.0, GST_FORMAT_BYTES, + GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, -1)); + + g_mutex_lock (handoff_lock); + GST_DEBUG ("wait for handoff buffer"); + g_cond_wait (handoff_cond, handoff_lock); + g_mutex_unlock (handoff_lock); + + GST_DEBUG ("bring pipe to state NULL"); + gst_element_set_state (pipeline, GST_STATE_NULL); + + GST_DEBUG ("Deleting pipeline"); + gst_object_unref (GST_OBJECT (pipeline)); + + g_mutex_free (handoff_lock); + g_cond_free (handoff_cond); +} + +GST_END_TEST; + +/* test: try changing state of sinks */ +static Suite * +gst_sinks_suite (void) +{ + Suite *s = suite_create ("Sinks"); + TCase *tc_chain = tcase_create ("general"); + guint timeout = 10; + + /* time out after 10s, not the default 3, we need this for the last test. + * We need a longer timeout when running under valgrind though. */ + if (g_getenv ("CK_DEFAULT_TIMEOUT") != NULL) + timeout = MAX (10, atoi (g_getenv ("CK_DEFAULT_TIMEOUT"))); + tcase_set_timeout (tc_chain, timeout); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_sink); + tcase_add_test (tc_chain, test_sink_completion); + tcase_add_test (tc_chain, test_src_sink); + tcase_add_test (tc_chain, test_livesrc_remove); + tcase_add_test (tc_chain, test_livesrc_sink); + tcase_add_test (tc_chain, test_livesrc2_sink); + tcase_add_test (tc_chain, test_livesrc3_sink); + tcase_add_test (tc_chain, test_locked_sink); + tcase_add_test (tc_chain, test_unlinked_live); + tcase_add_test (tc_chain, test_delayed_async); + tcase_add_test (tc_chain, test_added_async); + tcase_add_test (tc_chain, test_added_async2); + tcase_add_test (tc_chain, test_add_live); + tcase_add_test (tc_chain, test_add_live2); + tcase_add_test (tc_chain, test_bin_live); + tcase_add_test (tc_chain, test_fake_eos); + tcase_add_test (tc_chain, test_async_done); + tcase_add_test (tc_chain, test_async_done_eos); + tcase_add_test (tc_chain, test_async_false_seek); + tcase_add_test (tc_chain, test_async_false_seek_in_playing); + + return s; +} + +GST_CHECK_MAIN (gst_sinks); diff --git a/tests/check/generic/states.c b/tests/check/generic/states.c new file mode 100644 index 0000000..4db8a1b --- /dev/null +++ b/tests/check/generic/states.c @@ -0,0 +1,222 @@ +/* GStreamer + * + * unit test for state changes on all elements + * + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart 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. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <unistd.h> + +#include <gst/check/gstcheck.h> + +static GList *elements = NULL; + +static void +setup (void) +{ + GList *features, *f; + GList *plugins, *p; + gchar **ignorelist = NULL; + const gchar *STATE_IGNORE_ELEMENTS = NULL; + + GST_DEBUG ("getting elements for package %s", PACKAGE); + STATE_IGNORE_ELEMENTS = g_getenv ("GST_STATE_IGNORE_ELEMENTS"); + if (!g_getenv ("GST_NO_STATE_IGNORE_ELEMENTS") && STATE_IGNORE_ELEMENTS) { + GST_DEBUG ("Will ignore element factories: '%s'", STATE_IGNORE_ELEMENTS); + ignorelist = g_strsplit (STATE_IGNORE_ELEMENTS, " ", 0); + } + + plugins = gst_registry_get_plugin_list (gst_registry_get_default ()); + + for (p = plugins; p; p = p->next) { + GstPlugin *plugin = p->data; + + if (strcmp (gst_plugin_get_source (plugin), PACKAGE) != 0) + continue; + + features = + gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), + gst_plugin_get_name (plugin)); + + for (f = features; f; f = f->next) { + GstPluginFeature *feature = f->data; + const gchar *name = gst_plugin_feature_get_name (feature); + gboolean ignore = FALSE; + + if (!GST_IS_ELEMENT_FACTORY (feature)) + continue; + + if (ignorelist) { + gchar **s; + + for (s = ignorelist; s && *s; ++s) { + if (g_str_has_prefix (name, *s)) { + GST_DEBUG ("ignoring element %s", name); + ignore = TRUE; + } + } + if (ignore) + continue; + } + + GST_DEBUG ("adding element %s", name); + elements = g_list_prepend (elements, (gpointer) g_strdup (name)); + } + gst_plugin_feature_list_free (features); + } + gst_plugin_list_free (plugins); + g_strfreev (ignorelist); +} + +static void +teardown (void) +{ + GList *e; + + for (e = elements; e; e = e->next) { + g_free (e->data); + } + g_list_free (elements); + elements = NULL; +} + + +GST_START_TEST (test_state_changes_up_and_down_seq) +{ + GstElement *element; + GList *e; + + for (e = elements; e; e = e->next) { + const gchar *name = e->data; + + GST_DEBUG ("testing element %s", name); + element = gst_element_factory_make (name, name); + fail_if (element == NULL, "Could not make element from factory %s", name); + + if (GST_IS_PIPELINE (element)) { + GST_DEBUG ("element %s is a pipeline", name); + } + + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_NULL); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (element)); + } +} + +GST_END_TEST; + +GST_START_TEST (test_state_changes_up_seq) +{ + GstElement *element; + GList *e; + + for (e = elements; e; e = e->next) { + const gchar *name = e->data; + + GST_DEBUG ("testing element %s", name); + element = gst_element_factory_make (name, name); + fail_if (element == NULL, "Could not make element from factory %s", name); + + if (GST_IS_PIPELINE (element)) { + GST_DEBUG ("element %s is a pipeline", name); + } + + gst_element_set_state (element, GST_STATE_READY); + + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + + gst_element_set_state (element, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (element)); + } +} + +GST_END_TEST; + +GST_START_TEST (test_state_changes_down_seq) +{ + GstElement *element; + GList *e; + + for (e = elements; e; e = e->next) { + const gchar *name = e->data; + + GST_DEBUG ("testing element %s", name); + element = gst_element_factory_make (name, name); + fail_if (element == NULL, "Could not make element from factory %s", name); + + if (GST_IS_PIPELINE (element)) { + GST_DEBUG ("element %s is a pipeline", name); + } + + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_PLAYING); + + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_PLAYING); + + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_PLAYING); + + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (element)); + } +} + +GST_END_TEST; + + +static Suite * +states_suite (void) +{ + Suite *s = suite_create ("states"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_checked_fixture (tc_chain, setup, teardown); + tcase_add_test (tc_chain, test_state_changes_up_and_down_seq); + tcase_add_test (tc_chain, test_state_changes_up_seq); + tcase_add_test (tc_chain, test_state_changes_down_seq); + + return s; +} + +GST_CHECK_MAIN (states); diff --git a/tests/check/gst/capslist.h b/tests/check/gst/capslist.h new file mode 100644 index 0000000..ea468b3 --- /dev/null +++ b/tests/check/gst/capslist.h @@ -0,0 +1,36 @@ +#include <glib.h> + +/* defines an array of strings named caps_list, that contains a list of caps for + general tests. So if you don't know what caps to use to write a test, just + include this file */ + +static const gchar *caps_list[] = { + "audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)g726; audio/x-adpcm, layout=(string)g726", + "video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)I420; video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)YUY2; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)Y42B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)YUV9; video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)Y41B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234", + "video/x-raw, format=(string){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]", + "video/x-raw, format=(string){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]", + "video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", + "video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", + "video/x-raw, format=(string){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", + "video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0x000000FF, framerate = (double) [ 0, max ]", + "video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0xFF000000, framerate = (double) [ 0, max ]", + "video/x-raw-rgb,\\ bpp=(int)32", + /* Test fraction type */ + "test/gst-fraction, fraction = (fraction) 1/8", + "test/gst-fraction, fraction = (fraction) MIN", + "test/gst-fraction, fraction = (fraction) MAX", + /* Test fraction range */ + "test/gst-fraction-range, fraction = (fraction) [ 1/4, 1/3 ]", + "test/gst-fraction-range, fraction = (fraction) [ MIN, MAX ]", + "test/gst-fraction-range, fraction = (fraction) [ 1/MAX, MAX ]", + /* Test lists of fractions and fraction ranges */ + "test/gst-fraction-range, fraction = (fraction) { [ 1/4, 1/3 ], 1/8 }", + "test/gst-fraction-range, fraction = (fraction) { [ 1/4, 1/3 ], [ 1/8, 2/8 ] }", + + /* Some random checks */ + "video/x-raw, format = (string) { I420, Y42B, Y444 }, framerate = (fraction) [1/MAX, MAX], width = (int) [ 1, MAX ], height = (int) [ 1, MAX ]", + + "ANY", + "EMPTY" +}; + diff --git a/tests/check/gst/gst.c b/tests/check/gst/gst.c new file mode 100644 index 0000000..e907959 --- /dev/null +++ b/tests/check/gst/gst.c @@ -0,0 +1,113 @@ +/* GStreamer + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * + * gst.c: Unit test for gst.c + * + * 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 <gst/check/gstcheck.h> +#include <gst/gstversion.h> + +GST_START_TEST (test_init) +{ + /* don't segfault with NULL, NULL */ + gst_init (NULL, NULL); + /* allow calling twice. well, actually, thrice. */ + gst_init (NULL, NULL); +} + +GST_END_TEST; + +GST_START_TEST (test_deinit) +{ + gst_init (NULL, NULL); + + gst_deinit (); +} + +GST_END_TEST; + +GST_START_TEST (test_deinit_sysclock) +{ + GstClock *clock; + + gst_init (NULL, NULL); + + clock = gst_system_clock_obtain (); + gst_object_unref (clock); + + gst_deinit (); +} + +GST_END_TEST; + +/* tests if we can create an element from a compiled-in plugin */ +GST_START_TEST (test_new_pipeline) +{ + GstElement *pipeline; + + pipeline = gst_pipeline_new ("pipeline"); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* tests if we can load an element from a plugin */ +GST_START_TEST (test_new_fakesrc) +{ + GstElement *element; + + element = gst_element_factory_make ("fakesrc", NULL); + gst_object_unref (element); +} + +GST_END_TEST; + +GST_START_TEST (test_version) +{ + guint major, minor, micro, nano; + gchar *version; + + gst_version (&major, &minor, µ, &nano); + assert_equals_int (major, GST_VERSION_MAJOR); + + version = gst_version_string (); + fail_if (version == NULL); + g_free (version); +} + +GST_END_TEST; + +static Suite * +gst_suite (void) +{ + Suite *s = suite_create ("Gst"); + TCase *tc_chain = tcase_create ("gst tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_init); + tcase_add_test (tc_chain, test_new_pipeline); + tcase_add_test (tc_chain, test_new_fakesrc); + tcase_add_test (tc_chain, test_version); + /* run these last so the others don't fail if CK_FORK=no is being used */ + tcase_add_test (tc_chain, test_deinit_sysclock); + tcase_add_test (tc_chain, test_deinit); + + return s; +} + +GST_CHECK_MAIN (gst); diff --git a/tests/check/gst/gstbin.c b/tests/check/gst/gstbin.c new file mode 100644 index 0000000..598e595 --- /dev/null +++ b/tests/check/gst/gstbin.c @@ -0,0 +1,1192 @@ +/* GStreamer + * Copyright (C) 2005 Wim Taymans <wim@fluendo.com> + * Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart dot org> + * + * gstbin.c: Unit test for GstBin + * + * 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 <gst/check/gstcheck.h> + +static void +pop_async_done (GstBus * bus) +{ + GstMessage *message; + + GST_DEBUG ("popping async-done message"); + message = gst_bus_poll (bus, GST_MESSAGE_ASYNC_DONE, -1); + + fail_unless (message && GST_MESSAGE_TYPE (message) + == GST_MESSAGE_ASYNC_DONE, "did not get GST_MESSAGE_ASYNC_DONE"); + + gst_message_unref (message); + GST_DEBUG ("popped message"); +} + +static void +pop_messages (GstBus * bus, int count) +{ + GstMessage *message; + + int i; + + GST_DEBUG ("popping %d messages", count); + for (i = 0; i < count; ++i) { + message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); + + fail_unless (message && GST_MESSAGE_TYPE (message) + == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); + + gst_message_unref (message); + } + GST_DEBUG ("popped %d messages", count); +} + +GST_START_TEST (test_interface) +{ + GstBin *bin, *bin2; + GstElement *filesrc; + GstIterator *it; + GValue item = { 0, }; + + bin = GST_BIN (gst_bin_new (NULL)); + fail_unless (bin != NULL, "Could not create bin"); + + filesrc = gst_element_factory_make ("filesrc", NULL); + fail_unless (filesrc != NULL, "Could not create filesrc"); + fail_unless (GST_IS_URI_HANDLER (filesrc), "Filesrc not a URI handler"); + gst_bin_add (bin, filesrc); + + fail_unless (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc); + gst_object_unref (filesrc); + + it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER); + fail_unless (it != NULL); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); + fail_unless (g_value_get_object (&item) == (gpointer) filesrc); + g_value_reset (&item); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE); + gst_iterator_free (it); + + gst_bin_add_many (bin, + gst_element_factory_make ("identity", NULL), + gst_element_factory_make ("identity", NULL), + gst_element_factory_make ("identity", NULL), NULL); + it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER); + fail_unless (it != NULL); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); + fail_unless (g_value_get_object (&item) == (gpointer) filesrc); + g_value_reset (&item); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE); + gst_iterator_free (it); + + bin2 = bin; + bin = GST_BIN (gst_bin_new (NULL)); + fail_unless (bin != NULL); + gst_bin_add_many (bin, + gst_element_factory_make ("identity", NULL), + gst_element_factory_make ("identity", NULL), + GST_ELEMENT (bin2), gst_element_factory_make ("identity", NULL), NULL); + it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); + fail_unless (g_value_get_object (&item) == (gpointer) filesrc); + g_value_reset (&item); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE); + gst_iterator_free (it); + + gst_bin_add (bin, gst_element_factory_make ("filesrc", NULL)); + gst_bin_add (bin2, gst_element_factory_make ("filesrc", NULL)); + it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); + g_value_reset (&item); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); + g_value_reset (&item); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); + g_value_reset (&item); + fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE); + g_value_unset (&item); + gst_iterator_free (it); + + gst_object_unref (bin); +} + +GST_END_TEST; + +GST_START_TEST (test_message_state_changed) +{ + GstBin *bin; + GstBus *bus; + GstMessage *message; + GstStateChangeReturn ret; + + bin = GST_BIN (gst_bin_new (NULL)); + fail_unless (bin != NULL, "Could not create bin"); + ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); + + bus = g_object_new (gst_bus_get_type (), NULL); + gst_element_set_bus (GST_ELEMENT_CAST (bin), bus); + + /* change state, spawning a message, causing an incref on the bin */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + ASSERT_OBJECT_REFCOUNT (bin, "bin", 2); + + /* get and unref the message, causing a decref on the bin */ + message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); + + fail_unless (message && GST_MESSAGE_TYPE (message) + == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); + + gst_message_unref (message); + + ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); + + /* clean up */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + gst_object_unref (bus); + gst_object_unref (bin); +} + +GST_END_TEST; + +GST_START_TEST (test_message_state_changed_child) +{ + GstBin *bin; + GstElement *src; + GstBus *bus; + GstMessage *message; + GstStateChangeReturn ret; + + bin = GST_BIN (gst_bin_new (NULL)); + fail_unless (bin != NULL, "Could not create bin"); + ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); + + bus = g_object_new (gst_bus_get_type (), NULL); + gst_element_set_bus (GST_ELEMENT_CAST (bin), bus); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + gst_bin_add (bin, src); + ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + + /* change state, spawning two messages: + * - first for fakesrc, forwarded to bin's bus, causing incref on fakesrc + * - second for bin, causing an incref on the bin */ + GST_DEBUG ("setting bin to READY"); + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + ASSERT_OBJECT_REFCOUNT (src, "src", 2); + ASSERT_OBJECT_REFCOUNT (bin, "bin", 2); + + /* get and unref the message, causing a decref on the src */ + message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); + fail_unless (message && GST_MESSAGE_TYPE (message) + == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); + + fail_unless (message->src == GST_OBJECT (src)); + gst_message_unref (message); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (bin, "bin", 2); + + /* get and unref message 2, causing a decref on the bin */ + message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); + fail_unless (message && GST_MESSAGE_TYPE (message) + == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); + + fail_unless (message->src == GST_OBJECT (bin)); + gst_message_unref (message); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); + + /* clean up */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + gst_object_unref (bus); + gst_object_unref (bin); +} + +GST_END_TEST; + +GST_START_TEST (test_message_state_changed_children) +{ + GstPipeline *pipeline; + GstElement *src, *sink; + GstBus *bus; + GstStateChangeReturn ret; + GstState current, pending; + + pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); + fail_unless (pipeline != NULL, "Could not create pipeline"); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + /* need to silence the element as the deep_notify refcounts the + * parents while running */ + g_object_set (G_OBJECT (src), "silent", TRUE, NULL); + gst_bin_add (GST_BIN (pipeline), src); + + sink = gst_element_factory_make ("fakesink", NULL); + /* need to silence the element as the deep_notify refcounts the + * parents while running */ + g_object_set (G_OBJECT (sink), "silent", TRUE, NULL); + fail_if (sink == NULL, "Could not create fakesink"); + gst_bin_add (GST_BIN (pipeline), sink); + + fail_unless (gst_element_link (src, sink), "could not link src and sink"); + + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + + bus = gst_pipeline_get_bus (pipeline); + + /* change state to READY, spawning three messages */ + GST_DEBUG ("setting pipeline to READY"); + ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* each object is referenced by a message */ + ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); + ASSERT_OBJECT_REFCOUNT (src, "src", 2); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 2); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2); + + pop_messages (bus, 3); + fail_if (gst_bus_have_pending (bus), "unexpected pending messages"); + + ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + /* change state to PAUSED, spawning three messages */ + GST_DEBUG ("setting pipeline to PAUSED"); + ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + ret = + gst_element_get_state (GST_ELEMENT (pipeline), ¤t, &pending, + GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + fail_unless (current == GST_STATE_PAUSED); + fail_unless (pending == GST_STATE_VOID_PENDING); + + /* wait for async thread to settle down */ + GST_DEBUG ("waiting for refcount"); + while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 3) + THREAD_SWITCH (); + GST_DEBUG ("refcount <= 3 now"); + + /* each object is referenced by a message; + * base_src is blocked in the push and has an extra refcount. + * base_sink_chain has taken a refcount on the sink, and is blocked on + * preroll + * The stream-status messages holds 2 more refs to the element */ + ASSERT_OBJECT_REFCOUNT (src, "src", 4); + /* refcount can be 4 if the bin is still processing the async_done message of + * the sink. */ + ASSERT_OBJECT_REFCOUNT_BETWEEN (sink, "sink", 2, 3); + /* 2 or 3 is valid, because the pipeline might still be posting + * its state_change message */ + ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "pipeline", 2, 3); + + pop_messages (bus, 3); + pop_async_done (bus); + fail_if ((gst_bus_pop (bus)) != NULL); + + ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + /* change state to PLAYING, spawning three messages */ + GST_DEBUG ("setting pipeline to PLAYING"); + ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + ret = + gst_element_get_state (GST_ELEMENT (pipeline), ¤t, &pending, + GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + fail_unless (current == GST_STATE_PLAYING); + fail_unless (pending == GST_STATE_VOID_PENDING); + + /* each object is referenced by one message + * src might have an extra reference if it's still pushing + * sink might have an extra reference if it's still blocked on preroll + * pipeline posted a new-clock message too. */ + ASSERT_OBJECT_REFCOUNT_BETWEEN (src, "src", 2, 3); + ASSERT_OBJECT_REFCOUNT_BETWEEN (sink, "sink", 2, 3); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3); + + pop_messages (bus, 3); + fail_if ((gst_bus_pop (bus)) != NULL); + + ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); + /* src might have an extra reference if it's still pushing */ + ASSERT_OBJECT_REFCOUNT_BETWEEN (src, "src", 1, 2); + /* sink might have an extra reference if it's still blocked on preroll */ + ASSERT_OBJECT_REFCOUNT_BETWEEN (sink, "sink", 1, 2); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + /* go back to READY, spawning six messages */ + GST_DEBUG ("setting pipeline to READY"); + ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* each object is referenced by two messages, the source also has the + * stream-status message referencing it */ + ASSERT_OBJECT_REFCOUNT (src, "src", 4); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 3); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3); + + pop_messages (bus, 6); + fail_if ((gst_bus_pop (bus)) != NULL); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + /* setting pipeline to NULL flushes the bus automatically */ + ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + /* clean up */ + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_watch_for_state_change) +{ + GstElement *src, *sink, *bin; + GstBus *bus; + GstStateChangeReturn ret; + + bin = gst_element_factory_make ("bin", NULL); + fail_unless (bin != NULL, "Could not create bin"); + + bus = g_object_new (gst_bus_get_type (), NULL); + gst_element_set_bus (GST_ELEMENT_CAST (bin), bus); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + sink = gst_element_factory_make ("fakesink", NULL); + fail_if (sink == NULL, "Could not create fakesink"); + + gst_bin_add (GST_BIN (bin), sink); + gst_bin_add (GST_BIN (bin), src); + + fail_unless (gst_element_link (src, sink), "could not link src and sink"); + + /* change state, spawning two times three messages */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + ret = + gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, + GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + pop_messages (bus, 6); + pop_async_done (bus); + + fail_unless (gst_bus_have_pending (bus) == FALSE, + "Unexpected messages on bus"); + + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + pop_messages (bus, 3); + + /* this one might return either SUCCESS or ASYNC, likely SUCCESS */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); + gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE); + + pop_messages (bus, 3); + if (ret == GST_STATE_CHANGE_ASYNC) + pop_async_done (bus); + + fail_unless (gst_bus_have_pending (bus) == FALSE, + "Unexpected messages on bus"); + + /* setting bin to NULL flushes the bus automatically */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* clean up */ + gst_object_unref (bus); + gst_object_unref (bin); +} + +GST_END_TEST; + +GST_START_TEST (test_state_change_error_message) +{ + GstElement *src, *sink, *bin; + GstBus *bus; + GstStateChangeReturn ret; + + bin = gst_element_factory_make ("bin", NULL); + fail_unless (bin != NULL, "Could not create bin"); + + bus = g_object_new (gst_bus_get_type (), NULL); + gst_element_set_bus (GST_ELEMENT_CAST (bin), bus); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + sink = gst_element_factory_make ("fakesink", NULL); + fail_if (sink == NULL, "Could not create fakesink"); + + /* add but don't link elements */ + gst_bin_add (GST_BIN (bin), sink); + gst_bin_add (GST_BIN (bin), src); + + /* change state, this should succeed */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + /* now wait, the streaming thread will error because the source is not + * linked. */ + ret = gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, + GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_FAILURE); + + gst_bus_set_flushing (bus, TRUE); + + /* setting bin to NULL flushes the bus automatically */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + /* clean up */ + gst_object_unref (bus); + gst_object_unref (bin); +} + +GST_END_TEST; + + +/* adding an element with linked pads to a bin unlinks the + * pads */ +GST_START_TEST (test_add_linked) +{ + GstElement *src, *sink; + GstPad *srcpad, *sinkpad; + GstElement *pipeline; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + sink = gst_element_factory_make ("fakesink", NULL); + fail_if (sink == NULL, "Could not create fakesink"); + + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad != NULL); + sinkpad = gst_element_get_static_pad (sink, "sink"); + fail_unless (sinkpad != NULL); + + fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK); + + /* pads are linked now */ + fail_unless (gst_pad_is_linked (srcpad)); + fail_unless (gst_pad_is_linked (sinkpad)); + + /* adding element to bin voids hierarchy so pads are unlinked */ + gst_bin_add (GST_BIN (pipeline), src); + + /* check if pads really are unlinked */ + fail_unless (!gst_pad_is_linked (srcpad)); + fail_unless (!gst_pad_is_linked (sinkpad)); + + /* cannot link pads in wrong hierarchy */ + fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_WRONG_HIERARCHY); + + /* adding other element to bin as well */ + gst_bin_add (GST_BIN (pipeline), sink); + + /* now we can link again */ + fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK); + + /* check if pads really are linked */ + fail_unless (gst_pad_is_linked (srcpad)); + fail_unless (gst_pad_is_linked (sinkpad)); + + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +/* adding ourself should fail */ +GST_START_TEST (test_add_self) +{ + GstElement *bin; + + bin = gst_bin_new (NULL); + fail_unless (bin != NULL, "Could not create bin"); + + ASSERT_WARNING (gst_bin_add (GST_BIN (bin), bin)); + + gst_object_unref (bin); +} + +GST_END_TEST; + + +/* g_print ("%10s: %4d => %4d\n", GST_OBJECT_NAME (msg->src), old, new); */ + +#define ASSERT_STATE_CHANGE_MSG(bus,element,old_state,new_state,num) \ + { \ + GstMessage *msg; \ + GstState old = 0, new = 0, pending = 0; \ + msg = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); \ + fail_if (msg == NULL, "No state change message within 1 second (#" \ + G_STRINGIFY (num) ")"); \ + gst_message_parse_state_changed (msg, &old, &new, &pending); \ + fail_if (msg->src != GST_OBJECT (element), G_STRINGIFY(element) \ + " should have changed state next (#" G_STRINGIFY (num) ")"); \ + fail_if (old != old_state || new != new_state, "state change is not " \ + G_STRINGIFY (old_state) " => " G_STRINGIFY (new_state)); \ + gst_message_unref (msg); \ + } + +GST_START_TEST (test_children_state_change_order_flagged_sink) +{ + GstElement *src, *identity, *sink, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstBus *bus; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + bus = gst_element_get_bus (pipeline); + fail_unless (bus != NULL, "Pipeline has no bus?!"); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + g_object_set (src, "num-buffers", 5, NULL); + + identity = gst_element_factory_make ("identity", NULL); + fail_if (identity == NULL, "Could not create identity"); + + sink = gst_element_factory_make ("fakesink", NULL); + fail_if (sink == NULL, "Could not create fakesink"); + + gst_bin_add_many (GST_BIN (pipeline), src, identity, sink, NULL); + + fail_unless (gst_element_link (src, identity) == TRUE); + fail_unless (gst_element_link (identity, sink) == TRUE); + + /* (1) Test state change with fakesink being a regular sink */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_if (ret != GST_STATE_CHANGE_ASYNC, + "State change to PLAYING did not return ASYNC"); + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to PLAYING failed"); + fail_if (current != GST_STATE_PLAYING, "State change to PLAYING failed"); + fail_if (pending != GST_STATE_VOID_PENDING, "State change to PLAYING failed"); + + /* NULL => READY */ + ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_NULL, GST_STATE_READY, 101); + ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_NULL, GST_STATE_READY, 102); + ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_NULL, GST_STATE_READY, 103); + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_NULL, GST_STATE_READY, 104); + + /* READY => PAUSED */ + /* because of pre-rolling, sink will return ASYNC on state + * change and change state later when it has a buffer */ + GST_DEBUG ("popping READY -> PAUSED messages"); + ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, + 105); +#if 0 + /* From here on, all bets are off. Usually the source changes state next, + * but it might just as well be that the first buffer produced by the + * source reaches the sink before the source has finished its state change, + * in which case the sink will commit its new state before the source ... */ + ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 106); + ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 107); +#else + + pop_messages (bus, 2); /* pop remaining ready => paused messages off the bus */ + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, + 108); + pop_async_done (bus); +#endif + /* PAUSED => PLAYING */ + GST_DEBUG ("popping PAUSED -> PLAYING messages"); + ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_PAUSED, GST_STATE_PLAYING, 109); + ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_PAUSED, GST_STATE_PLAYING, + 110); + ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 111); + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, + 112); + + /* don't set to NULL that will set the bus flushing and kill our messages */ + ret = gst_element_set_state (pipeline, GST_STATE_READY); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); + ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); + + /* TODO: do we need to check downwards state change order as well? */ + pop_messages (bus, 4); /* pop playing => paused messages off the bus */ + pop_messages (bus, 4); /* pop paused => ready messages off the bus */ + + while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 1) + THREAD_SWITCH (); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to NULL failed"); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + + +GST_START_TEST (test_children_state_change_order_semi_sink) +{ + GstElement *src, *identity, *sink, *pipeline; + GstStateChangeReturn ret; + GstState current, pending; + GstBus *bus; + + /* (2) Now again, but check other code path where we don't have + * a proper sink correctly flagged as such, but a 'semi-sink' */ + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + bus = gst_element_get_bus (pipeline); + fail_unless (bus != NULL, "Pipeline has no bus?!"); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + + identity = gst_element_factory_make ("identity", NULL); + fail_if (identity == NULL, "Could not create identity"); + + sink = gst_element_factory_make ("fakesink", NULL); + fail_if (sink == NULL, "Could not create fakesink"); + + gst_bin_add_many (GST_BIN (pipeline), src, identity, sink, NULL); + + fail_unless (gst_element_link (src, identity) == TRUE); + fail_unless (gst_element_link (identity, sink) == TRUE); + + /* this is not very nice but should work just fine in this case. */ + GST_OBJECT_FLAG_UNSET (sink, GST_ELEMENT_IS_SINK); /* <======== */ + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_if (ret != GST_STATE_CHANGE_ASYNC, "State change to PLAYING not ASYNC"); + ret = + gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to PLAYING failed"); + fail_if (current != GST_STATE_PLAYING, "State change to PLAYING failed"); + fail_if (pending != GST_STATE_VOID_PENDING, "State change to PLAYING failed"); + + /* NULL => READY */ + ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_NULL, GST_STATE_READY, 201); + ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_NULL, GST_STATE_READY, 202); + ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_NULL, GST_STATE_READY, 203); + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_NULL, GST_STATE_READY, 204); + + /* READY => PAUSED */ + /* because of pre-rolling, sink will return ASYNC on state + * change and change state later when it has a buffer */ + GST_DEBUG ("popping READY -> PAUSED messages"); + ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, + 205); +#if 0 + /* From here on, all bets are off. Usually the source changes state next, + * but it might just as well be that the first buffer produced by the + * source reaches the sink before the source has finished its state change, + * in which case the sink will commit its new state before the source ... */ + ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 206); + ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 207); +#else + pop_messages (bus, 2); /* pop remaining ready => paused messages off the bus */ + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, + 208); + pop_async_done (bus); + + /* PAUSED => PLAYING */ + GST_DEBUG ("popping PAUSED -> PLAYING messages"); + ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_PAUSED, GST_STATE_PLAYING, 209); + ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_PAUSED, GST_STATE_PLAYING, + 210); + ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 211); + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, + 212); +#endif + + /* don't set to NULL that will set the bus flushing and kill our messages */ + ret = gst_element_set_state (pipeline, GST_STATE_READY); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); + + /* TODO: do we need to check downwards state change order as well? */ + pop_messages (bus, 4); /* pop playing => paused messages off the bus */ + pop_messages (bus, 4); /* pop paused => ready messages off the bus */ + + GST_DEBUG ("waiting for pipeline to reach refcount 1"); + while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 1) + THREAD_SWITCH (); + + GST_DEBUG ("checking refcount"); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to NULL failed"); + + GST_DEBUG ("checking refcount"); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + GST_DEBUG ("cleanup"); + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_children_state_change_order_two_sink) +{ + GstElement *src, *tee, *identity, *sink1, *sink2, *pipeline; + GstStateChangeReturn ret; + GstBus *bus; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + bus = gst_element_get_bus (pipeline); + fail_unless (bus != NULL, "Pipeline has no bus?!"); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + + tee = gst_element_factory_make ("tee", NULL); + fail_if (tee == NULL, "Could not create tee"); + + identity = gst_element_factory_make ("identity", NULL); + fail_if (identity == NULL, "Could not create identity"); + + sink1 = gst_element_factory_make ("fakesink", NULL); + fail_if (sink1 == NULL, "Could not create fakesink1"); + + sink2 = gst_element_factory_make ("fakesink", NULL); + fail_if (sink2 == NULL, "Could not create fakesink2"); + + gst_bin_add_many (GST_BIN (pipeline), src, tee, identity, sink1, sink2, NULL); + + fail_unless (gst_element_link (src, tee) == TRUE); + fail_unless (gst_element_link (tee, identity) == TRUE); + fail_unless (gst_element_link (identity, sink1) == TRUE); + fail_unless (gst_element_link (tee, sink2) == TRUE); + + ret = gst_element_set_state (pipeline, GST_STATE_READY); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); + + /* NULL => READY */ + { + GstMessage *msg; + GstState old = 0, new = 0, pending = 0; + GstObject *first, *second; + + msg = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); + fail_if (msg == NULL, "No state change message within 1 second (#201)"); + + gst_message_parse_state_changed (msg, &old, &new, &pending); + first = gst_object_ref (msg->src); + + fail_if (first != GST_OBJECT (sink1) && first != GST_OBJECT (sink2), + "sink1 or sink2 should have changed state next #(202)"); + gst_message_unref (msg); + + msg = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); + fail_if (msg == NULL, "No state change message within 1 second (#201)"); + + gst_message_parse_state_changed (msg, &old, &new, &pending); + second = gst_object_ref (msg->src); + + fail_if (second != GST_OBJECT (sink1) && second != GST_OBJECT (sink2), + "sink1 or sink2 should have changed state next #(202)"); + gst_message_unref (msg); + + fail_if (second == first, "got state change from same object"); + + gst_object_unref (first); + gst_object_unref (second); + } + ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_NULL, GST_STATE_READY, 203); + ASSERT_STATE_CHANGE_MSG (bus, tee, GST_STATE_NULL, GST_STATE_READY, 204); + ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_NULL, GST_STATE_READY, 205); + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_NULL, GST_STATE_READY, 206); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (tee, "tee", 1); + ASSERT_OBJECT_REFCOUNT (identity, "identity", 1); + ASSERT_OBJECT_REFCOUNT (sink1, "sink1", 1); + ASSERT_OBJECT_REFCOUNT (sink2, "sink2", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to NULL failed"); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (tee, "tee", 1); + ASSERT_OBJECT_REFCOUNT (identity, "identity", 1); + ASSERT_OBJECT_REFCOUNT (sink1, "sink1", 1); + ASSERT_OBJECT_REFCOUNT (sink2, "sink2", 1); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_iterate_sorted) +{ + GstElement *src, *tee, *identity, *sink1, *sink2, *pipeline, *bin; + GstIterator *it; + GValue elem = { 0, }; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + bin = gst_bin_new (NULL); + fail_unless (bin != NULL, "Could not create bin"); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_if (src == NULL, "Could not create fakesrc"); + + tee = gst_element_factory_make ("tee", NULL); + fail_if (tee == NULL, "Could not create tee"); + + sink1 = gst_element_factory_make ("fakesink", NULL); + fail_if (sink1 == NULL, "Could not create fakesink1"); + + gst_bin_add_many (GST_BIN (bin), src, tee, sink1, NULL); + + fail_unless (gst_element_link (src, tee) == TRUE); + fail_unless (gst_element_link (tee, sink1) == TRUE); + + identity = gst_element_factory_make ("identity", NULL); + fail_if (identity == NULL, "Could not create identity"); + + sink2 = gst_element_factory_make ("fakesink", NULL); + fail_if (sink2 == NULL, "Could not create fakesink2"); + + gst_bin_add_many (GST_BIN (pipeline), bin, identity, sink2, NULL); + + fail_unless (gst_element_link (tee, identity) == TRUE); + fail_unless (gst_element_link (identity, sink2) == TRUE); + + it = gst_bin_iterate_sorted (GST_BIN (pipeline)); + fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK); + fail_unless (g_value_get_object (&elem) == (gpointer) sink2); + g_value_reset (&elem); + + fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK); + fail_unless (g_value_get_object (&elem) == (gpointer) identity); + g_value_reset (&elem); + + fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK); + fail_unless (g_value_get_object (&elem) == (gpointer) bin); + g_value_reset (&elem); + + g_value_unset (&elem); + gst_iterator_free (it); + + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static void +test_link_structure_change_state_changed_sync_cb (GstBus * bus, + GstMessage * message, gpointer data) +{ + GstPipeline *pipeline = GST_PIPELINE (data); + GstElement *src, *identity, *sink; + GstState old, snew, pending; + + sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); + fail_unless (sink != NULL, "Could not get sink"); + + gst_message_parse_state_changed (message, &old, &snew, &pending); + if (message->src != GST_OBJECT (sink) || snew != GST_STATE_READY) { + gst_object_unref (sink); + return; + } + + src = gst_bin_get_by_name (GST_BIN (pipeline), "src"); + fail_unless (src != NULL, "Could not get src"); + + identity = gst_bin_get_by_name (GST_BIN (pipeline), "identity"); + fail_unless (identity != NULL, "Could not get identity"); + + /* link src to identity, the pipeline should detect the new link and + * resync the state change */ + fail_unless (gst_element_link (src, identity) == TRUE); + + gst_object_unref (src); + gst_object_unref (identity); + gst_object_unref (sink); +} + +GST_START_TEST (test_link_structure_change) +{ + GstElement *src, *identity, *sink, *pipeline; + GstBus *bus; + GstState state; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + fail_unless (bus != NULL, "Could not get bus"); + + /* use the sync signal handler to link elements while the pipeline is still + * doing the state change */ + gst_bus_set_sync_handler (bus, gst_bus_sync_signal_handler, pipeline); + g_object_connect (bus, "signal::sync-message::state-changed", + G_CALLBACK (test_link_structure_change_state_changed_sync_cb), pipeline, + NULL); + + src = gst_element_factory_make ("fakesrc", "src"); + fail_if (src == NULL, "Could not create fakesrc"); + + identity = gst_element_factory_make ("identity", "identity"); + fail_if (identity == NULL, "Could not create identity"); + + sink = gst_element_factory_make ("fakesink", "sink"); + fail_if (sink == NULL, "Could not create fakesink1"); + + gst_bin_add_many (GST_BIN (pipeline), src, identity, sink, NULL); + + gst_element_set_state (pipeline, GST_STATE_READY); + gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + + /* the state change will be done on src only if the pipeline correctly resyncs + * after that fakesrc has been linked to identity */ + gst_element_get_state (src, &state, NULL, 0); + fail_unless_equals_int (state, GST_STATE_READY); + + /* clean up */ + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static GstBusSyncReply +sync_handler_remove_sink (GstBus * bus, GstMessage * message, gpointer data) +{ + if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) { + GstElement *child; + + child = gst_bin_get_by_name (GST_BIN (data), "fakesink"); + fail_unless (child != NULL, "Could not find fakesink"); + + gst_bin_remove (GST_BIN (data), child); + gst_object_unref (child); + } + return GST_BUS_PASS; +} + +GST_START_TEST (test_state_failure_remove) +{ + GstElement *src, *sink, *pipeline; + GstBus *bus; + GstStateChangeReturn ret; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + src = gst_element_factory_make ("fakesrc", "fakesrc"); + fail_unless (src != NULL, "Could not create fakesrc"); + + sink = gst_element_factory_make ("fakesink", "fakesink"); + fail_unless (sink != NULL, "Could not create fakesink"); + + g_object_set (sink, "state-error", 1, NULL); + + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + + gst_element_link (src, sink); + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + fail_unless (bus != NULL, "Could not get bus"); + + gst_bus_set_sync_handler (bus, sync_handler_remove_sink, pipeline); + + ret = gst_element_set_state (pipeline, GST_STATE_READY); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, + "did not get state change success"); + + gst_element_set_state (pipeline, GST_STATE_NULL); + + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_many_bins) +{ + GstStateChangeReturn ret; + GstElement *src, *sink, *pipeline, *last_bin = NULL; + gint i; + +#define NUM_BINS 2000 + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + src = gst_element_factory_make ("fakesrc", "fakesrc"); + fail_unless (src != NULL, "Could not create fakesrc"); + g_object_set (src, "num-buffers", 3, NULL); + + sink = gst_element_factory_make ("fakesink", "fakesink"); + fail_unless (sink != NULL, "Could not create fakesink"); + + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + + for (i = 0; i < NUM_BINS; ++i) { + GstElement *bin, *identity; + GstPad *srcpad, *sinkpad; + + bin = gst_bin_new (NULL); + fail_unless (bin != NULL, "Could not create bin %d", i); + identity = gst_element_factory_make ("identity", "identity"); + fail_unless (identity != NULL, "Could not create identity %d", i); + g_object_set (identity, "silent", TRUE, NULL); + gst_bin_add (GST_BIN (bin), identity); + sinkpad = gst_element_get_static_pad (identity, "sink"); + srcpad = gst_element_get_static_pad (identity, "src"); + gst_element_add_pad (bin, gst_ghost_pad_new ("sink", sinkpad)); + gst_element_add_pad (bin, gst_ghost_pad_new ("src", srcpad)); + gst_object_unref (sinkpad); + gst_object_unref (srcpad); + + gst_bin_add (GST_BIN (pipeline), bin); + + if (last_bin == NULL) { + srcpad = gst_element_get_static_pad (src, "src"); + } else { + srcpad = gst_element_get_static_pad (last_bin, "src"); + } + sinkpad = gst_element_get_static_pad (bin, "sink"); + gst_pad_link_full (srcpad, sinkpad, GST_PAD_LINK_CHECK_NOTHING); + gst_object_unref (sinkpad); + gst_object_unref (srcpad); + + + last_bin = bin; + + /* insert some queues to limit the number of function calls in a row */ + if ((i % 100) == 0) { + GstElement *q = gst_element_factory_make ("queue", NULL); + + GST_LOG ("bin #%d, inserting queue", i); + gst_bin_add (GST_BIN (pipeline), q); + fail_unless (gst_element_link (last_bin, q)); + last_bin = q; + } + } + + fail_unless (gst_element_link (last_bin, sink)); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless_equals_int (ret, GST_STATE_CHANGE_ASYNC); + + for (i = 0; i < 15; ++i) { + GST_INFO ("waiting for preroll ..."); + ret = gst_element_get_state (pipeline, NULL, NULL, GST_SECOND); + if (ret != GST_STATE_CHANGE_ASYNC) + break; + } + fail_unless_equals_int (ret, GST_STATE_CHANGE_SUCCESS); + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +gst_bin_suite (void) +{ + Suite *s = suite_create ("GstBin"); + TCase *tc_chain = tcase_create ("bin tests"); + + tcase_set_timeout (tc_chain, 0); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_interface); + tcase_add_test (tc_chain, test_children_state_change_order_flagged_sink); + tcase_add_test (tc_chain, test_children_state_change_order_semi_sink); + tcase_add_test (tc_chain, test_children_state_change_order_two_sink); + tcase_add_test (tc_chain, test_message_state_changed); + tcase_add_test (tc_chain, test_message_state_changed_child); + tcase_add_test (tc_chain, test_message_state_changed_children); + tcase_add_test (tc_chain, test_watch_for_state_change); + tcase_add_test (tc_chain, test_state_change_error_message); + tcase_add_test (tc_chain, test_add_linked); + tcase_add_test (tc_chain, test_add_self); + tcase_add_test (tc_chain, test_iterate_sorted); + tcase_add_test (tc_chain, test_link_structure_change); + tcase_add_test (tc_chain, test_state_failure_remove); + + /* fails on OSX build bot for some reason, and is a bit silly anyway */ + if (0) + tcase_add_test (tc_chain, test_many_bins); + + return s; +} + +GST_CHECK_MAIN (gst_bin); diff --git a/tests/check/gst/gstbuffer.c b/tests/check/gst/gstbuffer.c new file mode 100644 index 0000000..1ac9688 --- /dev/null +++ b/tests/check/gst/gstbuffer.c @@ -0,0 +1,640 @@ +/* GStreamer + * + * unit test for GstBuffer + * + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart 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. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_VALGRIND_H +# include <valgrind/valgrind.h> +#else +# define RUNNING_ON_VALGRIND FALSE +#endif + +#include <gst/check/gstcheck.h> + +GST_START_TEST (test_subbuffer) +{ + GstBuffer *buffer, *sub; + gsize size, maxsize, ssize; + guint8 *data, *sdata; + + buffer = gst_buffer_new_and_alloc (4); + + /* check sizes, buffer starts out empty */ + data = gst_buffer_map (buffer, &size, &maxsize, GST_MAP_WRITE); + fail_unless (size == 4, "buffer has wrong size"); + fail_unless (maxsize >= 4, "buffer has wrong size"); + memset (data, 0, 4); + gst_buffer_unmap (buffer, data, 4); + + data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); + /* set some metadata */ + GST_BUFFER_TIMESTAMP (buffer) = 1; + GST_BUFFER_DURATION (buffer) = 2; + GST_BUFFER_OFFSET (buffer) = 3; + GST_BUFFER_OFFSET_END (buffer) = 4; + + sub = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 1, 2); + fail_if (sub == NULL, "copy region of buffer returned NULL"); + + sdata = gst_buffer_map (sub, &ssize, NULL, GST_MAP_READ); + fail_unless (ssize == 2, "subbuffer has wrong size"); + fail_unless (memcmp (data + 1, sdata, 2) == 0, + "subbuffer contains the wrong data"); + ASSERT_BUFFER_REFCOUNT (sub, "subbuffer", 1); + fail_unless (GST_BUFFER_TIMESTAMP (sub) == -1, + "subbuffer has wrong timestamp"); + fail_unless (GST_BUFFER_DURATION (sub) == -1, "subbuffer has wrong duration"); + fail_unless (GST_BUFFER_OFFSET (sub) == -1, "subbuffer has wrong offset"); + fail_unless (GST_BUFFER_OFFSET_END (sub) == -1, + "subbuffer has wrong offset end"); + gst_buffer_unmap (sub, sdata, ssize); + gst_buffer_unref (sub); + + /* create a subbuffer of size 0 */ + sub = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 1, 0); + fail_if (sub == NULL, "copy_region of buffer returned NULL"); + sdata = gst_buffer_map (sub, &ssize, NULL, GST_MAP_READ); + fail_unless (ssize == 0, "subbuffer has wrong size"); + fail_unless (memcmp (data + 1, sdata, 0) == 0, + "subbuffer contains the wrong data"); + ASSERT_BUFFER_REFCOUNT (sub, "subbuffer", 1); + gst_buffer_unmap (sub, sdata, ssize); + gst_buffer_unref (sub); + + /* test if metadata is coppied, not a complete buffer copy so only the + * timestamp and offset fields are copied. */ + sub = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 0, 1); + fail_if (sub == NULL, "copy_region of buffer returned NULL"); + fail_unless (gst_buffer_get_size (sub) == 1, "subbuffer has wrong size"); + fail_unless (GST_BUFFER_TIMESTAMP (sub) == 1, + "subbuffer has wrong timestamp"); + fail_unless (GST_BUFFER_OFFSET (sub) == 3, "subbuffer has wrong offset"); + fail_unless (GST_BUFFER_DURATION (sub) == -1, "subbuffer has wrong duration"); + fail_unless (GST_BUFFER_OFFSET_END (sub) == -1, + "subbuffer has wrong offset end"); + gst_buffer_unref (sub); + + /* test if metadata is coppied, a complete buffer is copied so all the timing + * fields should be copied. */ + sub = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 0, 4); + fail_if (sub == NULL, "copy_region of buffer returned NULL"); + fail_unless (gst_buffer_get_size (sub) == 4, "subbuffer has wrong size"); + fail_unless (GST_BUFFER_TIMESTAMP (sub) == 1, + "subbuffer has wrong timestamp"); + fail_unless (GST_BUFFER_DURATION (sub) == 2, "subbuffer has wrong duration"); + fail_unless (GST_BUFFER_OFFSET (sub) == 3, "subbuffer has wrong offset"); + fail_unless (GST_BUFFER_OFFSET_END (sub) == 4, + "subbuffer has wrong offset end"); + + /* clean up */ + gst_buffer_unref (sub); + + gst_buffer_unmap (buffer, data, size); + gst_buffer_unref (buffer); +} + +GST_END_TEST; + +GST_START_TEST (test_is_span_fast) +{ + GstBuffer *buffer, *sub1, *sub2; + + buffer = gst_buffer_new_and_alloc (4); + + sub1 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 0, 2); + fail_if (sub1 == NULL, "copy_region of buffer returned NULL"); + + sub2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 2, 2); + fail_if (sub2 == NULL, "copy_region of buffer returned NULL"); + + fail_if (gst_buffer_is_span_fast (buffer, sub2) == TRUE, + "a parent buffer can't be span_fasted"); + + fail_if (gst_buffer_is_span_fast (sub1, buffer) == TRUE, + "a parent buffer can't be span_fasted"); + + fail_if (gst_buffer_is_span_fast (sub1, sub2) == FALSE, + "two subbuffers next to each other should be span_fast"); + + /* clean up */ + gst_buffer_unref (sub1); + gst_buffer_unref (sub2); + gst_buffer_unref (buffer); +} + +GST_END_TEST; + +GST_START_TEST (test_span) +{ + GstBuffer *buffer, *sub1, *sub2, *span; + guint8 *data; + gsize size; + + buffer = gst_buffer_new_and_alloc (4); + + data = gst_buffer_map (buffer, &size, NULL, GST_MAP_WRITE); + memcpy (data, "data", 4); + gst_buffer_unmap (buffer, data, 4); + + ASSERT_CRITICAL (gst_buffer_span (NULL, 1, NULL, 2)); + ASSERT_CRITICAL (gst_buffer_span (buffer, 1, NULL, 2)); + ASSERT_CRITICAL (gst_buffer_span (NULL, 1, buffer, 2)); + ASSERT_CRITICAL (gst_buffer_span (buffer, 0, buffer, 10)); + + sub1 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 0, 2); + fail_if (sub1 == NULL, "copy_region of buffer returned NULL"); + + sub2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 2, 2); + fail_if (sub2 == NULL, "copy_region of buffer returned NULL"); + + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); + ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); + + /* span will create a new subbuffer from the parent */ + span = gst_buffer_span (sub1, 0, sub2, 4); + data = gst_buffer_map (span, &size, NULL, GST_MAP_READ); + fail_unless (size == 4, "spanned buffer is wrong size"); + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); + ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); + ASSERT_BUFFER_REFCOUNT (span, "span", 1); + fail_unless (memcmp (data, "data", 4) == 0, + "spanned buffer contains the wrong data"); + gst_buffer_unmap (span, data, size); + gst_buffer_unref (span); + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + + /* span from non-contiguous buffers will create new buffers */ + span = gst_buffer_span (sub2, 0, sub1, 4); + data = gst_buffer_map (span, &size, NULL, GST_MAP_READ); + fail_unless (size == 4, "spanned buffer is wrong size"); + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); + ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); + ASSERT_BUFFER_REFCOUNT (span, "span", 1); + fail_unless (memcmp (data, "tada", 4) == 0, + "spanned buffer contains the wrong data"); + gst_buffer_unmap (span, data, size); + gst_buffer_unref (span); + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + + /* span with different sizes */ + span = gst_buffer_span (sub1, 1, sub2, 3); + data = gst_buffer_map (span, &size, NULL, GST_MAP_READ); + fail_unless (size == 3, "spanned buffer is wrong size"); + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); + ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); + ASSERT_BUFFER_REFCOUNT (span, "span", 1); + fail_unless (memcmp (data, "ata", 3) == 0, + "spanned buffer contains the wrong data"); + gst_buffer_unmap (span, data, size); + gst_buffer_unref (span); + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + + span = gst_buffer_span (sub2, 0, sub1, 3); + data = gst_buffer_map (span, &size, NULL, GST_MAP_READ); + fail_unless (size == 3, "spanned buffer is wrong size"); + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); + ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); + ASSERT_BUFFER_REFCOUNT (span, "span", 1); + fail_unless (memcmp (data, "tad", 3) == 0, + "spanned buffer contains the wrong data"); + gst_buffer_unmap (span, data, size); + gst_buffer_unref (span); + ASSERT_BUFFER_REFCOUNT (buffer, "parent", 1); + + /* clean up */ + gst_buffer_unref (sub1); + gst_buffer_unref (sub2); + gst_buffer_unref (buffer); +} + +GST_END_TEST; + + +static const char ro_memory[] = "abcdefghijklmnopqrstuvwxyz"; + +static GstBuffer * +create_read_only_buffer (void) +{ + GstBuffer *buf; + + buf = gst_buffer_new (); + + /* assign some read-only data to the new buffer */ + gst_buffer_take_memory (buf, -1, + gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, + (gpointer) ro_memory, NULL, + sizeof (ro_memory), 0, sizeof (ro_memory))); + + return buf; +} + +GST_START_TEST (test_make_writable) +{ + GstBuffer *buf, *buf2; + guint8 *data; + gsize size; + + /* create read-only buffer and make it writable */ + buf = create_read_only_buffer (); + + data = gst_buffer_map (buf, &size, NULL, GST_MAP_WRITE); + data[4] = 'a'; + gst_buffer_unmap (buf, data, size); + gst_buffer_unref (buf); + + /* alloc'ed buffer with refcount 1 should be writable */ + buf = gst_buffer_new_and_alloc (32); + buf2 = gst_buffer_make_writable (buf); + fail_unless (buf == buf2, + "_make_writable() should have returned same buffer"); + gst_buffer_unref (buf2); + + /* alloc'ed buffer with refcount >1 should be copied */ + buf = gst_buffer_new_and_alloc (32); + gst_buffer_ref (buf); + buf2 = gst_buffer_make_writable (buf); + fail_unless (buf != buf2, "_make_writable() should have returned a copy!"); + gst_buffer_unref (buf2); + gst_buffer_unref (buf); +} + +GST_END_TEST; + +GST_START_TEST (test_subbuffer_make_writable) +{ + GstBuffer *buf, *sub_buf; + guint8 *data; + gsize size; + + /* create sub-buffer of read-only buffer and make it writable */ + buf = create_read_only_buffer (); + + sub_buf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, 0, 8); + + data = gst_buffer_map (sub_buf, &size, NULL, GST_MAP_WRITE); + fail_if (data == NULL); + data[4] = 'a'; + gst_buffer_unmap (sub_buf, data, size); + gst_buffer_unref (sub_buf); + gst_buffer_unref (buf); +} + +GST_END_TEST; + +GST_START_TEST (test_metadata_writable) +{ + GstBuffer *buffer, *sub1; + + buffer = gst_buffer_new_and_alloc (4); + GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); + GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); + + /* Buffer with refcount 1 should have writable metadata */ + fail_unless (gst_buffer_is_writable (buffer) == TRUE); + + /* Check that a buffer with refcount 2 does not have writable metadata */ + gst_buffer_ref (buffer); + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 2); + fail_unless (gst_buffer_is_writable (buffer) == FALSE); + + /* Check that make_metadata_writable produces a new sub-buffer with + * writable metadata. */ + sub1 = gst_buffer_make_writable (buffer); + fail_if (sub1 == buffer); + fail_unless (gst_buffer_is_writable (sub1) == TRUE); + + /* Check that make_metadata_writable() maintains the buffer flags */ + fail_unless (GST_BUFFER_FLAG_IS_SET (sub1, GST_BUFFER_FLAG_DISCONT)); + fail_unless (GST_BUFFER_FLAG_IS_SET (sub1, GST_BUFFER_FLAG_DELTA_UNIT)); + + /* Unset flags on writable buffer, then make sure they're still + * set on the original buffer */ + GST_BUFFER_FLAG_UNSET (sub1, GST_BUFFER_FLAG_DISCONT); + GST_BUFFER_FLAG_UNSET (sub1, GST_BUFFER_FLAG_DELTA_UNIT); + fail_unless (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)); + fail_unless (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)); + + /* Drop the subbuffer and check that the metadata is now writable again */ + ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); + gst_buffer_unref (sub1); + fail_unless (gst_buffer_is_writable (buffer) == TRUE); + + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + gst_buffer_unref (buffer); +} + +GST_END_TEST; + +GST_START_TEST (test_copy) +{ + GstBuffer *buffer, *copy; + gsize size, ssize; + guint8 *data, *sdata; + + buffer = gst_buffer_new_and_alloc (4); + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + + copy = gst_buffer_copy (buffer); + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + ASSERT_BUFFER_REFCOUNT (copy, "copy", 1); + /* buffers are copied and must point to different memory */ + fail_if (buffer == copy); + + data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); + sdata = gst_buffer_map (copy, &ssize, NULL, GST_MAP_READ); + + /* NOTE that data is refcounted */ + fail_unless (size == ssize); + + gst_buffer_unmap (copy, sdata, ssize); + gst_buffer_unmap (buffer, data, size); + + gst_buffer_unref (copy); + gst_buffer_unref (buffer); + + /* a 0-sized buffer has NULL data as per docs */ + buffer = gst_buffer_new_and_alloc (0); + data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); + fail_unless (data == NULL); + gst_buffer_unmap (buffer, data, size); + + /* copying a 0-sized buffer should not crash and also set + * the data member NULL. */ + copy = gst_buffer_copy (buffer); + data = gst_buffer_map (copy, &size, NULL, GST_MAP_READ); + fail_unless (data == NULL); + gst_buffer_unmap (copy, data, size); + + gst_buffer_unref (copy); + gst_buffer_unref (buffer); +} + +GST_END_TEST; + +GST_START_TEST (test_try_new_and_alloc) +{ + GstBuffer *buf; + gsize size; + guint8 *data; + + /* special case: alloc of 0 bytes results in new buffer with NULL data */ + buf = gst_buffer_new_and_alloc (0); + fail_unless (buf != NULL); + fail_unless (GST_IS_BUFFER (buf)); + data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ); + fail_unless (data == NULL); + gst_buffer_unmap (buf, data, size); + gst_buffer_unref (buf); + + /* normal alloc should still work */ + buf = gst_buffer_new_and_alloc (640 * 480 * 4); + fail_unless (buf != NULL); + fail_unless (GST_IS_BUFFER (buf)); + data = gst_buffer_map (buf, &size, NULL, GST_MAP_WRITE); + fail_unless (data != NULL); + fail_unless (size == (640 * 480 * 4)); + data[640 * 479 * 4 + 479] = 0xff; + gst_buffer_unmap (buf, data, size); + + gst_buffer_unref (buf); + +#if 0 + /* Disabled this part of the test, because it happily succeeds on 64-bit + * machines that have enough memory+swap, because the address space is large + * enough. There's not really any way to test the failure case except by + * allocating chunks of memory until it fails, which would suck. */ + + /* now this better fail (don't run in valgrind, it will abort + * or warn when passing silly arguments to malloc) */ + if (!RUNNING_ON_VALGRIND) { + buf = gst_buffer_new_and_alloc ((guint) - 1); + fail_unless (buf == NULL); + } +#endif +} + +GST_END_TEST; + +GST_START_TEST (test_size) +{ + GstBuffer *buf; + GstMemory *mem; + gsize maxalloc, maxalloc2, maxalloc3, maxalloc4; + gsize size, maxsize, offset; + + /* one memory block */ + buf = gst_buffer_new_allocate (NULL, 100, 0); + + size = gst_buffer_get_sizes (buf, &offset, &maxalloc); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxalloc >= 100); + + mem = gst_buffer_peek_memory (buf, 0, GST_MAP_WRITE); + gst_memory_resize (mem, 10, 70); + + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 70); + fail_unless (offset == 10); + fail_unless (maxsize == maxalloc); + + /* new memory */ + mem = gst_allocator_alloc (NULL, 100, 0); + size = gst_memory_get_sizes (mem, &offset, &maxalloc2); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxalloc2 >= 100); + + gst_memory_resize (mem, 20, 60); + size = gst_memory_get_sizes (mem, &offset, &maxsize); + fail_unless (size == 60); + fail_unless (offset == 20); + fail_unless (maxsize == maxalloc2); + + /* append */ + gst_buffer_take_memory (buf, -1, mem); + + size = gst_buffer_get_sizes (buf, &offset, &maxalloc); + fail_unless (size == 130); + fail_unless (offset == 10); + /* the maxsize is the size of the first buffer plus the remaining size in the + * second buffer */ + fail_unless (maxalloc == 80 + (maxalloc2 - 20)); + + /* appending an empty block */ + mem = gst_allocator_alloc (NULL, 100, 0); + size = gst_memory_get_sizes (mem, &offset, &maxalloc3); + gst_memory_resize (mem, 0, 0); + gst_buffer_take_memory (buf, -1, mem); + + size = gst_buffer_get_sizes (buf, &offset, &maxalloc); + fail_unless (size == 130); + fail_unless (offset == 10); + /* the maxsize is the size of the first buffer plus the remaining size in the + * second buffer and the last empty buffer*/ + fail_unless (maxalloc == 80 + (maxalloc2 - 20) + maxalloc3); + + /* prepending an empty block */ + mem = gst_allocator_alloc (NULL, 100, 0); + size = gst_memory_get_sizes (mem, &offset, &maxalloc4); + gst_memory_resize (mem, 0, 0); + gst_buffer_take_memory (buf, 0, mem); + + size = gst_buffer_get_sizes (buf, &offset, &maxalloc); + fail_unless (size == 130); + /* empty buffer maxsize can be used as offset */ + fail_unless (offset == 10 + maxalloc4); + /* the maxsize is the size of the first buffer plus the remaining size in the + * second buffer and the last empty buffer*/ + fail_unless (maxalloc == 80 + (maxalloc2 - 20) + maxalloc3 + maxalloc4); + + gst_buffer_unref (buf); +} + +GST_END_TEST; + +GST_START_TEST (test_resize) +{ + GstBuffer *buf; + gsize maxalloc; + gsize size, maxsize, offset; + + /* one memory block */ + buf = gst_buffer_new_allocate (NULL, 100, 0); + + size = gst_buffer_get_sizes (buf, &offset, &maxalloc); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxalloc >= 100); + + ASSERT_CRITICAL (gst_buffer_resize (buf, 200, 50)); + ASSERT_CRITICAL (gst_buffer_resize (buf, 0, 150)); + ASSERT_CRITICAL (gst_buffer_resize (buf, 1, maxalloc)); + ASSERT_CRITICAL (gst_buffer_resize (buf, maxalloc, 1)); + + /* this does nothing */ + gst_buffer_resize (buf, 0, 100); + + /* nothing should have changed */ + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxsize == maxalloc); + + gst_buffer_resize (buf, 0, 50); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 50); + fail_unless (offset == 0); + fail_unless (maxsize == maxalloc); + + gst_buffer_resize (buf, 0, 100); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxsize == maxalloc); + + gst_buffer_resize (buf, 1, 99); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 99); + fail_unless (offset == 1); + fail_unless (maxsize == maxalloc); + + ASSERT_CRITICAL (gst_buffer_resize (buf, 1, maxalloc - 1)); + + gst_buffer_resize (buf, 0, 99); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 99); + fail_unless (offset == 1); + fail_unless (maxsize == maxalloc); + + gst_buffer_resize (buf, -1, 100); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxsize == maxalloc); + + ASSERT_CRITICAL (gst_buffer_resize (buf, -1, 100)); + + gst_buffer_resize (buf, 50, 40); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 40); + fail_unless (offset == 50); + fail_unless (maxsize == maxalloc); + + gst_buffer_resize (buf, -50, 100); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxsize == maxalloc); + + gst_buffer_resize (buf, 0, 0); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 0); + fail_unless (offset == 0); + fail_unless (maxsize == maxalloc); + + gst_buffer_resize (buf, 0, 100); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxsize == maxalloc); + + gst_buffer_resize (buf, 0, 100); + size = gst_buffer_get_sizes (buf, &offset, &maxsize); + fail_unless (size == 100); + fail_unless (offset == 0); + fail_unless (maxsize == maxalloc); + + gst_buffer_unref (buf); +} + +GST_END_TEST; + +static Suite * +gst_buffer_suite (void) +{ + Suite *s = suite_create ("GstBuffer"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_subbuffer); + tcase_add_test (tc_chain, test_subbuffer_make_writable); + tcase_add_test (tc_chain, test_make_writable); + tcase_add_test (tc_chain, test_is_span_fast); + tcase_add_test (tc_chain, test_span); + tcase_add_test (tc_chain, test_metadata_writable); + tcase_add_test (tc_chain, test_copy); + tcase_add_test (tc_chain, test_try_new_and_alloc); + tcase_add_test (tc_chain, test_size); + tcase_add_test (tc_chain, test_resize); + + return s; +} + +GST_CHECK_MAIN (gst_buffer); diff --git a/tests/check/gst/gstbufferlist.c b/tests/check/gst/gstbufferlist.c new file mode 100644 index 0000000..2e2fdcd --- /dev/null +++ b/tests/check/gst/gstbufferlist.c @@ -0,0 +1,779 @@ +/* GStreamer + * + * unit test for GstBufferList + * + * Copyright (C) 2009 Axis Communications <dev-gstreamer at axis dot com> + * @author Jonas Holmberg <jonas dot holmberg at axis dot 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. + */ + +#include <gst/check/gstcheck.h> +#include <gst/gstbufferlist.h> +#include <string.h> + +#define TIMESTAMP 42 + +static GstBufferList *list; +static GstCaps *caps; + +static void +setup (void) +{ + list = gst_buffer_list_new (); + caps = gst_caps_new_simple ("text/plain", NULL); +} + +static void +cleanup (void) +{ + gst_caps_unref (caps); + gst_buffer_list_unref (list); +} + +#if 0 +static GstBuffer * +buffer_from_string (const gchar * str) +{ + gsize size; + GstBuffer *buf; + gpointer data; + + size = strlen (str); + buf = gst_buffer_new_and_alloc (size); + gst_buffer_set_caps (buf, caps); + GST_BUFFER_TIMESTAMP (buf) = TIMESTAMP; + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + memcpy (data, str, size); + gst_buffer_unmap (buf, data, size); + + return buf; +} + +static void +check_buffer (GstBuffer * buf, gsize size, const gchar * data) +{ + gchar *bdata; + gsize bsize, csize, msize; + + bdata = gst_buffer_map (buf, &bsize, &msize, GST_MAP_READ); + csize = size ? size : bsize; + GST_DEBUG ("%lu %lu %lu", bsize, csize, msize); + fail_unless (bsize == csize); + fail_unless (memcmp (bdata, data, csize) == 0); + gst_buffer_unmap (buf, bdata, bsize); +} +#endif + +GST_START_TEST (test_add_and_iterate) +{ + GstBuffer *buf1; + GstBuffer *buf2; + + /* buffer list is initially empty */ + fail_unless (gst_buffer_list_len (list) == 0); + + ASSERT_CRITICAL (gst_buffer_list_insert (list, 0, NULL)); + ASSERT_CRITICAL (gst_buffer_list_insert (NULL, 0, NULL)); + + buf1 = gst_buffer_new (); + + /* add a group of 2 buffers */ + fail_unless (gst_buffer_list_len (list) == 0); + ASSERT_CRITICAL (gst_buffer_list_insert (list, -1, NULL)); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 1); + gst_buffer_list_add (list, buf1); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 1); /* list takes ownership */ + fail_unless (gst_buffer_list_len (list) == 1); + buf2 = gst_buffer_new (); + gst_buffer_list_add (list, buf2); + ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 1); + fail_unless (gst_buffer_list_len (list) == 2); +} + +GST_END_TEST; + +#if 0 +GST_START_TEST (test_make_writable) +{ + GstBufferListIterator *it; + GstBufferList *wlist; + GstBuffer *buf1; + GstBuffer *buf2; + GstBuffer *buf3; + GstBuffer *buf; + + /* add buffers to list */ + it = gst_buffer_list_iterate (list); + gst_buffer_list_iterator_add_group (it); + buf1 = gst_buffer_new_and_alloc (1); + gst_buffer_list_iterator_add (it, buf1); + gst_buffer_list_iterator_add_group (it); + buf2 = gst_buffer_new_and_alloc (2); + gst_buffer_list_iterator_add (it, buf2); + buf3 = gst_buffer_new_and_alloc (3); + gst_buffer_list_iterator_add (it, buf3); + gst_buffer_list_iterator_free (it); + + /* making it writable with refcount 1 returns the same list */ + wlist = gst_buffer_list_make_writable (list); + fail_unless (wlist == list); + it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_next_group (it)); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf1); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 1); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_unless (gst_buffer_list_iterator_next_group (it)); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf2); + ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 1); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf3); + ASSERT_BUFFER_REFCOUNT (buf3, "buf3", 1); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_if (gst_buffer_list_iterator_next_group (it)); + gst_buffer_list_iterator_free (it); + + /* making it writable with refcount 2 returns a copy of the list with + * increased refcount on the buffers in the list */ + gst_buffer_list_ref (list); + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (list) == 2); + wlist = gst_buffer_list_make_writable (list); + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (list) == 1); + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (wlist) == 1); + fail_unless (wlist != list); + it = gst_buffer_list_iterate (wlist); + fail_unless (gst_buffer_list_iterator_next_group (it)); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf1); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 2); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_unless (gst_buffer_list_iterator_next_group (it)); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf2); + ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 2); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf3); + ASSERT_BUFFER_REFCOUNT (buf3, "buf3", 2); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_if (gst_buffer_list_iterator_next_group (it)); + gst_buffer_list_iterator_free (it); + gst_buffer_list_unref (wlist); +} + +GST_END_TEST; + +GST_START_TEST (test_copy) +{ + GstBufferListIterator *it; + GstBufferList *list_copy; + GstBuffer *buf1; + GstBuffer *buf2; + GstBuffer *buf3; + GstBuffer *buf; + + /* add buffers to the list */ + it = gst_buffer_list_iterate (list); + gst_buffer_list_iterator_add_group (it); + buf1 = gst_buffer_new (); + gst_buffer_list_iterator_add (it, buf1); + gst_buffer_list_iterator_add_group (it); + buf2 = gst_buffer_new (); + gst_buffer_list_iterator_add (it, buf2); + buf3 = gst_buffer_new (); + gst_buffer_list_iterator_add (it, buf3); + gst_buffer_list_iterator_free (it); + + /* make a copy */ + list_copy = gst_buffer_list_copy (list); + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (list) == 1); + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (list_copy) == 1); + fail_unless (list_copy != list); + it = gst_buffer_list_iterate (list_copy); + fail_unless (gst_buffer_list_iterator_next_group (it)); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf1); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 2); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_unless (gst_buffer_list_iterator_next_group (it)); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf2); + ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 2); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf3); + ASSERT_BUFFER_REFCOUNT (buf3, "buf3", 2); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_if (gst_buffer_list_iterator_next_group (it)); + gst_buffer_list_iterator_free (it); + gst_buffer_list_unref (list_copy); +} + +GST_END_TEST; + +GST_START_TEST (test_steal) +{ + GstBufferListIterator *it; + GstBuffer *buf1; + GstBuffer *buf2; + GstBuffer *buf3; + GstBuffer *buf; + + /* add buffers to the list */ + it = gst_buffer_list_iterate (list); + gst_buffer_list_iterator_add_group (it); + buf1 = gst_buffer_new (); + gst_buffer_list_iterator_add (it, buf1); + gst_buffer_list_iterator_add_group (it); + buf2 = gst_buffer_new (); + gst_buffer_list_iterator_add (it, buf2); + buf3 = gst_buffer_new (); + gst_buffer_list_iterator_add (it, buf3); + gst_buffer_list_iterator_free (it); + + /* check some error handling */ + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_steal (NULL))); + fail_unless (buf == NULL); + it = gst_buffer_list_iterate (list); + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_steal (it))); + fail_unless (buf == NULL); + + /* steal the first buffer */ + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_steal (it))); + fail_unless (gst_buffer_list_iterator_next_group (it)); + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_steal (it))); + fail_unless (gst_buffer_list_iterator_next (it) == buf1); + buf = gst_buffer_list_iterator_steal (it); + fail_unless (buf == buf1); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 1); + gst_buffer_unref (buf); + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_steal (it))); + fail_unless (buf == NULL); + + /* steal the second buffer */ + fail_unless (gst_buffer_list_iterator_next_group (it)); + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_steal (it))); + fail_unless (gst_buffer_list_iterator_next (it) == buf2); + buf = gst_buffer_list_iterator_steal (it); + fail_unless (buf == buf2); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 1); + gst_buffer_unref (buf); + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_steal (it))); + + /* steal the third buffer */ + fail_unless (gst_buffer_list_iterator_next (it) == buf3); + buf = gst_buffer_list_iterator_steal (it); + fail_unless (buf == buf3); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 1); + gst_buffer_unref (buf); + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_steal (it))); + + gst_buffer_list_iterator_free (it); + + /* iterate again when all buffers have been stolen */ + it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_unless (gst_buffer_list_iterator_next_group (it)); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_unless (gst_buffer_list_iterator_next_group (it)); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_if (gst_buffer_list_iterator_next_group (it)); + gst_buffer_list_iterator_free (it); +} + +GST_END_TEST; + +GST_START_TEST (test_take) +{ + GstBufferListIterator *it; + GstBuffer *buf1; + GstBuffer *buf2; + GstBuffer *buf3; + GstBuffer *buf; + + /* add buffers to the list */ + it = gst_buffer_list_iterate (list); + gst_buffer_list_iterator_add_group (it); + buf1 = gst_buffer_new (); + gst_buffer_ref (buf1); + gst_buffer_list_iterator_add (it, buf1); + gst_buffer_list_iterator_add_group (it); + buf2 = gst_buffer_new (); + gst_buffer_ref (buf2); + gst_buffer_list_iterator_add (it, buf2); + buf3 = gst_buffer_new (); + gst_buffer_ref (buf3); + gst_buffer_list_iterator_add (it, buf3); + gst_buffer_list_iterator_free (it); + + /* check some error handling */ + ASSERT_CRITICAL (gst_buffer_list_iterator_take (NULL, NULL)); + it = gst_buffer_list_iterate (list); + ASSERT_CRITICAL (gst_buffer_list_iterator_take (it, NULL)); + buf = gst_buffer_new (); + gst_buffer_ref (buf); + ASSERT_CRITICAL (gst_buffer_list_iterator_take (NULL, buf)); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 2); + + /* replace the first buffer */ + ASSERT_CRITICAL (gst_buffer_list_iterator_take (it, buf)); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 2); + fail_unless (gst_buffer_list_iterator_next_group (it)); + ASSERT_CRITICAL (gst_buffer_list_iterator_take (it, buf)); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 2); + fail_unless (gst_buffer_list_iterator_next (it) == buf1); + ASSERT_CRITICAL (gst_buffer_list_iterator_take (it, NULL)); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 2); + gst_buffer_list_iterator_take (it, buf); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 2); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 1); + gst_buffer_unref (buf1); + + /* replace the first buffer again, with itself */ + gst_buffer_ref (buf); + gst_buffer_list_iterator_take (it, buf); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 2); + + /* replace the second buffer */ + gst_buffer_ref (buf); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + ASSERT_CRITICAL (gst_buffer_list_iterator_take (it, buf)); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 3); + fail_unless (gst_buffer_list_iterator_next_group (it)); + ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 2); + ASSERT_CRITICAL (gst_buffer_list_iterator_take (it, buf)); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 3); + ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 2); + fail_unless (gst_buffer_list_iterator_next (it) == buf2); + ASSERT_CRITICAL (gst_buffer_list_iterator_take (it, NULL)); + ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 2); + gst_buffer_list_iterator_take (it, buf); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 3); + ASSERT_BUFFER_REFCOUNT (buf2, "buf2", 1); + gst_buffer_unref (buf2); + + /* replace the third buffer */ + gst_buffer_ref (buf); + fail_unless (gst_buffer_list_iterator_next (it) == buf3); + ASSERT_BUFFER_REFCOUNT (buf3, "buf3", 2); + gst_buffer_list_iterator_take (it, buf); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 4); + ASSERT_BUFFER_REFCOUNT (buf3, "buf3", 1); + gst_buffer_unref (buf3); + fail_if (gst_buffer_list_iterator_next_group (it)); + ASSERT_CRITICAL (gst_buffer_list_iterator_take (it, buf)); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 4); + gst_buffer_unref (buf); + + gst_buffer_list_iterator_free (it); +} + +GST_END_TEST; + +static gpointer do_data_func_data; +static gboolean notified; + +static GstBuffer * +do_data_func (GstBuffer * buffer, gpointer data) +{ + do_data_func_data = data; + fail_if (notified); + + return buffer; +} + +static GstBuffer * +do_func_null (GstBuffer * buffer) +{ + gst_buffer_unref (buffer); + + return NULL; +} + +GST_START_TEST (test_do) +{ + GstBufferListIterator *it; + GstBuffer *buf1; + GstBuffer *buf; + gchar *data; + + /* error handling */ + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_do (NULL, NULL, NULL))); + fail_unless (buf == NULL); + fail_unless (buf == NULL); + it = gst_buffer_list_iterate (list); + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_do (it, NULL, NULL))); + fail_unless (buf == NULL); + fail_unless (buf == NULL); + + /* add buffers to the list */ + gst_buffer_list_iterator_add_group (it); + buf1 = gst_buffer_new (); + gst_buffer_ref (buf1); + gst_buffer_list_iterator_add (it, buf1); + gst_buffer_list_iterator_add_group (it); + gst_buffer_list_iterator_free (it); + + /* call do-function */ + it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_next_group (it)); + ASSERT_CRITICAL ((buf = + gst_buffer_list_iterator_do (it, + (GstBufferListDoFunction) gst_buffer_ref, NULL))); + fail_unless (buf == NULL); + data = (char *) "data"; + ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_do (it, do_data_func, + data))); + fail_unless (buf == NULL); + fail_unless (do_data_func_data != data); + buf = gst_buffer_list_iterator_next (it); + fail_unless (buf == buf1); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 2); + buf = + gst_buffer_list_iterator_do (it, (GstBufferListDoFunction) gst_buffer_ref, + NULL); + fail_unless (buf == buf1); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 3); + gst_buffer_unref (buf); + buf = gst_buffer_list_iterator_do (it, do_data_func, data); + fail_unless (buf == buf1); + fail_unless (do_data_func_data == data); + + /* do-function that return a new buffer replaces the buffer in the list */ + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 2); + buf = gst_buffer_list_iterator_do (it, + (GstBufferListDoFunction) gst_mini_object_make_writable, NULL); + fail_unless (buf != buf1); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 1); + ASSERT_BUFFER_REFCOUNT (buf, "buf1", 1); + gst_buffer_replace (&buf1, buf); + + /* do-function that return NULL removes the buffer from the list */ + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 2); + fail_unless (gst_buffer_list_iterator_do (it, + (GstBufferListDoFunction) do_func_null, NULL) == NULL); + ASSERT_BUFFER_REFCOUNT (buf1, "buf1", 1); + ASSERT_CRITICAL ((buf = + gst_buffer_list_iterator_do (it, + (GstBufferListDoFunction) gst_buffer_ref, NULL))); + fail_unless (buf == NULL); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + gst_buffer_list_iterator_free (it); + it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_next_group (it)); + fail_unless (gst_buffer_list_iterator_next (it) == NULL); + fail_if (gst_buffer_list_iterator_next_group (it)); + gst_buffer_list_iterator_free (it); + gst_buffer_unref (buf1); +} + +GST_END_TEST; + +GST_START_TEST (test_merge) +{ + GstBufferListIterator *it; + GstBufferListIterator *merge_it; + GstBuffer *merged_buf; + GstBuffer *buf; + + it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_merge_group (it) == NULL); + + /* create a new group and add a buffer */ + gst_buffer_list_iterator_add_group (it); + fail_unless (gst_buffer_list_iterator_merge_group (it) == NULL); + buf = buffer_from_string ("One"); + gst_buffer_ref (buf); + gst_buffer_list_iterator_add (it, buf); + + /* merging a group with one buffer returns a copy of the buffer */ + merge_it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_next_group (merge_it)); + merged_buf = gst_buffer_list_iterator_merge_group (merge_it); + fail_unless (merged_buf != buf); + ASSERT_BUFFER_REFCOUNT (merged_buf, "merged_buf", 1); + gst_buffer_unref (buf); + fail_unless (GST_BUFFER_CAPS (merged_buf) == caps); + fail_unless (GST_BUFFER_TIMESTAMP (merged_buf) == TIMESTAMP); + check_buffer (merged_buf, 3, "One"); + gst_buffer_unref (merged_buf); + + /* add another buffer to the same group */ + gst_buffer_list_iterator_add (it, buffer_from_string ("Group")); + + /* merging a group returns a new buffer with merged data */ + merged_buf = gst_buffer_list_iterator_merge_group (merge_it); + ASSERT_BUFFER_REFCOUNT (merged_buf, "merged_buf", 1); + fail_unless (GST_BUFFER_CAPS (merged_buf) == caps); + fail_unless (GST_BUFFER_TIMESTAMP (merged_buf) == TIMESTAMP); + check_buffer (merged_buf, 8, "OneGroup"); + + /* merging the same group again should return a new buffer with merged data */ + buf = gst_buffer_list_iterator_merge_group (merge_it); + ASSERT_BUFFER_REFCOUNT (buf, "buf", 1); + fail_unless (buf != merged_buf); + check_buffer (buf, 8, "OneGroup"); + gst_buffer_unref (buf); + gst_buffer_unref (merged_buf); + + /* add a new group */ + gst_buffer_list_iterator_add_group (it); + gst_buffer_list_iterator_add (it, buffer_from_string ("AnotherGroup")); + gst_buffer_list_iterator_free (it); + + /* merge the first group again */ + merged_buf = gst_buffer_list_iterator_merge_group (merge_it); + ASSERT_BUFFER_REFCOUNT (merged_buf, "merged_buf", 1); + fail_unless (GST_BUFFER_CAPS (merged_buf) == caps); + fail_unless (GST_BUFFER_TIMESTAMP (merged_buf) == TIMESTAMP); + check_buffer (merged_buf, 8, "OneGroup"); + gst_buffer_unref (merged_buf); + + /* merge the second group */ + fail_unless (gst_buffer_list_iterator_next_group (merge_it)); + merged_buf = gst_buffer_list_iterator_merge_group (merge_it); + ASSERT_BUFFER_REFCOUNT (merged_buf, "merged_buf", 1); + fail_unless (GST_BUFFER_CAPS (merged_buf) == caps); + fail_unless (GST_BUFFER_TIMESTAMP (merged_buf) == TIMESTAMP); + check_buffer (merged_buf, 12, "AnotherGroup"); + gst_buffer_unref (merged_buf); + + gst_buffer_list_iterator_free (merge_it); + + /* steal the second buffer and merge the first group again */ + it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_next_group (it)); + fail_unless (gst_buffer_list_iterator_next (it) != NULL); + fail_unless (gst_buffer_list_iterator_next (it) != NULL); + buf = gst_buffer_list_iterator_steal (it); + gst_buffer_list_iterator_free (it); + fail_unless (buf != NULL); + check_buffer (buf, 0, "Group"); + gst_buffer_unref (buf); + merge_it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_next_group (merge_it)); + merged_buf = gst_buffer_list_iterator_merge_group (merge_it); + ASSERT_BUFFER_REFCOUNT (merged_buf, "merged_buf", 1); + fail_unless (GST_BUFFER_CAPS (merged_buf) == caps); + fail_unless (GST_BUFFER_TIMESTAMP (merged_buf) == TIMESTAMP); + check_buffer (merged_buf, 3, "One"); + gst_buffer_unref (merged_buf); + + /* steal the first buffer too and merge the first group again */ + it = gst_buffer_list_iterate (list); + fail_unless (gst_buffer_list_iterator_next_group (it)); + fail_unless (gst_buffer_list_iterator_next (it) != NULL); + buf = gst_buffer_list_iterator_steal (it); + fail_unless (buf != NULL); + check_buffer (buf, 3, "One"); + gst_buffer_unref (buf); + gst_buffer_list_iterator_free (it); + fail_unless (gst_buffer_list_iterator_merge_group (merge_it) == NULL); + gst_buffer_list_iterator_free (merge_it); +} + +GST_END_TEST; + +typedef struct +{ + GstBuffer *buf[3][3]; + guint iter; +} ForeachData; + +static GstBufferListItem +foreach_func1 (GstBuffer ** buffer, guint group, guint idx, ForeachData * data) +{ + fail_unless (buffer != NULL); + fail_unless (*buffer == data->buf[group][idx]); + + data->iter++; + + return GST_BUFFER_LIST_CONTINUE; +} + +static GstBufferListItem +foreach_func2 (GstBuffer ** buffer, guint group, guint idx, ForeachData * data) +{ + fail_unless (idx == 0); + fail_unless (buffer != NULL); + fail_unless (*buffer == data->buf[group][idx]); + + data->iter++; + + return GST_BUFFER_LIST_SKIP_GROUP; +} + +static GstBufferListItem +foreach_func3 (GstBuffer ** buffer, guint group, guint idx, ForeachData * data) +{ + fail_unless (group == 0); + fail_unless (idx == 0); + fail_unless (buffer != NULL); + fail_unless (*buffer == data->buf[group][idx]); + + data->iter++; + + return GST_BUFFER_LIST_END; +} + +static GstBufferListItem +foreach_func4 (GstBuffer ** buffer, guint group, guint idx, ForeachData * data) +{ + fail_unless (idx == 0); + fail_unless (buffer != NULL); + fail_unless (*buffer == data->buf[group][idx]); + + gst_buffer_unref (*buffer); + *buffer = NULL; + data->iter++; + + return GST_BUFFER_LIST_SKIP_GROUP; +} + +static GstBufferListItem +foreach_func5 (GstBuffer ** buffer, guint group, guint idx, ForeachData * data) +{ + fail_unless (buffer != NULL); + + data->iter++; + + return GST_BUFFER_LIST_CONTINUE; +} + +GST_START_TEST (test_foreach) +{ + GstBufferListIterator *it; + ForeachData data; + + /* add buffers to the list */ + it = gst_buffer_list_iterate (list); + gst_buffer_list_iterator_add_group (it); + data.buf[0][0] = gst_buffer_new (); + gst_buffer_list_iterator_add (it, data.buf[0][0]); + gst_buffer_list_iterator_add_group (it); + data.buf[1][0] = gst_buffer_new (); + gst_buffer_list_iterator_add (it, data.buf[1][0]); + data.buf[1][1] = gst_buffer_new (); + gst_buffer_list_iterator_add (it, data.buf[1][1]); + gst_buffer_list_iterator_free (it); + + fail_unless (gst_buffer_list_get (list, 0, 0) == data.buf[0][0]); + fail_unless (gst_buffer_list_get (list, 0, 1) == NULL); + fail_unless (gst_buffer_list_get (list, 1, 0) == data.buf[1][0]); + fail_unless (gst_buffer_list_get (list, 1, 1) == data.buf[1][1]); + fail_unless (gst_buffer_list_get (list, 1, 2) == NULL); + fail_unless (gst_buffer_list_get (list, 2, 0) == NULL); + fail_unless (gst_buffer_list_get (list, 2, 1) == NULL); + fail_unless (gst_buffer_list_get (list, 3, 3) == NULL); + + /* iterate everything */ + data.iter = 0; + gst_buffer_list_foreach (list, (GstBufferListFunc) foreach_func1, &data); + fail_unless (data.iter == 3); + + /* iterate only the first buffer of groups */ + data.iter = 0; + gst_buffer_list_foreach (list, (GstBufferListFunc) foreach_func2, &data); + fail_unless (data.iter == 2); + + /* iterate only the first buffer */ + data.iter = 0; + gst_buffer_list_foreach (list, (GstBufferListFunc) foreach_func3, &data); + fail_unless (data.iter == 1); + + /* remove the first buffer of each group */ + data.iter = 0; + gst_buffer_list_foreach (list, (GstBufferListFunc) foreach_func4, &data); + fail_unless (data.iter == 2); + + fail_unless (gst_buffer_list_get (list, 0, 0) == NULL); + fail_unless (gst_buffer_list_get (list, 0, 1) == NULL); + fail_unless (gst_buffer_list_get (list, 1, 0) == data.buf[1][1]); + fail_unless (gst_buffer_list_get (list, 1, 1) == NULL); + fail_unless (gst_buffer_list_get (list, 1, 2) == NULL); + fail_unless (gst_buffer_list_get (list, 2, 0) == NULL); + + /* iterate everything, just one more buffer now */ + data.iter = 0; + gst_buffer_list_foreach (list, (GstBufferListFunc) foreach_func5, &data); + fail_unless (data.iter == 1); +} + +GST_END_TEST; + +GST_START_TEST (test_list) +{ + GstBufferListIterator *it; + GList *l = NULL; + gint i; + + for (i = 0; i < 10; i++) { + gchar name[10]; + g_snprintf (name, 10, "%d", i); + l = g_list_append (l, buffer_from_string (name)); + } + + /* add buffers to the list */ + it = gst_buffer_list_iterate (list); + gst_buffer_list_iterator_add_group (it); + gst_buffer_list_iterator_add_list (it, l); + + /* add a buffer */ + gst_buffer_list_iterator_add (it, buffer_from_string ("10")); + + /* add another list */ + l = g_list_append (NULL, buffer_from_string ("11")); + gst_buffer_list_iterator_add_list (it, l); + + for (i = 0; i < 12; i++) { + GstBuffer *buf; + gchar name[10]; + + buf = gst_buffer_list_get (list, 0, i); + g_snprintf (name, 10, "%d", i); + check_buffer (buf, 0, name); + } + gst_buffer_list_iterator_free (it); +} + +GST_END_TEST; +#endif + +static Suite * +gst_buffer_list_suite (void) +{ + Suite *s = suite_create ("GstBufferList"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_checked_fixture (tc_chain, setup, cleanup); + tcase_add_test (tc_chain, test_add_and_iterate); +#if 0 + tcase_add_test (tc_chain, test_make_writable); + tcase_add_test (tc_chain, test_copy); + tcase_add_test (tc_chain, test_steal); + tcase_add_test (tc_chain, test_take); + tcase_add_test (tc_chain, test_do); + tcase_add_test (tc_chain, test_merge); + tcase_add_test (tc_chain, test_foreach); + tcase_add_test (tc_chain, test_list); +#endif + + return s; +} + +GST_CHECK_MAIN (gst_buffer_list); diff --git a/tests/check/gst/gstbus.c b/tests/check/gst/gstbus.c new file mode 100644 index 0000000..fecba75 --- /dev/null +++ b/tests/check/gst/gstbus.c @@ -0,0 +1,636 @@ +/* GStreamer message bus unit tests + * Copyright (C) 2005 Andy Wingo <wingo@pobox.com> + * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> + +static GstBus *test_bus = NULL; +static GMainLoop *main_loop; + +#define NUM_MESSAGES 1000 +#define NUM_THREADS 10 + +static gpointer +pound_bus_with_messages (gpointer data) +{ + gint thread_id = GPOINTER_TO_INT (data); + gint i; + + for (i = 0; i < NUM_MESSAGES; i++) { + GstMessage *m; + GstStructure *s; + + s = gst_structure_new ("test_message", + "thread_id", G_TYPE_INT, thread_id, "msg_id", G_TYPE_INT, i, NULL); + m = gst_message_new_application (NULL, s); + gst_bus_post (test_bus, m); + } + return NULL; +} + +static void +pull_messages (void) +{ + GstMessage *m; + const GstStructure *s; + guint message_ids[NUM_THREADS]; + gint i; + + for (i = 0; i < NUM_THREADS; i++) + message_ids[i] = 0; + + while (1) { + gint _t, _i; + + m = gst_bus_pop (test_bus); + if (!m) + break; + g_return_if_fail (GST_MESSAGE_TYPE (m) == GST_MESSAGE_APPLICATION); + + s = gst_message_get_structure (m); + if (!gst_structure_get_int (s, "thread_id", &_t)) + g_critical ("Invalid message"); + if (!gst_structure_get_int (s, "msg_id", &_i)) + g_critical ("Invalid message"); + + g_return_if_fail (_t < NUM_THREADS); + g_return_if_fail (_i == message_ids[_t]++); + + gst_message_unref (m); + } + + for (i = 0; i < NUM_THREADS; i++) + g_return_if_fail (message_ids[i] == NUM_MESSAGES); +} + +GST_START_TEST (test_hammer_bus) +{ + GThread *threads[NUM_THREADS]; + gint i; + + test_bus = gst_bus_new (); + + for (i = 0; i < NUM_THREADS; i++) + threads[i] = g_thread_create (pound_bus_with_messages, GINT_TO_POINTER (i), + TRUE, NULL); + + for (i = 0; i < NUM_THREADS; i++) + g_thread_join (threads[i]); + + pull_messages (); + + gst_object_unref ((GstObject *) test_bus); +} + +GST_END_TEST; + +static gboolean +message_func_eos (GstBus * bus, GstMessage * message, guint * p_counter) +{ + const GstStructure *s; + gint i; + + g_return_val_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS, FALSE); + + GST_DEBUG ("got EOS message"); + + s = gst_message_get_structure (message); + if (!gst_structure_get_int (s, "msg_id", &i)) + g_critical ("Invalid message"); + + if (p_counter != NULL) + *p_counter += 1; + + return i != 9; +} + +static gboolean +message_func_app (GstBus * bus, GstMessage * message, guint * p_counter) +{ + const GstStructure *s; + gint i; + + g_return_val_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_APPLICATION, + FALSE); + + GST_DEBUG ("got APP message"); + + s = gst_message_get_structure (message); + if (!gst_structure_get_int (s, "msg_id", &i)) + g_critical ("Invalid message"); + + if (p_counter != NULL) + *p_counter += 1; + + return i != 9; +} + +static gboolean +send_messages (gpointer data) +{ + GstMessage *m; + GstStructure *s; + gint i; + + for (i = 0; i < 10; i++) { + s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); + m = gst_message_new_application (NULL, s); + gst_bus_post (test_bus, m); + s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); + m = gst_message_new_custom (GST_MESSAGE_EOS, NULL, s); + gst_bus_post (test_bus, m); + } + + return FALSE; +} + +/* test if adding a signal watch for different message types calls the + * respective callbacks. */ +GST_START_TEST (test_watch) +{ + guint num_eos = 0; + guint num_app = 0; + guint id; + + test_bus = gst_bus_new (); + + main_loop = g_main_loop_new (NULL, FALSE); + + id = gst_bus_add_watch (test_bus, gst_bus_async_signal_func, NULL); + fail_if (id == 0); + g_signal_connect (test_bus, "message::eos", (GCallback) message_func_eos, + &num_eos); + g_signal_connect (test_bus, "message::application", + (GCallback) message_func_app, &num_app); + + g_idle_add ((GSourceFunc) send_messages, NULL); + while (g_main_context_pending (NULL)) + g_main_context_iteration (NULL, FALSE); + + fail_unless_equals_int (num_eos, 10); + fail_unless_equals_int (num_app, 10); + + g_source_remove (id); + g_main_loop_unref (main_loop); + + gst_object_unref ((GstObject *) test_bus); +} + +GST_END_TEST; + +/* test if adding a signal watch for different message types calls the + * respective callbacks. */ +GST_START_TEST (test_watch_with_custom_context) +{ + GMainContext *ctx; + GSource *source; + guint num_eos = 0; + guint num_app = 0; + guint id; + + test_bus = gst_bus_new (); + + ctx = g_main_context_new (); + main_loop = g_main_loop_new (ctx, FALSE); + + source = gst_bus_create_watch (test_bus); + g_source_set_callback (source, (GSourceFunc) gst_bus_async_signal_func, NULL, + NULL); + id = g_source_attach (source, ctx); + g_source_unref (source); + fail_if (id == 0); + + g_signal_connect (test_bus, "message::eos", (GCallback) message_func_eos, + &num_eos); + g_signal_connect (test_bus, "message::application", + (GCallback) message_func_app, &num_app); + + source = g_idle_source_new (); + g_source_set_callback (source, (GSourceFunc) send_messages, NULL, NULL); + g_source_attach (source, ctx); + g_source_unref (source); + + while (g_main_context_pending (ctx)) + g_main_context_iteration (ctx, FALSE); + + fail_unless_equals_int (num_eos, 10); + fail_unless_equals_int (num_app, 10); + + g_source_remove (id); + g_main_loop_unref (main_loop); + g_main_context_unref (ctx); + + gst_object_unref (test_bus); +} + +GST_END_TEST; + +/* test if adding a signal watch for different message types calls the + * respective callbacks. */ +GST_START_TEST (test_add_watch_with_custom_context) +{ + GMainContext *ctx; + GSource *source; + guint num_eos = 0; + guint num_app = 0; + + test_bus = gst_bus_new (); + + ctx = g_main_context_new (); + main_loop = g_main_loop_new (ctx, FALSE); + + g_main_context_push_thread_default (ctx); + gst_bus_add_signal_watch (test_bus); + g_main_context_pop_thread_default (ctx); + + g_signal_connect (test_bus, "message::eos", (GCallback) message_func_eos, + &num_eos); + g_signal_connect (test_bus, "message::application", + (GCallback) message_func_app, &num_app); + + source = g_idle_source_new (); + g_source_set_callback (source, (GSourceFunc) send_messages, NULL, NULL); + g_source_attach (source, ctx); + g_source_unref (source); + + while (g_main_context_pending (ctx)) + g_main_context_iteration (ctx, FALSE); + + fail_unless_equals_int (num_eos, 10); + fail_unless_equals_int (num_app, 10); + + g_main_loop_unref (main_loop); + g_main_context_unref (ctx); + + gst_object_unref (test_bus); +} + +GST_END_TEST; + +static gint messages_seen; + +static void +message_func (GstBus * bus, GstMessage * message, gpointer data) +{ + g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_APPLICATION); + + messages_seen++; +} + +static void +send_5app_1el_1err_2app_messages (guint interval_usecs) +{ + GstMessage *m; + GstStructure *s; + gint i; + + for (i = 0; i < 5; i++) { + s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); + m = gst_message_new_application (NULL, s); + GST_LOG ("posting application message"); + gst_bus_post (test_bus, m); + g_usleep (interval_usecs); + } + for (i = 0; i < 1; i++) { + s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); + m = gst_message_new_element (NULL, s); + GST_LOG ("posting element message"); + gst_bus_post (test_bus, m); + g_usleep (interval_usecs); + } + for (i = 0; i < 1; i++) { + m = gst_message_new_error (NULL, NULL, "debug string"); + GST_LOG ("posting error message"); + gst_bus_post (test_bus, m); + g_usleep (interval_usecs); + } + for (i = 0; i < 2; i++) { + s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); + m = gst_message_new_application (NULL, s); + GST_LOG ("posting application message"); + gst_bus_post (test_bus, m); + g_usleep (interval_usecs); + } +} + +static void +send_10_app_messages (void) +{ + GstMessage *m; + GstStructure *s; + gint i; + + for (i = 0; i < 10; i++) { + s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); + m = gst_message_new_application (NULL, s); + gst_bus_post (test_bus, m); + } +} + +/* test that you get the same messages from a poll as from signal watches. */ +GST_START_TEST (test_watch_with_poll) +{ + guint i; + + test_bus = gst_bus_new (); + messages_seen = 0; + + gst_bus_add_signal_watch (test_bus); + g_signal_connect (test_bus, "message", (GCallback) message_func, NULL); + + send_10_app_messages (); + + for (i = 0; i < 10; i++) + gst_message_unref (gst_bus_poll (test_bus, GST_MESSAGE_APPLICATION, + GST_CLOCK_TIME_NONE)); + + fail_if (gst_bus_have_pending (test_bus), "unexpected messages on bus"); + fail_unless (messages_seen == 10, "signal handler didn't get 10 messages"); + + gst_bus_remove_signal_watch (test_bus); + + gst_object_unref (test_bus); +} + +GST_END_TEST; + +/* test that you get the messages with pop. */ +GST_START_TEST (test_timed_pop) +{ + guint i; + + test_bus = gst_bus_new (); + + send_10_app_messages (); + + for (i = 0; i < 10; i++) + gst_message_unref (gst_bus_timed_pop (test_bus, GST_CLOCK_TIME_NONE)); + + fail_if (gst_bus_have_pending (test_bus), "unexpected messages on bus"); + + gst_object_unref (test_bus); +} + +GST_END_TEST; + +/* test that you get the messages with pop_filtered */ +GST_START_TEST (test_timed_pop_filtered) +{ + GstMessage *msg; + guint i; + + test_bus = gst_bus_new (); + + send_10_app_messages (); + for (i = 0; i < 10; i++) { + msg = gst_bus_timed_pop_filtered (test_bus, GST_CLOCK_TIME_NONE, + GST_MESSAGE_ANY); + fail_unless (msg != NULL); + gst_message_unref (msg); + } + + /* should flush all messages on the bus with types not matching */ + send_10_app_messages (); + msg = gst_bus_timed_pop_filtered (test_bus, 0, + GST_MESSAGE_ANY ^ GST_MESSAGE_APPLICATION); + fail_unless (msg == NULL); + msg = gst_bus_timed_pop_filtered (test_bus, GST_SECOND / 2, + GST_MESSAGE_ANY ^ GST_MESSAGE_APPLICATION); + fail_unless (msg == NULL); + /* there should be nothing on the bus now */ + fail_if (gst_bus_have_pending (test_bus), "unexpected messages on bus"); + msg = gst_bus_timed_pop_filtered (test_bus, 0, GST_MESSAGE_ANY); + fail_unless (msg == NULL); + + send_5app_1el_1err_2app_messages (0); + msg = gst_bus_timed_pop_filtered (test_bus, 0, + GST_MESSAGE_ANY ^ GST_MESSAGE_APPLICATION); + fail_unless (msg != NULL); + fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT); + gst_message_unref (msg); + fail_unless (gst_bus_have_pending (test_bus), "expected messages on bus"); + msg = gst_bus_timed_pop_filtered (test_bus, 0, GST_MESSAGE_APPLICATION); + fail_unless (msg != NULL); + fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_APPLICATION); + gst_message_unref (msg); + msg = gst_bus_timed_pop_filtered (test_bus, 0, GST_MESSAGE_ERROR); + fail_unless (msg == NULL); + + gst_object_unref (test_bus); +} + +GST_END_TEST; + +static gpointer +post_delayed_thread (gpointer data) +{ + THREAD_START (); + send_5app_1el_1err_2app_messages (1 * G_USEC_PER_SEC); + return NULL; +} + +/* test that you get the messages with pop_filtered if there's a timeout*/ +GST_START_TEST (test_timed_pop_filtered_with_timeout) +{ + GstMessage *msg; + + MAIN_INIT (); + + test_bus = gst_bus_new (); + + MAIN_START_THREAD_FUNCTIONS (1, post_delayed_thread, NULL); + + MAIN_SYNCHRONIZE (); + + msg = gst_bus_timed_pop_filtered (test_bus, 2 * GST_SECOND, + GST_MESSAGE_ERROR); + fail_unless (msg == NULL, "Got unexpected %s message", + (msg) ? GST_MESSAGE_TYPE_NAME (msg) : ""); + msg = gst_bus_timed_pop_filtered (test_bus, (3 + 1 + 1 + 1) * GST_SECOND, + GST_MESSAGE_ERROR | GST_MESSAGE_ELEMENT); + fail_unless (msg != NULL, "expected element message, but got nothing"); + fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT); + gst_message_unref (msg); + msg = gst_bus_timed_pop_filtered (test_bus, GST_CLOCK_TIME_NONE, + GST_MESSAGE_APPLICATION); + fail_unless (msg != NULL, "expected application message, but got nothing"); + fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_APPLICATION); + gst_message_unref (msg); + msg = gst_bus_timed_pop_filtered (test_bus, GST_CLOCK_TIME_NONE, + GST_MESSAGE_APPLICATION); + fail_unless (msg != NULL, "expected application message, but got nothing"); + fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_APPLICATION); + gst_message_unref (msg); + msg = gst_bus_timed_pop_filtered (test_bus, GST_SECOND / 4, + GST_MESSAGE_TAG | GST_MESSAGE_ERROR); + fail_unless (msg == NULL, "Got unexpected %s message", + (msg) ? GST_MESSAGE_TYPE_NAME (msg) : ""); + + MAIN_STOP_THREADS (); + + gst_object_unref (test_bus); +} + +GST_END_TEST; + +/* test that you get the messages with pop from another thread. */ +static gpointer +pop_thread (gpointer data) +{ + GstBus *bus = GST_BUS_CAST (data); + guint i; + + for (i = 0; i < 10; i++) + gst_message_unref (gst_bus_timed_pop (bus, GST_CLOCK_TIME_NONE)); + + return NULL; +} + +GST_START_TEST (test_timed_pop_thread) +{ + GThread *thread; + GError *error = NULL; + + test_bus = gst_bus_new (); + + thread = g_thread_create (pop_thread, test_bus, TRUE, &error); + fail_if (error != NULL); + + send_10_app_messages (); + + g_thread_join (thread); + + fail_if (gst_bus_have_pending (test_bus), "unexpected messages on bus"); + + /* try to pop a message without timeout. */ + fail_if (gst_bus_timed_pop (test_bus, 0) != NULL); + + /* with a small timeout */ + fail_if (gst_bus_timed_pop (test_bus, 1000) != NULL); + + gst_object_unref (test_bus); +} + +GST_END_TEST; + +static gboolean +cb_bus_call (GstBus * bus, GstMessage * msg, gpointer data) +{ + GMainLoop *loop = data; + + switch (GST_MESSAGE_TYPE (msg)) { + case GST_MESSAGE_EOS: + { + GST_INFO ("End-of-stream"); + g_main_loop_quit (loop); + break; + } + case GST_MESSAGE_ERROR: + { + GError *err = NULL; + + gst_message_parse_error (msg, &err, NULL); + g_error ("Error: %s", err->message); + g_error_free (err); + + g_main_loop_quit (loop); + break; + } + default: + { + GST_LOG ("BUS MESSAGE: type=%s", GST_MESSAGE_TYPE_NAME (msg)); + break; + } + } + + return TRUE; +} + +GST_START_TEST (test_custom_main_context) +{ + GMainContext *ctx; + GMainLoop *loop; + GstElement *pipeline; + GstElement *src; + GstElement *sink; + GSource *source; + GstBus *bus; + + ctx = g_main_context_new (); + loop = g_main_loop_new (ctx, FALSE); + + pipeline = gst_pipeline_new (NULL); + src = gst_element_factory_make ("fakesrc", NULL); + g_object_set (src, "num-buffers", 2000, NULL); + + sink = gst_element_factory_make ("fakesink", NULL); + + fail_unless (gst_bin_add (GST_BIN (pipeline), src)); + fail_unless (gst_bin_add (GST_BIN (pipeline), sink)); + fail_unless (gst_element_link (src, sink)); + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + source = gst_bus_create_watch (bus); + g_source_attach (source, ctx); + g_source_set_callback (source, (GSourceFunc) cb_bus_call, loop, NULL); + g_source_unref (source); + gst_object_unref (bus); + + GST_INFO ("starting pipeline"); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + + GST_INFO ("running event loop, ctx=%p", ctx); + g_main_loop_run (loop); + + gst_element_set_state (pipeline, GST_STATE_NULL); + + /* clean up */ + if (ctx) + g_main_context_unref (ctx); + g_main_loop_unref (loop); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +gst_bus_suite (void) +{ + Suite *s = suite_create ("GstBus"); + TCase *tc_chain = tcase_create ("stresstest"); + + tcase_set_timeout (tc_chain, 20); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_hammer_bus); + tcase_add_test (tc_chain, test_watch); + tcase_add_test (tc_chain, test_watch_with_poll); + tcase_add_test (tc_chain, test_watch_with_custom_context); + tcase_add_test (tc_chain, test_add_watch_with_custom_context); + tcase_add_test (tc_chain, test_timed_pop); + tcase_add_test (tc_chain, test_timed_pop_thread); + tcase_add_test (tc_chain, test_timed_pop_filtered); + tcase_add_test (tc_chain, test_timed_pop_filtered_with_timeout); + tcase_add_test (tc_chain, test_custom_main_context); + return s; +} + +GST_CHECK_MAIN (gst_bus); diff --git a/tests/check/gst/gstcaps.c b/tests/check/gst/gstcaps.c new file mode 100644 index 0000000..e5af97e --- /dev/null +++ b/tests/check/gst/gstcaps.c @@ -0,0 +1,937 @@ +/* GStreamer + * Copyright (C) 2005 Andy Wingo <wingo@pobox.com> + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * + * gstcaps.c: Unit test for GstCaps + * + * 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 <gst/check/gstcheck.h> +#include <gst/gstcaps.h> +#include "capslist.h" + +GST_START_TEST (test_from_string) +{ + GstCaps *caps; + GstCaps *caps2; + gchar *to_str; + int i; + + for (i = 0; i < G_N_ELEMENTS (caps_list); i++) { + caps = gst_caps_from_string (caps_list[i]); + fail_if (caps == NULL, + "Could not create caps from string %s\n", caps_list[i]); + to_str = gst_caps_to_string (caps); + fail_if (to_str == NULL, + "Could not convert caps back to string %s\n", caps_list[i]); + caps2 = gst_caps_from_string (caps_list[i]); + fail_if (caps2 == NULL, "Could not create caps from string %s\n", to_str); + + fail_unless (gst_caps_is_equal (caps, caps)); + fail_unless (gst_caps_is_equal (caps, caps2)); + + gst_caps_unref (caps); + gst_caps_unref (caps2); + g_free (to_str); + } +} + +GST_END_TEST; + +GST_START_TEST (test_double_append) +{ + GstStructure *s1; + GstCaps *c1; + + c1 = gst_caps_new_any (); + s1 = gst_structure_from_string ("audio/x-raw,rate=44100", NULL); + gst_caps_append_structure (c1, s1); + ASSERT_CRITICAL (gst_caps_append_structure (c1, s1)); + + gst_caps_unref (c1); +} + +GST_END_TEST; + +GST_START_TEST (test_mutability) +{ + GstStructure *s1; + GstCaps *c1; + gint ret; + + c1 = gst_caps_new_any (); + s1 = gst_structure_from_string ("audio/x-raw,rate=44100", NULL); + gst_structure_set (s1, "rate", G_TYPE_INT, 48000, NULL); + gst_caps_append_structure (c1, s1); + gst_structure_set (s1, "rate", G_TYPE_INT, 22500, NULL); + gst_caps_ref (c1); + ASSERT_CRITICAL (gst_structure_set (s1, "rate", G_TYPE_INT, 11250, NULL)); + fail_unless (gst_structure_get_int (s1, "rate", &ret)); + fail_unless (ret == 22500); + ASSERT_CRITICAL (gst_caps_set_simple (c1, "rate", G_TYPE_INT, 11250, NULL)); + fail_unless (gst_structure_get_int (s1, "rate", &ret)); + fail_unless (ret == 22500); + gst_caps_unref (c1); + gst_structure_set (s1, "rate", G_TYPE_INT, 11250, NULL); + fail_unless (gst_structure_get_int (s1, "rate", &ret)); + fail_unless (ret == 11250); + gst_caps_set_simple (c1, "rate", G_TYPE_INT, 1, NULL); + fail_unless (gst_structure_get_int (s1, "rate", &ret)); + fail_unless (ret == 1); + gst_caps_unref (c1); +} + +GST_END_TEST; + +GST_START_TEST (test_static_caps) +{ + static GstStaticCaps scaps = GST_STATIC_CAPS ("audio/x-raw,rate=44100"); + GstCaps *caps1; + GstCaps *caps2; + + /* caps creation */ + caps1 = gst_static_caps_get (&scaps); + fail_unless (caps1 != NULL); + /* 1 refcount core, one from us */ + fail_unless (GST_CAPS_REFCOUNT (caps1) == 2); + + /* caps should be the same */ + caps2 = gst_static_caps_get (&scaps); + fail_unless (caps2 != NULL); + /* 1 refcount core, two from us */ + fail_unless (GST_CAPS_REFCOUNT (caps1) == 3); + /* caps must be equal */ + fail_unless (caps1 == caps2); + + gst_caps_unref (caps1); + gst_caps_unref (caps2); +} + +GST_END_TEST; + +static const gchar non_simple_caps_string[] = + "video/x-raw, format=(string)I420, framerate=(fraction)[ 1/100, 100 ], " + "width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-raw, " + "format=(string)YUY2, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], " + "height=(int)[ 16, 4096 ]; video/x-raw, format=(string)RGB8_PALETTED, " + "framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], " + "height=(int)[ 16, 4096 ]; video/x-raw, " + "format=(string){ I420, YUY2, YV12 }, width=(int)[ 16, 4096 ], " + "height=(int)[ 16, 4096 ], framerate=(fraction)[ 1/100, 100 ]"; + +static gboolean +check_string_list (const GValue * format_value) +{ + const GValue *string_value; + gboolean got_rgb8 = FALSE; + gboolean got_yv12 = FALSE; + gboolean got_i420 = FALSE; + gboolean got_yuy2 = FALSE; + const gchar *string; + + string_value = gst_value_list_get_value (format_value, 0); + fail_unless (string_value != NULL); + fail_unless (G_VALUE_HOLDS_STRING (string_value)); + string = g_value_get_string (string_value); + fail_unless (string != NULL); + got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED")); + got_i420 = got_i420 || (g_str_equal (string, "I420")); + got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2")); + got_yv12 = got_yv12 || (g_str_equal (string, "YV12")); + + string_value = gst_value_list_get_value (format_value, 1); + fail_unless (string_value != NULL); + fail_unless (G_VALUE_HOLDS_STRING (string_value)); + string = g_value_get_string (string_value); + fail_unless (string != NULL); + got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED")); + got_i420 = got_i420 || (g_str_equal (string, "I420")); + got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2")); + got_yv12 = got_yv12 || (g_str_equal (string, "YV12")); + + string_value = gst_value_list_get_value (format_value, 2); + fail_unless (string_value != NULL); + fail_unless (G_VALUE_HOLDS_STRING (string_value)); + string = g_value_get_string (string_value); + fail_unless (string != NULL); + got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED")); + got_i420 = got_i420 || (g_str_equal (string, "I420")); + got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2")); + got_yv12 = got_yv12 || (g_str_equal (string, "YV12")); + + string_value = gst_value_list_get_value (format_value, 3); + fail_unless (string_value != NULL); + fail_unless (G_VALUE_HOLDS_STRING (string_value)); + string = g_value_get_string (string_value); + fail_unless (string != NULL); + got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED")); + got_i420 = got_i420 || (g_str_equal (string, "I420")); + got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2")); + got_yv12 = got_yv12 || (g_str_equal (string, "YV12")); + + return (got_rgb8 && got_i420 && got_yuy2 && got_yv12); +} + +GST_START_TEST (test_simplify) +{ + GstStructure *s1; + gboolean did_simplify; + GstCaps *caps; + + caps = gst_caps_from_string (non_simple_caps_string); + fail_unless (caps != NULL, + "gst_caps_from_string (non_simple_caps_string) failed"); + + did_simplify = gst_caps_do_simplify (caps); + fail_unless (did_simplify == TRUE, + "gst_caps_do_simplify() should have worked"); + + /* check simplified caps, should be: + * + * video/x-raw, format=(string){ RGB8_PALETTED, YV12, YUY2, I420 }, + * width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], + * framerate=(fraction)[ 1/100, 100 ] + */ + GST_DEBUG ("simplyfied %" GST_PTR_FORMAT, caps); + fail_unless (gst_caps_get_size (caps) == 1); + s1 = gst_caps_get_structure (caps, 0); + fail_unless (s1 != NULL); + + fail_unless (gst_structure_has_name (s1, "video/x-raw")); + { + const GValue *framerate_value; + const GValue *format_value; + const GValue *width_value; + const GValue *height_value; + const GValue *val_fps; + GValue test_fps = { 0, }; + gint min_width, max_width; + gint min_height, max_height; + + format_value = gst_structure_get_value (s1, "format"); + fail_unless (format_value != NULL); + fail_unless (GST_VALUE_HOLDS_LIST (format_value)); + fail_unless (gst_value_list_get_size (format_value) == 4); + fail_unless (check_string_list (format_value) == TRUE); + + g_value_init (&test_fps, GST_TYPE_FRACTION); + framerate_value = gst_structure_get_value (s1, "framerate"); + fail_unless (framerate_value != NULL); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (framerate_value)); + + val_fps = gst_value_get_fraction_range_min (framerate_value); + gst_value_set_fraction (&test_fps, 1, 100); + fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL); + + val_fps = gst_value_get_fraction_range_max (framerate_value); + gst_value_set_fraction (&test_fps, 100, 1); + fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL); + + g_value_unset (&test_fps); + + width_value = gst_structure_get_value (s1, "width"); + fail_unless (width_value != NULL); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (width_value)); + min_width = gst_value_get_int_range_min (width_value); + max_width = gst_value_get_int_range_max (width_value); + fail_unless (min_width == 16 && max_width == 4096); + + height_value = gst_structure_get_value (s1, "height"); + fail_unless (height_value != NULL); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (height_value)); + min_height = gst_value_get_int_range_min (height_value); + max_height = gst_value_get_int_range_max (height_value); + fail_unless (min_height == 16 && max_height == 4096); + } + + gst_caps_unref (caps); +} + +GST_END_TEST; + +GST_START_TEST (test_truncate) +{ + GstCaps *caps; + + caps = gst_caps_from_string (non_simple_caps_string); + fail_unless (caps != NULL, + "gst_caps_from_string (non_simple_caps_string) failed"); + fail_unless_equals_int (gst_caps_get_size (caps), 4); + gst_caps_truncate (caps); + fail_unless_equals_int (gst_caps_get_size (caps), 1); + gst_caps_unref (caps); +} + +GST_END_TEST; + +GST_START_TEST (test_subset) +{ + GstCaps *c1, *c2; + + c1 = gst_caps_from_string ("video/x-raw; video/x-raw"); + c2 = gst_caps_from_string ("video/x-raw, format=(string)YUY2"); + fail_unless (gst_caps_is_subset (c2, c1)); + fail_if (gst_caps_is_subset (c1, c2)); + gst_caps_unref (c1); + gst_caps_unref (c2); + + c1 = gst_caps_from_string + ("audio/x-raw, channels=(int)[ 1, 2 ], rate=(int)44100"); + c2 = gst_caps_from_string ("audio/x-raw, channels=(int)1, rate=(int)44100"); + fail_unless (gst_caps_is_subset (c2, c1)); + fail_if (gst_caps_is_subset (c1, c2)); + gst_caps_unref (c1); + gst_caps_unref (c2); + + c1 = gst_caps_from_string ("audio/x-raw, channels=(int) {1}"); + c2 = gst_caps_from_string ("audio/x-raw, channels=(int)1"); + fail_unless (gst_caps_is_subset (c2, c1)); + fail_unless (gst_caps_is_subset (c1, c2)); + fail_unless (gst_caps_is_equal (c1, c2)); + gst_caps_unref (c1); + gst_caps_unref (c2); + + c1 = gst_caps_from_string + ("audio/x-raw, rate=(int)44100, channels=(int)3, format=(string)U16_LE"); + c2 = gst_caps_from_string + ("audio/x-raw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], format=(string){ S16_LE, U16_LE }"); + fail_unless (gst_caps_is_subset (c1, c2)); + fail_if (gst_caps_is_subset (c2, c1)); + gst_caps_unref (c1); + gst_caps_unref (c2); +} + +GST_END_TEST; + +GST_START_TEST (test_merge_fundamental) +{ + GstCaps *c1, *c2; + + /* ANY + specific = ANY */ + c1 = gst_caps_from_string ("audio/x-raw,rate=44100"); + c2 = gst_caps_new_any (); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 0, NULL); + fail_unless (gst_caps_is_any (c2), NULL); + gst_caps_unref (c2); + + /* specific + ANY = ANY */ + c2 = gst_caps_from_string ("audio/x-raw,rate=44100"); + c1 = gst_caps_new_any (); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 0, NULL); + fail_unless (gst_caps_is_any (c2), NULL); + gst_caps_unref (c2); + + /* EMPTY + specific = specific */ + c1 = gst_caps_from_string ("audio/x-raw,rate=44100"); + c2 = gst_caps_new_empty (); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + fail_if (gst_caps_is_empty (c2), NULL); + gst_caps_unref (c2); + + /* specific + EMPTY = specific */ + c2 = gst_caps_from_string ("audio/x-raw,rate=44100"); + c1 = gst_caps_new_empty (); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + fail_if (gst_caps_is_empty (c2), NULL); + gst_caps_unref (c2); +} + +GST_END_TEST; + +GST_START_TEST (test_merge_same) +{ + GstCaps *c1, *c2, *test; + + /* this is the same */ + c1 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1"); + c2 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + test = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (test); + gst_caps_unref (c2); + + /* and so is this */ + c1 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1"); + c2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + gst_caps_unref (c2); + + c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); + c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AABB"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + gst_caps_unref (c2); + + c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AABB"); + c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + gst_caps_unref (c2); + + c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); + c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + gst_caps_unref (c2); + + c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); + c2 = gst_caps_from_string ("video/x-bar, data=(buffer)AA"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + gst_caps_unref (c2); +} + +GST_END_TEST; + +GST_START_TEST (test_merge_subset) +{ + GstCaps *c1, *c2, *test; + + /* the 2nd is already covered */ + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=1"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + test = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + /* here it is not */ + c2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2],rate=44100"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + test = gst_caps_from_string ("audio/x-raw,channels=[1,2],rate=44100"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + /* second one was already contained in the first one */ + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,3]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + test = gst_caps_from_string ("audio/x-raw,channels=[1,3]"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + /* second one was already contained in the first one */ + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + test = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + /* second one was already contained in the first one */ + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[2,4]"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + test = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + /* second one was already contained in the first one */ + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[2,3]"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + test = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + /* these caps cannot be merged */ + c2 = gst_caps_from_string ("audio/x-raw,channels=[2,3]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + test = + gst_caps_from_string + ("audio/x-raw,channels=[2,3];audio/x-raw,channels=[1,4]"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + /* these caps cannot be merged */ + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,3]"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + test = + gst_caps_from_string + ("audio/x-raw,channels=[1,2];audio/x-raw,channels=[1,3]"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + c2 = gst_caps_from_string ("audio/x-raw,channels={1,2}"); + c1 = gst_caps_from_string ("audio/x-raw,channels={1,2,3,4}"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + test = gst_caps_from_string ("audio/x-raw,channels={1,2};" + "audio/x-raw,channels={1,2,3,4}"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + c2 = gst_caps_from_string ("audio/x-raw,channels={1,2}"); + c1 = gst_caps_from_string ("audio/x-raw,channels={1,3}"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + test = gst_caps_from_string ("audio/x-raw,channels={1,2};" + "audio/x-raw,channels={1,3}"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + c2 = gst_caps_from_string ("video/x-raw, framerate=(fraction){ 15/2, 5/1 }"); + c1 = gst_caps_from_string ("video/x-raw, framerate=(fraction){ 15/1, 5/1 }"); + test = gst_caps_copy (c1); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_is_subset (test, c2)); + gst_caps_unref (test); + gst_caps_unref (c2); + + c2 = gst_caps_from_string ("audio/x-raw"); + c1 = gst_caps_from_string ("audio/x-raw,channels=1"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 1, NULL); + test = gst_caps_from_string ("audio/x-raw"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); + + c2 = gst_caps_from_string ("audio/x-raw,channels=1"); + c1 = gst_caps_from_string ("audio/x-raw"); + gst_caps_merge (c2, c1); + GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); + fail_unless (gst_caps_get_size (c2) == 2, NULL); + test = gst_caps_from_string ("audio/x-raw,channels=1; audio/x-raw"); + fail_unless (gst_caps_is_equal (c2, test)); + gst_caps_unref (c2); + gst_caps_unref (test); +} + +GST_END_TEST; + +GST_START_TEST (test_intersect) +{ + GstStructure *s; + GstCaps *c1, *c2, *ci1, *ci2; + + /* field not specified = any value possible, so the intersection + * should keep fields which are only part of one set of caps */ + c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20"); + c1 = gst_caps_from_string ("video/x-raw,format=(string)I420"); + + ci1 = gst_caps_intersect (c2, c1); + GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1); + fail_unless (gst_caps_get_size (ci1) == 1, NULL); + s = gst_caps_get_structure (ci1, 0); + fail_unless (gst_structure_has_name (s, "video/x-raw")); + fail_unless (gst_structure_get_value (s, "format") != NULL); + fail_unless (gst_structure_get_value (s, "width") != NULL); + + /* with changed order */ + ci2 = gst_caps_intersect (c1, c2); + GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2); + fail_unless (gst_caps_get_size (ci2) == 1, NULL); + s = gst_caps_get_structure (ci2, 0); + fail_unless (gst_structure_has_name (s, "video/x-raw")); + fail_unless (gst_structure_get_value (s, "format") != NULL); + fail_unless (gst_structure_get_value (s, "width") != NULL); + + fail_unless (gst_caps_is_equal (ci1, ci2)); + + gst_caps_unref (ci1); + gst_caps_unref (ci2); + + gst_caps_unref (c1); + gst_caps_unref (c2); + + /* ========== */ + + c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20"); + c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=30"); + + ci1 = gst_caps_intersect (c2, c1); + GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1); + fail_unless (gst_caps_is_empty (ci1), NULL); + + /* with changed order */ + ci2 = gst_caps_intersect (c1, c2); + GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2); + fail_unless (gst_caps_is_empty (ci2), NULL); + + fail_unless (gst_caps_is_equal (ci1, ci2)); + + gst_caps_unref (ci1); + gst_caps_unref (ci2); + + gst_caps_unref (c1); + gst_caps_unref (c2); + + /* ========== */ + + c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20"); + c1 = gst_caps_from_string ("video/x-raw2,format=(string)I420,width=20"); + + ci1 = gst_caps_intersect (c2, c1); + GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1); + fail_unless (gst_caps_is_empty (ci1), NULL); + + /* with changed order */ + ci2 = gst_caps_intersect (c1, c2); + GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2); + fail_unless (gst_caps_is_empty (ci2), NULL); + + fail_unless (gst_caps_is_equal (ci1, ci2)); + + gst_caps_unref (ci1); + gst_caps_unref (ci2); + + gst_caps_unref (c1); + gst_caps_unref (c2); + + /* ========== */ + + c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20"); + c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,height=30"); + + ci1 = gst_caps_intersect (c2, c1); + GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1); + fail_unless (gst_caps_get_size (ci1) == 1, NULL); + s = gst_caps_get_structure (ci1, 0); + fail_unless (gst_structure_has_name (s, "video/x-raw")); + fail_unless (gst_structure_get_value (s, "format") != NULL); + fail_unless (gst_structure_get_value (s, "width") != NULL); + fail_unless (gst_structure_get_value (s, "height") != NULL); + + /* with changed order */ + ci2 = gst_caps_intersect (c1, c2); + GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2); + fail_unless (gst_caps_get_size (ci2) == 1, NULL); + s = gst_caps_get_structure (ci2, 0); + fail_unless (gst_structure_has_name (s, "video/x-raw")); + fail_unless (gst_structure_get_value (s, "format") != NULL); + fail_unless (gst_structure_get_value (s, "height") != NULL); + fail_unless (gst_structure_get_value (s, "width") != NULL); + + fail_unless (gst_caps_is_equal (ci1, ci2)); + + gst_caps_unref (ci1); + gst_caps_unref (ci2); + + gst_caps_unref (c1); + gst_caps_unref (c2); +} + +GST_END_TEST; + +GST_START_TEST (test_intersect2) +{ + GstCaps *caps1, *caps2, *icaps; + + /* tests array subtraction */ + caps1 = gst_caps_from_string ("audio/x-raw, " + "channel-positions=(int)< " + "{ 1, 2, 3, 4, 5, 6 }, " + "{ 1, 2, 3, 4, 5, 6 }, " + "{ 1, 2, 3, 4, 5, 6 }, " + "{ 1, 2, 3, 4, 5, 6 }, " + "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }>"); + caps2 = gst_caps_from_string ("audio/x-raw, " + "channel-positions=(int)< 1, 2, 3, 4, 5, 6 >"); + icaps = gst_caps_intersect (caps1, caps2); + GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps); + fail_if (gst_caps_is_empty (icaps)); + fail_unless (gst_caps_is_equal (icaps, caps2)); + gst_caps_unref (caps1); + gst_caps_unref (caps2); + gst_caps_unref (icaps); + + /* ===== */ + + caps1 = gst_caps_from_string ("some/type, foo=(int)< { 1, 2 }, { 3, 4} >"); + caps2 = gst_caps_from_string ("some/type, foo=(int)< 1, 3 >"); + icaps = gst_caps_intersect (caps1, caps2); + GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps); + fail_if (gst_caps_is_empty (icaps)); + fail_unless (gst_caps_is_equal (icaps, caps2)); + gst_caps_unref (caps1); + gst_caps_unref (caps2); + gst_caps_unref (icaps); +} + +GST_END_TEST; + + +GST_START_TEST (test_intersect_zigzag) +{ + GstCaps *caps1, *caps2, *icaps, *result; + + /* tests if caps order is maintained */ + caps1 = gst_caps_from_string ("format/A; format/B; format/C; format/D"); + caps2 = gst_caps_from_string ("format/D; format/A; format/B; format/C"); + + icaps = gst_caps_intersect_full (caps1, caps2, GST_CAPS_INTERSECT_ZIG_ZAG); + result = gst_caps_from_string ("format/B; format/A; format/D; format/C"); + GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps); + fail_if (gst_caps_is_empty (icaps)); + fail_unless (gst_caps_is_equal (icaps, result)); + gst_caps_unref (icaps); + gst_caps_unref (result); + + icaps = gst_caps_intersect_full (caps2, caps1, GST_CAPS_INTERSECT_FIRST); + result = gst_caps_from_string ("format/A; format/B; format/D; format/C"); + GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps); + fail_if (gst_caps_is_empty (icaps)); + fail_unless (gst_caps_is_equal (icaps, result)); + gst_caps_unref (icaps); + gst_caps_unref (result); + + gst_caps_unref (caps1); + gst_caps_unref (caps2); +} + +GST_END_TEST; + + +GST_START_TEST (test_intersect_first) +{ + GstCaps *caps1, *caps2, *icaps, *result; + + /* tests if caps order is maintained */ + caps1 = gst_caps_from_string ("format/A; format/B; format/C; format/D"); + caps2 = gst_caps_from_string ("format/C; format/D; format/A"); + icaps = gst_caps_intersect_full (caps1, caps2, GST_CAPS_INTERSECT_FIRST); + result = gst_caps_from_string ("format/A; format/C; format/D"); + GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps); + fail_if (gst_caps_is_empty (icaps)); + fail_unless (gst_caps_is_equal (icaps, result)); + gst_caps_unref (caps1); + gst_caps_unref (caps2); + gst_caps_unref (icaps); + gst_caps_unref (result); +} + +GST_END_TEST; + + +GST_START_TEST (test_intersect_first2) +{ + GstCaps *caps1, *caps2, *icaps, *result; + + /* tests if caps order is maintained */ + caps1 = gst_caps_from_string ("format/A; format/B; format/C; format/D"); + caps2 = gst_caps_from_string ("format/D; format/A; format/B; format/C"); + + icaps = gst_caps_intersect_full (caps1, caps2, GST_CAPS_INTERSECT_FIRST); + result = gst_caps_from_string ("format/A; format/B; format/C; format/D"); + GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps); + fail_if (gst_caps_is_empty (icaps)); + fail_unless (gst_caps_is_equal (icaps, result)); + gst_caps_unref (icaps); + gst_caps_unref (result); + + icaps = gst_caps_intersect_full (caps2, caps1, GST_CAPS_INTERSECT_FIRST); + result = gst_caps_from_string ("format/D; format/A; format/B; format/C"); + GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps); + fail_if (gst_caps_is_empty (icaps)); + fail_unless (gst_caps_is_equal (icaps, result)); + gst_caps_unref (icaps); + gst_caps_unref (result); + + gst_caps_unref (caps1); + gst_caps_unref (caps2); +} + +GST_END_TEST; + +GST_START_TEST (test_intersect_duplication) +{ + GstCaps *c1, *c2, *test; + + c1 = gst_caps_from_string + ("audio/x-raw, format=(string)S16_LE, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]"); + c2 = gst_caps_from_string + ("audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ]; audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ]"); + + test = gst_caps_intersect_full (c1, c2, GST_CAPS_INTERSECT_FIRST); + fail_unless_equals_int (gst_caps_get_size (test), 1); + fail_unless (gst_caps_is_equal (c1, test)); + gst_caps_unref (c1); + gst_caps_unref (c2); + gst_caps_unref (test); +} + +GST_END_TEST; + +static gboolean +_caps_is_fixed_foreach (GQuark field_id, const GValue * value, gpointer unused) +{ + return gst_value_is_fixed (value); +} + + +GST_START_TEST (test_normalize) +{ + GstCaps *in, *norm, *out; + guint i; + + in = gst_caps_from_string ("some/type, foo=(int){ 1 , 2 }"); + out = gst_caps_from_string ("some/type, foo=(int) 1; some/type, foo=(int) 2"); + norm = gst_caps_normalize (in); + fail_if (gst_caps_is_empty (norm)); + fail_unless (gst_caps_is_equal (norm, out)); + for (i = 0; i < gst_caps_get_size (norm); i++) { + GstStructure *st = gst_caps_get_structure (norm, i); + /* Make sure all fields of all structures are fixed */ + fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); + } + + gst_caps_unref (in); + gst_caps_unref (out); + gst_caps_unref (norm); + + in = gst_caps_from_string + ("some/type, foo=(int){ 1 , 2 }, bar=(int){ 3, 4 }"); + out = + gst_caps_from_string + ("some/type, foo=(int) 1, bar=(int) 3; some/type, foo=(int) 2, bar=(int) 3;" + "some/type, foo=(int) 1, bar=(int) 4; some/type, foo=(int) 2, bar=(int) 4;"); + norm = gst_caps_normalize (in); + fail_if (gst_caps_is_empty (norm)); + fail_unless (gst_caps_is_equal (norm, out)); + for (i = 0; i < gst_caps_get_size (norm); i++) { + GstStructure *st = gst_caps_get_structure (norm, i); + /* Make sure all fields of all structures are fixed */ + fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); + } + + gst_caps_unref (in); + gst_caps_unref (out); + gst_caps_unref (norm); + + in = gst_caps_from_string + ("some/type, foo=(string){ 1 , 2 }, bar=(string) { 3 }"); + out = + gst_caps_from_string + ("some/type, foo=(string) 1, bar=(string) 3; some/type, foo=(string) 2, bar=(string) 3"); + norm = gst_caps_normalize (in); + fail_if (gst_caps_is_empty (norm)); + fail_unless (gst_caps_is_equal (norm, out)); + for (i = 0; i < gst_caps_get_size (norm); i++) { + GstStructure *st = gst_caps_get_structure (norm, i); + /* Make sure all fields of all structures are fixed */ + fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); + } + + gst_caps_unref (in); + gst_caps_unref (out); + gst_caps_unref (norm); +} + +GST_END_TEST; + +GST_START_TEST (test_broken) +{ + GstCaps *c1; + + /* NULL is not valid for media_type */ + ASSERT_CRITICAL (c1 = + gst_caps_new_simple (NULL, "field", G_TYPE_INT, 1, NULL)); + fail_if (c1); + +#ifndef G_DISABLE_CHECKS + /* such a name is not valid, see gst_structure_validate_name() */ + ASSERT_CRITICAL (c1 = + gst_caps_new_simple ("1#@abc", "field", G_TYPE_INT, 1, NULL)); + fail_if (c1); +#endif +} + +GST_END_TEST; + + +static Suite * +gst_caps_suite (void) +{ + Suite *s = suite_create ("GstCaps"); + TCase *tc_chain = tcase_create ("operations"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_from_string); + tcase_add_test (tc_chain, test_double_append); + tcase_add_test (tc_chain, test_mutability); + tcase_add_test (tc_chain, test_static_caps); + tcase_add_test (tc_chain, test_simplify); + tcase_add_test (tc_chain, test_truncate); + tcase_add_test (tc_chain, test_subset); + tcase_add_test (tc_chain, test_merge_fundamental); + tcase_add_test (tc_chain, test_merge_same); + tcase_add_test (tc_chain, test_merge_subset); + tcase_add_test (tc_chain, test_intersect); + tcase_add_test (tc_chain, test_intersect2); + tcase_add_test (tc_chain, test_intersect_zigzag); + tcase_add_test (tc_chain, test_intersect_first); + tcase_add_test (tc_chain, test_intersect_first2); + tcase_add_test (tc_chain, test_intersect_duplication); + tcase_add_test (tc_chain, test_normalize); + tcase_add_test (tc_chain, test_broken); + + return s; +} + +GST_CHECK_MAIN (gst_caps); diff --git a/tests/check/gst/gstchildproxy.c b/tests/check/gst/gstchildproxy.c new file mode 100644 index 0000000..a4249ff --- /dev/null +++ b/tests/check/gst/gstchildproxy.c @@ -0,0 +1,79 @@ +/* GStreamer + * Copyright (C) 2009 Stefan Kost <ensonic@users.sf.net> + * + * gstchildproxy.c: Unit test for GstChildProxy interface + * + * 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 <gst/check/gstcheck.h> + +GST_START_TEST (test_get) +{ + GstElement *pipeline; + gchar *name; + + pipeline = gst_pipeline_new ("foo"); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + gst_child_proxy_get (GST_OBJECT (pipeline), "name", &name, NULL); + fail_if (g_strcmp0 ("foo", name)); + g_free (name); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_child_get) +{ + GstElement *pipeline, *elem; + gchar *name; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + elem = gst_element_factory_make ("fakesrc", "src"); + fail_if (elem == NULL, "Could not create fakesrc"); + + gst_bin_add (GST_BIN (pipeline), elem); + + gst_child_proxy_get (GST_OBJECT (pipeline), "src::name", &name, NULL); + fail_if (g_strcmp0 ("src", name)); + g_free (name); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + + +static Suite * +gst_child_proxy_suite (void) +{ + Suite *s = suite_create ("GstChildProxy"); + TCase *tc_chain = tcase_create ("child proxy tests"); + + tcase_set_timeout (tc_chain, 0); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_get); + tcase_add_test (tc_chain, test_child_get); + + return s; +} + +GST_CHECK_MAIN (gst_child_proxy); diff --git a/tests/check/gst/gstclock.c b/tests/check/gst/gstclock.c new file mode 100644 index 0000000..a8f374d --- /dev/null +++ b/tests/check/gst/gstclock.c @@ -0,0 +1,93 @@ +/* GStreamer + * Copyright (C) 2010 Alessandro Decina <alessandro.decina@collabora.co.uk> + * + * 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 <gst/check/gstcheck.h> + +static void +weak_notify (gpointer data, GObject * object) +{ + *(gboolean *) data = FALSE; +} + +static GstClockReturn +fake_wait_async (GstClock * clock, GstClockEntry * entry) +{ + return GST_CLOCK_OK; +} + +GST_START_TEST (test_set_master_refcount) +{ + GstClock *master, *slave; + GstClockClass *klass; + gboolean master_alive = TRUE; + + /* create master and slave */ + master = g_object_new (GST_TYPE_CLOCK, "name", "TestClockMaster", NULL); + slave = g_object_new (GST_TYPE_CLOCK, "name", "TestClockMaster", NULL); + GST_OBJECT_FLAG_SET (slave, GST_CLOCK_FLAG_CAN_SET_MASTER); + + /* look ma! i'm doing monkey patching in C */ + klass = GST_CLOCK_GET_CLASS (master); + klass->wait_async = fake_wait_async; + + fail_unless_equals_int (GST_OBJECT_REFCOUNT (master), 1); + fail_unless_equals_int (GST_OBJECT_REFCOUNT (slave), 1); + + g_object_weak_ref (G_OBJECT (master), weak_notify, &master_alive); + fail_unless_equals_int (GST_OBJECT_REFCOUNT (master), 1); + + gst_clock_set_master (slave, master); + /* slave stores master in slave->master */ + fail_unless_equals_int (GST_OBJECT_REFCOUNT (master), 2); + /* master stores a ref to slave in master->clockid */ + fail_unless_equals_int (GST_OBJECT_REFCOUNT (slave), 2); + + /* discard our ref */ + gst_object_unref (master); + + /* master should still be reffed inside slave */ + fail_unless_equals_int (GST_OBJECT_REFCOUNT (master), 1); + fail_unless (master_alive); + + /* drop the last ref to mater */ + gst_clock_set_master (slave, NULL); + + fail_if (master_alive); + fail_unless_equals_int (GST_OBJECT_REFCOUNT (slave), 1); + + gst_object_unref (slave); + + klass->wait_async = NULL; +} + +GST_END_TEST; + +static Suite * +gst_clock_suite (void) +{ + Suite *s = suite_create ("GstClock"); + TCase *tc_chain = tcase_create ("clock"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_set_master_refcount); + + return s; +} + +GST_CHECK_MAIN (gst_clock); diff --git a/tests/check/gst/gstcpp.cc b/tests/check/gst/gstcpp.cc new file mode 100644 index 0000000..c6aaf73 --- /dev/null +++ b/tests/check/gst/gstcpp.cc @@ -0,0 +1,2 @@ +#include "gst.c" + diff --git a/tests/check/gst/gstdatetime.c b/tests/check/gst/gstdatetime.c new file mode 100644 index 0000000..ccc692f --- /dev/null +++ b/tests/check/gst/gstdatetime.c @@ -0,0 +1,306 @@ +/* GStreamer + * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk> + * Copyright (C) 2010 Christian Hergert <chris@dronelabs.com> + * + * gstdatetime.c: Unit tests for GstDateTime + * + * 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 <string.h> +#include <time.h> +#include <gst/check/gstcheck.h> + +#define ASSERT_TIME(dt,H,M,S) G_STMT_START { \ + assert_equals_int ((H), gst_date_time_get_hour ((dt))); \ + assert_equals_int ((M), gst_date_time_get_minute ((dt))); \ + assert_equals_int ((S), gst_date_time_get_second ((dt))); \ +} G_STMT_END + +GST_START_TEST (test_GstDateTime_now) +{ + GstDateTime *dt; + time_t t; + struct tm tm; + + memset (&tm, 0, sizeof (tm)); + t = time (NULL); +#ifdef HAVE_LOCALTIME_R + localtime_r (&t, &tm); +#else + memcpy (&tm, localtime (&t), sizeof (struct tm)); +#endif + dt = gst_date_time_new_now_local_time (); + assert_equals_int (gst_date_time_get_year (dt), 1900 + tm.tm_year); + assert_equals_int (gst_date_time_get_month (dt), 1 + tm.tm_mon); + assert_equals_int (gst_date_time_get_day (dt), tm.tm_mday); + assert_equals_int (gst_date_time_get_hour (dt), tm.tm_hour); + assert_equals_int (gst_date_time_get_minute (dt), tm.tm_min); + assert_equals_int (gst_date_time_get_second (dt), tm.tm_sec); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_new_from_unix_epoch_local_time) +{ + GstDateTime *dt; + struct tm tm; + time_t t; + + memset (&tm, 0, sizeof (tm)); + t = time (NULL); +#ifdef HAVE_LOCALTIME_R + localtime_r (&t, &tm); +#else + memcpy (&tm, localtime (&t), sizeof (struct tm)); +#endif + dt = gst_date_time_new_from_unix_epoch_local_time (t); + assert_equals_int (gst_date_time_get_year (dt), 1900 + tm.tm_year); + assert_equals_int (gst_date_time_get_month (dt), 1 + tm.tm_mon); + assert_equals_int (gst_date_time_get_day (dt), tm.tm_mday); + assert_equals_int (gst_date_time_get_hour (dt), tm.tm_hour); + assert_equals_int (gst_date_time_get_minute (dt), tm.tm_min); + assert_equals_int (gst_date_time_get_second (dt), tm.tm_sec); + gst_date_time_unref (dt); + + memset (&tm, 0, sizeof (tm)); + tm.tm_year = 70; + tm.tm_mday = 1; + tm.tm_mon = 0; + tm.tm_hour = 0; + tm.tm_min = 0; + tm.tm_sec = 0; + t = mktime (&tm); + dt = gst_date_time_new_from_unix_epoch_local_time (t); + assert_equals_int (gst_date_time_get_year (dt), 1970); + assert_equals_int (gst_date_time_get_month (dt), 1); + assert_equals_int (gst_date_time_get_day (dt), 1); + assert_equals_int (gst_date_time_get_hour (dt), 0); + assert_equals_int (gst_date_time_get_minute (dt), 0); + assert_equals_int (gst_date_time_get_second (dt), 0); + gst_date_time_unref (dt); +} + +GST_END_TEST; + + +GST_START_TEST (test_GstDateTime_new_from_unix_epoch_utc) +{ + GstDateTime *dt; + struct tm tm; + time_t t; + + memset (&tm, 0, sizeof (tm)); + t = time (NULL); +#ifdef HAVE_GMTIME_R + gmtime_r (&t, &tm); +#else + memcpy (&tm, gmtime (&t), sizeof (struct tm)); +#endif + dt = gst_date_time_new_from_unix_epoch_utc (t); + assert_equals_int (gst_date_time_get_year (dt), 1900 + tm.tm_year); + assert_equals_int (gst_date_time_get_month (dt), 1 + tm.tm_mon); + assert_equals_int (gst_date_time_get_day (dt), tm.tm_mday); + assert_equals_int (gst_date_time_get_hour (dt), tm.tm_hour); + assert_equals_int (gst_date_time_get_minute (dt), tm.tm_min); + assert_equals_int (gst_date_time_get_second (dt), tm.tm_sec); + assert_equals_int (gst_date_time_get_time_zone_offset (dt), 0); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_get_dmy) +{ + GstDateTime *dt; + time_t t; + struct tm tt; + + t = time (NULL); +#ifdef HAVE_LOCALTIME_R + localtime_r (&t, &tt); +#else + memcpy (&tt, localtime (&t), sizeof (struct tm)); +#endif + dt = gst_date_time_new_from_unix_epoch_local_time (t); + assert_equals_int (gst_date_time_get_year (dt), tt.tm_year + 1900); + assert_equals_int (gst_date_time_get_month (dt), tt.tm_mon + 1); + assert_equals_int (gst_date_time_get_day (dt), tt.tm_mday); + + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_get_hour) +{ + GstDateTime *dt; + + dt = gst_date_time_new (0, 2009, 10, 19, 15, 13, 11); + assert_equals_int (15, gst_date_time_get_hour (dt)); + gst_date_time_unref (dt); + + dt = gst_date_time_new (0, 100, 10, 19, 1, 0, 0); + assert_equals_int (1, gst_date_time_get_hour (dt)); + gst_date_time_unref (dt); + + dt = gst_date_time_new (0, 100, 10, 19, 0, 0, 0); + assert_equals_int (0, gst_date_time_get_hour (dt)); + gst_date_time_unref (dt); + + dt = gst_date_time_new (0, 100, 10, 1, 23, 59, 59); + assert_equals_int (23, gst_date_time_get_hour (dt)); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_get_microsecond) +{ + GTimeVal tv; + GstDateTime *dt; + + g_get_current_time (&tv); + dt = gst_date_time_new (0, 2010, 7, 15, 11, 12, + 13 + (tv.tv_usec / 1000000.0)); + assert_equals_int (tv.tv_usec, gst_date_time_get_microsecond (dt)); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_get_minute) +{ + GstDateTime *dt; + + dt = gst_date_time_new (0, 2009, 12, 1, 1, 31, 0); + assert_equals_int (31, gst_date_time_get_minute (dt)); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_get_second) +{ + GstDateTime *dt; + + dt = gst_date_time_new (0, 2009, 12, 1, 1, 31, 44); + assert_equals_int (44, gst_date_time_get_second (dt)); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_new_full) +{ + GstDateTime *dt; + + dt = gst_date_time_new (0, 2009, 12, 11, 12, 11, 10.001234); + assert_equals_int (2009, gst_date_time_get_year (dt)); + assert_equals_int (12, gst_date_time_get_month (dt)); + assert_equals_int (11, gst_date_time_get_day (dt)); + assert_equals_int (12, gst_date_time_get_hour (dt)); + assert_equals_int (11, gst_date_time_get_minute (dt)); + assert_equals_int (10, gst_date_time_get_second (dt)); + assert_equals_int (1234, gst_date_time_get_microsecond (dt)); + assert_equals_float (0, gst_date_time_get_time_zone_offset (dt)); + gst_date_time_unref (dt); + + dt = gst_date_time_new (2.5, 2010, 3, 29, 12, 13, 16.5); + assert_equals_int (2010, gst_date_time_get_year (dt)); + assert_equals_int (3, gst_date_time_get_month (dt)); + assert_equals_int (29, gst_date_time_get_day (dt)); + assert_equals_int (12, gst_date_time_get_hour (dt)); + assert_equals_int (13, gst_date_time_get_minute (dt)); + assert_equals_int (16, gst_date_time_get_second (dt)); + assert_equals_int (500000, gst_date_time_get_microsecond (dt)); + assert_equals_float (2.5, gst_date_time_get_time_zone_offset (dt)); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_utc_now) +{ + GstDateTime *dt; + time_t t; + struct tm tm; + + t = time (NULL); +#ifdef HAVE_GMTIME_R + gmtime_r (&t, &tm); +#else + memcpy (&tm, gmtime (&t), sizeof (struct tm)); +#endif + dt = gst_date_time_new_now_utc (); + assert_equals_int (tm.tm_year + 1900, gst_date_time_get_year (dt)); + assert_equals_int (tm.tm_mon + 1, gst_date_time_get_month (dt)); + assert_equals_int (tm.tm_mday, gst_date_time_get_day (dt)); + assert_equals_int (tm.tm_hour, gst_date_time_get_hour (dt)); + assert_equals_int (tm.tm_min, gst_date_time_get_minute (dt)); + assert_equals_int (tm.tm_sec, gst_date_time_get_second (dt)); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +GST_START_TEST (test_GstDateTime_get_utc_offset) +{ + GstDateTime *dt; + gfloat ts; + struct tm tm; + time_t t; + + t = time (NULL); + memset (&tm, 0, sizeof (tm)); +#ifdef HAVE_LOCALTIME_R + localtime_r (&t, &tm); +#else + memcpy (&tm, localtime (&t), sizeof (struct tm)); +#endif + + dt = gst_date_time_new_now_local_time (); + ts = gst_date_time_get_time_zone_offset (dt); + assert_equals_int (ts, tm.tm_gmtoff / 3600.0); + gst_date_time_unref (dt); +} + +GST_END_TEST; + +static Suite * +gst_date_time_suite (void) +{ + Suite *s = suite_create ("GstDateTime"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_GstDateTime_get_dmy); + tcase_add_test (tc_chain, test_GstDateTime_get_hour); + tcase_add_test (tc_chain, test_GstDateTime_get_microsecond); + tcase_add_test (tc_chain, test_GstDateTime_get_minute); + tcase_add_test (tc_chain, test_GstDateTime_get_second); + tcase_add_test (tc_chain, test_GstDateTime_get_utc_offset); + tcase_add_test (tc_chain, test_GstDateTime_new_from_unix_epoch_local_time); + tcase_add_test (tc_chain, test_GstDateTime_new_from_unix_epoch_utc); + tcase_add_test (tc_chain, test_GstDateTime_new_full); + tcase_add_test (tc_chain, test_GstDateTime_now); + tcase_add_test (tc_chain, test_GstDateTime_utc_now); + + return s; +} + +GST_CHECK_MAIN (gst_date_time); diff --git a/tests/check/gst/gstelement.c b/tests/check/gst/gstelement.c new file mode 100644 index 0000000..5bb45da --- /dev/null +++ b/tests/check/gst/gstelement.c @@ -0,0 +1,367 @@ +/* GStreamer + * Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart dot org> + * + * gstelement.c: Unit test for GstElement + * + * 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 <gst/check/gstcheck.h> + +GST_START_TEST (test_add_remove_pad) +{ + GstElement *e; + GstPad *p; + + /* getting an existing element class is cheating, but easier */ + e = gst_element_factory_make ("fakesrc", "source"); + + /* create a new floating pad with refcount 1 */ + p = gst_pad_new ("source", GST_PAD_SRC); + ASSERT_OBJECT_REFCOUNT (p, "pad", 1); + /* ref it for ourselves */ + gst_object_ref (p); + ASSERT_OBJECT_REFCOUNT (p, "pad", 2); + /* adding it sinks the pad -> not floating, same refcount */ + gst_element_add_pad (e, p); + ASSERT_OBJECT_REFCOUNT (p, "pad", 2); + + /* removing it reduces the refcount */ + gst_element_remove_pad (e, p); + ASSERT_OBJECT_REFCOUNT (p, "pad", 1); + + /* clean up our own reference */ + gst_object_unref (p); + gst_object_unref (e); +} + +GST_END_TEST; + +GST_START_TEST (test_add_pad_unref_element) +{ + GstElement *e; + GstPad *p; + + /* getting an existing element class is cheating, but easier */ + e = gst_element_factory_make ("fakesrc", "source"); + + /* create a new floating pad with refcount 1 */ + p = gst_pad_new ("source", GST_PAD_SRC); + ASSERT_OBJECT_REFCOUNT (p, "pad", 1); + /* ref it for ourselves */ + gst_object_ref (p); + ASSERT_OBJECT_REFCOUNT (p, "pad", 2); + /* adding it sinks the pad -> not floating, same refcount */ + gst_element_add_pad (e, p); + ASSERT_OBJECT_REFCOUNT (p, "pad", 2); + + /* unreffing the element should clean it up */ + gst_object_unref (GST_OBJECT (e)); + + ASSERT_OBJECT_REFCOUNT (p, "pad", 1); + + /* clean up our own reference */ + gst_object_unref (p); +} + +GST_END_TEST; + +GST_START_TEST (test_error_no_bus) +{ + GstElement *e; + GstBus *bus; + + e = gst_element_factory_make ("fakesrc", "source"); + + /* get the bus, should be NULL */ + bus = gst_element_get_bus (e); + fail_if (bus != NULL); + + /* I don't want errors shown */ + gst_debug_set_default_threshold (GST_LEVEL_NONE); + + GST_ELEMENT_ERROR (e, RESOURCE, OPEN_READ, ("I could not read"), ("debug")); + + gst_object_unref (e); +} + +GST_END_TEST; + +/* link and run two elements without putting them in a pipeline */ +GST_START_TEST (test_link) +{ + GstElement *src, *sink; + + src = gst_element_factory_make ("fakesrc", "source"); + sink = gst_element_factory_make ("fakesink", "sink"); + + fail_unless (gst_element_link_pads (src, "src", sink, "sink")); + + /* do sink to source state change */ + gst_element_set_state (sink, GST_STATE_PAUSED); + gst_element_set_state (src, GST_STATE_PAUSED); + + /* wait for preroll */ + gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE); + + /* play some more */ + gst_element_set_state (sink, GST_STATE_PLAYING); + gst_element_set_state (src, GST_STATE_PLAYING); + + g_usleep (G_USEC_PER_SEC); + + /* and stop */ + gst_element_set_state (sink, GST_STATE_PAUSED); + gst_element_set_state (src, GST_STATE_PAUSED); + + /* wait for preroll */ + gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE); + + gst_element_set_state (sink, GST_STATE_NULL); + gst_element_set_state (src, GST_STATE_NULL); + + gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE); + g_usleep (G_USEC_PER_SEC / 2); + + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + gst_element_unlink_pads (src, "src", sink, "sink"); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + + gst_object_unref (src); + gst_object_unref (sink); +} + +GST_END_TEST; + +/* linking two elements without pads should fail */ +GST_START_TEST (test_link_no_pads) +{ + GstElement *src, *sink; + + src = gst_bin_new ("src"); + sink = gst_bin_new ("sink"); + + fail_if (gst_element_link (src, sink)); + + gst_object_unref (src); + gst_object_unref (sink); +} + +GST_END_TEST; + +typedef struct _GstTestElement +{ + GstElement parent; + +} GstTestElement; + +typedef struct _GstTestElementClass +{ + GstElementClass parent; + +} GstTestElementClass; + +static void +gst_test_element_class_init (GstTestElementClass * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstPadTemplate *templ; + + gst_element_class_set_metadata (element_class, "Test element", + "Element", "Does nothing", "Foo Bar <foo@bar.com>"); + + fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list + (element_class)), 0); + + fail_unless (gst_element_class_get_pad_template (element_class, + "test") == NULL); + + gst_element_class_add_pad_template (element_class, + gst_pad_template_new ("test", GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_ANY)); + + fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list + (element_class)), 1); + + fail_unless ((templ = + gst_element_class_get_pad_template (element_class, "test")) != NULL); + fail_unless (gst_caps_is_any (templ->caps)); + + gst_element_class_add_pad_template (element_class, + gst_pad_template_new ("test2", GST_PAD_SRC, GST_PAD_ALWAYS, + GST_CAPS_ANY)); + + fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list + (element_class)), 2); + + fail_unless ((templ = + gst_element_class_get_pad_template (element_class, "test2")) != NULL); + fail_unless (gst_caps_is_any (templ->caps)); + + /* Add "test" again, with NONE caps this time */ + gst_element_class_add_pad_template (element_class, + gst_pad_template_new ("test", GST_PAD_SRC, GST_PAD_ALWAYS, + GST_CAPS_NONE)); + + fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list + (element_class)), 2); + + fail_unless ((templ = + gst_element_class_get_pad_template (element_class, "test")) != NULL); + fail_unless (gst_caps_is_empty (templ->caps)); +} + +static GType +gst_test_element_get_type (void) +{ + static GType gst_test_element_type = G_TYPE_NONE; + + if (gst_test_element_type == G_TYPE_NONE) { + static const GTypeInfo gst_test_element_info = { + sizeof (GstTestElementClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gst_test_element_class_init, + NULL, + NULL, + sizeof (GstTestElement), + 0, + NULL, /* instance_init */ + NULL + }; + + gst_test_element_type = g_type_register_static (GST_TYPE_ELEMENT, + "GstTestElement", &gst_test_element_info, 0); + } + return gst_test_element_type; +} + +typedef struct _GstTestElement2 +{ + GstTestElement parent; + +} GstTestElement2; + +typedef struct _GstTestElement2Class +{ + GstTestElementClass parent; + +} GstTestElement2Class; + +static void +gst_test_element2_class_init (GstTestElement2Class * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstPadTemplate *templ; + + gst_element_class_set_metadata (element_class, "Test element 2", + "Element", "Does nothing", "Foo Bar <foo@bar.com>"); + + fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list + (element_class)), 2); + + fail_unless ((templ = + gst_element_class_get_pad_template (element_class, "test")) != NULL); + fail_unless (gst_caps_is_empty (templ->caps)); + + fail_unless ((templ = + gst_element_class_get_pad_template (element_class, "test2")) != NULL); + fail_unless (gst_caps_is_any (templ->caps)); + + /* Add "test" pad with ANY caps, should have "test" pad with EMPTY caps before */ + gst_element_class_add_pad_template (element_class, + gst_pad_template_new ("test", GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_ANY)); + + fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list + (element_class)), 2); + + fail_unless ((templ = + gst_element_class_get_pad_template (element_class, "test")) != NULL); + fail_unless (gst_caps_is_any (templ->caps)); + + + gst_element_class_add_pad_template (element_class, + gst_pad_template_new ("test4", GST_PAD_SRC, GST_PAD_ALWAYS, + GST_CAPS_ANY)); + + fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list + (element_class)), 3); + + fail_unless ((templ = + gst_element_class_get_pad_template (element_class, "test4")) != NULL); + fail_unless (gst_caps_is_any (templ->caps)); +} + +static GType +gst_test_element2_get_type (void) +{ + static GType gst_test_element2_type = G_TYPE_NONE; + + if (gst_test_element2_type == G_TYPE_NONE) { + static const GTypeInfo gst_test_element2_info = { + sizeof (GstTestElement2Class), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gst_test_element2_class_init, + NULL, + NULL, + sizeof (GstTestElement2), + 0, + NULL, /* instance_init */ + NULL + }; + + gst_test_element2_type = + g_type_register_static (gst_test_element_get_type (), "GstTestElement2", + &gst_test_element2_info, 0); + } + return gst_test_element2_type; +} + + +GST_START_TEST (test_pad_templates) +{ + GstTestElement *test; + GstTestElement2 *test2; + + test = g_object_new (gst_test_element_get_type (), NULL); + test2 = g_object_new (gst_test_element2_get_type (), NULL); + + g_object_unref (test); + g_object_unref (test2); +} + +GST_END_TEST; + +static Suite * +gst_element_suite (void) +{ + Suite *s = suite_create ("GstElement"); + TCase *tc_chain = tcase_create ("element tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_add_remove_pad); + tcase_add_test (tc_chain, test_add_pad_unref_element); + tcase_add_test (tc_chain, test_error_no_bus); + tcase_add_test (tc_chain, test_link); + tcase_add_test (tc_chain, test_link_no_pads); + tcase_add_test (tc_chain, test_pad_templates); + + return s; +} + +GST_CHECK_MAIN (gst_element); diff --git a/tests/check/gst/gstelementfactory.c b/tests/check/gst/gstelementfactory.c new file mode 100644 index 0000000..42bdbcf --- /dev/null +++ b/tests/check/gst/gstelementfactory.c @@ -0,0 +1,181 @@ +/* GStreamer + * Copyright (C) 2011 Stefan Kost <ensonic@users.sf.net> + * + * gstelementfactory.c: Unit test for GstElementFactory + * + * 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 <gst/check/gstcheck.h> + +static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " "channels = (int) [ 1, 6 ]") + ); +static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " "channels = (int) [ 1, 6 ]") + ); + +static void +setup_pad_template (GstElementFactory * factory, GstStaticPadTemplate * tmpl) +{ + GstStaticPadTemplate *template; + + template = g_slice_dup (GstStaticPadTemplate, tmpl); + factory->staticpadtemplates = g_list_append (factory->staticpadtemplates, + template); + factory->numpadtemplates++; +} + +static GstElementFactory * +setup_factory (void) +{ + GstPluginFeature *feature; + GstElementFactory *factory; + + feature = g_object_newv (GST_TYPE_ELEMENT_FACTORY, 0, NULL); + gst_plugin_feature_set_name (feature, "test"); + + factory = GST_ELEMENT_FACTORY_CAST (feature); +#if 0 + gst_element_class_set_metadata (factory, "test", "test", "test", "test"); +#endif + + setup_pad_template (factory, &sink_template); + setup_pad_template (factory, &src_template); + + return factory; +} + +/* create a basic factory */ +GST_START_TEST (test_create) +{ + GstElementFactory *factory; + + factory = setup_factory (); + fail_if (factory == NULL); + + g_object_unref (factory); +} + +GST_END_TEST; + +/* test if the factory can accept some caps */ +GST_START_TEST (test_can_sink_any_caps) +{ + GstElementFactory *factory; + GstCaps *caps; + gboolean res; + + factory = setup_factory (); + fail_if (factory == NULL); + + caps = gst_caps_new_simple ("audio/x-raw-int", NULL); + fail_if (caps == NULL); + res = gst_element_factory_can_sink_any_caps (factory, caps); + fail_if (!res); + gst_caps_unref (caps); + + g_object_unref (factory); +} + +GST_END_TEST; + +/* test if the factory is compatible with some caps */ +GST_START_TEST (test_can_sink_all_caps) +{ + GstElementFactory *factory; + GstCaps *caps; + gboolean res; + + factory = setup_factory (); + fail_if (factory == NULL); + + caps = gst_caps_new_simple ("audio/x-raw-int", NULL); + fail_if (caps == NULL); + res = gst_element_factory_can_sink_all_caps (factory, caps); + fail_if (res); + gst_caps_unref (caps); + + g_object_unref (factory); +} + +GST_END_TEST; + +/* check if the elementfactory of a class is filled (see #131079) */ +GST_START_TEST (test_class) +{ + GstElementClass *klass; + GstElementFactory *factory, *tmp; + GType type; + + GST_DEBUG ("finding factory for queue"); + factory = gst_element_factory_find ("queue"); + fail_if (factory == NULL); + + /* it may already be loaded if check is being run with CK_FORK=no */ + if (!GST_PLUGIN_FEATURE (factory)->loaded) { + GST_DEBUG ("getting the type"); + /* feature is not loaded, should return 0 as the type */ + type = gst_element_factory_get_element_type (factory); + fail_if (type != 0); + } + + GST_DEBUG ("now loading the plugin"); + tmp = + GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE + (factory))); + fail_if (tmp == NULL); + + gst_object_unref (factory); + factory = tmp; + + /* feature is now loaded */ + type = gst_element_factory_get_element_type (factory); + fail_if (type == 0); + + klass = g_type_class_ref (factory->type); + fail_if (klass == NULL); + + GST_DEBUG ("checking the element factory class field"); + /* and elementfactory is filled in */ + fail_if (klass->elementfactory == NULL); + fail_if (klass->elementfactory != factory); + +} + +GST_END_TEST; + + +static Suite * +gst_element_factory_suite (void) +{ + Suite *s = suite_create ("GstElementFactory"); + TCase *tc_chain = tcase_create ("element-factory tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_class); + tcase_add_test (tc_chain, test_create); + tcase_add_test (tc_chain, test_can_sink_any_caps); + tcase_add_test (tc_chain, test_can_sink_all_caps); + + return s; +} + +GST_CHECK_MAIN (gst_element_factory); diff --git a/tests/check/gst/gstevent.c b/tests/check/gst/gstevent.c new file mode 100644 index 0000000..296ec56 --- /dev/null +++ b/tests/check/gst/gstevent.c @@ -0,0 +1,564 @@ +/* GStreamer + * Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com> + * + * gstevent.c: Unit test for event handling + * + * 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 <gst/check/gstcheck.h> + +GST_START_TEST (create_events) +{ + GstEvent *event, *event2; + GstStructure *structure; + + /* FLUSH_START */ + { + event = gst_event_new_flush_start (); + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_START); + fail_unless (GST_EVENT_IS_UPSTREAM (event)); + fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); + fail_if (GST_EVENT_IS_SERIALIZED (event)); + gst_event_unref (event); + } + /* FLUSH_STOP */ + { + gboolean reset_time; + + event = gst_event_new_flush_stop (TRUE); + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP); + fail_unless (GST_EVENT_IS_UPSTREAM (event)); + fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); + fail_unless (GST_EVENT_IS_SERIALIZED (event)); + + gst_event_parse_flush_stop (event, &reset_time); + fail_unless (reset_time == TRUE); + gst_event_unref (event); + } + /* EOS */ + { + event = gst_event_new_eos (); + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_EOS); + fail_if (GST_EVENT_IS_UPSTREAM (event)); + fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); + fail_unless (GST_EVENT_IS_SERIALIZED (event)); + gst_event_unref (event); + } + /* SEGMENT */ + { + GstSegment segment, parsed; + + gst_segment_init (&segment, GST_FORMAT_TIME); + segment.rate = 0.5; + segment.applied_rate = 1.0; + segment.start = 1; + segment.stop = G_MAXINT64; + segment.time = 0xdeadbeef; + + event = gst_event_new_segment (&segment); + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT); + fail_if (GST_EVENT_IS_UPSTREAM (event)); + fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); + fail_unless (GST_EVENT_IS_SERIALIZED (event)); + + gst_event_copy_segment (event, &parsed); + fail_unless (parsed.rate == 0.5); + fail_unless (parsed.applied_rate == 1.0); + fail_unless (parsed.format == GST_FORMAT_TIME); + fail_unless (parsed.start == 1); + fail_unless (parsed.stop == G_MAXINT64); + fail_unless (parsed.time == 0xdeadbeef); + + gst_event_unref (event); + } + + /* TAGS */ + { + GstTagList *taglist = gst_tag_list_new (); + GstTagList *tl2 = NULL; + + event = gst_event_new_tag (taglist); + fail_if (taglist == NULL); + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_TAG); + fail_if (GST_EVENT_IS_UPSTREAM (event)); + fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); + fail_unless (GST_EVENT_IS_SERIALIZED (event)); + + gst_event_parse_tag (event, &tl2); + fail_unless (taglist == tl2); + gst_event_unref (event); + } + + /* QOS */ + { + GstQOSType t1 = GST_QOS_TYPE_THROTTLE, t2; + gdouble p1 = 1.0, p2; + GstClockTimeDiff ctd1 = G_GINT64_CONSTANT (10), ctd2; + GstClockTime ct1 = G_GUINT64_CONSTANT (20), ct2; + + event = gst_event_new_qos (t1, p1, ctd1, ct1); + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_QOS); + fail_unless (GST_EVENT_IS_UPSTREAM (event)); + fail_if (GST_EVENT_IS_DOWNSTREAM (event)); + fail_if (GST_EVENT_IS_SERIALIZED (event)); + + gst_event_parse_qos (event, &t2, &p2, &ctd2, &ct2); + fail_unless (p1 == p2); + fail_unless (ctd1 == ctd2); + fail_unless (ct1 == ct2); + gst_event_parse_qos (event, &t2, &p2, &ctd2, &ct2); + fail_unless (t2 == GST_QOS_TYPE_THROTTLE); + fail_unless (p1 == p2); + fail_unless (ctd1 == ctd2); + fail_unless (ct1 == ct2); + gst_event_unref (event); + + ctd1 = G_GINT64_CONSTANT (-10); + event = gst_event_new_qos (t1, p1, ctd1, ct1); + gst_event_parse_qos (event, &t2, &p2, &ctd2, &ct2); + fail_unless (t2 == GST_QOS_TYPE_THROTTLE); + gst_event_unref (event); + + event = gst_event_new_qos (t1, p1, ctd1, ct1); + gst_event_parse_qos (event, &t2, &p2, &ctd2, &ct2); + fail_unless (t2 == GST_QOS_TYPE_THROTTLE); + fail_unless (p1 == p2); + fail_unless (ctd1 == ctd2); + fail_unless (ct1 == ct2); + gst_event_unref (event); + } + + /* SEEK */ + { + gdouble rate; + GstFormat format; + GstSeekFlags flags; + GstSeekType cur_type, stop_type; + gint64 cur, stop; + + event = gst_event_new_seek (0.5, GST_FORMAT_BYTES, + GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, + GST_SEEK_TYPE_SET, 1, GST_SEEK_TYPE_NONE, 0xdeadbeef); + + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_SEEK); + fail_unless (GST_EVENT_IS_UPSTREAM (event)); + fail_if (GST_EVENT_IS_DOWNSTREAM (event)); + fail_if (GST_EVENT_IS_SERIALIZED (event)); + + gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, + &stop_type, &stop); + fail_unless (rate == 0.5); + fail_unless (format == GST_FORMAT_BYTES); + fail_unless (flags == (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE)); + fail_unless (cur_type == GST_SEEK_TYPE_SET); + fail_unless (cur == 1); + fail_unless (stop_type == GST_SEEK_TYPE_NONE); + fail_unless (stop == 0xdeadbeef); + + gst_event_unref (event); + } + + /* NAVIGATION */ + { + structure = gst_structure_new ("application/x-gst-navigation", "event", + G_TYPE_STRING, "key-press", "key", G_TYPE_STRING, "mon", NULL); + fail_if (structure == NULL); + event = gst_event_new_navigation (structure); + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_NAVIGATION); + fail_unless (GST_EVENT_IS_UPSTREAM (event)); + fail_if (GST_EVENT_IS_DOWNSTREAM (event)); + fail_if (GST_EVENT_IS_SERIALIZED (event)); + + fail_unless (gst_event_get_structure (event) == structure); + gst_event_unref (event); + } + + /* Custom event types */ + { + structure = gst_structure_empty_new ("application/x-custom"); + fail_if (structure == NULL); + event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, structure); + fail_if (event == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_UPSTREAM); + fail_unless (GST_EVENT_IS_UPSTREAM (event)); + fail_if (GST_EVENT_IS_DOWNSTREAM (event)); + fail_if (GST_EVENT_IS_SERIALIZED (event)); + fail_unless (gst_event_get_structure (event) == structure); + fail_unless (gst_event_has_name (event, "application/x-custom")); + gst_event_unref (event); + + /* Decided not to test the other custom enum types, as they + * only differ by the value of the enum passed to gst_event_new_custom + */ + } + + /* Event copying */ + { + structure = gst_structure_empty_new ("application/x-custom"); + fail_if (structure == NULL); + event = gst_event_new_custom (GST_EVENT_CUSTOM_BOTH, structure); + + fail_if (event == NULL); + event2 = gst_event_copy (event); + fail_if (event2 == NULL); + fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_TYPE (event2)); + fail_unless (gst_event_has_name (event, "application/x-custom")); + + /* The structure should have been duplicated */ + fail_if (gst_event_get_structure (event) == + gst_event_get_structure (event2)); + + gst_event_unref (event); + gst_event_unref (event2); + } + + /* Make events writable */ + { + structure = gst_structure_empty_new ("application/x-custom"); + fail_if (structure == NULL); + event = gst_event_new_custom (GST_EVENT_CUSTOM_BOTH, structure); + /* ref the event so that it becomes non-writable */ + gst_event_ref (event); + gst_event_ref (event); + /* this should fail if the structure isn't writable */ + ASSERT_CRITICAL (gst_structure_remove_all_fields ((GstStructure *) + gst_event_get_structure (event))); + fail_unless (gst_event_has_name (event, "application/x-custom")); + + /* now make writable */ + event2 = + GST_EVENT (gst_mini_object_make_writable (GST_MINI_OBJECT (event))); + fail_unless (event != event2); + /* this fail if the structure isn't writable */ + gst_structure_remove_all_fields ((GstStructure *) + gst_event_get_structure (event2)); + fail_unless (gst_event_has_name (event2, "application/x-custom")); + + gst_event_unref (event); + gst_event_unref (event); + gst_event_unref (event2); + } +} + +GST_END_TEST; + +static GTimeVal sent_event_time; +static GstEvent *got_event_before_q, *got_event_after_q; +static GTimeVal got_event_time; + +static GstProbeReturn +event_probe (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer user_data) +{ + GstMiniObject *data = type_data; + gboolean before_q = (gboolean) GPOINTER_TO_INT (user_data); + + GST_DEBUG ("event probe called %p", data); + + fail_unless (GST_IS_EVENT (data)); + + if (before_q) { + switch (GST_EVENT_TYPE (GST_EVENT (data))) { + case GST_EVENT_CUSTOM_UPSTREAM: + case GST_EVENT_CUSTOM_BOTH: + case GST_EVENT_CUSTOM_BOTH_OOB: + if (got_event_before_q != NULL) + break; + gst_event_ref ((GstEvent *) data); + g_get_current_time (&got_event_time); + got_event_before_q = GST_EVENT (data); + break; + default: + break; + } + } else { + switch (GST_EVENT_TYPE (GST_EVENT (data))) { + case GST_EVENT_CUSTOM_DOWNSTREAM: + case GST_EVENT_CUSTOM_DOWNSTREAM_OOB: + case GST_EVENT_CUSTOM_BOTH: + case GST_EVENT_CUSTOM_BOTH_OOB: + if (got_event_after_q != NULL) + break; + gst_event_ref ((GstEvent *) data); + g_get_current_time (&got_event_time); + got_event_after_q = GST_EVENT (data); + break; + default: + break; + } + } + + return GST_PROBE_OK; +} + + +typedef struct +{ + GMutex *lock; + GCond *cond; + gboolean signaled; +} SignalData; + +static void +signal_data_init (SignalData * data) +{ + GST_DEBUG ("init %p", data); + data->lock = g_mutex_new (); + data->cond = g_cond_new (); + data->signaled = FALSE; +} + +static void +signal_data_cleanup (SignalData * data) +{ + GST_DEBUG ("free %p", data); + g_mutex_free (data->lock); + g_cond_free (data->cond); +} + +static void +signal_data_signal (SignalData * data) +{ + g_mutex_lock (data->lock); + data->signaled = TRUE; + g_cond_broadcast (data->cond); + GST_DEBUG ("signaling %p", data); + g_mutex_unlock (data->lock); +} + +static void +signal_data_wait (SignalData * data) +{ + g_mutex_lock (data->lock); + GST_DEBUG ("signal wait %p", data); + while (!data->signaled) + g_cond_wait (data->cond, data->lock); + GST_DEBUG ("signal wait done %p", data); + g_mutex_unlock (data->lock); +} + +static GstProbeReturn +signal_blocked (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer user_data) +{ + SignalData *data = (SignalData *) user_data; + + GST_DEBUG ("signal called %p", data); + signal_data_signal (data); + GST_DEBUG ("signal done %p", data); + + return GST_PROBE_OK; +} + +static void test_event + (GstBin * pipeline, GstEventType type, GstPad * pad, + gboolean expect_before_q, GstPad * fake_srcpad) +{ + GstEvent *event; + GstPad *peer; + gint i; + SignalData data; + gulong id; + + got_event_before_q = got_event_after_q = NULL; + + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, + GST_CLOCK_TIME_NONE); + + GST_DEBUG ("test event called"); + + event = gst_event_new_custom (type, + gst_structure_empty_new ("application/x-custom")); + g_get_current_time (&sent_event_time); + got_event_time.tv_sec = 0; + got_event_time.tv_usec = 0; + + signal_data_init (&data); + + /* We block the pad so the stream lock is released and we can send the event */ + id = gst_pad_add_probe (fake_srcpad, GST_PROBE_TYPE_BLOCK, + signal_blocked, &data, NULL); + fail_unless (id != 0); + + signal_data_wait (&data); + + /* We send on the peer pad, since the pad is blocked */ + GST_DEBUG ("sending event %p", event); + fail_unless ((peer = gst_pad_get_peer (pad)) != NULL); + gst_pad_send_event (peer, event); + gst_object_unref (peer); + + gst_pad_remove_probe (fake_srcpad, id); + + if (expect_before_q) { + /* Wait up to 5 seconds for the event to appear */ + for (i = 0; i < 500; i++) { + g_usleep (G_USEC_PER_SEC / 100); + if (got_event_before_q != NULL) + break; + } + fail_if (got_event_before_q == NULL, + "Expected event failed to appear upstream of the queue " + "within 5 seconds"); + fail_unless (GST_EVENT_TYPE (got_event_before_q) == type); + } else { + /* Wait up to 10 seconds for the event to appear */ + for (i = 0; i < 1000; i++) { + g_usleep (G_USEC_PER_SEC / 100); + if (got_event_after_q != NULL) + break; + } + fail_if (got_event_after_q == NULL, + "Expected event failed to appear after the queue within 10 seconds"); + fail_unless (GST_EVENT_TYPE (got_event_after_q) == type); + } + + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); + gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, + GST_CLOCK_TIME_NONE); + + if (got_event_before_q) + gst_event_unref (got_event_before_q); + if (got_event_after_q) + gst_event_unref (got_event_after_q); + + got_event_before_q = got_event_after_q = NULL; + + signal_data_cleanup (&data); +} + +static gint64 +timediff (GTimeVal * end, GTimeVal * start) +{ + return (end->tv_sec - start->tv_sec) * G_USEC_PER_SEC + + (end->tv_usec - start->tv_usec); +} + +GST_START_TEST (send_custom_events) +{ + /* Run some tests on custom events. Checking for serialisation and whatnot. + * pipeline is fakesrc ! queue ! fakesink */ + GstBin *pipeline; + GstElement *fakesrc, *fakesink, *queue; + GstPad *srcpad, *sinkpad; + + fail_if ((pipeline = (GstBin *) gst_pipeline_new ("testpipe")) == NULL); + fail_if ((fakesrc = gst_element_factory_make ("fakesrc", NULL)) == NULL); + fail_if ((fakesink = gst_element_factory_make ("fakesink", NULL)) == NULL); + fail_if ((queue = gst_element_factory_make ("queue", NULL)) == NULL); + + gst_bin_add_many (pipeline, fakesrc, queue, fakesink, NULL); + fail_unless (gst_element_link_many (fakesrc, queue, fakesink, NULL)); + + g_object_set (G_OBJECT (fakesink), "sync", FALSE, NULL); + + /* Send 100 buffers per sec */ + g_object_set (G_OBJECT (fakesrc), "silent", TRUE, "datarate", 100, + "sizemax", 1, "sizetype", 2, NULL); + g_object_set (G_OBJECT (queue), "max-size-buffers", 0, "max-size-time", + (guint64) GST_SECOND, "max-size-bytes", 0, NULL); + g_object_set (G_OBJECT (fakesink), "silent", TRUE, "sync", TRUE, NULL); + + /* add pad-probes to faksrc.src and fakesink.sink */ + fail_if ((srcpad = gst_element_get_static_pad (fakesrc, "src")) == NULL); + gst_pad_add_probe (srcpad, GST_PROBE_TYPE_EVENT, + event_probe, GINT_TO_POINTER (TRUE), NULL); + + fail_if ((sinkpad = gst_element_get_static_pad (fakesink, "sink")) == NULL); + gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_EVENT, + event_probe, GINT_TO_POINTER (FALSE), NULL); + + /* Upstream events */ + test_event (pipeline, GST_EVENT_CUSTOM_UPSTREAM, sinkpad, TRUE, srcpad); + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, + "GST_EVENT_CUSTOM_UP took too long to reach source: %" + G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); + + test_event (pipeline, GST_EVENT_CUSTOM_BOTH, sinkpad, TRUE, srcpad); + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, + "GST_EVENT_CUSTOM_BOTH took too long to reach source: %" + G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); + + test_event (pipeline, GST_EVENT_CUSTOM_BOTH_OOB, sinkpad, TRUE, srcpad); + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, + "GST_EVENT_CUSTOM_BOTH_OOB took too long to reach source: %" + G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); + + /* Out of band downstream events */ + test_event (pipeline, GST_EVENT_CUSTOM_DOWNSTREAM_OOB, srcpad, FALSE, srcpad); + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, + "GST_EVENT_CUSTOM_DS_OOB took too long to reach source: %" + G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); + + test_event (pipeline, GST_EVENT_CUSTOM_BOTH_OOB, srcpad, FALSE, srcpad); + fail_unless (timediff (&got_event_time, + &sent_event_time) < G_USEC_PER_SEC / 2, + "GST_EVENT_CUSTOM_BOTH_OOB took too long to reach source: %" + G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); + + /* In-band downstream events are expected to take at least 1 second + * to traverse the queue */ + test_event (pipeline, GST_EVENT_CUSTOM_DOWNSTREAM, srcpad, FALSE, srcpad); + fail_unless (timediff (&got_event_time, + &sent_event_time) >= G_USEC_PER_SEC / 2, + "GST_EVENT_CUSTOM_DS arrived too quickly for an in-band event: %" + G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); + + test_event (pipeline, GST_EVENT_CUSTOM_BOTH, srcpad, FALSE, srcpad); + fail_unless (timediff (&got_event_time, + &sent_event_time) >= G_USEC_PER_SEC / 2, + "GST_EVENT_CUSTOM_BOTH arrived too quickly for an in-band event: %" + G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); + + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, + GST_CLOCK_TIME_NONE); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +gst_event_suite (void) +{ + Suite *s = suite_create ("GstEvent"); + TCase *tc_chain = tcase_create ("events"); + + tcase_set_timeout (tc_chain, 20); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, create_events); + tcase_add_test (tc_chain, send_custom_events); + return s; +} + +GST_CHECK_MAIN (gst_event); diff --git a/tests/check/gst/gstghostpad.c b/tests/check/gst/gstghostpad.c new file mode 100644 index 0000000..068a6e9 --- /dev/null +++ b/tests/check/gst/gstghostpad.c @@ -0,0 +1,1083 @@ +/* GStreamer + * Copyright (C) 2005 Wim Taymans <wim@fluendo.com> + * + * gstghostpad.c: Unit test for GstGhostPad + * + * 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 <gst/check/gstcheck.h> + +/* test if removing a bin also cleans up the ghostpads + */ +GST_START_TEST (test_remove1) +{ + GstElement *b1, *b2, *src, *sink; + GstPad *srcpad, *sinkpad; + GstPadLinkReturn ret; + + b1 = gst_element_factory_make ("pipeline", NULL); + b2 = gst_element_factory_make ("bin", NULL); + src = gst_element_factory_make ("fakesrc", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1); + ASSERT_OBJECT_REFCOUNT (b2, "bin", 1); + + fail_unless (gst_bin_add (GST_BIN (b2), sink)); + fail_unless (gst_bin_add (GST_BIN (b1), src)); + ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1); + ASSERT_OBJECT_REFCOUNT (b2, "bin", 1); + fail_unless (gst_bin_add (GST_BIN (b1), b2)); + ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1); + ASSERT_OBJECT_REFCOUNT (b2, "bin", 1); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_element_add_pad (b2, gst_ghost_pad_new ("sink", sinkpad)); + gst_object_unref (sinkpad); + + srcpad = gst_element_get_static_pad (src, "src"); + /* get the ghostpad */ + sinkpad = gst_element_get_static_pad (b2, "sink"); + + ret = gst_pad_link (srcpad, sinkpad); + fail_unless (ret == GST_PAD_LINK_OK); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + /* now remove the bin with the ghostpad, b2 is disposed now. */ + ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1); + ASSERT_OBJECT_REFCOUNT (b2, "bin", 1); + gst_bin_remove (GST_BIN (b1), b2); + + srcpad = gst_element_get_static_pad (src, "src"); + /* pad cannot be linked now */ + fail_if (gst_pad_is_linked (srcpad)); + gst_object_unref (srcpad); + + ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1); + gst_object_unref (b1); +} + +GST_END_TEST; + +/* test if removing a bin also cleans up the ghostpads + */ +GST_START_TEST (test_remove2) +{ + GstElement *b1, *b2, *src, *sink; + GstPad *srcpad, *sinkpad; + GstPadLinkReturn ret; + + b1 = gst_element_factory_make ("pipeline", NULL); + b2 = gst_element_factory_make ("bin", NULL); + src = gst_element_factory_make ("fakesrc", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + + fail_unless (gst_bin_add (GST_BIN (b2), sink)); + fail_unless (gst_bin_add (GST_BIN (b1), src)); + fail_unless (gst_bin_add (GST_BIN (b1), b2)); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_element_add_pad (b2, gst_ghost_pad_new ("sink", sinkpad)); + gst_object_unref (sinkpad); + + srcpad = gst_element_get_static_pad (src, "src"); + ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2); /* since we got one */ + /* get the ghostpad */ + sinkpad = gst_element_get_static_pad (b2, "sink"); + ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); /* since we got one */ + + GST_DEBUG ("linking srcpad and sinkpad"); + ret = gst_pad_link (srcpad, sinkpad); + GST_DEBUG ("linked srcpad and sinkpad"); + fail_unless (ret == GST_PAD_LINK_OK); + /* the linking causes a proxypad to be created for srcpad, + * to which sinkpad gets linked. This proxypad has a ref to srcpad */ + ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 3); + ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + + /* now remove the sink from the bin */ + gst_bin_remove (GST_BIN (b2), sink); + + srcpad = gst_element_get_static_pad (src, "src"); + /* pad is still linked to ghostpad */ + fail_if (!gst_pad_is_linked (srcpad)); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 3); + gst_object_unref (srcpad); + ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1); + + /* cleanup */ + /* now unlink the pads */ + gst_pad_unlink (srcpad, sinkpad); + ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1); /* proxy has dropped ref */ + ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (b2, "bin", 1); + /* remove b2 from b1 */ + gst_bin_remove (GST_BIN (b1), b2); + + /* flush the message, dropping the b1 refcount to 1 */ + gst_element_set_state (b1, GST_STATE_READY); + gst_element_set_state (b1, GST_STATE_NULL); + ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1); + gst_object_unref (b1); +} + +GST_END_TEST; + + + +/* test if a ghost pad without a target can be linked and + * unlinked. An untargeted ghostpad has a default ANY caps unless there + * is a padtemplate that says something else. + */ +GST_START_TEST (test_ghost_pads_notarget) +{ + GstElement *b1, *b2, *sink; + GstPad *srcpad, *sinkpad, *peer; + GstPadLinkReturn ret; + gboolean bret; + GstBus *bus; + GstCaps *caps; + + b1 = gst_element_factory_make ("pipeline", NULL); + + /* make sure all messages are discarded */ + bus = gst_pipeline_get_bus (GST_PIPELINE (b1)); + gst_bus_set_flushing (bus, TRUE); + gst_object_unref (bus); + + b2 = gst_element_factory_make ("bin", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + + fail_unless (gst_bin_add (GST_BIN (b1), sink)); + fail_unless (gst_bin_add (GST_BIN (b1), b2)); + + srcpad = gst_ghost_pad_new_no_target ("src", GST_PAD_SRC); + fail_unless (srcpad != NULL); + sinkpad = gst_element_get_static_pad (sink, "sink"); + fail_unless (sinkpad != NULL); + + ret = gst_pad_link (srcpad, sinkpad); + fail_unless (ret == GST_PAD_LINK_OK); + + /* check if the peers are ok */ + peer = gst_pad_get_peer (srcpad); + fail_unless (peer == sinkpad); + gst_object_unref (peer); + + peer = gst_pad_get_peer (sinkpad); + fail_unless (peer == srcpad); + gst_object_unref (peer); + + /* check caps, untargetted pad should return ANY or the padtemplate caps + * when it was created from a template */ + caps = gst_pad_get_caps (srcpad, NULL); + fail_unless (gst_caps_is_any (caps)); + gst_caps_unref (caps); + + /* unlink */ + bret = gst_pad_unlink (srcpad, sinkpad); + fail_unless (bret == TRUE); + + /* cleanup */ + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + gst_object_unref (b1); +} + +GST_END_TEST; + +/* Test that removing the target of a ghostpad properly sets the target of the + * ghostpad to NULL */ +GST_START_TEST (test_remove_target) +{ + GstElement *b1, *b2, *src, *sink; + GstPad *sinkpad, *ghost, *target; + + b1 = gst_element_factory_make ("pipeline", NULL); + b2 = gst_element_factory_make ("bin", NULL); + src = gst_element_factory_make ("fakesrc", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + + fail_unless (gst_bin_add (GST_BIN (b2), sink)); + fail_unless (gst_bin_add (GST_BIN (b1), src)); + fail_unless (gst_bin_add (GST_BIN (b1), b2)); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + + sinkpad = gst_element_get_static_pad (sink, "sink"); + gst_element_add_pad (b2, gst_ghost_pad_new ("sink", sinkpad)); + + ghost = gst_element_get_static_pad (b2, "sink"); + + target = gst_ghost_pad_get_target (GST_GHOST_PAD (ghost)); + fail_unless (target == sinkpad); + gst_object_unref (target); + gst_object_unref (sinkpad); + + gst_bin_remove (GST_BIN (b2), sink); + + target = gst_ghost_pad_get_target (GST_GHOST_PAD (ghost)); + fail_unless (target == NULL); + + gst_object_unref (b1); +} + +GST_END_TEST; + + +/* test if linking fails over different bins using a pipeline + * like this: + * + * fakesrc num_buffers=10 ! ( fakesink ) + * + */ +GST_START_TEST (test_link) +{ + GstElement *b1, *b2, *src, *sink; + GstPad *srcpad, *sinkpad, *gpad, *ppad, *tmp; + GstPadLinkReturn ret; + + b1 = gst_element_factory_make ("pipeline", NULL); + b2 = gst_element_factory_make ("bin", NULL); + src = gst_element_factory_make ("fakesrc", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + + fail_unless (gst_bin_add (GST_BIN (b2), sink)); + fail_unless (gst_bin_add (GST_BIN (b1), src)); + fail_unless (gst_bin_add (GST_BIN (b1), b2)); + + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad != NULL); + sinkpad = gst_element_get_static_pad (sink, "sink"); + fail_unless (sinkpad != NULL); + + /* linking in different hierarchies should fail */ + ret = gst_pad_link (srcpad, sinkpad); + fail_unless (ret == GST_PAD_LINK_WRONG_HIERARCHY); + + /* now setup a ghostpad */ + gpad = gst_ghost_pad_new ("sink", sinkpad); + + /* Check if the internal pads are set correctly */ + ppad = GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (gpad))); + fail_unless (ppad == GST_PAD_PEER (sinkpad)); + tmp = GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (ppad))); + fail_unless (tmp == gpad); + gst_object_unref (tmp); + gst_object_unref (ppad); + gst_object_unref (sinkpad); + /* need to ref as _add_pad takes ownership */ + gst_object_ref (gpad); + gst_element_add_pad (b2, gpad); + + /* our new sinkpad */ + sinkpad = gpad; + + /* and linking should work now */ + ret = gst_pad_link (srcpad, sinkpad); + fail_unless (ret == GST_PAD_LINK_OK); + + /* flush the message, dropping the b1 refcount to 1 */ + gst_element_set_state (b1, GST_STATE_READY); + gst_element_set_state (b1, GST_STATE_NULL); + ASSERT_OBJECT_REFCOUNT (b1, "pipeline", 1); + + gst_object_unref (srcpad); + gst_object_unref (sinkpad); + gst_object_unref (b1); +} + +GST_END_TEST; + +/* test if ghostpads are created automagically when using + * gst_element_link_pads. + * + * fakesrc num_buffers=10 ! ( identity ) ! fakesink + */ +GST_START_TEST (test_ghost_pads) +{ + GstElement *b1, *b2, *src, *i1, *sink; + GstPad *gsink, *gsrc, *gisrc, *gisink, *isink, *isrc, *fsrc, *fsink; + GstStateChangeReturn ret; + + b1 = gst_element_factory_make ("pipeline", NULL); + b2 = gst_element_factory_make ("bin", NULL); + src = gst_element_factory_make ("fakesrc", NULL); + g_object_set (src, "num-buffers", (int) 10, NULL); + i1 = gst_element_factory_make ("identity", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + + fail_unless (gst_bin_add (GST_BIN (b2), i1)); + fail_unless (gst_bin_add (GST_BIN (b1), src)); + fail_unless (gst_bin_add (GST_BIN (b1), b2)); + fail_unless (gst_bin_add (GST_BIN (b1), sink)); + fail_unless (gst_element_link_pads (src, NULL, i1, NULL)); + fail_unless (gst_element_link_pads (i1, NULL, sink, NULL)); + GST_OBJECT_LOCK (b2); + fail_unless (b2->numsinkpads == 1); + fail_unless (GST_IS_GHOST_PAD (b2->sinkpads->data)); + fail_unless (b2->numsrcpads == 1); + fail_unless (GST_IS_GHOST_PAD (b2->srcpads->data)); + GST_OBJECT_UNLOCK (b2); + + fsrc = gst_element_get_static_pad (src, "src"); + fail_unless (fsrc != NULL); + gsink = GST_PAD (gst_object_ref (b2->sinkpads->data)); + fail_unless (gsink != NULL); + gsrc = GST_PAD (gst_object_ref (b2->srcpads->data)); + fail_unless (gsrc != NULL); + fsink = gst_element_get_static_pad (sink, "sink"); + fail_unless (fsink != NULL); + + isink = gst_element_get_static_pad (i1, "sink"); + fail_unless (isink != NULL); + isrc = gst_element_get_static_pad (i1, "src"); + fail_unless (isrc != NULL); + gisrc = gst_pad_get_peer (isink); + fail_unless (gisrc != NULL); + gisink = gst_pad_get_peer (isrc); + fail_unless (gisink != NULL); + + /* all objects above have one refcount owned by us as well */ + + ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 3); /* parent and gisrc */ + ASSERT_OBJECT_REFCOUNT (gsink, "gsink", 2); /* parent */ + ASSERT_OBJECT_REFCOUNT (gsrc, "gsrc", 2); /* parent */ + ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 3); /* parent and gisink */ + + ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 2); /* parent */ + ASSERT_OBJECT_REFCOUNT (isink, "isink", 3); /* parent and gsink */ + ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 2); /* parent */ + ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 3); /* parent and gsrc */ + + ret = gst_element_set_state (b1, GST_STATE_PLAYING); + ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + ret = gst_element_set_state (b1, GST_STATE_NULL); + ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + + gst_object_unref (b1); + /* unreffing the bin will unref all elements, which will unlink and unparent + * all pads */ + + /* wait for thread to settle down */ + while (GST_OBJECT_REFCOUNT_VALUE (fsrc) > 1) + THREAD_SWITCH (); + + ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 1); + ASSERT_OBJECT_REFCOUNT (gsink, "gsink", 1); + ASSERT_OBJECT_REFCOUNT (gsrc, "gsink", 1); + ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 1); + + ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 2); /* gsink */ + ASSERT_OBJECT_REFCOUNT (isink, "isink", 1); /* gsink */ + ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 2); /* gsrc */ + ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 1); /* gsrc */ + + gst_object_unref (gsink); + ASSERT_OBJECT_REFCOUNT (isink, "isink", 1); + ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 1); + ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 1); + gst_object_unref (gisrc); + ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 1); + + gst_object_unref (gsrc); + ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 1); + ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 1); + ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 1); + gst_object_unref (gisink); + ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 1); + + gst_object_unref (fsrc); + gst_object_unref (isrc); + gst_object_unref (isink); + gst_object_unref (fsink); +} + +GST_END_TEST; + +GST_START_TEST (test_ghost_pads_bin) +{ + GstBin *pipeline; + GstBin *srcbin; + GstBin *sinkbin; + GstElement *src; + GstElement *sink; + GstPad *srcpad, *srcghost, *target; + GstPad *sinkpad, *sinkghost; + + pipeline = GST_BIN (gst_pipeline_new ("pipe")); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + srcbin = GST_BIN (gst_bin_new ("srcbin")); + gst_bin_add (pipeline, GST_ELEMENT (srcbin)); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + sinkbin = GST_BIN (gst_bin_new ("sinkbin")); + gst_bin_add (pipeline, GST_ELEMENT (sinkbin)); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + src = gst_element_factory_make ("fakesrc", "src"); + gst_bin_add (srcbin, src); + srcpad = gst_element_get_static_pad (src, "src"); + srcghost = gst_ghost_pad_new ("src", srcpad); + gst_object_unref (srcpad); + gst_element_add_pad (GST_ELEMENT (srcbin), srcghost); + + sink = gst_element_factory_make ("fakesink", "sink"); + gst_bin_add (sinkbin, sink); + sinkpad = gst_element_get_static_pad (sink, "sink"); + sinkghost = gst_ghost_pad_new ("sink", sinkpad); + gst_object_unref (sinkpad); + gst_element_add_pad (GST_ELEMENT (sinkbin), sinkghost); + + gst_element_link (GST_ELEMENT (srcbin), GST_ELEMENT (sinkbin)); + + fail_unless (GST_PAD_PEER (srcghost) != NULL); + fail_unless (GST_PAD_PEER (sinkghost) != NULL); + target = gst_ghost_pad_get_target (GST_GHOST_PAD (srcghost)); + fail_unless (GST_PAD_PEER (target) != NULL); + gst_object_unref (target); + target = gst_ghost_pad_get_target (GST_GHOST_PAD (sinkghost)); + fail_unless (GST_PAD_PEER (target) != NULL); + gst_object_unref (target); + + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +typedef struct +{ + GMutex *mutex; + GCond *cond; +} BlockData; + +static GstProbeReturn +block_callback (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer user_data) +{ + BlockData *block_data = (BlockData *) user_data; + + g_mutex_lock (block_data->mutex); + GST_DEBUG ("blocked\n"); + g_cond_signal (block_data->cond); + g_mutex_unlock (block_data->mutex); + + return GST_PROBE_OK; +} + +GST_START_TEST (test_ghost_pads_block) +{ + GstBin *pipeline; + GstBin *srcbin; + GstElement *src; + GstPad *srcpad; + GstPad *srcghost; + BlockData block_data; + + pipeline = GST_BIN (gst_pipeline_new ("pipeline")); + + srcbin = GST_BIN (gst_bin_new ("srcbin")); + gst_bin_add (pipeline, GST_ELEMENT (srcbin)); + + src = gst_element_factory_make ("fakesrc", "src"); + gst_bin_add (srcbin, src); + srcpad = gst_element_get_static_pad (src, "src"); + srcghost = gst_ghost_pad_new ("src", srcpad); + gst_element_add_pad (GST_ELEMENT (srcbin), srcghost); + gst_object_unref (srcpad); + + block_data.mutex = g_mutex_new (); + block_data.cond = g_cond_new (); + + g_mutex_lock (block_data.mutex); + gst_pad_add_probe (srcghost, GST_PROBE_TYPE_BLOCK, block_callback, + &block_data, NULL); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + /* and wait now */ + g_cond_wait (block_data.cond, block_data.mutex); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + g_mutex_unlock (block_data.mutex); + + g_mutex_free (block_data.mutex); + g_cond_free (block_data.cond); + + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_ghost_pads_probes) +{ + GstBin *pipeline; + GstBin *srcbin; + GstElement *src; + GstPad *srcpad; + GstPad *srcghost; + BlockData block_data; + + pipeline = GST_BIN (gst_pipeline_new ("pipeline")); + + srcbin = GST_BIN (gst_bin_new ("srcbin")); + gst_bin_add (pipeline, GST_ELEMENT (srcbin)); + + src = gst_element_factory_make ("fakesrc", "src"); + gst_bin_add (srcbin, src); + srcpad = gst_element_get_static_pad (src, "src"); + srcghost = gst_ghost_pad_new ("src", srcpad); + gst_element_add_pad (GST_ELEMENT (srcbin), srcghost); + gst_object_unref (srcpad); + + block_data.mutex = g_mutex_new (); + block_data.cond = g_cond_new (); + + g_mutex_lock (block_data.mutex); + gst_pad_add_probe (srcghost, GST_PROBE_TYPE_BLOCK, block_callback, + &block_data, NULL); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + /* and wait now */ + g_cond_wait (block_data.cond, block_data.mutex); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + g_mutex_unlock (block_data.mutex); + + g_mutex_free (block_data.mutex); + g_cond_free (block_data.cond); + + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_ghost_pads_new_from_template) +{ + GstPad *sinkpad, *ghostpad; + GstPadTemplate *padtempl, *ghosttempl; + GstCaps *padcaps, *ghostcaps, *newcaps; + + padcaps = gst_caps_from_string ("some/caps"); + fail_unless (padcaps != NULL); + ghostcaps = gst_caps_from_string ("some/caps;some/other-caps"); + fail_unless (ghostcaps != NULL); + + padtempl = gst_pad_template_new ("padtempl", GST_PAD_SINK, + GST_PAD_ALWAYS, padcaps); + fail_unless (padtempl != NULL); + ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK, + GST_PAD_ALWAYS, ghostcaps); + + sinkpad = gst_pad_new_from_template (padtempl, "sinkpad"); + fail_unless (sinkpad != NULL); + + ghostpad = gst_ghost_pad_new_from_template ("ghostpad", sinkpad, ghosttempl); + fail_unless (ghostpad != NULL); + + /* check template is properly set */ + fail_unless (GST_PAD_PAD_TEMPLATE (ghostpad) == ghosttempl); + + /* check ghostpad caps are from the sinkpad */ + newcaps = gst_pad_get_caps (ghostpad, NULL); + fail_unless (newcaps != NULL); + fail_unless (gst_caps_is_equal (newcaps, padcaps)); + gst_caps_unref (newcaps); + gst_caps_unref (padcaps); + gst_caps_unref (ghostcaps); + + gst_object_unref (sinkpad); + gst_object_unref (ghostpad); + + gst_object_unref (padtempl); + gst_object_unref (ghosttempl); +} + +GST_END_TEST; + +GST_START_TEST (test_ghost_pads_new_no_target_from_template) +{ + GstPad *sinkpad, *ghostpad; + GstPadTemplate *padtempl, *ghosttempl; + GstCaps *padcaps, *ghostcaps, *newcaps; + + padcaps = gst_caps_from_string ("some/caps"); + fail_unless (padcaps != NULL); + ghostcaps = gst_caps_from_string ("some/caps;some/other-caps"); + fail_unless (ghostcaps != NULL); + + padtempl = gst_pad_template_new ("padtempl", GST_PAD_SINK, + GST_PAD_ALWAYS, padcaps); + fail_unless (padtempl != NULL); + ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK, + GST_PAD_ALWAYS, ghostcaps); + + sinkpad = gst_pad_new_from_template (padtempl, "sinkpad"); + fail_unless (sinkpad != NULL); + + ghostpad = gst_ghost_pad_new_no_target_from_template ("ghostpad", ghosttempl); + fail_unless (ghostpad != NULL); + + /* check template is properly set */ + fail_unless (GST_PAD_PAD_TEMPLATE (ghostpad) == ghosttempl); + + /* check ghostpad caps are from the ghostpad template */ + newcaps = gst_pad_get_caps (ghostpad, NULL); + fail_unless (newcaps != NULL); + fail_unless (gst_caps_is_equal (newcaps, ghostcaps)); + gst_caps_unref (newcaps); + + fail_unless (gst_ghost_pad_set_target ((GstGhostPad *) ghostpad, sinkpad)); + + /* check ghostpad caps are now from the target pad */ + newcaps = gst_pad_get_caps (ghostpad, NULL); + fail_unless (newcaps != NULL); + fail_unless (gst_caps_is_equal (newcaps, padcaps)); + gst_caps_unref (newcaps); + + gst_object_unref (sinkpad); + gst_object_unref (ghostpad); + + gst_object_unref (padtempl); + gst_object_unref (ghosttempl); + + gst_caps_unref (padcaps); + gst_caps_unref (ghostcaps); +} + +GST_END_TEST; + +static void +ghost_notify_caps (GObject * object, GParamSpec * pspec, gpointer * user_data) +{ + GST_DEBUG ("caps notify called"); + (*(gint *) user_data)++; +} + +GST_START_TEST (test_ghost_pads_forward_setcaps) +{ + GstCaps *templ_caps, *caps1, *caps2; + GstPadTemplate *src_template, *sink_template; + GstPad *src, *ghost, *sink; + gint notify_counter = 0; + + templ_caps = gst_caps_from_string ("meh; muh"); + src_template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, templ_caps); + gst_caps_unref (templ_caps); + + templ_caps = gst_caps_from_string ("muh; meh"); + sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, templ_caps); + gst_caps_unref (templ_caps); + + src = gst_pad_new_from_template (src_template, "src"); + sink = gst_pad_new_from_template (sink_template, "sink"); + + /* ghost source pad, setting caps on the source influences the caps of the + * ghostpad. */ + ghost = gst_ghost_pad_new ("ghostsrc", src); + g_signal_connect (ghost, "notify::caps", + G_CALLBACK (ghost_notify_caps), ¬ify_counter); + fail_unless (gst_pad_link (ghost, sink) == GST_PAD_LINK_OK); + + /* Activate pads for caps forwarding/setting to work */ + gst_pad_set_active (src, TRUE); + gst_pad_set_active (ghost, TRUE); + + caps1 = gst_caps_from_string ("meh"); + fail_unless (gst_pad_set_caps (src, caps1)); + caps2 = gst_pad_get_current_caps (ghost); + fail_unless (gst_caps_is_equal (caps1, caps2)); + fail_unless_equals_int (notify_counter, 1); + + gst_object_unref (ghost); + gst_caps_unref (caps1); + + /* source 2, setting the caps on the ghostpad does not influence the caps of + * the target */ + notify_counter = 0; + ghost = gst_ghost_pad_new ("ghostsrc", src); + g_signal_connect (ghost, "notify::caps", + G_CALLBACK (ghost_notify_caps), ¬ify_counter); + fail_unless (gst_pad_link (ghost, sink) == GST_PAD_LINK_OK); + + gst_pad_set_active (ghost, TRUE); + gst_pad_set_active (sink, TRUE); + + caps1 = gst_caps_from_string ("meh"); + fail_unless (gst_pad_set_caps (ghost, caps1)); +#if 0 + caps2 = gst_pad_get_current_caps (src); + fail_unless (caps2 == NULL); +#endif + fail_unless_equals_int (notify_counter, 1); + + gst_object_unref (ghost); + gst_caps_unref (caps1); + + + /* ghost sink pad. Setting caps on the ghostpad will also set those caps on + * the target pad. */ + notify_counter = 0; + ghost = gst_ghost_pad_new ("ghostsink", sink); + g_signal_connect (ghost, "notify::caps", + G_CALLBACK (ghost_notify_caps), ¬ify_counter); + fail_unless (gst_pad_link (src, ghost) == GST_PAD_LINK_OK); + + gst_pad_set_active (src, TRUE); + gst_pad_set_active (ghost, TRUE); + + caps1 = gst_caps_from_string ("muh"); + fail_unless (gst_pad_set_caps (ghost, caps1)); + caps2 = gst_pad_get_current_caps (sink); + fail_unless (gst_caps_is_equal (caps1, caps2)); + fail_unless_equals_int (notify_counter, 1); + + gst_object_unref (ghost); + gst_caps_unref (caps1); + + /* clear caps on pads */ + gst_pad_set_active (src, FALSE); + gst_pad_set_active (src, TRUE); + gst_pad_set_active (sink, FALSE); + gst_pad_set_active (sink, TRUE); + + /* sink pad 2, setting caps just on the target pad should not influence the caps + * on the ghostpad. */ + notify_counter = 0; + ghost = gst_ghost_pad_new ("ghostsink", sink); + fail_unless (gst_pad_get_current_caps (ghost) == NULL); + g_signal_connect (ghost, "notify::caps", + G_CALLBACK (ghost_notify_caps), ¬ify_counter); + fail_unless (gst_pad_link (src, ghost) == GST_PAD_LINK_OK); + + gst_pad_set_active (ghost, TRUE); + + caps1 = gst_caps_from_string ("muh"); + fail_unless (gst_pad_set_caps (sink, caps1)); + caps2 = gst_pad_get_current_caps (ghost); + fail_unless (caps2 == NULL); + fail_unless_equals_int (notify_counter, 0); + + gst_object_unref (ghost); + gst_caps_unref (caps1); + + gst_object_unref (src); + gst_object_unref (sink); + gst_object_unref (src_template); + gst_object_unref (sink_template); +} + +GST_END_TEST; + +static gint linked_count1; +static gint unlinked_count1; +static gint linked_count2; +static gint unlinked_count2; + +static GstPadLinkReturn +pad_linked1 (GstPad * pad, GstPad * peer) +{ + linked_count1++; + + return GST_PAD_LINK_OK; +} + +static void +pad_unlinked1 (GstPad * pad) +{ + unlinked_count1++; +} + +static GstPadLinkReturn +pad_linked2 (GstPad * pad, GstPad * peer) +{ + linked_count2++; + + return GST_PAD_LINK_OK; +} + +static void +pad_unlinked2 (GstPad * pad) +{ + unlinked_count2++; +} + +GST_START_TEST (test_ghost_pads_sink_link_unlink) +{ + GstCaps *padcaps; + GstPad *srcpad, *sinkpad, *ghostpad; + GstPadTemplate *srctempl, *sinktempl; + GstPadLinkReturn ret; + gboolean res; + + padcaps = gst_caps_from_string ("some/caps"); + fail_unless (padcaps != NULL); + srctempl = gst_pad_template_new ("srctempl", GST_PAD_SRC, + GST_PAD_ALWAYS, padcaps); + gst_caps_unref (padcaps); + + padcaps = gst_caps_from_string ("some/caps"); + fail_unless (padcaps != NULL); + sinktempl = gst_pad_template_new ("sinktempl", GST_PAD_SINK, + GST_PAD_ALWAYS, padcaps); + gst_caps_unref (padcaps); + + srcpad = gst_pad_new_from_template (srctempl, "src"); + fail_unless (srcpad != NULL); + sinkpad = gst_pad_new_from_template (sinktempl, "sink"); + fail_unless (sinkpad != NULL); + + /* set up link/unlink functions for the pad */ + linked_count1 = unlinked_count1 = 0; + gst_pad_set_link_function (sinkpad, pad_linked1); + gst_pad_set_unlink_function (sinkpad, pad_unlinked1); + linked_count2 = unlinked_count2 = 0; + gst_pad_set_link_function (srcpad, pad_linked2); + gst_pad_set_unlink_function (srcpad, pad_unlinked2); + + /* this should trigger a link from the internal pad to the sinkpad */ + ghostpad = gst_ghost_pad_new ("ghostpad", sinkpad); + fail_unless (ghostpad != NULL); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 0); + fail_unless (unlinked_count2 == 0); + + /* this should not trigger anything because we are not directly + * linking/unlinking the sink pad. */ + ret = gst_pad_link (srcpad, ghostpad); + fail_unless (ret == GST_PAD_LINK_OK); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 0); + + res = gst_pad_unlink (srcpad, ghostpad); + fail_unless (res == TRUE); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 1); + + /* this should trigger the unlink */ + res = gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (ghostpad), NULL); + fail_unless (res == TRUE); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 1); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 1); + + gst_object_unref (ghostpad); + gst_object_unref (sinkpad); + gst_object_unref (srcpad); + gst_object_unref (srctempl); + gst_object_unref (sinktempl); +} + +GST_END_TEST; + +GST_START_TEST (test_ghost_pads_src_link_unlink) +{ + GstCaps *padcaps; + GstPad *srcpad, *sinkpad, *ghostpad, *dummy; + GstPadTemplate *srctempl, *sinktempl; + GstPadLinkReturn ret; + gboolean res; + + padcaps = gst_caps_from_string ("some/caps"); + fail_unless (padcaps != NULL); + srctempl = gst_pad_template_new ("srctempl", GST_PAD_SRC, + GST_PAD_ALWAYS, padcaps); + gst_caps_unref (padcaps); + + padcaps = gst_caps_from_string ("some/caps"); + fail_unless (padcaps != NULL); + sinktempl = gst_pad_template_new ("sinktempl", GST_PAD_SINK, + GST_PAD_ALWAYS, padcaps); + gst_caps_unref (padcaps); + + srcpad = gst_pad_new_from_template (srctempl, "src"); + fail_unless (srcpad != NULL); + sinkpad = gst_pad_new_from_template (sinktempl, "sink"); + fail_unless (sinkpad != NULL); + + /* set up link/unlink functions for the pad */ + linked_count1 = unlinked_count1 = 0; + gst_pad_set_link_function (srcpad, pad_linked1); + gst_pad_set_unlink_function (srcpad, pad_unlinked1); + linked_count2 = unlinked_count2 = 0; + gst_pad_set_link_function (sinkpad, pad_linked2); + gst_pad_set_unlink_function (sinkpad, pad_unlinked2); + + /* this should trigger a link from the internal pad to the srcpad */ + ghostpad = gst_ghost_pad_new ("ghostpad", srcpad); + fail_unless (ghostpad != NULL); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 0); + fail_unless (unlinked_count2 == 0); + + /* this should fail with a critial */ + ASSERT_CRITICAL (dummy = gst_ghost_pad_new ("ghostpad", srcpad)); + fail_unless (dummy == NULL); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 0); + fail_unless (unlinked_count2 == 0); + + /* this should not trigger anything because we are not directly + * linking/unlinking the src pad. */ + ret = gst_pad_link (ghostpad, sinkpad); + fail_unless (ret == GST_PAD_LINK_OK); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 0); + + /* this link should fail because we are already linked. Let's make sure the + * link functions are not called */ + ret = gst_pad_link (ghostpad, sinkpad); + fail_unless (ret == GST_PAD_LINK_WAS_LINKED); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 0); + + res = gst_pad_unlink (ghostpad, sinkpad); + fail_unless (res == TRUE); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 1); + + res = gst_pad_unlink (ghostpad, sinkpad); + fail_unless (res == FALSE); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 0); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 1); + + /* this should trigger the unlink function */ + res = gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (ghostpad), NULL); + fail_unless (res == TRUE); + fail_unless (linked_count1 == 1); + fail_unless (unlinked_count1 == 1); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 1); + + /* and this the link function again */ + res = gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (ghostpad), srcpad); + fail_unless (res == TRUE); + fail_unless (linked_count1 == 2); + fail_unless (unlinked_count1 == 1); + fail_unless (linked_count2 == 1); + fail_unless (unlinked_count2 == 1); + + gst_object_unref (ghostpad); + gst_object_unref (sinkpad); + gst_object_unref (srcpad); + gst_object_unref (srctempl); + gst_object_unref (sinktempl); +} + +GST_END_TEST; + +GST_START_TEST (test_ghost_pads_change_when_linked) +{ + GstElement *b1, *b2, *src, *fmt, *sink1, *sink2; + GstPad *sinkpad, *ghostpad; + GstCaps *caps; + + b1 = gst_element_factory_make ("pipeline", NULL); + b2 = gst_element_factory_make ("bin", NULL); + src = gst_element_factory_make ("fakesrc", NULL); + fmt = gst_element_factory_make ("capsfilter", NULL); + sink1 = gst_element_factory_make ("fakesink", NULL); + sink2 = gst_element_factory_make ("fakesink", NULL); + + gst_bin_add (GST_BIN (b2), sink1); + gst_bin_add (GST_BIN (b2), sink2); + gst_bin_add (GST_BIN (b1), src); + gst_bin_add (GST_BIN (b1), fmt); + gst_bin_add (GST_BIN (b1), b2); + + caps = gst_caps_from_string ("audio/x-raw-int, width=16, channels=1"); + g_object_set (fmt, "caps", caps, NULL); + gst_caps_unref (caps); + + /* create the ghostpad as a sink-pad for bin 2 */ + ghostpad = gst_ghost_pad_new_no_target ("sink", GST_PAD_SINK); + gst_element_add_pad (b2, ghostpad); + + sinkpad = gst_element_get_static_pad (sink1, "sink"); + fail_unless (gst_ghost_pad_set_target ((GstGhostPad *) ghostpad, sinkpad)); + gst_object_unref (sinkpad); + + fail_unless (gst_element_link_many (src, fmt, b2, NULL)); + + /* set different target after ghostpad is linked */ + sinkpad = gst_element_get_static_pad (sink2, "sink"); + fail_unless (gst_ghost_pad_set_target ((GstGhostPad *) ghostpad, sinkpad)); + gst_object_unref (sinkpad); + + /* clean up */ + gst_object_unref (b1); +} + +GST_END_TEST; + + +static Suite * +gst_ghost_pad_suite (void) +{ + Suite *s = suite_create ("GstGhostPad"); + + TCase *tc_chain = tcase_create ("ghost pad tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_remove1); + tcase_add_test (tc_chain, test_remove2); + tcase_add_test (tc_chain, test_remove_target); + tcase_add_test (tc_chain, test_link); + tcase_add_test (tc_chain, test_ghost_pads); + tcase_add_test (tc_chain, test_ghost_pads_bin); + tcase_add_test (tc_chain, test_ghost_pads_notarget); + tcase_add_test (tc_chain, test_ghost_pads_block); + tcase_add_test (tc_chain, test_ghost_pads_probes); + tcase_add_test (tc_chain, test_ghost_pads_new_from_template); + tcase_add_test (tc_chain, test_ghost_pads_new_no_target_from_template); + tcase_add_test (tc_chain, test_ghost_pads_forward_setcaps); + tcase_add_test (tc_chain, test_ghost_pads_sink_link_unlink); + tcase_add_test (tc_chain, test_ghost_pads_src_link_unlink); + tcase_add_test (tc_chain, test_ghost_pads_change_when_linked); + + return s; +} + +GST_CHECK_MAIN (gst_ghost_pad); diff --git a/tests/check/gst/gstindex.c b/tests/check/gst/gstindex.c new file mode 100644 index 0000000..f533dd0 --- /dev/null +++ b/tests/check/gst/gstindex.c @@ -0,0 +1,59 @@ +/* GStreamer GstIndex unit test + * Copyright (C) 2008 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> + +#include <gst/gst.h> +#include <string.h> + +GST_START_TEST (test_index_entries) +{ + GstIndexEntry *entry; + GstElement *pipe; + GstIndex *index; + gint id = -1; + + pipe = gst_pipeline_new ("pipeline"); + + index = gst_index_new (); + fail_unless (gst_index_get_writer_id (index, GST_OBJECT (pipe), &id)); + + entry = gst_index_add_format (index, id, GST_FORMAT_BYTES); + gst_index_entry_free (entry); + + gst_object_unref (index); + gst_object_unref (pipe); + +} + +GST_END_TEST; + +static Suite * +gst_index_suite (void) +{ + Suite *s = suite_create ("GstIndex"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_index_entries); + + return s; +} + +GST_CHECK_MAIN (gst_index); diff --git a/tests/check/gst/gstinfo.c b/tests/check/gst/gstinfo.c new file mode 100644 index 0000000..e7757d8 --- /dev/null +++ b/tests/check/gst/gstinfo.c @@ -0,0 +1,266 @@ +/* GStreamer + * + * Unit tests for GstInfo + * + * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> + +#ifndef GST_DISABLE_GST_DEBUG + +static void +printf_extension_log_func (GstDebugCategory * category, + GstDebugLevel level, const gchar * file, const gchar * function, + gint line, GObject * object, GstDebugMessage * message, gpointer unused) +{ + const gchar *dbg_msg; + + dbg_msg = gst_debug_message_get (message); + fail_unless (dbg_msg != NULL); + + /* g_print ("%s\n", dbg_msg); */ + + /* quick hack to still get stuff to show if GST_DEBUG is set */ + if (g_getenv ("GST_DEBUG")) { + gst_debug_log_default (category, level, file, function, line, object, + message, unused); + } +} + +/* check our GST_PTR_FORMAT printf extension stuff */ +GST_START_TEST (info_ptr_format_printf_extension) +{ + /* set up our own log function to make sure the code in gstinfo is actually + * executed without GST_DEBUG being set or it being output to stdout */ + gst_debug_remove_log_function (gst_debug_log_default); + gst_debug_add_log_function (printf_extension_log_func, NULL); + + gst_debug_set_default_threshold (GST_LEVEL_LOG); + + /* NULL object */ + GST_LOG ("NULL: %" GST_PTR_FORMAT, (gpointer) NULL); + + /* structure */ + { + GstStructure *s; + + s = gst_structure_new ("foo/bar", "number", G_TYPE_INT, 1, + "string", G_TYPE_STRING, "s", "float-number", G_TYPE_DOUBLE, + (gdouble) 424242.42, NULL); + + GST_LOG ("STRUCTURE: %" GST_PTR_FORMAT, s); + gst_structure_free (s); + } + + /* message */ + { + GstMessage *msg; + + msg = gst_message_new_element (NULL, + gst_structure_new ("redirect", "new-location", G_TYPE_STRING, + "http://foobar.com/r0x0r.ogg", "minimum-bitrate", G_TYPE_INT, + 56000, NULL)); + + GST_LOG ("MESSAGE: %" GST_PTR_FORMAT, msg); + gst_message_unref (msg); + } + +#if 0 + /* TODO: GObject */ + { + GST_LOG ("GOBJECT: %" GST_PTR_FORMAT, obj); + } + + /* TODO: GstObject */ + { + GST_LOG ("GSTOBJECT: %" GST_PTR_FORMAT, obj); + } + + /* TODO: GstPad */ + { + GST_LOG ("PAD: %" GST_PTR_FORMAT, pad); + } + + /* TODO: GstCaps */ + { + GST_LOG ("PAD: %" GST_PTR_FORMAT, pad); + } +#endif + + /* clean up */ + gst_debug_set_default_threshold (GST_LEVEL_NONE); + gst_debug_add_log_function (gst_debug_log_default, NULL); + gst_debug_remove_log_function (printf_extension_log_func); +} + +GST_END_TEST; + +/* check our GST_SEGMENT_FORMAT printf extension stuff */ +GST_START_TEST (info_segment_format_printf_extension) +{ + /* set up our own log function to make sure the code in gstinfo is actually + * executed without GST_DEBUG being set or it being output to stdout */ + gst_debug_remove_log_function (gst_debug_log_default); + gst_debug_add_log_function (printf_extension_log_func, NULL); + + gst_debug_set_default_threshold (GST_LEVEL_LOG); + + /* TIME segment */ + { + GstSegment segment; + + gst_segment_init (&segment, GST_FORMAT_TIME); + + segment.rate = 1.0; + segment.applied_rate = 2.0; + segment.start = 0; + segment.stop = 5 * 60 * GST_SECOND; + segment.time = 0; + + segment.position = 2 * GST_SECOND; + segment.duration = 90 * 60 * GST_SECOND; + + GST_LOG ("TIME: %" GST_SEGMENT_FORMAT, &segment); + } + + /* BYTE segment */ + { + GstSegment segment; + + gst_segment_init (&segment, GST_FORMAT_BYTES); + + segment.rate = 1.0; + segment.applied_rate = 1.0; + segment.start = 0; + segment.stop = 9999999; + segment.time = 0; + + GST_LOG ("BYTE: %" GST_SEGMENT_FORMAT, &segment); + } + + /* UNKNOWN format segment (format numbers are consecutive from 0) */ + { + GstSegment segment; + + gst_segment_init (&segment, 98765432); + + segment.rate = 1.0; + segment.applied_rate = 1.0; + segment.start = 0; + segment.stop = 987654321; + segment.time = 0; + + GST_LOG ("UNKNOWN: %" GST_SEGMENT_FORMAT, &segment); + } + + /* UNDEFINED format segment */ + { + GstSegment segment; + + gst_segment_init (&segment, GST_FORMAT_UNDEFINED); + + GST_LOG ("UNDEFINED: %" GST_SEGMENT_FORMAT, &segment); + } + + /* NULL segment */ + GST_LOG ("NULL: %" GST_SEGMENT_FORMAT, (GstSegment *) NULL); + + /* clean up */ + gst_debug_set_default_threshold (GST_LEVEL_NONE); + gst_debug_add_log_function (gst_debug_log_default, NULL); + gst_debug_remove_log_function (printf_extension_log_func); +} + +GST_END_TEST; + +GST_START_TEST (info_log_handler) +{ + guint removed; + + removed = gst_debug_remove_log_function (gst_debug_log_default); + fail_unless (removed == 1); +} + +GST_END_TEST; + +GST_START_TEST (info_dump_mem) +{ + GstDebugCategory *cat = NULL; + GstElement *e; + + const guint8 data[] = { 0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70, + 0x71, 0x74, 0x20, 0x20, 0x20, 0x05, 0x03, 0x00, 0x71, 0x74, 0x20, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xef, 0xe1, 0x6d, 0x6f, 0x6f, 0x76, 0x00, 0x00, 0x00, 0x6c, + 0x6d, 0x76, 0x68, 0x64, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xd1, 0x00, 0x1d, + 0xbf, 0xd1, 0x00, 0x1e, 0x00, 0x00, 0x0b, 0xb5, 0x00, 0x04, 0x59, 0xc5, + 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, '%', 's', '%', 's' + }; + + e = gst_element_factory_make ("fakesink", NULL); + GST_DEBUG_CATEGORY_INIT (cat, "dumpcat", 0, "data dump debug category"); + GST_MEMDUMP ("quicktime header", data, sizeof (data)); + GST_MEMDUMP (NULL, data, sizeof (data)); + GST_CAT_MEMDUMP (cat, "quicktime header", data, sizeof (data)); + GST_MEMDUMP_OBJECT (e, "object stuff", data, sizeof (data)); + GST_CAT_MEMDUMP_OBJECT (cat, e, "object/cat stuff", data, sizeof (data)); + gst_object_unref (e); +} + +GST_END_TEST; + +GST_START_TEST (info_fixme) +{ + GstDebugCategory *cat = NULL; + GstElement *e; + + e = gst_element_factory_make ("fakesink", NULL); + GST_DEBUG_CATEGORY_INIT (cat, "fixcat", 0, "FIXME debug category"); + GST_FIXME ("fix %s thing", "this"); + GST_FIXME_OBJECT (e, "fix %s object", "this"); + GST_CAT_FIXME (cat, "fix some%s in this category", "thing"); + GST_CAT_FIXME_OBJECT (cat, e, "fix some%s in this cat and object", "thing"); + gst_object_unref (e); +} + +GST_END_TEST; +#endif + +static Suite * +gst_info_suite (void) +{ + Suite *s = suite_create ("GstInfo"); + TCase *tc_chain = tcase_create ("info"); + + tcase_set_timeout (tc_chain, 30); + + suite_add_tcase (s, tc_chain); +#ifndef GST_DISABLE_GST_DEBUG + tcase_add_test (tc_chain, info_segment_format_printf_extension); + tcase_add_test (tc_chain, info_ptr_format_printf_extension); + tcase_add_test (tc_chain, info_log_handler); + tcase_add_test (tc_chain, info_dump_mem); + tcase_add_test (tc_chain, info_fixme); +#endif + + return s; +} + +GST_CHECK_MAIN (gst_info); diff --git a/tests/check/gst/gstiterator.c b/tests/check/gst/gstiterator.c new file mode 100644 index 0000000..e6d9389 --- /dev/null +++ b/tests/check/gst/gstiterator.c @@ -0,0 +1,229 @@ +/* GStreamer + * Copyright (C) 2005 Andy Wingo <wingo@pobox.com> + * + * gstiterator.c: Unit test for iterators + * + * 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 <gst/check/gstcheck.h> + + +static GList * +make_list_of_ints (gint n) +{ + GList *ret = NULL; + gint i; + + for (i = 0; i < n; i++) + ret = g_list_prepend (ret, GINT_TO_POINTER (i)); + + return g_list_reverse (ret); +} + +#define NUM_ELEMENTS 10 + +GST_START_TEST (test_manual_iteration) +{ + GList *l; + guint32 cookie = 0; + GMutex *m; + GstIterator *iter; + GstIteratorResult res; + GValue item = { 0, }; + gint i = 0; + + l = make_list_of_ints (NUM_ELEMENTS); + m = g_mutex_new (); + + iter = gst_iterator_new_list (G_TYPE_POINTER, m, &cookie, &l, NULL, NULL); + + fail_unless (iter != NULL); + + while (1) { + res = gst_iterator_next (iter, &item); + if (i < NUM_ELEMENTS) { + fail_unless (res == GST_ITERATOR_OK); + fail_unless (GPOINTER_TO_INT (g_value_get_pointer (&item)) == i); + g_value_reset (&item); + i++; + continue; + } else { + fail_unless (res == GST_ITERATOR_DONE); + break; + } + } + /* clean up */ + g_value_unset (&item); + gst_iterator_free (iter); + g_mutex_free (m); + g_list_free (l); +} + +GST_END_TEST; + +GST_START_TEST (test_resync) +{ + GList *l; + guint32 cookie = 0; + GMutex *m; + GstIterator *iter; + GstIteratorResult res; + GValue item = { 0, }; + gint i = 0; + gboolean hacked_list = FALSE; + + l = make_list_of_ints (NUM_ELEMENTS); + m = g_mutex_new (); + + iter = gst_iterator_new_list (G_TYPE_POINTER, m, &cookie, &l, NULL, NULL); + + fail_unless (iter != NULL); + + while (1) { + res = gst_iterator_next (iter, &item); + if (i < NUM_ELEMENTS / 2) { + fail_unless (res == GST_ITERATOR_OK); + fail_unless (GPOINTER_TO_INT (g_value_get_pointer (&item)) == i); + g_value_reset (&item); + i++; + continue; + } else if (!hacked_list) { + /* here's where we test resync */ + fail_unless (res == GST_ITERATOR_OK); + g_value_reset (&item); + l = g_list_prepend (l, GINT_TO_POINTER (-1)); + cookie++; + hacked_list = TRUE; + continue; + } else { + fail_unless (res == GST_ITERATOR_RESYNC); + gst_iterator_resync (iter); + res = gst_iterator_next (iter, &item); + fail_unless (res == GST_ITERATOR_OK); + fail_unless (GPOINTER_TO_INT (g_value_get_pointer (&item)) == -1); + g_value_reset (&item); + break; + } + } + + /* clean up */ + g_value_unset (&item); + gst_iterator_free (iter); + g_mutex_free (m); + g_list_free (l); +} + +GST_END_TEST; + +static gboolean +add_fold_func (const GValue * item, GValue * ret, gpointer user_data) +{ + g_value_set_int (ret, + g_value_get_int (ret) + GPOINTER_TO_INT (g_value_get_pointer (item))); + return TRUE; +} + +GST_START_TEST (test_fold) +{ + GList *l; + guint32 cookie = 0; + GMutex *m; + GstIterator *iter; + GstIteratorResult res; + gint i, expected; + GValue ret = { 0, }; + + l = make_list_of_ints (NUM_ELEMENTS); + m = g_mutex_new (); + iter = gst_iterator_new_list (G_TYPE_POINTER, m, &cookie, &l, NULL, NULL); + fail_unless (iter != NULL); + + expected = 0; + for (i = 0; i < NUM_ELEMENTS; i++) + expected += i; + + g_value_init (&ret, G_TYPE_INT); + g_value_set_int (&ret, 0); + + res = gst_iterator_fold (iter, add_fold_func, &ret, NULL); + + fail_unless (res == GST_ITERATOR_DONE); + fail_unless (g_value_get_int (&ret) == expected); + + /* clean up */ + gst_iterator_free (iter); + g_mutex_free (m); + g_list_free (l); +} + +GST_END_TEST; + +GST_START_TEST (test_single) +{ + GstIterator *it; + GstStructure *s = gst_structure_new ("test", NULL); + GValue v = { 0, }; + GstStructure *i; + + g_value_init (&v, GST_TYPE_STRUCTURE); + g_value_set_boxed (&v, s); + it = gst_iterator_new_single (GST_TYPE_STRUCTURE, &v); + g_value_reset (&v); + + fail_unless (gst_iterator_next (it, &v) == GST_ITERATOR_OK); + i = g_value_get_boxed (&v); + fail_unless (strcmp (gst_structure_get_name (s), + gst_structure_get_name (i)) == 0); + i = NULL; + g_value_reset (&v); + + fail_unless (gst_iterator_next (it, &v) == GST_ITERATOR_DONE); + fail_unless (g_value_get_boxed (&v) == NULL); + + gst_iterator_free (it); + gst_structure_free (s); + + it = gst_iterator_new_single (GST_TYPE_STRUCTURE, NULL); + + fail_unless (gst_iterator_next (it, &v) == GST_ITERATOR_DONE); + fail_unless (g_value_get_boxed (&v) == NULL); + + g_value_reset (&v); + + gst_iterator_free (it); +} + +GST_END_TEST; + +static Suite * +gst_iterator_suite (void) +{ + Suite *s = suite_create ("GstIterator"); + TCase *tc_chain = tcase_create ("correctness"); + + tcase_set_timeout (tc_chain, 0); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_manual_iteration); + tcase_add_test (tc_chain, test_resync); + tcase_add_test (tc_chain, test_fold); + tcase_add_test (tc_chain, test_single); + return s; +} + +GST_CHECK_MAIN (gst_iterator); diff --git a/tests/check/gst/gstmessage.c b/tests/check/gst/gstmessage.c new file mode 100644 index 0000000..423226a --- /dev/null +++ b/tests/check/gst/gstmessage.c @@ -0,0 +1,365 @@ +/* GStreamer + * + * unit test for GstMessage + * + * Copyright (C) <2005> Wim Taymans <wim at fluendo dot 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. + */ + +#include <gst/check/gstcheck.h> + +static GQuark domain; + +GST_START_TEST (test_parsing) +{ + GstMessage *message; + + domain = g_quark_from_static_string ("test"); + + /* GST_MESSAGE_EOS */ + { + message = gst_message_new_eos (NULL); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + gst_message_unref (message); + } + /* GST_MESSAGE_ERROR */ + { + GError *error = NULL; + gchar *debug; + + error = g_error_new (domain, 10, "test error"); + fail_if (error == NULL); + message = gst_message_new_error (NULL, error, "error string"); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + + g_error_free (error); + error = NULL; + debug = NULL; + + gst_message_parse_error (message, &error, &debug); + fail_if (error == NULL); + fail_if (debug == NULL); + fail_unless (strcmp (error->message, "test error") == 0); + fail_unless (error->domain == domain); + fail_unless (error->code == 10); + fail_unless (strcmp (debug, "error string") == 0); + + gst_message_unref (message); + g_error_free (error); + g_free (debug); + } + /* GST_MESSAGE_WARNING */ + { + GError *warning = NULL; + gchar *debug; + + warning = g_error_new (domain, 10, "test warning"); + fail_if (warning == NULL); + message = gst_message_new_warning (NULL, warning, "warning string"); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + + g_error_free (warning); + warning = NULL; + debug = NULL; + + gst_message_parse_warning (message, &warning, &debug); + fail_if (warning == NULL); + fail_if (debug == NULL); + fail_unless (strcmp (warning->message, "test warning") == 0); + fail_unless (warning->domain == domain); + fail_unless (warning->code == 10); + fail_unless (strcmp (debug, "warning string") == 0); + + gst_message_unref (message); + g_error_free (warning); + g_free (debug); + } + /* GST_MESSAGE_INFO */ + { + } + /* GST_MESSAGE_TAG */ + { + GstTagList *tag; + + /* FIXME, do some more tag adding */ + tag = gst_tag_list_new (); + fail_if (tag == NULL); + message = gst_message_new_tag (NULL, tag); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + tag = NULL; + gst_message_parse_tag (message, &tag); + fail_if (tag == NULL); + /* FIXME, check the actual tags */ + gst_message_unref (message); + gst_tag_list_free (tag); + } + /* GST_MESSAGE_BUFFERING */ + { + } + /* GST_MESSAGE_STATE_CHANGED */ + { + GstState oldstate, newstate, pending; + + oldstate = GST_STATE_PAUSED; + newstate = GST_STATE_PLAYING; + pending = GST_STATE_VOID_PENDING; + + message = gst_message_new_state_changed (NULL, oldstate, newstate, pending); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + + /* set some wrong values to check if the parse method overwrites them + * with the good values */ + oldstate = GST_STATE_READY; + newstate = GST_STATE_READY; + pending = GST_STATE_READY; + gst_message_parse_state_changed (message, &oldstate, &newstate, &pending); + fail_unless (oldstate == GST_STATE_PAUSED); + fail_unless (newstate == GST_STATE_PLAYING); + fail_unless (pending == GST_STATE_VOID_PENDING); + + gst_message_unref (message); + } + /* GST_MESSAGE_STEP_DONE */ + { + } + /* GST_MESSAGE_NEW_CLOCK */ + { + } + /* GST_MESSAGE_STRUCTURE_CHANGE */ + { + } + /* GST_MESSAGE_STREAM_STATUS */ + { + } + /* GST_MESSAGE_APPLICATION */ + { + GstStructure *structure; + const GstStructure *struc; + gint some_int; + gdouble a_double; + + structure = gst_structure_new ("test_struct", + "some_int", G_TYPE_INT, 10, + "a_double", G_TYPE_DOUBLE, (gdouble) 1.8, NULL); + fail_if (structure == NULL); + message = gst_message_new_application (NULL, structure); + fail_if (message == NULL); + struc = gst_message_get_structure (message); + fail_if (struc == NULL); + fail_unless (gst_structure_get_int (struc, "some_int", &some_int)); + fail_unless (gst_structure_get_double (struc, "a_double", &a_double)); + fail_unless (some_int == 10); + fail_unless (a_double == 1.8); + + gst_message_unref (message); + } + + /* + void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list); + void gst_message_parse_state_changed (GstMessage *message, GstState *old_state, + GstState *new_state); + void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); + void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug); + */ + + /* GST_MESSAGE_STREAM_STATUS */ + { + GstStreamStatusType type; + GstTask *task, *task2; + GValue value = { 0 }; + const GValue *val; + + message = + gst_message_new_stream_status (NULL, GST_STREAM_STATUS_TYPE_ENTER, + NULL); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + + /* set some wrong values to check if the parse method overwrites them + * with the good values */ + type = GST_STREAM_STATUS_TYPE_START; + gst_message_parse_stream_status (message, &type, NULL); + fail_unless (type == GST_STREAM_STATUS_TYPE_ENTER); + + /* create a task with some dummy function, we're not actually going to run + * the task here */ + task = gst_task_create ((GstTaskFunction) gst_object_unref, NULL); + + ASSERT_OBJECT_REFCOUNT (task, "task", 1); + + /* set the task */ + g_value_init (&value, GST_TYPE_TASK); + g_value_set_object (&value, task); + + ASSERT_OBJECT_REFCOUNT (task, "task", 2); + + gst_message_set_stream_status_object (message, &value); + ASSERT_OBJECT_REFCOUNT (task, "task", 3); + g_value_unset (&value); + ASSERT_OBJECT_REFCOUNT (task, "task", 2); + gst_object_unref (task); + ASSERT_OBJECT_REFCOUNT (task, "task", 1); + + /* get the object back, no refcount is changed */ + val = gst_message_get_stream_status_object (message); + ASSERT_OBJECT_REFCOUNT (task, "task", 1); + + task2 = g_value_get_object (val); + + fail_unless (GST_IS_TASK (task2)); + fail_unless (task2 == task); + + ASSERT_OBJECT_REFCOUNT (task, "task", 1); + ASSERT_OBJECT_REFCOUNT (task2, "task", 1); + + gst_message_unref (message); + } + + /* GST_MESSAGE_REQUEST_STATE */ + { + GstState state; + + state = GST_STATE_PAUSED; + + message = gst_message_new_request_state (NULL, state); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_REQUEST_STATE); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + + /* set some wrong values to check if the parse method overwrites them + * with the good values */ + state = GST_STATE_READY; + gst_message_parse_request_state (message, &state); + fail_unless (state == GST_STATE_PAUSED); + + gst_message_unref (message); + } + /* GST_MESSAGE_QOS */ + { + gboolean live; + GstClockTime running_time; + GstClockTime stream_time; + GstClockTime timestamp, duration; + gint64 jitter; + gdouble proportion; + gint quality; + GstFormat format; + guint64 processed; + guint64 dropped; + + running_time = 1 * GST_SECOND; + stream_time = 2 * GST_SECOND; + timestamp = 3 * GST_SECOND; + duration = 4 * GST_SECOND; + + message = + gst_message_new_qos (NULL, TRUE, running_time, stream_time, timestamp, + duration); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + + /* check defaults */ + gst_message_parse_qos_values (message, &jitter, &proportion, &quality); + fail_unless (jitter == 0); + fail_unless (proportion == 1.0); + fail_unless (quality == 1000000); + + gst_message_parse_qos_stats (message, &format, &processed, &dropped); + fail_unless (format == GST_FORMAT_UNDEFINED); + fail_unless (processed == -1); + fail_unless (dropped == -1); + + /* set some wrong values to check if the parse method overwrites them + * with the good values */ + running_time = stream_time = timestamp = duration = 5 * GST_SECOND; + live = FALSE; + gst_message_parse_qos (message, &live, &running_time, &stream_time, + ×tamp, &duration); + fail_unless (live == TRUE); + fail_unless (running_time == 1 * GST_SECOND); + fail_unless (stream_time == 2 * GST_SECOND); + fail_unless (timestamp == 3 * GST_SECOND); + fail_unless (duration == 4 * GST_SECOND); + + /* change some values */ + gst_message_set_qos_values (message, -10, 2.0, 5000); + gst_message_parse_qos_values (message, &jitter, &proportion, &quality); + fail_unless (jitter == -10); + fail_unless (proportion == 2.0); + fail_unless (quality == 5000); + + gst_message_set_qos_stats (message, GST_FORMAT_DEFAULT, 1030, 65); + gst_message_parse_qos_stats (message, &format, &processed, &dropped); + fail_unless (format == GST_FORMAT_DEFAULT); + fail_unless (processed == 1030); + fail_unless (dropped == 65); + + gst_message_unref (message); + } + /* GST_MESSAGE_PROGRESS */ + { + GstProgressType type; + gchar *category, *text; + + message = + gst_message_new_progress (NULL, GST_PROGRESS_TYPE_START, "connecting", + "Connecting to youtbue.com"); + fail_if (message == NULL); + fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_PROGRESS); + fail_unless (GST_MESSAGE_SRC (message) == NULL); + + /* set some wrong values to check if the parse method overwrites them + * with the good values */ + type = GST_PROGRESS_TYPE_ERROR; + gst_message_parse_progress (message, &type, &category, &text); + fail_unless (type == GST_PROGRESS_TYPE_START); + fail_unless (!strcmp (category, "connecting")); + fail_unless (!strcmp (text, "Connecting to youtbue.com")); + g_free (category); + g_free (text); + + gst_message_unref (message); + } +} + +GST_END_TEST; + +static Suite * +gst_message_suite (void) +{ + Suite *s = suite_create ("GstMessage"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_parsing); + + return s; +} + +GST_CHECK_MAIN (gst_message); diff --git a/tests/check/gst/gstmeta.c b/tests/check/gst/gstmeta.c new file mode 100644 index 0000000..69eb370 --- /dev/null +++ b/tests/check/gst/gstmeta.c @@ -0,0 +1,200 @@ +/* GStreamer + * + * unit test for GstMeta + * + * Copyright (C) <2009> Wim Taymans <wim.taymans@gmail.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. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_VALGRIND_H +# include <valgrind/valgrind.h> +#else +# define RUNNING_ON_VALGRIND FALSE +#endif + +#include <gst/check/gstcheck.h> + +/* test metadata for PTS/DTS and duration */ +typedef struct +{ + GstMeta meta; + + GstClockTime pts; + GstClockTime dts; + GstClockTime duration; + GstClockTime clock_rate; +} GstMetaTest; + +static const GstMetaInfo *gst_meta_test_get_info (void); +#define GST_META_TEST_INFO (gst_meta_test_get_info()) + +#define GST_META_TEST_GET(buf) ((GstMetaTest *)gst_buffer_get_meta(buf,GST_META_TEST_INFO)) +#define GST_META_TEST_ADD(buf) ((GstMetaTest *)gst_buffer_add_meta(buf,GST_META_TEST_INFO,NULL)) + +#if 0 +/* unused currently. This is a user function to fill the metadata with default + * values. We don't call this from the init function because the user is mostly + * likely going to override the values immediately after */ +static void +gst_meta_test_init (GstMetaTest * meta) +{ + meta->pts = GST_CLOCK_TIME_NONE; + meta->dts = GST_CLOCK_TIME_NONE; + meta->duration = GST_CLOCK_TIME_NONE; + meta->clock_rate = GST_SECOND; +} +#endif + +static void +test_init_func (GstMetaTest * meta, GstBuffer * buffer) +{ + GST_DEBUG ("init called on buffer %p, meta %p", buffer, meta); + /* nothing to init really, the init function is mostly for allocating + * additional memory or doing special setup as part of adding the metadata to + * the buffer*/ +} + +static void +test_free_func (GstMetaTest * meta, GstBuffer * buffer) +{ + GST_DEBUG ("free called on buffer %p, meta %p", buffer, meta); + /* nothing to free really */ +} + +static void +test_copy_func (GstBuffer * copybuf, GstMetaTest * meta, + GstBuffer * buffer, gsize offset, gsize size) +{ + GstMetaTest *test; + + GST_DEBUG ("copy called from buffer %p to %p, meta %p, %u-%u", buffer, + copybuf, meta, offset, size); + + test = GST_META_TEST_ADD (copybuf); + if (offset == 0) { + /* same offset, copy timestamps */ + test->pts = meta->pts; + test->dts = meta->dts; + if (size == gst_buffer_get_size (buffer)) { + /* same size, copy duration */ + test->duration = meta->duration; + } else { + /* else clear */ + test->duration = GST_CLOCK_TIME_NONE; + } + } else { + test->pts = -1; + test->dts = -1; + test->duration = -1; + } + test->clock_rate = meta->clock_rate; +} + +static const GstMetaInfo * +gst_meta_test_get_info (void) +{ + static const GstMetaInfo *meta_test_info = NULL; + + if (meta_test_info == NULL) { + meta_test_info = gst_meta_register ("GstMetaTest", "GstMetaTest", + sizeof (GstMetaTest), + (GstMetaInitFunction) test_init_func, + (GstMetaFreeFunction) test_free_func, + (GstMetaCopyFunction) test_copy_func, (GstMetaTransformFunction) NULL); + } + return meta_test_info; +} + +GST_START_TEST (test_meta_test) +{ + GstBuffer *buffer, *copy, *subbuf; + GstMetaTest *meta; + gpointer data; + + buffer = gst_buffer_new_and_alloc (4); + fail_if (buffer == NULL); + + data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE); + fail_if (data == NULL); + memset (data, 0, 4); + gst_buffer_unmap (buffer, data, 4); + + /* add some metadata */ + meta = GST_META_TEST_ADD (buffer); + fail_if (meta == NULL); + /* fill some values */ + meta->pts = 1000; + meta->dts = 2000; + meta->duration = 1000; + meta->clock_rate = 1000; + + /* copy of the buffer */ + copy = gst_buffer_copy (buffer); + /* get metadata of the buffer */ + meta = GST_META_TEST_GET (copy); + fail_if (meta == NULL); + fail_if (meta->pts != 1000); + fail_if (meta->dts != 2000); + fail_if (meta->duration != 1000); + fail_if (meta->clock_rate != 1000); + gst_buffer_unref (copy); + + /* make subbuffer */ + subbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 0, 1); + /* get metadata of the buffer */ + meta = GST_META_TEST_GET (subbuf); + fail_if (meta == NULL); + fail_if (meta->pts != 1000); + fail_if (meta->dts != 2000); + fail_if (meta->duration != -1); + fail_if (meta->clock_rate != 1000); + gst_buffer_unref (subbuf); + + /* make another subbuffer */ + subbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 1, 3); + /* get metadata of the buffer */ + meta = GST_META_TEST_GET (subbuf); + fail_if (meta == NULL); + fail_if (meta->pts != -1); + fail_if (meta->dts != -1); + fail_if (meta->duration != -1); + fail_if (meta->clock_rate != 1000); + gst_buffer_unref (subbuf); + + /* clean up */ + gst_buffer_unref (buffer); +} + +GST_END_TEST; + +static Suite * +gst_buffermeta_suite (void) +{ + Suite *s = suite_create ("GstMeta"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_meta_test); + + return s; +} + +GST_CHECK_MAIN (gst_buffermeta); diff --git a/tests/check/gst/gstminiobject.c b/tests/check/gst/gstminiobject.c new file mode 100644 index 0000000..237f7e4 --- /dev/null +++ b/tests/check/gst/gstminiobject.c @@ -0,0 +1,471 @@ +/* GStreamer + * + * unit test for GstMiniObject + * + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * Copyright (C) <2005> Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> + +GST_START_TEST (test_copy) +{ + GstBuffer *buffer, *copy; + + buffer = gst_buffer_new_and_alloc (4); + + copy = GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CAST (buffer))); + + fail_if (copy == NULL, "Copy of buffer returned NULL"); + fail_unless (gst_buffer_get_size (copy) == 4, + "Copy of buffer has different size"); +} + +GST_END_TEST; + +GST_START_TEST (test_is_writable) +{ + GstBuffer *buffer; + GstMiniObject *mobj; + + buffer = gst_buffer_new_and_alloc (4); + mobj = GST_MINI_OBJECT_CAST (buffer); + + fail_unless (gst_mini_object_is_writable (mobj), + "A buffer with one ref should be writable"); + + fail_if (gst_mini_object_ref (mobj) == NULL, "Could not ref the mobj"); + + fail_if (gst_mini_object_is_writable (mobj), + "A buffer with two refs should not be writable"); +} + +GST_END_TEST; + +GST_START_TEST (test_make_writable) +{ + GstBuffer *buffer; + GstMiniObject *mobj, *mobj2, *mobj3; + + buffer = gst_buffer_new_and_alloc (4); + mobj = GST_MINI_OBJECT_CAST (buffer); + + mobj2 = gst_mini_object_make_writable (mobj); + fail_unless (GST_IS_BUFFER (mobj2), "make_writable did not return a buffer"); + fail_unless (mobj == mobj2, + "make_writable returned a copy for a buffer with refcount 1"); + + mobj2 = gst_mini_object_ref (mobj); + mobj3 = gst_mini_object_make_writable (mobj); + fail_unless (GST_IS_BUFFER (mobj3), "make_writable did not return a buffer"); + fail_if (mobj == mobj3, + "make_writable returned same object for a buffer with refcount > 1"); + + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (mobj) == 1, + "refcount of original mobj object should be back to 1"); + + mobj2 = gst_mini_object_make_writable (mobj); + fail_unless (GST_IS_BUFFER (mobj2), "make_writable did not return a buffer"); + fail_unless (mobj == mobj2, + "make_writable returned a copy for a buffer with refcount 1"); + +} + +GST_END_TEST; + +static gint num_threads = 10; +static gint refs_per_thread = 10000; + +/* test thread-safe refcounting of GstMiniObject */ +static void +thread_ref (GstMiniObject * mobj) +{ + int j; + + THREAD_START (); + + for (j = 0; j < refs_per_thread; ++j) { + gst_mini_object_ref (mobj); + + if (j % num_threads == 0) + THREAD_SWITCH (); + } + GST_DEBUG ("thread stopped"); +} + +GST_START_TEST (test_ref_threaded) +{ + GstBuffer *buffer; + GstMiniObject *mobj; + gint expected; + + buffer = gst_buffer_new_and_alloc (4); + + mobj = GST_MINI_OBJECT_CAST (buffer); + + MAIN_START_THREADS (num_threads, thread_ref, mobj); + + MAIN_STOP_THREADS (); + + expected = num_threads * refs_per_thread + 1; + ASSERT_MINI_OBJECT_REFCOUNT (mobj, "miniobject", expected); +} + +GST_END_TEST; + +static void +thread_unref (GstMiniObject * mobj) +{ + int j; + + THREAD_START (); + + for (j = 0; j < refs_per_thread; ++j) { + gst_mini_object_unref (mobj); + + if (j % num_threads == 0) + THREAD_SWITCH (); + } +} + +GST_START_TEST (test_unref_threaded) +{ + GstBuffer *buffer; + GstMiniObject *mobj; + int i; + + buffer = gst_buffer_new_and_alloc (4); + + mobj = GST_MINI_OBJECT (buffer); + + for (i = 0; i < num_threads * refs_per_thread; ++i) + gst_mini_object_ref (mobj); + + MAIN_START_THREADS (num_threads, thread_unref, mobj); + + MAIN_STOP_THREADS (); + + ASSERT_MINI_OBJECT_REFCOUNT (mobj, "miniobject", 1); + + /* final unref */ + gst_mini_object_unref (mobj); +} + +GST_END_TEST; + +/* ======== weak ref test ======== */ + +static gboolean weak_ref_notify_succeeded = FALSE; + +static void +on_weak_ref_notify (gpointer data, GstMiniObject * where_object_was) +{ + weak_ref_notify_succeeded = TRUE; +} + +GST_START_TEST (test_weak_ref) +{ + GstBuffer *buffer; + + buffer = gst_buffer_new_and_alloc (4); + + gst_mini_object_weak_ref (GST_MINI_OBJECT (buffer), on_weak_ref_notify, + &buffer); + + gst_buffer_unref (buffer); + + fail_unless (weak_ref_notify_succeeded, + "No weak reference notification took place."); +} + +GST_END_TEST; + +#if 0 +/* ======== recycle test ======== */ + +static gint recycle_buffer_count = 10; + +typedef struct _MyBufferPool MyBufferPool; + +struct _MyBufferPool +{ + GSList *buffers; + + volatile gboolean is_closed; +}; + +static void my_recycle_buffer_destroy (MyRecycleBuffer * buf); + +static MyBufferPool * +my_buffer_pool_new (void) +{ + return g_new0 (MyBufferPool, 1); +} + +static void +my_buffer_pool_free (MyBufferPool * self) +{ + while (self->buffers != NULL) { + my_recycle_buffer_destroy (self->buffers->data); + self->buffers = g_slist_delete_link (self->buffers, self->buffers); + } + + g_free (self); +} + +static void +my_buffer_pool_add (MyBufferPool * self, GstBuffer * buf) +{ + g_mutex_lock (mutex); + self->buffers = g_slist_prepend (self->buffers, gst_buffer_ref (buf)); + g_mutex_unlock (mutex); +} + +static GstBuffer * +my_buffer_pool_drain_one (MyBufferPool * self) +{ + GstBuffer *buf = NULL; + + g_mutex_lock (mutex); + if (self->buffers != NULL) { + buf = self->buffers->data; + self->buffers = g_slist_delete_link (self->buffers, self->buffers); + } + g_mutex_unlock (mutex); + + return buf; +} + +static void +my_recycle_buffer_finalize (GstMiniObject * mini_object) +{ + GstBuffer *self = GST_BUFFER_CAST (mini_object); + + if (self->pool != NULL) { + my_buffer_pool_add (self->pool, GST_BUFFER_CAST (self)); + g_usleep (G_USEC_PER_SEC / 100); + } else { + GST_MINI_OBJECT_CLASS (my_recycle_buffer_parent_class)->finalize + (mini_object); + } +} + +static GstBuffer * +my_recycle_buffer_new (MyBufferPool * pool) +{ + GstBuffer *buf; + + buf = gst_buffer_new (); + + //buf->pool = pool; + + return GST_BUFFER_CAST (buf); +} + +static void +my_recycle_buffer_destroy (MyRecycleBuffer * buf) +{ + buf->pool = NULL; + gst_buffer_unref (GST_BUFFER_CAST (buf)); +} + +static void +thread_buffer_producer (MyBufferPool * pool) +{ + int j; + + THREAD_START (); + + for (j = 0; j < recycle_buffer_count; ++j) { + GstBuffer *buf = my_recycle_buffer_new (pool); + gst_buffer_unref (buf); + } + + pool->is_closed = TRUE; +} + +static void +thread_buffer_consumer (MyBufferPool * pool) +{ + THREAD_START (); + + do { + GstBuffer *buf; + + buf = my_buffer_pool_drain_one (pool); + if (buf != NULL) + my_recycle_buffer_destroy (MY_RECYCLE_BUFFER_CAST (buf)); + + THREAD_SWITCH (); + } + while (!pool->is_closed); +} + +GST_START_TEST (test_recycle_threaded) +{ + MyBufferPool *pool; + + pool = my_buffer_pool_new (); + + MAIN_START_THREADS (1, thread_buffer_producer, pool); + MAIN_START_THREADS (1, thread_buffer_consumer, pool); + + MAIN_STOP_THREADS (); + + my_buffer_pool_free (pool); +} + +GST_END_TEST; +#endif + +/* ======== value collection test ======== */ +typedef struct _MyFoo +{ + GObject object; +} MyFoo; + +typedef struct _MyFooClass +{ + GObjectClass gobject_class; +} MyFooClass; + +enum +{ + PROP_BUFFER = 1 +}; + +GType my_foo_get_type (void); +G_DEFINE_TYPE (MyFoo, my_foo, G_TYPE_OBJECT); + +static void +my_foo_init (MyFoo * foo) +{ +} + +static void +my_foo_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) +{ + GstBuffer *new_buf; + + g_assert (prop_id == PROP_BUFFER); + + new_buf = gst_buffer_new_and_alloc (1024); + g_value_set_boxed (value, GST_MINI_OBJECT (new_buf)); + gst_buffer_unref (new_buf); +} + +static void +my_foo_set_property (GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec) +{ + GstMiniObject *mini_obj; + + g_assert (prop_id == PROP_BUFFER); + + mini_obj = g_value_get_boxed (value); + g_assert (GST_IS_BUFFER (mini_obj)); + +#if 0 + /* gst_value_dup_mini_object() does not exist yet */ + mini_obj = gst_value_dup_mini_object (value); + g_assert (GST_IS_MINI_OBJECT (mini_obj)); + g_assert (GST_IS_BUFFER (mini_obj)); + gst_mini_object_unref (mini_obj); +#endif +} + + +static void +my_foo_class_init (MyFooClass * klass) +{ + GObjectClass *gobject_klass = G_OBJECT_CLASS (klass); + + gobject_klass->get_property = my_foo_get_property; + gobject_klass->set_property = my_foo_set_property; + + g_object_class_install_property (gobject_klass, PROP_BUFFER, + g_param_spec_boxed ("buffer", "Buffer", + "a newly created GstBuffer", GST_TYPE_BUFFER, G_PARAM_READWRITE)); +} + +GST_START_TEST (test_value_collection) +{ + GstBuffer *buf = NULL; + MyFoo *foo; + + foo = (MyFoo *) g_object_new (my_foo_get_type (), NULL); + + /* test g_object_get() refcounting */ + g_object_get (foo, "buffer", &buf, NULL); + g_assert (GST_IS_BUFFER (buf)); + g_assert (GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (buf)) == 1); + gst_buffer_unref (buf); + + /* test g_object_set() refcounting */ + buf = gst_buffer_new_and_alloc (1024); + g_object_set (foo, "buffer", buf, NULL); + g_assert (GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (buf)) == 1); + gst_buffer_unref (buf); + + g_object_unref (foo); +} + +GST_END_TEST; + + +GST_START_TEST (test_dup_null_mini_object) +{ + GValue value = { 0, }; + GstMiniObject *mo; + + g_value_init (&value, GST_TYPE_BUFFER); + + g_value_set_boxed (&value, NULL); + + mo = GST_MINI_OBJECT_CAST (g_value_dup_boxed (&value)); + g_assert (mo == NULL); + + g_value_unset (&value); +} + +GST_END_TEST; + +static Suite * +gst_mini_object_suite (void) +{ + Suite *s = suite_create ("GstMiniObject"); + TCase *tc_chain = tcase_create ("general"); + + /* turn off timeout */ + tcase_set_timeout (tc_chain, 60); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_copy); + tcase_add_test (tc_chain, test_is_writable); + tcase_add_test (tc_chain, test_make_writable); + tcase_add_test (tc_chain, test_ref_threaded); + tcase_add_test (tc_chain, test_unref_threaded); + tcase_add_test (tc_chain, test_weak_ref); + //tcase_add_test (tc_chain, test_recycle_threaded); + tcase_add_test (tc_chain, test_value_collection); + tcase_add_test (tc_chain, test_dup_null_mini_object); + return s; +} + +GST_CHECK_MAIN (gst_mini_object); diff --git a/tests/check/gst/gstobject.c b/tests/check/gst/gstobject.c new file mode 100644 index 0000000..6f7ccb8 --- /dev/null +++ b/tests/check/gst/gstobject.c @@ -0,0 +1,547 @@ +/* GStreamer + * + * unit test for GstObject + * + * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gst/check/gstcheck.h> + +/* + Create a fake subclass + */ +typedef struct _GstFakeObjectClass GstFakeObjectClass; +typedef struct _GstFakeObject GstFakeObject; + +struct _GstFakeObject +{ + GstObject object; +}; + +struct _GstFakeObjectClass +{ + GstObjectClass parent_class; +}; + +//static GstObjectClass *parent_class = NULL; +//static guint gst_fake_object_signals[LAST_SIGNAL] = { 0 }; + +static GType +gst_fake_object_get_type (void) +{ + static volatile gsize fake_object_type = 0; + + if (g_once_init_enter (&fake_object_type)) { + GType type; + static const GTypeInfo fake_object_info = { + sizeof (GstFakeObjectClass), + NULL, //gst_fake_object_base_class_init, + NULL, //gst_fake_object_base_class_finalize, + NULL, //(GClassInitFunc) gst_fake_object_class_init, + NULL, + NULL, + sizeof (GstFakeObject), + 0, + NULL, //(GInstanceInitFunc) gst_fake_object_init, + NULL + }; + + type = g_type_register_static (GST_TYPE_OBJECT, + "GstFakeObject", &fake_object_info, 0); + g_once_init_leave (&fake_object_type, type); + } + return fake_object_type; +} + +#ifndef HAVE_OSX +/* g_object_new on abstract GstObject should fail */ +GST_START_TEST (test_fail_abstract_new) +{ + GstObject *object; + + ASSERT_CRITICAL (object = g_object_new (gst_object_get_type (), NULL)); + fail_unless (object == NULL, "Created an instance of abstract GstObject"); +} + +GST_END_TEST; +#endif + +/* g_object_new on GstFakeObject should succeed */ +GST_START_TEST (test_fake_object_new) +{ + GstObject *object; + + object = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object == NULL, "Failed to create instance of GstFakeObject"); + fail_unless (GST_IS_OBJECT (object), + "GstFakeObject instance is not a GstObject"); + gst_object_unref (object); +} + +GST_END_TEST; + +/* GstFakeObject name tests */ +GST_START_TEST (test_fake_object_name) +{ + GstObject *object; + gchar *name; + gchar *name2; + + object = g_object_new (gst_fake_object_get_type (), NULL); + + name = gst_object_get_name (object); + fail_if (name == NULL, "Newly created object has no name"); + fail_if (strncmp (name, "fakeobject", 10) != 0, + "Random name %s does not start with Gst", name); + g_free (name); + + /* give a random name by setting with NULL; + * GstFakeObject class -> fakeobject%d */ + gst_object_set_name (object, NULL); + name = gst_object_get_name (object); + fail_if (name == NULL, "Random name was not assigned"); + fail_if (strncmp (name, "fakeobject", 10) != 0, + "Random name %s does not start with Gst", name); + g_free (name); + + gst_object_set_name (object, "fake"); + name = gst_object_get_name (object); + fail_if (name == NULL, "Failed to get name of GstFakeObject"); + fail_if (strcmp (name, "fake") != 0, "Name of GstFakeObject is not 'fake'"); + + /* change the gotten name to see that it's a copy and not the original */ + name[0] = 'm'; + name2 = gst_object_get_name (object); + fail_if (strcmp (name2, "fake") != 0, + "Copy of object name affected actual object name"); + g_free (name); + g_free (name2); + + gst_object_unref (object); +} + +GST_END_TEST; + +/* thread function for threaded name change test */ +static gpointer +thread_name_object (GstObject * object) +{ + gchar *thread_id = g_strdup_printf ("%p", g_thread_self ()); + + THREAD_START (); + + /* give main thread a head start */ + g_usleep (100000); + + /* write our name repeatedly */ + g_message ("THREAD %s: starting loop\n", thread_id); + while (THREAD_TEST_RUNNING ()) { + gst_object_set_name (object, thread_id); + /* a minimal sleep invokes a thread switch */ + THREAD_SWITCH (); + } + + /* thread is done, so let's return */ + g_message ("THREAD %s: set name\n", thread_id); + g_free (thread_id); + + return NULL; +} + +#if 0 +GST_START_TEST (test_fake_object_name_threaded_wrong) +{ + GstObject *object; + gchar *name; + gint i; + gboolean expected_failure = FALSE; + + g_message ("\nTEST: set/get without lock\n"); + + object = g_object_new (gst_fake_object_get_type (), NULL); + gst_object_set_name (object, "main"); + + MAIN_START_THREADS (5, thread_name_object, object); + + /* start looping and set/get name repeatedly */ + for (i = 0; i < 1000; ++i) { + gst_object_set_name (object, "main"); + THREAD_SWITCH (); + name = gst_object_get_name (object); + if (strcmp (name, "main") != 0) { + g_message ("MAIN: expected failure during run %d\n", i); + expected_failure = TRUE; + g_free (name); + break; + } + g_free (name); + } + MAIN_STOP_THREADS (); + + gst_object_unref (object); + + fail_unless (expected_failure, "name did not get changed"); +} + +GST_END_TEST; +#endif + +/* + * main thread sets and gets name directly on struct inside the object lock + * succeed because lock is held during set/get, and threads are locked out + */ +GST_START_TEST (test_fake_object_name_threaded_right) +{ + GstObject *object; + gchar *name; + gint i; + + g_message ("\nTEST: set/get inside lock\n"); + + object = g_object_new (gst_fake_object_get_type (), NULL); + gst_object_set_name (object, "main"); + + MAIN_START_THREADS (5, thread_name_object, object); + + /* start looping and set/get name repeatedly */ + for (i = 0; i < 1000; ++i) { + GST_OBJECT_LOCK (object); + g_free (GST_OBJECT_NAME (object)); + GST_OBJECT_NAME (object) = g_strdup ("main"); + THREAD_SWITCH (); + name = g_strdup (GST_OBJECT_NAME (object)); + GST_OBJECT_UNLOCK (object); + + fail_unless (strcmp (name, "main") == 0, + "Name got changed while lock held during run %d", i); + g_free (name); + } + MAIN_STOP_THREADS (); + gst_object_unref (object); +} + +GST_END_TEST; +/* + * main thread creates lots of objects + * child threads sets default names on objects + * then main thread checks uniqueness of object names + */ + +static GList *object_list = NULL; +static gint num_objects = 1000; +static gint num_threads = 5; + +/* thread function for threaded default name change test */ +static gpointer +thread_name_object_default (int *i) +{ + int j; + + THREAD_START (); + + for (j = *i; j < num_objects; j += num_threads) { + GstObject *o = GST_OBJECT (g_list_nth_data (object_list, j)); + + /* g_message ("THREAD %p: setting default name on object %d\n", + g_thread_self (), j); */ + gst_object_set_name (o, NULL); + THREAD_SWITCH (); + } + + /* thread is done, so let's return */ + g_message ("THREAD %p: set name\n", g_thread_self ()); + g_free (i); + + return NULL; +} + +static gint +gst_object_name_compare (GstObject * o, GstObject * p) +{ + gint result; + + GST_OBJECT_LOCK (o); + GST_OBJECT_LOCK (p); + + if (o->name == NULL && p->name == NULL) { + result = 0; + } else if (o->name == NULL) { + result = -1; + } else if (p->name == NULL) { + result = 1; + } else { + result = strcmp (o->name, p->name); + } + + GST_OBJECT_UNLOCK (p); + GST_OBJECT_UNLOCK (o); + + return result; +} + +GST_START_TEST (test_fake_object_name_threaded_unique) +{ + GstObject *object; + gint i; + gint *ip; + gchar *name1, *name2; + GList *l; + + g_message ("\nTEST: uniqueness of default names\n"); + + for (i = 0; i < num_objects; ++i) { + object = g_object_new (gst_fake_object_get_type (), NULL); + object_list = g_list_append (object_list, object); + } + + MAIN_INIT (); + + mark_point (); + for (i = 0; i < num_threads; ++i) { + ip = g_new (gint, 1); + *ip = i; + MAIN_START_THREAD_FUNCTION (i, thread_name_object_default, ip); + } + + mark_point (); + MAIN_SYNCHRONIZE (); + mark_point (); + MAIN_STOP_THREADS (); + + /* sort GList based on object name */ + /* FIXME: sort and test */ + object_list = + g_list_sort (object_list, (GCompareFunc) gst_object_name_compare); + + name1 = gst_object_get_name (GST_OBJECT (object_list->data)); + for (l = object_list->next; l->next; l = l->next) { + g_message ("object with name %s\n", name1); + name2 = gst_object_get_name (GST_OBJECT (l->data)); + fail_if (strcmp (name1, name2) == 0, "Two objects with name %s", name2); + g_free (name1); + name1 = name2; + } + g_free (name1); + + /* free stuff */ + g_list_foreach (object_list, (GFunc) g_object_unref, NULL); +} + +GST_END_TEST; + +/* parentage test on GstFakeObject */ +GST_START_TEST (test_fake_object_parentage) +{ + GstObject *object1, *object2; + GstObject *parent; + gboolean result; + + /* create new object */ + object1 = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object1 == NULL, "Failed to create instance of GstFakeObject"); + fail_unless (GST_IS_OBJECT (object1), + "GstFakeObject instance is not a GstObject"); + fail_unless (g_object_is_floating (object1), + "GstFakeObject instance is not floating"); + + /* check the parent */ + parent = gst_object_get_parent (object1); + fail_if (parent != NULL, "GstFakeObject has parent"); + /* try to set a NULL parent, this should give a warning */ + ASSERT_CRITICAL (result = gst_object_set_parent (object1, NULL)); + fail_if (result == TRUE, "GstFakeObject accepted NULL parent"); + /* try to set itself as parent, we expect a warning here */ + ASSERT_CRITICAL (result = gst_object_set_parent (object1, object1)); + fail_if (result == TRUE, "GstFakeObject accepted itself as parent"); + + /* should still be floating */ + fail_unless (g_object_is_floating (object1), + "GstFakeObject instance is not floating"); + + /* create another object */ + object2 = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object2 == NULL, + "Failed to create another instance of GstFakeObject"); + fail_unless (GST_IS_OBJECT (object2), + "second GstFakeObject instance is not a GstObject"); + fail_unless (g_object_is_floating (object1), + "GstFakeObject instance is not floating"); + + /* try to set other object as parent */ + result = gst_object_set_parent (object1, object2); + fail_if (result == FALSE, + "GstFakeObject could not accept other object as parent"); + + /* should not be floating anymore */ + fail_if (g_object_is_floating (object1), + "GstFakeObject instance is still floating"); + /* parent should still be floating */ + fail_unless (g_object_is_floating (object2), + "GstFakeObject instance is not floating"); + + /* check the parent */ + parent = gst_object_get_parent (object1); + fail_if (parent != object2, "GstFakeObject has wrong parent"); + gst_object_unref (parent); + /* try to set other object as parent again */ + result = gst_object_set_parent (object1, object2); + fail_if (result == TRUE, "GstFakeObject could set parent twice"); + + /* ref before unparenting */ + gst_object_ref (object1); + /* clear parent of object */ + gst_object_unparent (object1); + + /* check the parent */ + parent = gst_object_get_parent (object1); + fail_if (parent != NULL, "GstFakeObject has parent"); + + /* object should not be floating */ + fail_if (g_object_is_floating (object1), + "GstFakeObject instance is floating again"); + + gst_object_unref (object1); + gst_object_unref (object2); +} + +GST_END_TEST; + +/* parentage test dispose on GstFakeObject, since our testcase + * does not handle the parent relation completely, the parent does + * not hold a ref to the child, we cannot dispose the parent to + * dipose the child as well. This test needs to be run with DEBUG + * info to check if the finalize methods are called correctly. */ +GST_START_TEST (test_fake_object_parentage_dispose) +{ + GstObject *object1, *object2; + gboolean result; + + object1 = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object1 == NULL, "Failed to create instance of GstFakeObject"); + + object2 = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object2 == NULL, "Failed to create instance of GstFakeObject"); + + /* try to set other object as parent */ + result = gst_object_set_parent (object1, object2); + fail_if (result == FALSE, + "GstFakeObject could not accept other object as parent"); + + /* clear parent of object */ + gst_object_unparent (object1); + + /* now dispose parent */ + gst_object_unref (object2); +} + +GST_END_TEST; + +GST_START_TEST (test_fake_object_has_ancestor) +{ + GstObject *object1, *object2, *object3, *object4; + gboolean result; + + object1 = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object1 == NULL, "Failed to create instance of GstFakeObject"); + + object2 = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object2 == NULL, "Failed to create instance of GstFakeObject"); + + object3 = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object3 == NULL, "Failed to create instance of GstFakeObject"); + + object4 = g_object_new (gst_fake_object_get_type (), NULL); + fail_if (object4 == NULL, "Failed to create instance of GstFakeObject"); + + /* try to set other object as parent */ + result = gst_object_set_parent (object1, object3); + fail_if (result == FALSE, + "GstFakeObject could not accept other object as parent"); + result = gst_object_set_parent (object2, object3); + fail_if (result == FALSE, + "GstFakeObject could not accept other object as parent"); + result = gst_object_set_parent (object3, object4); + fail_if (result == FALSE, + "GstFakeObject could not accept other object as parent"); + + fail_unless (gst_object_has_ancestor (object1, object1)); + fail_if (gst_object_has_ancestor (object1, object2)); + fail_unless (gst_object_has_ancestor (object1, object3)); + fail_unless (gst_object_has_ancestor (object1, object4)); + fail_if (gst_object_has_ancestor (object3, object1)); + fail_if (gst_object_has_ancestor (object4, object1)); + fail_unless (gst_object_has_ancestor (object3, object4)); + fail_if (gst_object_has_ancestor (object4, object3)); + fail_unless (gst_object_has_ancestor (object4, object4)); + + /* unparent everything */ + gst_object_unparent (object3); + gst_object_unparent (object2); + gst_object_unparent (object1); + + /* now dispose objects */ + gst_object_unref (object4); +} + +GST_END_TEST; + +/* test: try renaming a parented object, make sure it fails */ + +static Suite * +gst_object_suite (void) +{ + Suite *s = suite_create ("GstObject"); + TCase *tc_chain = tcase_create ("general"); + + /* turn off timeout */ + tcase_set_timeout (tc_chain, 60); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_fake_object_new); + tcase_add_test (tc_chain, test_fake_object_name); +#if 0 + tcase_add_test (tc_chain, test_fake_object_name_threaded_wrong); +#endif + tcase_add_test (tc_chain, test_fake_object_name_threaded_right); + tcase_add_test (tc_chain, test_fake_object_name_threaded_unique); + tcase_add_test (tc_chain, test_fake_object_parentage); + tcase_add_test (tc_chain, test_fake_object_parentage_dispose); + + tcase_add_test (tc_chain, test_fake_object_has_ancestor); + //tcase_add_checked_fixture (tc_chain, setup, teardown); + + /* FIXME: GLib shouldn't crash here, but issue a warning and return a NULL + * object, or at least g_error() and then abort properly ... (tpm) */ +#ifndef HAVE_OSX + /* Disabled for OS/X because a) it's a pretty silly test anyway and + * b) different OS/X versions raise different signals and it isn't worth + * the effort to try and detect which one should be producing which + */ + /* SEGV tests go last so we can debug the others */ + if (g_getenv ("CK_FORK") == NULL || strcmp (g_getenv ("CK_FORK"), "no") != 0) + tcase_add_test_raise_signal (tc_chain, test_fail_abstract_new, SIGSEGV); +#endif + + return s; +} + +GST_CHECK_MAIN (gst_object); diff --git a/tests/check/gst/gstpad.c b/tests/check/gst/gstpad.c new file mode 100644 index 0000000..4a763e1 --- /dev/null +++ b/tests/check/gst/gstpad.c @@ -0,0 +1,1013 @@ +/* GStreamer + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * + * gstpad.c: Unit test for GstPad + * + * 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 <gst/check/gstcheck.h> + +GST_START_TEST (test_link) +{ + GstPad *src, *sink; + GstPadTemplate *srct; + + GstPadLinkReturn ret; + gchar *name; + + src = gst_pad_new ("source", GST_PAD_SRC); + fail_if (src == NULL); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + + name = gst_pad_get_name (src); + fail_unless (strcmp (name, "source") == 0); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + g_free (name); + + sink = gst_pad_new ("sink", GST_PAD_SINK); + fail_if (sink == NULL); + + /* linking without templates or caps should fail */ + ret = gst_pad_link (src, sink); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1); + fail_unless (ret == GST_PAD_LINK_NOFORMAT); + + ASSERT_CRITICAL (gst_pad_get_pad_template (NULL)); + + srct = gst_pad_get_pad_template (src); + fail_unless (srct == NULL); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + + /* clean up */ + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + gst_object_unref (src); + gst_object_unref (sink); +} + +GST_END_TEST; + +/* threaded link/unlink */ +/* use globals */ +static GstPad *src, *sink; + +static void +thread_link_unlink (gpointer data) +{ + THREAD_START (); + + while (THREAD_TEST_RUNNING ()) { + gst_pad_link (src, sink); + gst_pad_unlink (src, sink); + THREAD_SWITCH (); + } +} + +GST_START_TEST (test_link_unlink_threaded) +{ + GstCaps *caps; + int i; + + src = gst_pad_new ("source", GST_PAD_SRC); + fail_if (src == NULL); + sink = gst_pad_new ("sink", GST_PAD_SINK); + fail_if (sink == NULL); + + caps = gst_caps_from_string ("foo/bar"); + gst_pad_set_caps (src, caps); + gst_pad_set_active (sink, TRUE); + gst_pad_set_caps (sink, caps); + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + MAIN_START_THREADS (5, thread_link_unlink, NULL); + for (i = 0; i < 1000; ++i) { + gst_pad_is_linked (src); + gst_pad_is_linked (sink); + THREAD_SWITCH (); + } + MAIN_STOP_THREADS (); + + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + gst_caps_unref (caps); + + ASSERT_CAPS_REFCOUNT (caps, "caps", 2); + gst_object_unref (src); + gst_object_unref (sink); +} + +GST_END_TEST; + +GST_START_TEST (test_refcount) +{ + GstPad *src, *sink; + GstCaps *caps; + GstPadLinkReturn plr; + + sink = gst_pad_new ("sink", GST_PAD_SINK); + fail_if (sink == NULL); + + src = gst_pad_new ("src", GST_PAD_SRC); + fail_if (src == NULL); + + caps = gst_caps_from_string ("foo/bar"); + /* one for me */ + ASSERT_CAPS_REFCOUNT (caps, "caps", 1); + + fail_unless (gst_pad_set_caps (src, caps) == TRUE); + /* can't set caps on flushing sinkpad */ + fail_if (gst_pad_set_caps (sink, caps) == TRUE); + /* one for me and one for each set_caps */ + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + gst_pad_set_active (sink, TRUE); + fail_unless (gst_pad_set_caps (sink, caps) == TRUE); + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + plr = gst_pad_link (src, sink); + fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); + /* src caps added to pending caps on sink */ + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + gst_pad_unlink (src, sink); + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + /* cleanup */ + gst_object_unref (src); + gst_object_unref (sink); + ASSERT_CAPS_REFCOUNT (caps, "caps", 1); + + gst_caps_unref (caps); +} + +GST_END_TEST; + +GST_START_TEST (test_get_allowed_caps) +{ + GstPad *src, *sink; + GstCaps *caps, *gotcaps; + GstBuffer *buffer; + GstPadLinkReturn plr; + + ASSERT_CRITICAL (gst_pad_get_allowed_caps (NULL)); + + buffer = gst_buffer_new (); + ASSERT_CRITICAL (gst_pad_get_allowed_caps ((GstPad *) buffer)); + gst_buffer_unref (buffer); + + src = gst_pad_new ("src", GST_PAD_SRC); + fail_if (src == NULL); + caps = gst_pad_get_allowed_caps (src); + fail_unless (caps == NULL); + + caps = gst_caps_from_string ("foo/bar"); + + sink = gst_pad_new ("sink", GST_PAD_SINK); + fail_unless (gst_pad_set_caps (src, caps) == TRUE); + fail_if (gst_pad_set_caps (sink, caps) == TRUE); + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + gst_pad_set_active (sink, TRUE); + fail_unless (gst_pad_set_caps (sink, caps) == TRUE); + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + plr = gst_pad_link (src, sink); + fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); + + gotcaps = gst_pad_get_allowed_caps (src); + fail_if (gotcaps == NULL); +#if 0 + /* FIXME, does not work, caps events are different so the sinkpad loses caps + * when linking */ + fail_unless (gst_caps_is_equal (gotcaps, caps)); +#endif + + ASSERT_CAPS_REFCOUNT (gotcaps, "gotcaps", 1); + gst_caps_unref (gotcaps); + + gst_pad_unlink (src, sink); + + /* cleanup */ + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + + gst_object_unref (src); + gst_object_unref (sink); + + ASSERT_CAPS_REFCOUNT (caps, "caps", 1); + gst_caps_unref (caps); +} + +GST_END_TEST; + +static gboolean +name_is_valid (const gchar * name, GstPadPresence presence) +{ + GstPadTemplate *new; + GstCaps *any = GST_CAPS_ANY; + + new = gst_pad_template_new (name, GST_PAD_SRC, presence, any); + if (new) { + gst_object_unref (GST_OBJECT (new)); + return TRUE; + } + return FALSE; +} + +GST_START_TEST (test_name_is_valid) +{ + gboolean result = FALSE; + + fail_unless (name_is_valid ("src", GST_PAD_ALWAYS)); + ASSERT_WARNING (name_is_valid ("src%", GST_PAD_ALWAYS)); + ASSERT_WARNING (result = name_is_valid ("src%d", GST_PAD_ALWAYS)); + fail_if (result); + + fail_unless (name_is_valid ("src", GST_PAD_REQUEST)); + ASSERT_WARNING (name_is_valid ("src%s%s", GST_PAD_REQUEST)); + ASSERT_WARNING (name_is_valid ("src%c", GST_PAD_REQUEST)); + ASSERT_WARNING (name_is_valid ("src%", GST_PAD_REQUEST)); + ASSERT_WARNING (name_is_valid ("src%dsrc", GST_PAD_REQUEST)); + + fail_unless (name_is_valid ("src", GST_PAD_SOMETIMES)); + fail_unless (name_is_valid ("src%c", GST_PAD_SOMETIMES)); +} + +GST_END_TEST; + +static GstProbeReturn +_probe_handler (GstPad * pad, GstProbeType type, GstBuffer * buffer, + gpointer userdata) +{ + gint ret = GPOINTER_TO_INT (userdata); + + if (ret == 1) + return GST_PROBE_OK; + + return GST_PROBE_DROP; +} + +GST_START_TEST (test_push_unlinked) +{ + GstPad *src; + GstCaps *caps; + GstBuffer *buffer; + gulong id; + + src = gst_pad_new ("src", GST_PAD_SRC); + fail_if (src == NULL); + caps = gst_pad_get_allowed_caps (src); + fail_unless (caps == NULL); + + caps = gst_caps_from_string ("foo/bar"); + + gst_pad_set_caps (src, caps); + ASSERT_CAPS_REFCOUNT (caps, "caps", 2); + + /* pushing on an inactive pad will return wrong state */ + buffer = gst_buffer_new (); + gst_buffer_ref (buffer); + fail_unless (gst_pad_push (src, buffer) == GST_FLOW_WRONG_STATE); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + gst_buffer_unref (buffer); + + gst_pad_set_active (src, TRUE); + + /* pushing on an unlinked pad will drop the buffer */ + buffer = gst_buffer_new (); + gst_buffer_ref (buffer); + fail_unless (gst_pad_push (src, buffer) == GST_FLOW_NOT_LINKED); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + gst_buffer_unref (buffer); + + /* adding a probe that returns FALSE will drop the buffer without trying + * to chain */ + id = gst_pad_add_probe (src, GST_PROBE_TYPE_BUFFER, + (GstPadProbeCallback) _probe_handler, GINT_TO_POINTER (0), NULL); + buffer = gst_buffer_new (); + gst_buffer_ref (buffer); + fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + gst_buffer_unref (buffer); + gst_pad_remove_probe (src, id); + + /* adding a probe that returns TRUE will still chain the buffer, + * and hence drop because pad is unlinked */ + id = gst_pad_add_probe (src, GST_PROBE_TYPE_BUFFER, + (GstPadProbeCallback) _probe_handler, GINT_TO_POINTER (1), NULL); + buffer = gst_buffer_new (); + gst_buffer_ref (buffer); + fail_unless (gst_pad_push (src, buffer) == GST_FLOW_NOT_LINKED); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + gst_buffer_unref (buffer); + gst_pad_remove_probe (src, id); + + + /* cleanup */ + ASSERT_CAPS_REFCOUNT (caps, "caps", 2); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + + gst_object_unref (src); + + ASSERT_CAPS_REFCOUNT (caps, "caps", 1); + gst_caps_unref (caps); +} + +GST_END_TEST; + +GST_START_TEST (test_push_linked) +{ + GstPad *src, *sink; + GstPadLinkReturn plr; + GstCaps *caps; + GstBuffer *buffer; + gulong id; + + /* setup */ + sink = gst_pad_new ("sink", GST_PAD_SINK); + fail_if (sink == NULL); + gst_pad_set_chain_function (sink, gst_check_chain_func); + + src = gst_pad_new ("src", GST_PAD_SRC); + fail_if (src == NULL); + + caps = gst_caps_from_string ("foo/bar"); + /* one for me */ + ASSERT_CAPS_REFCOUNT (caps, "caps", 1); + + gst_pad_set_caps (src, caps); + gst_pad_set_active (sink, TRUE); + gst_pad_set_caps (sink, caps); + /* one for me and one for each set_caps */ + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + plr = gst_pad_link (src, sink); + fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); + ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + + buffer = gst_buffer_new (); +#if 0 + /* FIXME, new pad should be flushing */ + gst_buffer_ref (buffer); + fail_unless (gst_pad_push (src, buffer) == GST_FLOW_WRONG_STATE); + gst_buffer_ref (buffer); + fail_unless (gst_pad_chain (sink, buffer) == GST_FLOW_WRONG_STATE); +#endif + + /* activate pads */ + gst_pad_set_active (src, TRUE); + gst_pad_set_active (sink, TRUE); + + /* test */ + /* pushing on a linked pad will drop the ref to the buffer */ + gst_buffer_ref (buffer); + fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 2); + gst_buffer_unref (buffer); + fail_unless_equals_int (g_list_length (buffers), 1); + buffer = GST_BUFFER (buffers->data); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + gst_buffer_unref (buffer); + g_list_free (buffers); + buffers = NULL; + + /* adding a probe that returns FALSE will drop the buffer without trying + * to chain */ + id = gst_pad_add_probe (src, GST_PROBE_TYPE_BUFFER, + (GstPadProbeCallback) _probe_handler, GINT_TO_POINTER (0), NULL); + buffer = gst_buffer_new (); + gst_buffer_ref (buffer); + fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + gst_buffer_unref (buffer); + gst_pad_remove_probe (src, id); + fail_unless_equals_int (g_list_length (buffers), 0); + + /* adding a probe that returns TRUE will still chain the buffer */ + id = gst_pad_add_probe (src, GST_PROBE_TYPE_BUFFER, + (GstPadProbeCallback) _probe_handler, GINT_TO_POINTER (1), NULL); + buffer = gst_buffer_new (); + gst_buffer_ref (buffer); + fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK); + gst_pad_remove_probe (src, id); + + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 2); + gst_buffer_unref (buffer); + fail_unless_equals_int (g_list_length (buffers), 1); + buffer = GST_BUFFER (buffers->data); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + gst_buffer_unref (buffer); + g_list_free (buffers); + buffers = NULL; + + /* teardown */ + gst_pad_unlink (src, sink); + ASSERT_CAPS_REFCOUNT (caps, "caps", 2); + gst_object_unref (src); + gst_object_unref (sink); + ASSERT_CAPS_REFCOUNT (caps, "caps", 1); + + gst_caps_unref (caps); +} + +GST_END_TEST; + +static GstBuffer * +buffer_from_string (const gchar * str) +{ + guint size; + GstBuffer *buf; + gpointer data; + + size = strlen (str); + buf = gst_buffer_new_and_alloc (size); + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + memcpy (data, str, size); + gst_buffer_unmap (buf, data, size); + + return buf; +} + +static gboolean +buffer_compare (GstBuffer * buf, const gchar * str, gsize size) +{ + gboolean res; + gpointer data; + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_READ); + res = memcmp (data, str, size) == 0; + GST_DEBUG ("%s <-> %s: %d", (gchar *) data, str, res); + gst_buffer_unmap (buf, data, size); + + return res; +} + +GST_START_TEST (test_push_buffer_list_compat) +{ + GstPad *src, *sink; + GstPadLinkReturn plr; + GstCaps *caps; + GstBufferList *list; + GstBuffer *buffer; + + /* setup */ + sink = gst_pad_new ("sink", GST_PAD_SINK); + fail_if (sink == NULL); + gst_pad_set_chain_function (sink, gst_check_chain_func); + /* leave chainlistfunc unset */ + + src = gst_pad_new ("src", GST_PAD_SRC); + fail_if (src == NULL); + + caps = gst_caps_from_string ("foo/bar"); + + gst_pad_set_caps (src, caps); + gst_pad_set_active (sink, TRUE); + gst_pad_set_caps (sink, caps); + + plr = gst_pad_link (src, sink); + fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); + + list = gst_buffer_list_new (); + + /* activate pads */ + gst_pad_set_active (src, TRUE); + gst_pad_set_active (sink, TRUE); + + /* test */ + /* adding to a buffer list will drop the ref to the buffer */ + gst_buffer_list_add (list, buffer_from_string ("ListGroup")); + gst_buffer_list_add (list, buffer_from_string ("AnotherListGroup")); + + fail_unless (gst_pad_push_list (src, list) == GST_FLOW_OK); + fail_unless_equals_int (g_list_length (buffers), 2); + buffer = GST_BUFFER (buffers->data); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + fail_unless (buffer_compare (buffer, "ListGroup", 9)); + gst_buffer_unref (buffer); + buffers = g_list_delete_link (buffers, buffers); + buffer = GST_BUFFER (buffers->data); + ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); + fail_unless (buffer_compare (buffer, "AnotherListGroup", 16)); + gst_buffer_unref (buffer); + buffers = g_list_delete_link (buffers, buffers); + fail_unless (buffers == NULL); + + /* teardown */ + gst_pad_unlink (src, sink); + gst_object_unref (src); + gst_object_unref (sink); + ASSERT_CAPS_REFCOUNT (caps, "caps", 1); + gst_caps_unref (caps); +} + +GST_END_TEST; + +GST_START_TEST (test_flowreturn) +{ + GstFlowReturn ret; + GQuark quark; + + /* test some of the macros */ + ret = GST_FLOW_UNEXPECTED; + fail_if (strcmp (gst_flow_get_name (ret), "unexpected")); + quark = gst_flow_to_quark (ret); + fail_if (strcmp (g_quark_to_string (quark), "unexpected")); + + ret = GST_FLOW_RESEND; + fail_if (strcmp (gst_flow_get_name (ret), "resend")); + quark = gst_flow_to_quark (ret); + fail_if (strcmp (g_quark_to_string (quark), "resend")); + + /* custom returns */ + ret = GST_FLOW_CUSTOM_SUCCESS; + fail_if (strcmp (gst_flow_get_name (ret), "custom-success")); + quark = gst_flow_to_quark (ret); + fail_if (strcmp (g_quark_to_string (quark), "custom-success")); + + ret = GST_FLOW_CUSTOM_ERROR; + fail_if (strcmp (gst_flow_get_name (ret), "custom-error")); + quark = gst_flow_to_quark (ret); + fail_if (strcmp (g_quark_to_string (quark), "custom-error")); + + /* custom returns clamping */ + ret = GST_FLOW_CUSTOM_SUCCESS + 2; + fail_if (strcmp (gst_flow_get_name (ret), "custom-success")); + quark = gst_flow_to_quark (ret); + fail_if (strcmp (g_quark_to_string (quark), "custom-success")); + + ret = GST_FLOW_CUSTOM_ERROR - 2; + fail_if (strcmp (gst_flow_get_name (ret), "custom-error")); + quark = gst_flow_to_quark (ret); + fail_if (strcmp (g_quark_to_string (quark), "custom-error")); + + /* unknown values */ + ret = GST_FLOW_CUSTOM_ERROR + 2; + fail_if (strcmp (gst_flow_get_name (ret), "unknown")); + quark = gst_flow_to_quark (ret); + fail_unless (quark == 0); +} + +GST_END_TEST; + +GST_START_TEST (test_push_negotiation) +{ + GstPad *src, *sink; + GstPadLinkReturn plr; + GstCaps *srccaps = + gst_caps_from_string ("audio/x-raw-int,width={16,32},depth={16,32}"); + GstCaps *sinkcaps = + gst_caps_from_string ("audio/x-raw-int,width=32,depth={16,32}"); + GstPadTemplate *src_template; + GstPadTemplate *sink_template; + GstCaps *caps; + + /* setup */ + src_template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, srccaps); + sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, sinkcaps); + gst_caps_unref (srccaps); + gst_caps_unref (sinkcaps); + + sink = gst_pad_new_from_template (sink_template, "sink"); + fail_if (sink == NULL); + gst_pad_set_chain_function (sink, gst_check_chain_func); + + src = gst_pad_new_from_template (src_template, "src"); + fail_if (src == NULL); + + plr = gst_pad_link (src, sink); + fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); + + /* activate pads */ + gst_pad_set_active (src, TRUE); + gst_pad_set_active (sink, TRUE); + + caps = gst_caps_from_string ("audio/x-raw-int,width=16,depth=16"); + + /* Should fail if src pad caps are incompatible with sink pad caps */ + gst_pad_set_caps (src, caps); + fail_unless (gst_pad_set_caps (sink, caps) == FALSE); + + /* teardown */ + gst_pad_unlink (src, sink); + gst_object_unref (src); + gst_object_unref (sink); + gst_caps_unref (caps); + gst_object_unref (sink_template); + gst_object_unref (src_template); +} + +GST_END_TEST; + +/* see that an unref also unlinks the pads */ +GST_START_TEST (test_src_unref_unlink) +{ + GstPad *src, *sink; + GstCaps *caps; + GstPadLinkReturn plr; + + sink = gst_pad_new ("sink", GST_PAD_SINK); + fail_if (sink == NULL); + + src = gst_pad_new ("src", GST_PAD_SRC); + fail_if (src == NULL); + + caps = gst_caps_from_string ("foo/bar"); + + gst_pad_set_caps (src, caps); + gst_pad_set_active (sink, TRUE); + gst_pad_set_caps (sink, caps); + + plr = gst_pad_link (src, sink); + fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); + + /* unref the srcpad */ + gst_object_unref (src); + + /* sink should be unlinked now */ + fail_if (gst_pad_is_linked (sink)); + + /* cleanup */ + gst_object_unref (sink); + gst_caps_unref (caps); +} + +GST_END_TEST; + +/* see that an unref also unlinks the pads */ +GST_START_TEST (test_sink_unref_unlink) +{ + GstPad *src, *sink; + GstCaps *caps; + GstPadLinkReturn plr; + + sink = gst_pad_new ("sink", GST_PAD_SINK); + fail_if (sink == NULL); + + src = gst_pad_new ("src", GST_PAD_SRC); + fail_if (src == NULL); + + caps = gst_caps_from_string ("foo/bar"); + + gst_pad_set_caps (src, caps); + gst_pad_set_active (sink, TRUE); + gst_pad_set_caps (sink, caps); + + plr = gst_pad_link (src, sink); + fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); + + /* unref the sinkpad */ + gst_object_unref (sink); + + /* src should be unlinked now */ + fail_if (gst_pad_is_linked (src)); + + /* cleanup */ + gst_object_unref (src); + gst_caps_unref (caps); +} + +GST_END_TEST; + +static gulong id; + +static GstProbeReturn +block_async_cb (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer user_data) +{ + gboolean *bool_user_data = (gboolean *) user_data; + + fail_unless ((type & GST_PROBE_TYPE_BLOCK) != 0); + + /* here we should have blocked == 0 unblocked == 0 */ + fail_unless (bool_user_data[0] == FALSE); + fail_unless (bool_user_data[1] == FALSE); + + bool_user_data[0] = TRUE; + + gst_pad_remove_probe (pad, id); + bool_user_data[1] = TRUE; + + return GST_PROBE_OK; +} + +GST_START_TEST (test_block_async) +{ + GstPad *pad; + /* we set data[0] = TRUE when the pad is blocked, data[1] = TRUE when it's + * unblocked */ + gboolean data[2] = { FALSE, FALSE }; + + pad = gst_pad_new ("src", GST_PAD_SRC); + fail_unless (pad != NULL); + + gst_pad_set_active (pad, TRUE); + id = gst_pad_add_probe (pad, GST_PROBE_TYPE_BLOCK, block_async_cb, &data, + NULL); + + fail_unless (data[0] == FALSE); + fail_unless (data[1] == FALSE); + gst_pad_push (pad, gst_buffer_new ()); + + gst_object_unref (pad); +} + +GST_END_TEST; + +#if 0 +static void +block_async_second (GstPad * pad, gboolean blocked, gpointer user_data) +{ + gst_pad_set_blocked (pad, FALSE, unblock_async_cb, NULL, NULL); +} + +static void +block_async_first (GstPad * pad, gboolean blocked, gpointer user_data) +{ + static int n_calls = 0; + gboolean *bool_user_data = (gboolean *) user_data; + + if (++n_calls > 1) + /* we expect this callback to be called only once */ + g_warn_if_reached (); + + *bool_user_data = blocked; + + /* replace block_async_first with block_async_second so next time the pad is + * blocked the latter should be called */ + gst_pad_set_blocked (pad, TRUE, block_async_second, NULL, NULL); + + /* unblock temporarily, in the next push block_async_second should be called + */ + gst_pad_push_event (pad, gst_event_new_flush_start ()); +} + +GST_START_TEST (test_block_async_replace_callback) +{ + GstPad *pad; + gboolean blocked; + + pad = gst_pad_new ("src", GST_PAD_SRC); + fail_unless (pad != NULL); + gst_pad_set_active (pad, TRUE); + + gst_pad_set_blocked (pad, TRUE, block_async_first, &blocked, NULL); + blocked = FALSE; + + gst_pad_push (pad, gst_buffer_new ()); + fail_unless (blocked == TRUE); + /* block_async_first flushes to unblock */ + gst_pad_push_event (pad, gst_event_new_flush_stop ()); + + /* push again, this time block_async_second should be called */ + gst_pad_push (pad, gst_buffer_new ()); + fail_unless (blocked == TRUE); + + gst_object_unref (pad); +} + +GST_END_TEST; +#endif + +static void +block_async_full_destroy (gpointer user_data) +{ + gint *state = (gint *) user_data; + + fail_unless (*state < 2); + + GST_DEBUG ("setting state to 2"); + *state = 2; +} + +static GstProbeReturn +block_async_full_cb (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer user_data) +{ + *(gint *) user_data = (gint) TRUE; + + gst_pad_push_event (pad, gst_event_new_flush_start ()); + GST_DEBUG ("setting state to 1"); + + return GST_PROBE_OK; +} + +GST_START_TEST (test_block_async_full_destroy) +{ + GstPad *pad; + /* 0 = unblocked, 1 = blocked, 2 = destroyed */ + gint state = 0; + gulong id; + + pad = gst_pad_new ("src", GST_PAD_SRC); + fail_unless (pad != NULL); + gst_pad_set_active (pad, TRUE); + + id = gst_pad_add_probe (pad, GST_PROBE_TYPE_BLOCK, block_async_full_cb, + &state, block_async_full_destroy); + fail_unless (state == 0); + + gst_pad_push (pad, gst_buffer_new ()); + /* block_async_full_cb sets state to 1 and then flushes to unblock temporarily + */ + fail_unless (state == 1); + gst_pad_push_event (pad, gst_event_new_flush_stop (TRUE)); + + /* unblock callback is called */ + gst_pad_remove_probe (pad, id); + fail_unless (state == 2); + + gst_object_unref (pad); +} + +GST_END_TEST; + +GST_START_TEST (test_block_async_full_destroy_dispose) +{ + GstPad *pad; + /* 0 = unblocked, 1 = blocked, 2 = destroyed */ + gint state = 0; + + pad = gst_pad_new ("src", GST_PAD_SRC); + fail_unless (pad != NULL); + gst_pad_set_active (pad, TRUE); + + (void) gst_pad_add_probe (pad, GST_PROBE_TYPE_BLOCK, block_async_full_cb, + &state, block_async_full_destroy); + + gst_pad_push (pad, gst_buffer_new ()); + /* block_async_full_cb sets state to 1 and then flushes to unblock temporarily + */ + fail_unless_equals_int (state, 1); + gst_pad_push_event (pad, gst_event_new_flush_stop (TRUE)); + + /* gst_BLOCK calls the destroy_notify function if necessary */ + gst_object_unref (pad); + + fail_unless_equals_int (state, 2); +} + +GST_END_TEST; + + +#if 0 +static void +unblock_async_no_flush_cb (GstPad * pad, gboolean blocked, gpointer user_data) +{ + gboolean *bool_user_data = (gboolean *) user_data; + + /* here we should have blocked == 1 unblocked == 0 */ + + fail_unless (blocked == FALSE); + + fail_unless (bool_user_data[0] == TRUE); + fail_unless (bool_user_data[1] == TRUE); + fail_unless (bool_user_data[2] == FALSE); + + bool_user_data[2] = TRUE; +} +#endif + + +#if 0 +static void +unblock_async_not_called (GstPad * pad, gboolean blocked, gpointer user_data) +{ + g_warn_if_reached (); +} +#endif + +static GstProbeReturn +block_async_second_no_flush (GstPad * pad, GstProbeType type, + gpointer type_data, gpointer user_data) +{ + gboolean *bool_user_data = (gboolean *) user_data; + + GST_DEBUG ("second probe called"); + + fail_unless (type & GST_PROBE_TYPE_BLOCK); + + fail_unless (bool_user_data[0] == TRUE); + fail_unless (bool_user_data[1] == FALSE); + fail_unless (bool_user_data[2] == FALSE); + + bool_user_data[1] = TRUE; + + GST_DEBUG ("removing second probe with id %lu", id); + gst_pad_remove_probe (pad, id); + + return GST_PROBE_OK; +} + +static GstProbeReturn +block_async_first_no_flush (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer user_data) +{ + static int n_calls = 0; + gboolean *bool_user_data = (gboolean *) user_data; + + fail_unless (type & GST_PROBE_TYPE_BLOCK); + + GST_DEBUG ("first probe called"); + + if (++n_calls > 1) + /* we expect this callback to be called only once */ + g_warn_if_reached (); + + *bool_user_data = TRUE; + + fail_unless (bool_user_data[0] == TRUE); + fail_unless (bool_user_data[1] == FALSE); + fail_unless (bool_user_data[2] == FALSE); + + GST_DEBUG ("removing first probe with id %lu", id); + gst_pad_remove_probe (pad, id); + + GST_DEBUG ("adding second probe"); + /* replace block_async_first with block_async_second so next time the pad is + * blocked the latter should be called */ + id = gst_pad_add_probe (pad, GST_PROBE_TYPE_BLOCK, + block_async_second_no_flush, user_data, NULL); + GST_DEBUG ("added probe with id %lu", id); + + return GST_PROBE_OK; +} + +GST_START_TEST (test_block_async_replace_callback_no_flush) +{ + GstPad *pad; + gboolean bool_user_data[3] = { FALSE, FALSE, FALSE }; + + pad = gst_pad_new ("src", GST_PAD_SRC); + fail_unless (pad != NULL); + gst_pad_set_active (pad, TRUE); + + GST_DEBUG ("adding probe"); + id = gst_pad_add_probe (pad, GST_PROBE_TYPE_BLOCK, + block_async_first_no_flush, bool_user_data, NULL); + GST_DEBUG ("added probe with id %lu", id); + fail_if (id == 0); + + GST_DEBUG ("pushing buffer"); + gst_pad_push (pad, gst_buffer_new ()); + fail_unless (bool_user_data[0] == TRUE); + fail_unless (bool_user_data[1] == TRUE); + fail_unless (bool_user_data[2] == FALSE); + + gst_object_unref (pad); +} + +GST_END_TEST; + + +static Suite * +gst_pad_suite (void) +{ + Suite *s = suite_create ("GstPad"); + TCase *tc_chain = tcase_create ("general"); + + /* turn off timeout */ + tcase_set_timeout (tc_chain, 60); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_link); + tcase_add_test (tc_chain, test_refcount); + tcase_add_test (tc_chain, test_get_allowed_caps); + tcase_add_test (tc_chain, test_link_unlink_threaded); + tcase_add_test (tc_chain, test_name_is_valid); + tcase_add_test (tc_chain, test_push_unlinked); + tcase_add_test (tc_chain, test_push_linked); + tcase_add_test (tc_chain, test_push_buffer_list_compat); + tcase_add_test (tc_chain, test_flowreturn); + tcase_add_test (tc_chain, test_push_negotiation); + tcase_add_test (tc_chain, test_src_unref_unlink); + tcase_add_test (tc_chain, test_sink_unref_unlink); + tcase_add_test (tc_chain, test_block_async); +#if 0 + tcase_add_test (tc_chain, test_block_async_replace_callback); +#endif + tcase_add_test (tc_chain, test_block_async_full_destroy); + tcase_add_test (tc_chain, test_block_async_full_destroy_dispose); + tcase_add_test (tc_chain, test_block_async_replace_callback_no_flush); + + return s; +} + +GST_CHECK_MAIN (gst_pad); diff --git a/tests/check/gst/gstparamspecs.c b/tests/check/gst/gstparamspecs.c new file mode 100644 index 0000000..c6d3024 --- /dev/null +++ b/tests/check/gst/gstparamspecs.c @@ -0,0 +1,128 @@ +/* GStreamer GstParamSpec unit tests + * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> +#include <gst/gst.h> +#include <string.h> + +/* some minimal dummy object */ +#define GST_TYPE_DUMMY_OBJ gst_dummy_obj_get_type() + +typedef struct +{ + GstElement parent; + guint num, denom; +} GstDummyObj; + +typedef GstElementClass GstDummyObjClass; + +GType gst_dummy_obj_get_type (void); +G_DEFINE_TYPE (GstDummyObj, gst_dummy_obj, GST_TYPE_ELEMENT); + +static void +gst_dummy_obj_get_property (GObject * obj, guint prop_id, GValue * val, + GParamSpec * pspec); +static void +gst_dummy_obj_set_property (GObject * obj, guint prop_id, const GValue * val, + GParamSpec * pspec); + +static void +gst_dummy_obj_class_init (GstDummyObjClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->get_property = gst_dummy_obj_get_property; + gobject_class->set_property = gst_dummy_obj_set_property; + + ASSERT_CRITICAL ( + /* default value is out of bounds, should print a warning */ + g_object_class_install_property (gobject_class, 1, + gst_param_spec_fraction ("ratio", "ratio", "ratio", 0, 1, 2, 1, + 16, 4, G_PARAM_READWRITE));); + + /* should be within bounds */ + g_object_class_install_property (gobject_class, 2, + gst_param_spec_fraction ("other-ratio", "other ratio", "other ratio", + 0, 1, 2, 1, 16, 9, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, 3, + g_param_spec_boolean ("foo", "foo", "foo", TRUE, G_PARAM_READWRITE)); +} + +static void +gst_dummy_obj_init (GstDummyObj * obj) +{ + /* nothing to do there */ +} + +static void +gst_dummy_obj_set_property (GObject * obj, guint prop_id, const GValue * val, + GParamSpec * pspec) +{ + GstDummyObj *dobj = (GstDummyObj *) obj; + + fail_unless_equals_int (prop_id, 2); + dobj->num = gst_value_get_fraction_numerator (val); + dobj->denom = gst_value_get_fraction_denominator (val); +} + +static void +gst_dummy_obj_get_property (GObject * obj, guint prop_id, GValue * val, + GParamSpec * pspec) +{ + GstDummyObj *dobj = (GstDummyObj *) obj; + + fail_unless_equals_int (prop_id, 2); + gst_value_set_fraction (val, dobj->num, dobj->denom); +} + +GST_START_TEST (test_param_spec_fraction) +{ + GObject *obj; + GValue val = { 0, }; + gint n = 0, d = 0; + + obj = g_object_new (GST_TYPE_DUMMY_OBJ, "other-ratio", 15, 8, NULL); + + g_value_init (&val, GST_TYPE_FRACTION); + g_object_get_property (G_OBJECT (obj), "other-ratio", &val); + fail_unless_equals_int (gst_value_get_fraction_numerator (&val), 15); + fail_unless_equals_int (gst_value_get_fraction_denominator (&val), 8); + g_value_unset (&val); + + g_object_get (obj, "other-ratio", &n, &d, NULL); + fail_unless_equals_int (n, 15); + fail_unless_equals_int (d, 8); + + g_object_unref (obj); +} + +GST_END_TEST static Suite * +gst_param_spec_suite (void) +{ + Suite *s = suite_create ("GstParamSpec"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_param_spec_fraction); + + return s; +} + +GST_CHECK_MAIN (gst_param_spec); diff --git a/tests/check/gst/gstpipeline.c b/tests/check/gst/gstpipeline.c new file mode 100644 index 0000000..97de541 --- /dev/null +++ b/tests/check/gst/gstpipeline.c @@ -0,0 +1,585 @@ +/* GStreamer + * Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart dot org> + * + * gstpipeline.c: Unit test for GstPipeline + * + * 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/check/gstcheck.h> +#include <gst/gst.h> + +#define WAIT_TIME (300 * GST_MSECOND) + +/* an empty pipeline can go to PLAYING in one go */ +GST_START_TEST (test_async_state_change_empty) +{ + GstPipeline *pipeline; + + pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), + GST_STATE_PLAYING), GST_STATE_CHANGE_SUCCESS); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_async_state_change_fake_ready) +{ + GstPipeline *pipeline; + GstElement *src, *sink; + + pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + src = gst_element_factory_make ("fakesrc", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + + gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); + gst_element_link (src, sink); + + fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), + GST_STATE_READY), GST_STATE_CHANGE_SUCCESS); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_async_state_change_fake) +{ + GstPipeline *pipeline; + GstElement *src, *sink; + GstBus *bus; + gboolean done = FALSE; + + pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); + fail_unless (pipeline != NULL, "Could not create pipeline"); + + src = gst_element_factory_make ("fakesrc", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + + gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); + gst_element_link (src, sink); + + bus = gst_pipeline_get_bus (pipeline); + + fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), + GST_STATE_PLAYING), GST_STATE_CHANGE_ASYNC); + + while (!done) { + GstMessage *message; + GstState old, new, pending; + + message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); + if (message) { + gst_message_parse_state_changed (message, &old, &new, &pending); + GST_DEBUG_OBJECT (message->src, "state change from %d to %d", old, new); + if (message->src == GST_OBJECT (pipeline) && new == GST_STATE_PLAYING) + done = TRUE; + gst_message_unref (message); + } + } + + fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), + GST_STATE_NULL), GST_STATE_CHANGE_SUCCESS); + + /* here we don't get the state change messages, because of auto-flush in + * the bus */ + + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_get_bus) +{ + GstPipeline *pipeline; + GstBus *bus; + + pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); + fail_unless (pipeline != NULL, "Could not create pipeline"); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + bus = gst_pipeline_get_bus (pipeline); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after get_bus", 1); + ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); + + gst_object_unref (pipeline); + + ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1); + gst_object_unref (bus); +} + +GST_END_TEST; + +static GMainLoop *loop = NULL; + +static gboolean +message_received (GstBus * bus, GstMessage * message, gpointer data) +{ + GstElement *pipeline = GST_ELEMENT (data); + GstMessageType type = message->type; + + GST_DEBUG ("message received"); + switch (type) { + case GST_MESSAGE_STATE_CHANGED: + { + GstState old, new, pending; + + GST_DEBUG ("state change message received"); + gst_message_parse_state_changed (message, &old, &new, &pending); + GST_DEBUG ("new state %d", new); + if (message->src == GST_OBJECT (pipeline) && new == GST_STATE_PLAYING) { + GST_DEBUG ("quitting main loop"); + g_main_loop_quit (loop); + } + } + break; + case GST_MESSAGE_ERROR: + { + g_print ("error\n"); + } + break; + default: + break; + } + + return TRUE; +} + +GST_START_TEST (test_bus) +{ + GstElement *pipeline; + GstElement *src, *sink; + GstBus *bus; + guint id; + GstState current; + GstStateChangeReturn ret; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); + + src = gst_element_factory_make ("fakesrc", NULL); + fail_unless (src != NULL); + sink = gst_element_factory_make ("fakesink", NULL); + fail_unless (sink != NULL); + + gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); + fail_unless (gst_element_link (src, sink)); + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after get_bus", 1); + ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); + + id = gst_bus_add_watch (bus, message_received, pipeline); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after add_watch", 1); + ASSERT_OBJECT_REFCOUNT (bus, "bus after add_watch", 3); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_ASYNC); + + loop = g_main_loop_new (NULL, FALSE); + GST_DEBUG ("going into main loop"); + g_main_loop_run (loop); + GST_DEBUG ("left main loop"); + + /* PLAYING now */ + + ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "pipeline after gone to playing", 1, + 3); + + /* cleanup */ + GST_DEBUG ("cleanup"); + + ret = gst_element_set_state (pipeline, GST_STATE_NULL); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + ret = gst_element_get_state (pipeline, ¤t, NULL, GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + fail_unless (current == GST_STATE_NULL, "state is not NULL but %d", current); + + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline at start of cleanup", 1); + ASSERT_OBJECT_REFCOUNT (bus, "bus at start of cleanup", 3); + + fail_unless (g_source_remove (id)); + ASSERT_OBJECT_REFCOUNT (bus, "bus after removing source", 2); + + GST_DEBUG ("unreffing pipeline"); + gst_object_unref (pipeline); + + ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1); + gst_object_unref (bus); +} + +GST_END_TEST; + +static GMutex *probe_lock; +static GCond *probe_cond; + +static gboolean +sink_pad_probe (GstPad * pad, GstProbeType type, GstBuffer * buffer, + GstClockTime * first_timestamp) +{ + fail_if (GST_BUFFER_TIMESTAMP (buffer) == GST_CLOCK_TIME_NONE, + "testing if buffer timestamps are right, but got CLOCK_TIME_NONE"); + + if (*first_timestamp == GST_CLOCK_TIME_NONE) { + *first_timestamp = GST_BUFFER_TIMESTAMP (buffer); + } + + g_mutex_lock (probe_lock); + g_cond_signal (probe_cond); + g_mutex_unlock (probe_lock); + + return TRUE; +} + +GST_START_TEST (test_base_time) +{ + GstElement *pipeline, *fakesrc, *fakesink; + GstPad *sink; + GstClockTime observed, lower, upper, base, stream; + GstClock *clock; + + pipeline = gst_element_factory_make ("pipeline", "pipeline"); + fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); + fakesink = gst_element_factory_make ("fakesink", "fakesink"); + + fail_unless (pipeline && fakesrc && fakesink, "couldn't make elements"); + + g_object_set (fakesrc, "is-live", (gboolean) TRUE, NULL); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); + gst_element_link (fakesrc, fakesink); + + sink = gst_element_get_static_pad (fakesink, "sink"); + gst_pad_add_probe (sink, GST_PROBE_TYPE_BUFFER, + (GstPadProbeCallback) sink_pad_probe, &observed, NULL); + + fail_unless (gst_element_set_state (pipeline, GST_STATE_PAUSED) + == GST_STATE_CHANGE_NO_PREROLL, "expected no-preroll from live pipeline"); + + clock = gst_system_clock_obtain (); + fail_unless (clock && GST_IS_CLOCK (clock), "i want a clock dammit"); + gst_pipeline_use_clock (GST_PIPELINE (pipeline), clock); + + fail_unless (gst_element_get_start_time (pipeline) == 0, + "stream time doesn't start off at 0"); + + probe_lock = g_mutex_new (); + probe_cond = g_cond_new (); + + /* test the first: that base time is being distributed correctly, timestamps + are correct relative to the running clock and base time */ + { + lower = gst_clock_get_time (clock); + + observed = GST_CLOCK_TIME_NONE; + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (gst_element_get_state (pipeline, NULL, NULL, + GST_CLOCK_TIME_NONE) + == GST_STATE_CHANGE_SUCCESS, "failed state change"); + + g_mutex_lock (probe_lock); + while (observed == GST_CLOCK_TIME_NONE) + g_cond_wait (probe_cond, probe_lock); + g_mutex_unlock (probe_lock); + + /* now something a little more than lower was distributed as the base time, + * and the buffer was timestamped between 0 and upper-base + */ + + base = gst_element_get_base_time (pipeline); + fail_if (base == GST_CLOCK_TIME_NONE); + + /* set stream time */ + gst_element_set_state (pipeline, GST_STATE_PAUSED); + + /* pulling upper here makes sure that the pipeline's new stream time has + already been computed */ + upper = gst_clock_get_time (clock); + + fail_unless (gst_element_get_state (pipeline, NULL, NULL, + GST_CLOCK_TIME_NONE) + == GST_STATE_CHANGE_NO_PREROLL, "failed state change"); + + fail_if (observed == GST_CLOCK_TIME_NONE, "no timestamp recorded"); + + fail_unless (base >= lower, "early base time: %" GST_TIME_FORMAT " < %" + GST_TIME_FORMAT, GST_TIME_ARGS (base), GST_TIME_ARGS (lower)); + fail_unless (upper >= base, "bogus base time: %" GST_TIME_FORMAT " > %" + GST_TIME_FORMAT, GST_TIME_ARGS (base), GST_TIME_ARGS (upper)); + + stream = gst_element_get_start_time (pipeline); + + fail_unless (stream > 0, "bogus new stream time: %" GST_TIME_FORMAT " > %" + GST_TIME_FORMAT, GST_TIME_ARGS (stream), GST_TIME_ARGS (0)); + fail_unless (stream <= upper, + "bogus new stream time: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT, + GST_TIME_ARGS (stream), GST_TIME_ARGS (upper)); + + fail_unless (observed <= stream, "timestamps outrun stream time: %" + GST_TIME_FORMAT " > %" GST_TIME_FORMAT, + GST_TIME_ARGS (observed), GST_TIME_ARGS (stream)); + fail_unless (observed != GST_CLOCK_TIME_NONE, "early timestamp: %" + GST_TIME_FORMAT " < %" GST_TIME_FORMAT, GST_TIME_ARGS (observed), + GST_TIME_ARGS (lower - base)); + fail_unless (observed <= upper - base, + "late timestamp: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT, + GST_TIME_ARGS (observed), GST_TIME_ARGS (upper - base)); + } + + /* test the second: that the base time is redistributed when we go to PLAYING + again */ + { + GstClockID clock_id; + GstClockTime oldbase = base, oldstream = stream; + + /* let some time pass */ + clock_id = gst_clock_new_single_shot_id (clock, upper + WAIT_TIME); + fail_unless (gst_clock_id_wait (clock_id, NULL) == GST_CLOCK_OK, + "unexpected clock_id_wait return"); + gst_clock_id_unref (clock_id); + + lower = gst_clock_get_time (clock); + fail_if (lower == GST_CLOCK_TIME_NONE); + + observed = GST_CLOCK_TIME_NONE; + + fail_unless (lower >= upper + WAIT_TIME, "clock did not advance?"); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (gst_element_get_state (pipeline, NULL, NULL, + GST_CLOCK_TIME_NONE) + == GST_STATE_CHANGE_SUCCESS, "failed state change"); + + g_mutex_lock (probe_lock); + while (observed == GST_CLOCK_TIME_NONE) + g_cond_wait (probe_cond, probe_lock); + g_mutex_unlock (probe_lock); + + /* now the base time should have advanced by more than WAIT_TIME compared + * to what it was. The buffer will be timestamped between the last stream + * time and upper minus base. + */ + + base = gst_element_get_base_time (pipeline); + fail_if (base == GST_CLOCK_TIME_NONE); + + /* set stream time */ + gst_element_set_state (pipeline, GST_STATE_PAUSED); + + /* new stream time already set */ + upper = gst_clock_get_time (clock); + + fail_unless (gst_element_get_state (pipeline, NULL, NULL, + GST_CLOCK_TIME_NONE) + == GST_STATE_CHANGE_NO_PREROLL, "failed state change"); + + fail_if (observed == GST_CLOCK_TIME_NONE, "no timestamp recorded"); + + stream = gst_element_get_start_time (pipeline); + + fail_unless (base >= oldbase + WAIT_TIME, "base time not reset"); + fail_unless (upper >= base + stream, "bogus base time: %" + GST_TIME_FORMAT " > %" GST_TIME_FORMAT, GST_TIME_ARGS (base), + GST_TIME_ARGS (upper)); + + fail_unless (lower >= base); + fail_unless (observed >= lower - base, "early timestamp: %" + GST_TIME_FORMAT " < %" GST_TIME_FORMAT, + GST_TIME_ARGS (observed), GST_TIME_ARGS (lower - base)); + fail_unless (observed <= upper - base, "late timestamp: %" + GST_TIME_FORMAT " > %" GST_TIME_FORMAT, + GST_TIME_ARGS (observed), GST_TIME_ARGS (upper - base)); + fail_unless (stream - oldstream <= upper - lower, + "insufficient stream time: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT, + GST_TIME_ARGS (observed), GST_TIME_ARGS (upper)); + } + + /* test the third: that if I set CLOCK_TIME_NONE as the stream time, that the + base time is not changed */ + { + GstClockID clock_id; + GstClockTime oldbase = base, oldobserved = observed; + GstClockReturn ret; + + /* let some time pass */ + clock_id = gst_clock_new_single_shot_id (clock, upper + WAIT_TIME); + ret = gst_clock_id_wait (clock_id, NULL); + fail_unless (ret == GST_CLOCK_OK, + "unexpected clock_id_wait return %d", ret); + gst_clock_id_unref (clock_id); + + lower = gst_clock_get_time (clock); + + observed = GST_CLOCK_TIME_NONE; + + fail_unless (lower >= upper + WAIT_TIME, "clock did not advance?"); + + /* bling */ + gst_element_set_start_time (pipeline, GST_CLOCK_TIME_NONE); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (gst_element_get_state (pipeline, NULL, NULL, + GST_CLOCK_TIME_NONE) + == GST_STATE_CHANGE_SUCCESS, "failed state change"); + + g_mutex_lock (probe_lock); + while (observed == GST_CLOCK_TIME_NONE) + g_cond_wait (probe_cond, probe_lock); + g_mutex_unlock (probe_lock); + + /* now the base time should be the same as it was, and the timestamp should + * be more than WAIT_TIME past what it was. + */ + + base = gst_element_get_base_time (pipeline); + + /* set stream time */ + gst_element_set_state (pipeline, GST_STATE_PAUSED); + + /* new stream time already set */ + upper = gst_clock_get_time (clock); + + fail_unless (gst_element_get_state (pipeline, NULL, NULL, + GST_CLOCK_TIME_NONE) + == GST_STATE_CHANGE_NO_PREROLL, "failed state change"); + + fail_if (observed == GST_CLOCK_TIME_NONE, "no timestamp recorded"); + + fail_unless (gst_element_get_start_time (pipeline) + == GST_CLOCK_TIME_NONE, "stream time was reset"); + + fail_unless (base == oldbase, "base time was reset"); + + fail_unless (observed >= lower - base, "early timestamp: %" + GST_TIME_FORMAT " < %" GST_TIME_FORMAT, + GST_TIME_ARGS (observed), GST_TIME_ARGS (lower - base)); + fail_unless (observed <= upper - base, "late timestamp: %" + GST_TIME_FORMAT " > %" GST_TIME_FORMAT, + GST_TIME_ARGS (observed), GST_TIME_ARGS (upper - base)); + fail_unless (observed - oldobserved >= WAIT_TIME, + "insufficient tstamp delta: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT, + GST_TIME_ARGS (observed), GST_TIME_ARGS (oldobserved)); + } + + gst_object_unref (sink); + gst_object_unref (clock); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static gpointer +pipeline_thread (gpointer data) +{ + GstElement *pipeline, *src, *sink; + + src = gst_element_factory_make ("fakesrc", NULL); + g_object_set (src, "num-buffers", 20, NULL); + sink = gst_element_factory_make ("fakesink", NULL); + g_object_set (sink, "sync", TRUE, NULL); + pipeline = gst_pipeline_new (NULL); + gst_bin_add (GST_BIN (pipeline), src); + gst_bin_add (GST_BIN (pipeline), sink); + gst_element_link (src, sink); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + g_usleep (G_USEC_PER_SEC / 10); + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); + return NULL; +} + +GST_START_TEST (test_concurrent_create) +{ + GThread *threads[30]; + int i; + + for (i = 0; i < G_N_ELEMENTS (threads); ++i) { + threads[i] = g_thread_create (pipeline_thread, NULL, TRUE, NULL); + } + for (i = 0; i < G_N_ELEMENTS (threads); ++i) { + if (threads[i]) + g_thread_join (threads[i]); + } +} + +GST_END_TEST; + +GST_START_TEST (test_pipeline_in_pipeline) +{ + GstElement *pipeline, *bin, *fakesrc, *fakesink; + GstMessage *msg; + + pipeline = gst_element_factory_make ("pipeline", "pipeline"); + bin = gst_element_factory_make ("pipeline", "pipeline-as-bin"); + fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); + fakesink = gst_element_factory_make ("fakesink", "fakesink"); + + fail_unless (pipeline && bin && fakesrc && fakesink); + + g_object_set (fakesrc, "num-buffers", 100, NULL); + + gst_bin_add (GST_BIN (pipeline), bin); + gst_bin_add_many (GST_BIN (bin), fakesrc, fakesink, NULL); + gst_element_link (fakesrc, fakesink); + + fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PLAYING), + GST_STATE_CHANGE_ASYNC); + + msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline), -1, + GST_MESSAGE_EOS); + gst_message_unref (msg); + + gst_element_set_state (pipeline, GST_STATE_NULL); + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +gst_pipeline_suite (void) +{ + Suite *s = suite_create ("GstPipeline"); + TCase *tc_chain = tcase_create ("pipeline tests"); + + tcase_set_timeout (tc_chain, 0); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_async_state_change_empty); + tcase_add_test (tc_chain, test_async_state_change_fake_ready); + tcase_add_test (tc_chain, test_async_state_change_fake); + tcase_add_test (tc_chain, test_get_bus); + tcase_add_test (tc_chain, test_bus); + tcase_add_test (tc_chain, test_base_time); + tcase_add_test (tc_chain, test_concurrent_create); + tcase_add_test (tc_chain, test_pipeline_in_pipeline); + + return s; +} + +GST_CHECK_MAIN (gst_pipeline); diff --git a/tests/check/gst/gstplugin.c b/tests/check/gst/gstplugin.c new file mode 100644 index 0000000..772a1b4 --- /dev/null +++ b/tests/check/gst/gstplugin.c @@ -0,0 +1,316 @@ +/* GStreamer + * + * unit test for GstPlugin + * + * Copyright 2004 Thomas Vander Stichele <thomas at apestaart dot org> + * Copyright 2005 David Schleef <ds@schleef.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. + */ + +#include "config.h" + +#include <gst/check/gstcheck.h> + + +static gboolean +register_check_elements (GstPlugin * plugin) +{ + return TRUE; +} + +GST_START_TEST (test_register_static) +{ + GstPlugin *plugin; + + fail_unless (gst_plugin_register_static (GST_VERSION_MAJOR, + GST_VERSION_MINOR, "more-elements", "more-elements", + register_check_elements, VERSION, GST_LICENSE, PACKAGE, + GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)); + + plugin = g_object_new (GST_TYPE_PLUGIN, NULL); + + gst_object_unref (plugin); +} + +GST_END_TEST; + +GST_START_TEST (test_registry) +{ + GList *g; + GstRegistry *registry; + + registry = gst_registry_get_default (); + + for (g = registry->plugins; g; g = g->next) { + GstPlugin *plugin = GST_PLUGIN (g->data); + + ASSERT_OBJECT_REFCOUNT (plugin, "plugin in registry", 1); + GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin), + plugin->desc.name); + } + for (g = registry->features; g; g = g->next) { + GstPluginFeature *feature = GST_PLUGIN_FEATURE (g->data); + + fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 1, + "Feature in registry should have refcount of 1"); + GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (feature), + GST_OBJECT_NAME (feature)); + } +} + +GST_END_TEST; + +GST_START_TEST (test_load_coreelements) +{ + GstPlugin *unloaded_plugin; + GstPlugin *loaded_plugin; + + unloaded_plugin = gst_default_registry_find_plugin ("coreelements"); + fail_if (unloaded_plugin == NULL, "Failed to find coreelements plugin"); + fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 2, + "Refcount of unloaded plugin in registry initially should be 2"); + GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin)); + + loaded_plugin = gst_plugin_load (unloaded_plugin); + fail_if (loaded_plugin == NULL, "Failed to load plugin"); + + if (loaded_plugin != unloaded_plugin) { + fail_if (GST_OBJECT_REFCOUNT_VALUE (loaded_plugin) != 2, + "Refcount of loaded plugin in registry should be 2"); + GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (loaded_plugin)); + fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 1, + "Refcount of replaced plugin should be 1"); + GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin)); + } + + gst_object_unref (unloaded_plugin); + gst_object_unref (loaded_plugin); +} + +GST_END_TEST; + +GST_START_TEST (test_registry_get_plugin_list) +{ + GList *list; + GstPlugin *plugin; + + plugin = gst_default_registry_find_plugin ("coreelements"); + fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2, + "Refcount of plugin in registry should be 2"); + + list = gst_registry_get_plugin_list (gst_registry_get_default ()); + + fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3, + "Refcount of plugin in registry+list should be 3"); + + gst_plugin_list_free (list); + + fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2, + "Refcount of plugin in after list free should be 2"); + + gst_object_unref (plugin); +} + +GST_END_TEST; + +GST_START_TEST (test_find_plugin) +{ + GstPlugin *plugin; + + plugin = gst_registry_find_plugin (gst_registry_get_default (), + "coreelements"); + fail_if (plugin == NULL, "Failed to find coreelements plugin"); + ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2); + + fail_unless_equals_string (plugin->desc.version, VERSION); + fail_unless_equals_string (plugin->desc.license, "LGPL"); + fail_unless_equals_string (plugin->desc.source, "gstreamer"); + fail_unless_equals_string (plugin->desc.package, GST_PACKAGE_NAME); + fail_unless_equals_string (plugin->desc.origin, GST_PACKAGE_ORIGIN); + + gst_object_unref (plugin); +} + +GST_END_TEST; + + +GST_START_TEST (test_find_feature) +{ + GstPluginFeature *feature; + + feature = gst_registry_find_feature (gst_registry_get_default (), + "identity", GST_TYPE_ELEMENT_FACTORY); + fail_if (feature == NULL, "Failed to find identity element factory"); + fail_if (strcmp (feature->plugin_name, "coreelements"), + "Expected identity to be from coreelements plugin"); + + fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 2, + "Refcount of feature should be 2"); + GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (feature)); + + gst_object_unref (feature); +} + +GST_END_TEST; + +GST_START_TEST (test_find_element) +{ + GstElementFactory *element_factory; + + element_factory = gst_element_factory_find ("identity"); + fail_if (element_factory == NULL, "Failed to find identity element factory"); + + fail_if (GST_OBJECT_REFCOUNT_VALUE (element_factory) != 2, + "Refcount of plugin in registry+feature should be 2"); + + gst_object_unref (element_factory); +} + +GST_END_TEST; + +#if 0 +guint8 * +peek (gpointer data, gint64 offset, guint size) +{ + return NULL; +} + +void +suggest (gpointer data, guint probability, const GstCaps * caps) +{ + +} + +GST_START_TEST (test_typefind) +{ + GstPlugin *plugin; + GstPluginFeature *feature; + GstTypeFind typefind = { + peek, + suggest, + NULL, + NULL, + GST_PADDING_INIT + }; + + plugin = gst_default_registry_find_plugin ("typefindfunctions"); + fail_if (plugin == NULL, "Failed to find typefind functions"); + fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2, + "Refcount of plugin in registry should be 2"); + fail_if (gst_plugin_is_loaded (plugin), "Expected plugin to be unloaded"); + + feature = gst_registry_find_feature (gst_registry_get_default (), + "audio/x-au", GST_TYPE_TYPE_FIND_FACTORY); + fail_if (feature == NULL, "Failed to find audio/x-aw typefind factory"); + fail_if (feature->plugin != plugin, + "Expected identity to be from coreelements plugin"); + + fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3, + "Refcount of plugin in registry+feature should be 3"); + + gst_type_find_factory_call_function (GST_TYPE_FIND_FACTORY (feature), + &typefind); + + gst_object_unref (feature->plugin); + + fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1, + "Refcount of plugin in after list free should be 1"); + + gst_object_unref (plugin); +} + +GST_END_TEST; +#endif + +GST_START_TEST (test_version_checks) +{ + fail_if (gst_default_registry_check_feature_version ("identity", + GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO) == FALSE, + "Unexpected version check result"); + + fail_if (gst_default_registry_check_feature_version ("identity", + GST_VERSION_MAJOR + 1, GST_VERSION_MINOR, GST_VERSION_MICRO) == TRUE, + "Unexpected version check result"); + + fail_if (gst_default_registry_check_feature_version ("identity", + GST_VERSION_MAJOR, GST_VERSION_MINOR + 1, GST_VERSION_MICRO) == TRUE, + "Unexpected version check result"); + + /* If the nano is set, then we expect that X.Y.Z-1.x >= X.Y.Z, so that a + * devel plugin is valid against an upcoming release */ + if (GST_VERSION_NANO > 0) { + fail_unless (gst_default_registry_check_feature_version ("identity", + GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO + 1) == + TRUE, "Unexpected version check result"); + } else { + fail_if (gst_default_registry_check_feature_version ("identity", + GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO + 1) == + TRUE, "Unexpected version check result"); + } + + if (GST_VERSION_MAJOR > 0) { + fail_if (gst_default_registry_check_feature_version ("identity", + GST_VERSION_MAJOR - 1, GST_VERSION_MINOR, + GST_VERSION_MICRO) == FALSE, "Unexpected version check result"); + } + + if (GST_VERSION_MINOR > 0) { + fail_if (gst_default_registry_check_feature_version ("identity", + GST_VERSION_MAJOR, GST_VERSION_MINOR - 1, + GST_VERSION_MICRO) == FALSE, "Unexpected version check result"); + } + + if (GST_VERSION_MICRO > 0) { + fail_if (gst_default_registry_check_feature_version ("identity", + GST_VERSION_MAJOR, GST_VERSION_MINOR, + GST_VERSION_MICRO - 1) == FALSE, "Unexpected version check result"); + } + + fail_if (gst_default_registry_check_feature_version ("entityid", + GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO) == TRUE, + "Unexpected version check result"); +} + +GST_END_TEST; + +static Suite * +gst_plugin_suite (void) +{ + Suite *s = suite_create ("GstPlugin"); + TCase *tc_chain = tcase_create ("general"); + + /* turn off timeout */ + tcase_set_timeout (tc_chain, 60); + + suite_add_tcase (s, tc_chain); +#ifdef GST_GNUC_CONSTRUCTOR_DEFINED + tcase_add_test (tc_chain, test_old_register_static); +#endif + tcase_add_test (tc_chain, test_register_static); + tcase_add_test (tc_chain, test_registry); + tcase_add_test (tc_chain, test_load_coreelements); + tcase_add_test (tc_chain, test_registry_get_plugin_list); + tcase_add_test (tc_chain, test_find_plugin); + tcase_add_test (tc_chain, test_find_feature); + tcase_add_test (tc_chain, test_find_element); + tcase_add_test (tc_chain, test_version_checks); + //tcase_add_test (tc_chain, test_typefind); + + return s; +} + +GST_CHECK_MAIN (gst_plugin); diff --git a/tests/check/gst/gstpoll.c b/tests/check/gst/gstpoll.c new file mode 100644 index 0000000..612cda1 --- /dev/null +++ b/tests/check/gst/gstpoll.c @@ -0,0 +1,341 @@ +/* GStreamer + * + * unit test for GstPoll + * + * Copyright (C) <2007> Peter Kjellerstedt <pkj@axis.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. + */ + +#include <unistd.h> +#include <gst/check/gstcheck.h> + +#ifdef G_OS_WIN32 +#include <winsock2.h> +#include <fcntl.h> +#define EINPROGRESS WSAEINPROGRESS +#else +#include <sys/socket.h> +#endif + +GST_START_TEST (test_poll_wait) +{ + GstPoll *set; + GstPollFD rfd = GST_POLL_FD_INIT; + GstPollFD wfd = GST_POLL_FD_INIT; + gint socks[2]; + guchar c = 'A'; + + set = gst_poll_new (FALSE); + fail_if (set == NULL, "Failed to create a GstPoll"); + +#ifdef G_OS_WIN32 + fail_if (_pipe (socks, 4096, _O_BINARY) < 0, "Could not create a pipe"); +#else + fail_if (socketpair (PF_UNIX, SOCK_STREAM, 0, socks) < 0, + "Could not create a pipe"); +#endif + rfd.fd = socks[0]; + wfd.fd = socks[1]; + + fail_unless (gst_poll_add_fd (set, &rfd), "Could not add read descriptor"); + fail_unless (gst_poll_fd_ctl_read (set, &rfd, TRUE), + "Could not mark the descriptor as readable"); + + fail_unless (write (wfd.fd, &c, 1) == 1, "write() failed"); + + fail_unless (gst_poll_wait (set, GST_CLOCK_TIME_NONE) == 1, + "One descriptor should be available"); + fail_unless (gst_poll_fd_can_read (set, &rfd), + "Read descriptor should be readable"); + fail_if (gst_poll_fd_can_write (set, &rfd), + "Read descriptor should not be writeable"); + + fail_unless (gst_poll_add_fd (set, &wfd), "Could not add write descriptor"); + fail_unless (gst_poll_fd_ctl_write (set, &wfd, TRUE), + "Could not mark the descriptor as writeable"); + + fail_unless (gst_poll_wait (set, GST_CLOCK_TIME_NONE) == 2, + "Two descriptors should be available"); + fail_unless (gst_poll_fd_can_read (set, &rfd), + "Read descriptor should be readable"); + fail_if (gst_poll_fd_can_write (set, &rfd), + "Read descriptor should not be writeable"); + fail_if (gst_poll_fd_can_read (set, &wfd), + "Write descriptor should not be readable"); + fail_unless (gst_poll_fd_can_write (set, &wfd), + "Write descriptor should be writeable"); + + fail_unless (read (rfd.fd, &c, 1) == 1, "read() failed"); + + fail_unless (gst_poll_wait (set, GST_CLOCK_TIME_NONE) == 1, + "One descriptor should be available"); + fail_if (gst_poll_fd_can_read (set, &rfd), + "Read descriptor should not be readable"); + fail_if (gst_poll_fd_can_write (set, &rfd), + "Read descriptor should not be writeable"); + fail_if (gst_poll_fd_can_read (set, &wfd), + "Write descriptor should not be readable"); + fail_unless (gst_poll_fd_can_write (set, &wfd), + "Write descriptor should be writeable"); + + gst_poll_free (set); + close (socks[0]); + close (socks[1]); +} + +GST_END_TEST; + +GST_START_TEST (test_poll_basic) +{ + GstPoll *set; + GstPollFD fd = GST_POLL_FD_INIT; + + fd.fd = 1; + + set = gst_poll_new (FALSE); + fail_if (set == NULL, "Failed to create a GstPoll"); + + fail_unless (gst_poll_add_fd (set, &fd), "Could not add descriptor"); + fail_unless (gst_poll_fd_ctl_write (set, &fd, TRUE), + "Could not mark the descriptor as writeable"); + fail_unless (gst_poll_fd_ctl_read (set, &fd, TRUE), + "Could not mark the descriptor as readable"); + fail_if (gst_poll_fd_has_closed (set, &fd), + "Descriptor should not be closed"); + fail_if (gst_poll_fd_has_error (set, &fd), + "Descriptor should not have an error"); + fail_if (gst_poll_fd_can_write (set, &fd), + "Descriptor should not be writeable"); + fail_if (gst_poll_fd_can_read (set, &fd), + "Descriptor should not be readable"); + fail_unless (gst_poll_remove_fd (set, &fd), "Could not remove descriptor"); + + fail_if (gst_poll_remove_fd (set, &fd), + "Could remove already removed descriptor"); + + fail_unless (gst_poll_wait (set, 50 * GST_MSECOND) == 0, + "Waiting did not timeout"); + + gst_poll_free (set); + + set = gst_poll_new (TRUE); + fail_if (set == NULL, "Failed to create a GstPoll"); + gst_poll_set_flushing (set, TRUE); + gst_poll_free (set); +} + +GST_END_TEST; + +static gpointer +delayed_stop (gpointer data) +{ + GstPoll *set = data; + + THREAD_START (); + + g_usleep (500000); + + gst_poll_set_flushing (set, TRUE); + + return NULL; +} + +GST_START_TEST (test_poll_wait_stop) +{ + GstPoll *set; + + set = gst_poll_new (TRUE); + fail_if (set == NULL, "Failed to create a GstPoll"); + + MAIN_START_THREADS (1, delayed_stop, set); + + fail_unless (gst_poll_wait (set, GST_SECOND) != 0, "Waiting timed out"); + + MAIN_STOP_THREADS (); + + gst_poll_free (set); +} + +GST_END_TEST; + +static gpointer +delayed_restart (gpointer data) +{ + GstPoll *set = data; + GstPollFD fd = GST_POLL_FD_INIT; + + fd.fd = 1; + + THREAD_START (); + + g_usleep (500000); + + gst_poll_add_fd (set, &fd); + gst_poll_fd_ctl_write (set, &fd, TRUE); + gst_poll_restart (set); + + return NULL; +} + +GST_START_TEST (test_poll_wait_restart) +{ + GstPoll *set; + GstPollFD fd = GST_POLL_FD_INIT; + + fd.fd = 1; + + set = gst_poll_new (TRUE); + fail_if (set == NULL, "Failed to create a GstPoll"); + + MAIN_START_THREADS (1, delayed_restart, set); + + fail_unless (gst_poll_wait (set, GST_SECOND) > 0, "Waiting was interrupted"); + fail_unless (gst_poll_fd_can_write (set, &fd), + "Write descriptor should be writeable"); + + MAIN_STOP_THREADS (); + + gst_poll_free (set); +} + +GST_END_TEST; + +static gpointer +delayed_flush (gpointer data) +{ + GstPoll *set = data; + + THREAD_START (); + + g_usleep (500000); + gst_poll_set_flushing (set, TRUE); + + return NULL; +} + +GST_START_TEST (test_poll_wait_flush) +{ + GstPoll *set; + + set = gst_poll_new (TRUE); + fail_if (set == NULL, "Failed to create a GstPoll"); + + gst_poll_set_flushing (set, TRUE); + fail_unless (gst_poll_wait (set, GST_SECOND) == -1 && errno == EBUSY, + "Waiting was not flushed"); + fail_unless (gst_poll_wait (set, GST_SECOND) == -1 && errno == EBUSY, + "Waiting was not flushed"); + + gst_poll_set_flushing (set, FALSE); + fail_unless (gst_poll_wait (set, GST_SECOND) == 0, "Waiting did not timeout"); + + MAIN_START_THREADS (1, delayed_flush, set); + + fail_unless (gst_poll_wait (set, GST_SECOND) == -1 && errno == EBUSY, + "Waiting was not flushed"); + fail_unless (gst_poll_wait (set, GST_SECOND) == -1 && errno == EBUSY, + "Waiting was not flushed"); + + gst_poll_set_flushing (set, FALSE); + fail_unless (gst_poll_wait (set, GST_SECOND) == 0, "Waiting did not timeout"); + + MAIN_STOP_THREADS (); + + gst_poll_free (set); +} + +GST_END_TEST; + +static gpointer +delayed_control (gpointer data) +{ + GstPoll *set = data; + GstPollFD fd = GST_POLL_FD_INIT; + + fd.fd = 1; + + THREAD_START (); + + g_usleep (500000); + + gst_poll_add_fd (set, &fd); + gst_poll_fd_ctl_write (set, &fd, TRUE); + gst_poll_restart (set); + + THREAD_SYNCHRONIZE (); + + g_usleep (500000); + + gst_poll_add_fd (set, &fd); + gst_poll_fd_ctl_write (set, &fd, TRUE); + gst_poll_restart (set); + + return NULL; +} + +GST_START_TEST (test_poll_controllable) +{ + GstPoll *set; + GstPollFD fd = GST_POLL_FD_INIT; + + fd.fd = 1; + + set = gst_poll_new (FALSE); + fail_if (set == NULL, "Failed to create a GstPoll"); + + MAIN_START_THREADS (1, delayed_control, set); + + fail_unless (gst_poll_wait (set, GST_SECOND) == 0, "Waiting did not timeout"); + + fail_unless (gst_poll_remove_fd (set, &fd), "Could not remove descriptor"); + fail_unless (gst_poll_set_controllable (set, TRUE), + "Could not make the set controllable"); + + MAIN_SYNCHRONIZE (); + + fail_unless (gst_poll_wait (set, GST_SECOND) > 0, "Waiting was interrupted"); + fail_unless (gst_poll_fd_can_write (set, &fd), + "Write descriptor should be writeable"); + + MAIN_STOP_THREADS (); + + gst_poll_free (set); +} + +GST_END_TEST; + +static Suite * +gst_poll_suite (void) +{ + Suite *s = suite_create ("GstPoll"); + TCase *tc_chain = tcase_create ("general"); + + /* turn off timeout */ + tcase_set_timeout (tc_chain, 60); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_poll_basic); + tcase_add_test (tc_chain, test_poll_wait); + tcase_add_test (tc_chain, test_poll_wait_stop); + tcase_add_test (tc_chain, test_poll_wait_restart); + tcase_add_test (tc_chain, test_poll_wait_flush); + tcase_add_test (tc_chain, test_poll_controllable); + + return s; +} + +GST_CHECK_MAIN (gst_poll); diff --git a/tests/check/gst/gstpreset.c b/tests/check/gst/gstpreset.c new file mode 100644 index 0000000..3e624a0 --- /dev/null +++ b/tests/check/gst/gstpreset.c @@ -0,0 +1,303 @@ +/* GStreamer + * Copyright (C) 2008 Nokia Corporation and its subsidary(-ies) + * contact: <stefan.kost@nokia.com> + * + * gstpreset.c: Unit test for GstPreset + * + * 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 <glib.h> +#include <glib/gstdio.h> +#include <gst/check/gstcheck.h> + +#include <unistd.h> + +static GType gst_preset_test_get_type (void); + +#define GST_TYPE_PRESET_TEST (gst_preset_test_get_type ()) +#define GST_PRESET_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PRESET_TEST, GstPresetTest)) +#define GST_PRESET_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PRESET_TEST, GstPresetTestClass)) +#define GST_IS_PRESET_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PRESET_TEST)) +#define GST_IS_PRESET_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PRESET_TEST)) +#define GST_PRESET_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PRESET_TEST, GstPresetTestClass)) +#define GST_PRESET_TEST_NAME "preset-test" + +enum +{ + PROP_TEST = 1, +}; + +typedef struct _GstPresetTest +{ + GstElement parent; + + gint test; +} GstPresetTest; + +typedef struct _GstPresetTestClass +{ + GstElementClass parent_class; +} GstPresetTestClass; + +static void +gst_preset_test_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + GstPresetTest *self = GST_PRESET_TEST (object); + + switch (property_id) { + case PROP_TEST: + g_value_set_int (value, self->test); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gst_preset_test_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + GstPresetTest *self = GST_PRESET_TEST (object); + + switch (property_id) { + case PROP_TEST: + self->test = g_value_get_int (value); + break; + } +} + +static void +gst_preset_test_class_init (GObjectClass * klass) +{ + klass->set_property = gst_preset_test_set_property; + klass->get_property = gst_preset_test_get_property; + + g_object_class_install_property (klass, PROP_TEST, + g_param_spec_int ("test", + "test prop", + "test parameter for preset test", + G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); +} + +static void +gst_preset_test_base_init (GstPresetTestClass * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_set_details_simple (element_class, + "Element for unit tests", + "Testing", "Use in unit tests", "Stefan Kost <stefan.kost@nokia.com>"); +} + +static GType +gst_preset_test_get_type (void) +{ + static volatile gsize preset_test_type = 0; + + if (g_once_init_enter (&preset_test_type)) { + GType type; + const GTypeInfo info = { + sizeof (GstPresetTestClass), + (GBaseInitFunc) gst_preset_test_base_init, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gst_preset_test_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GstPresetTest), + 0, /* n_preallocs */ + NULL, /* instance_init */ + NULL /* value_table */ + }; + const GInterfaceInfo preset_interface_info = { + NULL, /* interface_init */ + NULL, /* interface_finalize */ + NULL /* interface_data */ + }; + type = g_type_register_static (GST_TYPE_ELEMENT, "GstPresetTest", &info, 0); + g_type_add_interface_static (type, GST_TYPE_PRESET, &preset_interface_info); + g_once_init_leave (&preset_test_type, type); + } + return preset_test_type; +} + +static gboolean +gst_preset_test_plugin_init (GstPlugin * plugin) +{ + gst_element_register (plugin, GST_PRESET_TEST_NAME, GST_RANK_NONE, + GST_TYPE_PRESET_TEST); + return TRUE; +} + + +GST_START_TEST (test_check) +{ + GstElement *elem; + + elem = gst_element_factory_make (GST_PRESET_TEST_NAME, NULL); + fail_unless (GST_IS_PRESET (elem)); + + gst_object_unref (elem); +} + +GST_END_TEST; + +GST_START_TEST (test_load) +{ + GstElement *elem; + gboolean res; + + elem = gst_element_factory_make (GST_PRESET_TEST_NAME, NULL); + res = gst_preset_load_preset (GST_PRESET (elem), "does-not-exist"); + fail_unless (!res); + + gst_object_unref (elem); +} + +GST_END_TEST; + +GST_START_TEST (test_add) +{ + GstElement *elem; + gboolean res; + gint val; + + elem = gst_element_factory_make (GST_PRESET_TEST_NAME, NULL); + g_object_set (elem, "test", 5, NULL); + + res = gst_preset_save_preset (GST_PRESET (elem), "test"); + fail_unless (res); + + res = gst_preset_load_preset (GST_PRESET (elem), "test"); + fail_unless (res); + g_object_get (elem, "test", &val, NULL); + fail_unless (val == 5); + + gst_object_unref (elem); +} + +GST_END_TEST; + + +GST_START_TEST (test_del) +{ + GstElement *elem; + gboolean res; + + elem = gst_element_factory_make (GST_PRESET_TEST_NAME, NULL); + res = gst_preset_save_preset (GST_PRESET (elem), "test"); + fail_unless (res); + + res = gst_preset_delete_preset (GST_PRESET (elem), "test"); + fail_unless (res); + + res = gst_preset_load_preset (GST_PRESET (elem), "test"); + fail_unless (!res); + + gst_object_unref (elem); +} + +GST_END_TEST; + +GST_START_TEST (test_two_instances) +{ + GstElement *elem1, *elem2; + gboolean res; + gint val; + + elem1 = gst_element_factory_make (GST_PRESET_TEST_NAME, NULL); + g_object_set (elem1, "test", 5, NULL); + + res = gst_preset_save_preset (GST_PRESET (elem1), "test"); + fail_unless (res); + + elem2 = gst_element_factory_make (GST_PRESET_TEST_NAME, NULL); + res = gst_preset_load_preset (GST_PRESET (elem2), "test"); + fail_unless (res); + g_object_get (elem2, "test", &val, NULL); + fail_unless (val == 5); + + gst_object_unref (elem1); + gst_object_unref (elem2); +} + +GST_END_TEST; + + +static void +remove_preset_file (void) +{ + gchar *preset_file_name; + + preset_file_name = g_build_filename (g_get_user_data_dir (), + "gstreamer-" GST_MAJORMINOR, "presets", "GstPresetTest.prs", NULL); + g_unlink (preset_file_name); + g_free (preset_file_name); +} + +static void +test_setup (void) +{ + remove_preset_file (); + gst_plugin_register_static (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gst-test", + "preset test plugin", + gst_preset_test_plugin_init, + VERSION, GST_LICENSE, PACKAGE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); +} + +static void +test_teardown (void) +{ + remove_preset_file (); +} + + +static Suite * +gst_preset_suite (void) +{ + Suite *s = suite_create ("GstPreset"); + TCase *tc = tcase_create ("preset"); + gchar *gst_dir; + gboolean can_write = FALSE; + + /* check if we can create presets */ + gst_dir = g_build_filename (g_get_user_data_dir (), + "gstreamer-" GST_MAJORMINOR, NULL); + can_write = (g_access (gst_dir, R_OK | W_OK | X_OK) == 0); + g_free (gst_dir); + + suite_add_tcase (s, tc); + tcase_add_test (tc, test_check); + tcase_add_test (tc, test_load); + if (can_write) { + tcase_add_test (tc, test_add); + tcase_add_test (tc, test_del); + tcase_add_test (tc, test_two_instances); + } + tcase_add_unchecked_fixture (tc, test_setup, test_teardown); + + return s; +} + +GST_CHECK_MAIN (gst_preset); diff --git a/tests/check/gst/gstquery.c b/tests/check/gst/gstquery.c new file mode 100644 index 0000000..b37eec2 --- /dev/null +++ b/tests/check/gst/gstquery.c @@ -0,0 +1,293 @@ +/* GStreamer + * + * 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 <gst/check/gstcheck.h> +GST_START_TEST (create_queries) +{ + GstQuery *query; + + /* POSITION */ + { + GstFormat format; + gint64 position; + + query = gst_query_new_position (GST_FORMAT_TIME); + fail_if (query == NULL); + fail_unless (GST_QUERY_TYPE (query) == GST_QUERY_POSITION); + + gst_query_parse_position (query, &format, NULL); + fail_if (format != GST_FORMAT_TIME); + + gst_query_set_position (query, GST_FORMAT_TIME, 0xdeadbeaf); + + gst_query_parse_position (query, &format, &position); + fail_if (format != GST_FORMAT_TIME); + fail_if (position != 0xdeadbeaf); + + gst_query_unref (query); + } + /* DURATION */ + { + GstFormat format; + gint64 duration; + + query = gst_query_new_duration (GST_FORMAT_TIME); + fail_if (query == NULL); + fail_unless (GST_QUERY_TYPE (query) == GST_QUERY_DURATION); + + gst_query_parse_duration (query, &format, NULL); + fail_if (format != GST_FORMAT_TIME); + + gst_query_set_duration (query, GST_FORMAT_TIME, 0xdeadbeaf); + + gst_query_parse_duration (query, &format, &duration); + fail_if (format != GST_FORMAT_TIME); + fail_if (duration != 0xdeadbeaf); + + gst_query_unref (query); + } + /* BUFFERING RANGES */ + { + gint64 start, stop; + + query = gst_query_new_buffering (GST_FORMAT_PERCENT); + fail_if (query == NULL); + fail_unless (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); + + fail_unless (gst_query_add_buffering_range (query, 0, 20)); + fail_unless (gst_query_add_buffering_range (query, 25, 30)); + + /* check incoherent range insertion */ + fail_if (gst_query_add_buffering_range (query, 10, 15)); + fail_if (gst_query_add_buffering_range (query, 50, 40)); + + fail_unless (gst_query_get_n_buffering_ranges (query) == 2); + + fail_unless (gst_query_parse_nth_buffering_range (query, 0, &start, &stop)); + fail_unless (start == 0); + fail_unless (stop == 20); + + fail_unless (gst_query_parse_nth_buffering_range (query, 1, &start, &stop)); + fail_unless (start == 25); + fail_unless (stop == 30); + + gst_query_unref (query); + } + { + /* FIXME make tests for: + * + * LATENCY + * JITTER + * RATE + * SEEKING + * SEGMENT + * CONVERT + */ + } + /* SEGMENT */ + { + gdouble rate; + GstFormat format; + gint64 start, stop; + + format = GST_FORMAT_BYTES; + query = gst_query_new_segment (format); + + fail_if (query == NULL); + fail_unless (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT); + + gst_query_parse_segment (query, &rate, &format, &start, &stop); + + /* see if empty gives undefined formats */ + fail_if (rate != 0.0); + fail_if (format != GST_FORMAT_BYTES); + fail_if (start != -1); + fail_if (stop != -1); + + /* change all values */ + gst_query_set_segment (query, 2.0, GST_FORMAT_TIME, 1 * GST_SECOND, + 3 * GST_SECOND); + + gst_query_parse_segment (query, &rate, &format, &start, &stop); + + /* see if the values were changed */ + fail_if (rate != 2.0); + fail_if (format != GST_FORMAT_TIME); + fail_if (start != 1 * GST_SECOND); + fail_if (stop != 3 * GST_SECOND); + + gst_query_unref (query); + } + + /* FORMATS */ + { + guint size; + GstFormat format; + + query = gst_query_new_formats (); + fail_if (query == NULL); + fail_unless (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS); + + /* empty */ + gst_query_parse_n_formats (query, &size); + fail_if (size != 0); + + /* see if empty gives undefined formats */ + gst_query_parse_nth_format (query, 0, &format); + fail_if (format != GST_FORMAT_UNDEFINED); + gst_query_parse_nth_format (query, 1, &format); + fail_if (format != GST_FORMAT_UNDEFINED); + + /* set 2 formats */ + gst_query_set_formats (query, 2, GST_FORMAT_TIME, GST_FORMAT_BYTES); + + gst_query_parse_n_formats (query, &size); + fail_if (size != 2); + + format = GST_FORMAT_UNDEFINED; + + gst_query_parse_nth_format (query, 0, &format); + fail_if (format != GST_FORMAT_TIME); + gst_query_parse_nth_format (query, 1, &format); + fail_if (format != GST_FORMAT_BYTES); + + /* out of bounds, should return UNDEFINED */ + gst_query_parse_nth_format (query, 2, &format); + fail_if (format != GST_FORMAT_UNDEFINED); + + /* overwrite with 3 formats */ + gst_query_set_formats (query, 3, GST_FORMAT_TIME, GST_FORMAT_BYTES, + GST_FORMAT_PERCENT); + + gst_query_parse_n_formats (query, &size); + fail_if (size != 3); + + gst_query_parse_nth_format (query, 2, &format); + fail_if (format != GST_FORMAT_PERCENT); + + /* create one from an array */ + { + static GstFormat formats[] = { + GST_FORMAT_TIME, + GST_FORMAT_BYTES, + GST_FORMAT_PERCENT + }; + gst_query_set_formatsv (query, 3, formats); + + gst_query_parse_n_formats (query, &size); + fail_if (size != 3); + + gst_query_parse_nth_format (query, 0, &format); + fail_if (format != GST_FORMAT_TIME); + gst_query_parse_nth_format (query, 2, &format); + fail_if (format != GST_FORMAT_PERCENT); + } + gst_query_unref (query); + } +} + +GST_END_TEST; + +GST_START_TEST (test_queries) +{ + GstBin *bin; + GstElement *src, *sink; + GstStateChangeReturn ret; + GstPad *pad; + GstQuery *dur, *pos; + + fail_unless ((bin = (GstBin *) gst_pipeline_new (NULL)) != NULL, + "Could not create pipeline"); + fail_unless ((src = gst_element_factory_make ("fakesrc", NULL)) != NULL, + "Could not create fakesrc"); + g_object_set (src, "datarate", 200, "sizetype", 2, NULL); + + fail_unless ((sink = gst_element_factory_make ("fakesink", NULL)) != NULL, + "Could not create fakesink"); + g_object_set (sink, "sync", TRUE, NULL); + fail_unless ((dur = gst_query_new_duration (GST_FORMAT_BYTES)) != NULL, + "Could not prepare duration query"); + fail_unless ((pos = gst_query_new_position (GST_FORMAT_BYTES)) != NULL, + "Could not prepare position query"); + + fail_unless (gst_bin_add (bin, src), "Could not add src to bin"); + fail_unless (gst_bin_add (bin, sink), "Could not add sink to bin"); + fail_unless (gst_element_link (src, sink), "could not link src and sink"); + + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); + fail_if (ret == GST_STATE_CHANGE_FAILURE, "Failed to set pipeline PLAYING"); + if (ret == GST_STATE_CHANGE_ASYNC) + gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE); + + /* Query the bin */ + fail_unless (gst_element_query (GST_ELEMENT (bin), pos), + "Could not query pipeline position"); + fail_unless (gst_element_query (GST_ELEMENT (bin), dur), + "Could not query pipeline duration"); + + /* Query elements */ + fail_unless (gst_element_query (GST_ELEMENT (src), pos), + "Could not query position of fakesrc"); + fail_unless (gst_element_query (GST_ELEMENT (src), pos), + "Could not query duration of fakesrc"); + + fail_unless (gst_element_query (GST_ELEMENT (sink), pos), + "Could not query position of fakesink"); + fail_unless (gst_element_query (GST_ELEMENT (sink), pos), + "Could not query duration of fakesink"); + + /* Query pads */ + fail_unless ((pad = gst_element_get_static_pad (src, "src")) != NULL, + "Could not get source pad of fakesrc"); + fail_unless (gst_pad_query (pad, pos), + "Could not query position of fakesrc src pad"); + fail_unless (gst_pad_query (pad, dur), + "Could not query duration of fakesrc src pad"); + gst_object_unref (pad); + + /* We don't query the sink pad of fakesink, it doesn't + * handle downstream queries atm, but it might later, who knows? */ + + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); + fail_if (ret == GST_STATE_CHANGE_FAILURE, "Failed to set pipeline NULL"); + if (ret == GST_STATE_CHANGE_ASYNC) + gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE); + + gst_query_unref (dur); + gst_query_unref (pos); + gst_object_unref (bin); +} + +GST_END_TEST; + +static Suite * +gst_query_suite (void) +{ + Suite *s = suite_create ("GstQuery"); + TCase *tc_chain = tcase_create ("queries"); + + tcase_set_timeout (tc_chain, 20); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, create_queries); + tcase_add_test (tc_chain, test_queries); + return s; +} + +GST_CHECK_MAIN (gst_query); diff --git a/tests/check/gst/gstregistry.c b/tests/check/gst/gstregistry.c new file mode 100644 index 0000000..91190cc --- /dev/null +++ b/tests/check/gst/gstregistry.c @@ -0,0 +1,219 @@ +/* GStreamer unit tests for the plugin registry + * + * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net> + * + * 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/check/gstcheck.h> +#include <string.h> + +static gint +plugin_name_cmp (GstPlugin * a, GstPlugin * b) +{ + const gchar *name_a = gst_plugin_get_name (a); + const gchar *name_b = gst_plugin_get_name (b); + + return strcmp (name_a, name_b); +} + +static gint +plugin_ptr_cmp (GstPlugin * a, GstPlugin * b) +{ + return (a == b) ? 0 : 1; +} + +static void +print_plugin (const gchar * marker, GstRegistry * registry, GstPlugin * plugin) +{ + const gchar *name; + GList *features, *f; + + name = gst_plugin_get_name (plugin); + + GST_DEBUG ("%s: plugin %p %d %s file: %s", marker, plugin, + GST_OBJECT_REFCOUNT (plugin), name, + GST_STR_NULL (gst_plugin_get_filename (plugin))); + + features = gst_registry_get_feature_list_by_plugin (registry, name); + for (f = features; f != NULL; f = f->next) { + GstPluginFeature *feature; + + feature = GST_PLUGIN_FEATURE (f->data); + + GST_LOG ("%s: feature: %p %s", marker, feature, + gst_plugin_feature_get_name (feature)); + } + gst_plugin_feature_list_free (features); +} + +GST_START_TEST (test_registry_update) +{ + GstPluginFeature *old_identity, *new_identity; + GstPluginFeature *old_pipeline, *new_pipeline; + GstRegistry *registry; + GList *plugins_before, *plugins_after, *l; + + registry = gst_registry_get_default (); + fail_unless (registry != NULL); + ASSERT_OBJECT_REFCOUNT (registry, "default registry", 1); + + /* refcount should still be 1 the second time */ + registry = gst_registry_get_default (); + fail_unless (registry != NULL); + ASSERT_OBJECT_REFCOUNT (registry, "default registry", 1); + + old_identity = gst_registry_lookup_feature (registry, "identity"); + fail_unless (old_identity != NULL, "Can't find plugin feature 'identity'"); + + old_pipeline = gst_registry_lookup_feature (registry, "pipeline"); + fail_unless (old_pipeline != NULL, "Can't find plugin feature 'pipeline'"); + + /* plugins should have a refcount of 2: the registry holds one reference, + * and the other one is ours for the list */ + plugins_before = gst_registry_get_plugin_list (registry); + for (l = plugins_before; l; l = l->next) { + GstPlugin *plugin; + + plugin = GST_PLUGIN (l->data); + + print_plugin ("before1", registry, plugin); + + ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2); + } + + GST_LOG (" ----- calling gst_update_registry -----"); + + fail_unless (gst_update_registry () != FALSE, "registry update failed"); + + GST_LOG (" ----- registry updated -----"); + + /* static plugins should have the same refcount as before (ie. 2), whereas + * file-based plugins *may* have been replaced by a newly-created object + * if the on-disk file changed (and was not yet loaded). There should be + * only one reference left for those, and that's ours */ + for (l = plugins_before; l; l = l->next) { + GstPlugin *plugin; + + plugin = GST_PLUGIN (l->data); + + print_plugin ("before2", registry, plugin); + + if (gst_plugin_get_filename (plugin)) { + /* file-based plugin. */ + ASSERT_OBJECT_REFCOUNT_BETWEEN (plugin, "plugin", 1, 2); + } else { + /* static plugin */ + ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2); + } + } + + GST_LOG (" -----------------------------------"); + + plugins_after = gst_registry_get_plugin_list (registry); + for (l = plugins_after; l; l = l->next) { + GstPlugin *plugin = GST_PLUGIN (l->data); + + print_plugin ("after ", registry, plugin); + + /* file-based plugins should have a refcount of 2 (one for the registry, + * one for us for the list) or 3 (one for the registry, one for the before + * list, one for the after list), static plugins should have one of 3 + * (one for the registry, one for the new list and one for the old list). + * This implicitly also makes sure that all static plugins are the same + * objects as they were before. Non-static ones may or may not have been + * replaced by new objects */ + if (gst_plugin_get_filename (plugin)) { + if (g_list_find_custom (plugins_before, plugin, + (GCompareFunc) plugin_ptr_cmp) != NULL) { + /* Same plugin existed in the before list. Refcount must be 3 */ + ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 3); + } else { + /* This plugin is newly created, so should only exist in the after list + * and the registry: Refcount must be 2 */ + ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2); + } + } else { + ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 3); + } + } + + /* check that we still have all plugins in the new list that we had before */ + for (l = plugins_after; l; l = l->next) { + GstPlugin *plugin; + + plugin = GST_PLUGIN (l->data); + + fail_unless (g_list_find_custom (plugins_before, plugin, + (GCompareFunc) plugin_name_cmp) != NULL, + "Plugin %s is in new list but not in old one?!", + gst_plugin_get_name (plugin)); + } + for (l = plugins_before; l; l = l->next) { + GstPlugin *plugin; + + plugin = GST_PLUGIN (l->data); + fail_unless (g_list_find_custom (plugins_after, plugin, + (GCompareFunc) plugin_name_cmp) != NULL, + "Plugin %s is in old list but not in new one?!", + gst_plugin_get_name (plugin)); + } + + new_identity = gst_registry_lookup_feature (registry, "identity"); + fail_unless (new_identity != NULL, "Can't find plugin feature 'identity'"); + fail_unless (old_identity == new_identity, "Old and new 'identity' feature " + "objects should be the same, but are different objects"); + + /* One ref each for: the registry, old_identity, new_identity */ + ASSERT_OBJECT_REFCOUNT (old_identity, "old identity feature after update", 3); + + new_pipeline = gst_registry_lookup_feature (registry, "pipeline"); + fail_unless (new_pipeline != NULL, "Can't find plugin feature 'pipeline'"); + fail_unless (old_pipeline == new_pipeline, "Old and new 'pipeline' feature " + "objects should be the same, but are different objects"); + + gst_plugin_list_free (plugins_before); + plugins_before = NULL; + gst_plugin_list_free (plugins_after); + plugins_after = NULL; + registry = NULL; + + gst_object_unref (old_identity); + gst_object_unref (new_identity); + gst_object_unref (old_pipeline); + gst_object_unref (new_pipeline); +} + +GST_END_TEST; + +static Suite * +registry_suite (void) +{ + Suite *s = suite_create ("registry"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + + tcase_add_test (tc_chain, test_registry_update); + + return s; +} + +GST_CHECK_MAIN (registry); diff --git a/tests/check/gst/gstsegment.c b/tests/check/gst/gstsegment.c new file mode 100644 index 0000000..ca78aa0 --- /dev/null +++ b/tests/check/gst/gstsegment.c @@ -0,0 +1,1793 @@ +/* GStreamer + * Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com> + * 2009 Wim Taymans <wim.taymans@gmail.com> + * + * gstsegment.c: Unit test for segments + * + * 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 <gst/check/gstcheck.h> + +/* mess with the segment structure in the bytes format */ +GST_START_TEST (segment_seek_nosize) +{ + GstSegment segment; + gboolean res; + guint64 cstart, cstop; + gboolean update; + + gst_segment_init (&segment, GST_FORMAT_BYTES); + + /* configure segment to start 100 */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_SET, 100, GST_SEEK_TYPE_NONE, -1, &update); + fail_unless (segment.start == 100); + fail_unless (segment.stop == -1); + fail_unless (update == TRUE); + + /* configure segment to stop relative, should not do anything since + * size is unknown. */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, 200, GST_SEEK_TYPE_CUR, -100, &update); + fail_unless (segment.start == 100); + fail_unless (segment.stop == -1); + fail_unless (update == FALSE); + + /* do some clipping on the open range */ + /* completely outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop); + fail_unless (res == FALSE); + + /* touching lower bound, still outside of the segment */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop); + fail_unless (res == FALSE); + + /* partially inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 150); + + /* inside, touching lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 100, 150, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 150); + + /* special case, 0 duration and outside segment */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 90, 90, &cstart, &cstop); + fail_unless (res == FALSE); + + /* special case, 0 duration and touching lower bound, i.e. inside segment */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 100, 100, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 100); + + /* special case, 0 duration and inside the segment */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 120, 120, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 120); + fail_unless (cstop == 120); + + /* completely inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 150, 200, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 150); + fail_unless (cstop == 200); + + /* invalid start */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop); + fail_unless (res == FALSE); + + /* start outside, we don't know the stop */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == -1); + + /* start on lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == -1); + + /* start inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 150); + fail_unless (cstop == -1); + + /* add 100 to start, set stop to 300 */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 300, &update); + fail_unless (segment.start == 200); + fail_unless (segment.stop == 300); + fail_unless (update == TRUE); + + update = FALSE; + /* add 100 to start (to 300), set stop to 200, this is not allowed. + * nothing should be updated in the segment. A g_warning is + * emited. */ + ASSERT_CRITICAL (gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 200, &update)); + fail_unless (segment.start == 200); + fail_unless (segment.stop == 300); + /* update didn't change */ + fail_unless (update == FALSE); + + update = TRUE; + /* seek relative to end, should not do anything since size is + * unknown. */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_END, -300, GST_SEEK_TYPE_END, -100, &update); + fail_unless (segment.start == 200); + fail_unless (segment.stop == 300); + fail_unless (update == FALSE); + + /* completely outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop); + fail_unless (res == FALSE); + + /* touching lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 200, &cstart, &cstop); + fail_unless (res == FALSE); + + /* partially inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 250, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 200); + fail_unless (cstop == 250); + + /* inside, touching lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 200, 250, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 200); + fail_unless (cstop == 250); + + /* completely inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 250, 290, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 250); + fail_unless (cstop == 290); + + /* partially inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 250, 350, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 250); + fail_unless (cstop == 300); + + /* invalid start */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop); + fail_unless (res == FALSE); + + /* start outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 200); + fail_unless (cstop == 300); + + /* start on lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 200, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 200); + fail_unless (cstop == 300); + + /* start inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 250, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 250); + fail_unless (cstop == 300); + + /* start outside on boundary */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 300, -1, &cstart, &cstop); + fail_unless (res == FALSE); + + /* start completely outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 350, -1, &cstart, &cstop); + fail_unless (res == FALSE); +} + +GST_END_TEST; + +/* mess with the segment structure in the bytes format */ +GST_START_TEST (segment_seek_size) +{ + GstSegment segment; + gboolean res; + guint64 cstart, cstop; + gboolean update; + + gst_segment_init (&segment, GST_FORMAT_BYTES); + segment.duration = 200; + + /* configure segment to start 100 */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_SET, 100, GST_SEEK_TYPE_NONE, -1, &update); + fail_unless (segment.start == 100); + fail_unless (segment.stop == -1); + fail_unless (update == TRUE); + + /* configure segment to stop relative, does not update stop + * since we did not set it before. */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, 200, GST_SEEK_TYPE_CUR, -100, &update); + fail_unless (segment.start == 100); + fail_unless (segment.stop == -1); + fail_unless (update == FALSE); + + /* do some clipping on the open range */ + /* completely outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop); + fail_unless (res == FALSE); + + /* touching lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop); + fail_unless (res == FALSE); + + /* partially inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 150); + + /* inside, touching lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 100, 150, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 150); + + /* completely inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 150, 200, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 150); + fail_unless (cstop == 200); + + /* partially inside, clip to size */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 150, 300, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 150); + fail_unless (cstop == 200); + + /* invalid start */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop); + fail_unless (res == FALSE); + + /* start outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == -1); + + /* start on lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == -1); + + /* start inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 150); + fail_unless (cstop == -1); + + /* add 100 to start, set stop to 300, stop clips to 200 */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 300, &update); + fail_unless (segment.start == 200); + fail_unless (segment.stop == 200); + + /* add 100 to start (to 300), set stop to 200, this clips start + * to duration */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 200, &update); + fail_unless (segment.start == 200); + fail_unless (segment.stop == 200); + fail_unless (update == FALSE); + + /* seek relative to end */ + gst_segment_do_seek (&segment, 1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_END, -100, GST_SEEK_TYPE_END, -20, &update); + fail_unless (segment.start == 100); + fail_unless (segment.stop == 180); + fail_unless (update == TRUE); + + /* completely outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop); + fail_unless (res == FALSE); + + /* touching lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop); + fail_unless (res == FALSE); + + /* partially inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 150); + + /* inside, touching lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 100, 150, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 150); + + /* completely inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 150, 170, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 150); + fail_unless (cstop == 170); + + /* partially inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, + 150, 250, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 150); + fail_unless (cstop == 180); + + /* invalid start */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop); + fail_unless (res == FALSE); + + /* start outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 180); + + /* start on lower bound */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 100); + fail_unless (cstop == 180); + + /* start inside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop); + fail_unless (res == TRUE); + fail_unless (cstart == 150); + fail_unless (cstop == 180); + + /* start outside on boundary */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 180, -1, &cstart, &cstop); + fail_unless (res == FALSE); + + /* start completely outside */ + res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 250, -1, &cstart, &cstop); + fail_unless (res == FALSE); +} + +GST_END_TEST; + +GST_START_TEST (segment_seek_reverse) +{ + GstSegment segment; + gboolean update; + + gst_segment_init (&segment, GST_FORMAT_BYTES); + segment.duration = 200; + + /* configure segment to stop 100 */ + gst_segment_do_seek (&segment, -1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, 100, &update); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 100); + fail_unless (segment.time == 0); + fail_unless (segment.position == 100); + fail_unless (update == TRUE); + + /* update */ + gst_segment_do_seek (&segment, -1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_SET, 10, GST_SEEK_TYPE_CUR, -20, &update); + fail_unless (segment.start == 10); + fail_unless (segment.stop == 80); + fail_unless (segment.time == 10); + fail_unless (segment.position == 80); + fail_unless (update == TRUE); + + gst_segment_do_seek (&segment, -1.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_SET, 20, GST_SEEK_TYPE_NONE, 0, &update); + fail_unless (segment.start == 20); + fail_unless (segment.stop == 80); + fail_unless (segment.time == 20); + fail_unless (segment.position == 80); + fail_unless (update == FALSE); +} + +GST_END_TEST; + +/* mess with the segment structure in the bytes format */ +GST_START_TEST (segment_seek_rate) +{ + GstSegment segment; + gboolean update; + + gst_segment_init (&segment, GST_FORMAT_BYTES); + + /* configure segment to rate 2.0 */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_NONE, -1, &update); + fail_unless (segment.format == GST_FORMAT_BYTES); + fail_unless (segment.start == 0); + fail_unless (segment.stop == -1); + fail_unless (segment.rate == 2.0); + fail_unless (update == FALSE); + +#if 0 + /* 0 is the same in all formats and should not fail */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, -1, &update); + fail_unless (segment.format == GST_FORMAT_BYTES); + + /* set to -1 means start from 0 */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_SET, -1, GST_SEEK_TYPE_NONE, -1, &update); + fail_unless (segment.format == GST_FORMAT_BYTES); + fail_unless (segment.start == 0); + + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_CUR, 0, GST_SEEK_TYPE_NONE, -1, &update); + + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_END, 0, GST_SEEK_TYPE_NONE, -1, &update); + + /* -1 for end is fine too in all formats */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_SET, -1, &update); + + /* 0 as relative end is fine too */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_CUR, 0, &update); + + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, 0, &update); +#endif + + /* set a real stop position, this must happen in bytes */ + gst_segment_do_seek (&segment, 3.0, + GST_FORMAT_BYTES, + GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_SET, 100, &update); + fail_unless (segment.format == GST_FORMAT_BYTES); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 100); + fail_unless (segment.rate == 3.0); + /* no seek should happen, we just updated the stop position in forward + * playback mode.*/ + fail_unless (update == FALSE); + +#if 0 + /* 0 as relative end is fine too */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_CUR, 0, &update); + fail_unless (segment.stop == 100); + + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, 0, &update); + fail_unless (segment.stop == 100); + + /* -1 for end is fine too in all formats */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_SET, -1, &update); + fail_unless (segment.stop == -1); +#endif + + /* set some duration, stop -1 END seeks will now work with the + * duration, if the formats match */ + segment.duration = 200; + fail_unless (segment.duration == 200); + + /* seek to end with 0 should set the stop to the duration */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, 0, &update); + fail_unless (segment.stop == 200); + fail_unless (segment.duration == 200); + + /* subtract 100 from the end */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, -100, &update); + fail_unless (segment.stop == 100); + fail_unless (segment.duration == 200); + + /* add 100 to the duration, this should be clamped to the duration */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, 100, &update); + fail_unless (segment.stop == 200); + fail_unless (segment.duration == 200); + + /* add 300 to the start, this should be clamped to the duration */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_CUR, 300, GST_SEEK_TYPE_END, 0, &update); + fail_unless (segment.start == 200); + fail_unless (segment.stop == 200); + fail_unless (segment.duration == 200); + + /* subtract 300 from the start, this should be clamped to 0 */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_CUR, -300, GST_SEEK_TYPE_END, 0, &update); + GST_DEBUG ("%" G_GINT64_FORMAT, segment.start); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.duration == 200); +} + +GST_END_TEST; + +#if 0 +/* mess with the segment structure in the bytes format */ +GST_START_TEST (segment_newsegment_open) +{ + GstSegment segment; + + gst_segment_init (&segment, GST_FORMAT_BYTES); + + /* time should also work for starting from 0 */ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, -1, + 0); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.format == GST_FORMAT_BYTES); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == -1); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* we set stop but in the wrong format, stop stays open. */ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, + 200, 0); + + fail_unless (segment.start == 0); + fail_unless (segment.stop == -1); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + + /* update, nothing changes */ + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 0, -1, + 0); + + fail_unless (segment.start == 0); + fail_unless (segment.stop == -1); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + + /* update */ + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, + GST_FORMAT_BYTES, 100, -1, 100); + + fail_unless (segment.start == 100); + fail_unless (segment.stop == -1); + fail_unless (segment.time == 100); + fail_unless (segment.base == 100); + fail_unless (segment.position == 100); + + /* last_stop 0, base does not change */ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_BYTES, 0, + -1, 0); + + fail_unless (segment.start == 0); + fail_unless (segment.stop == -1); + fail_unless (segment.time == 0); + fail_unless (segment.base == 100); + + gst_segment_set_last_stop (&segment, GST_FORMAT_BYTES, 200); + + fail_unless (segment.position == 200); + + /* last_stop 200, base changes */ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_BYTES, 0, + -1, 0); + + fail_unless (segment.start == 0); + fail_unless (segment.stop == -1); + fail_unless (segment.time == 0); + fail_unless (segment.base == 300); + fail_unless (segment.position == 0); +} + +GST_END_TEST; + + +/* mess with the segment structure in the bytes format */ +GST_START_TEST (segment_newsegment_closed) +{ + GstSegment segment; + + gst_segment_init (&segment, GST_FORMAT_BYTES); + + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, + GST_FORMAT_BYTES, 0, 200, 0); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.format == GST_FORMAT_BYTES); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* assume we advanced to position 40 */ + gst_segment_set_last_stop (&segment, GST_FORMAT_BYTES, 40); + fail_unless (segment.position == 40); + + /* do an update to the start, last_stop is unchanged because it's bigger */ + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 20, + 200, 20); + + fail_unless (segment.start == 20); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 20); + fail_unless (segment.base == 20); + fail_unless (segment.position == 40); + + /* do an update past our last_stop, it should be updated now */ + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 50, + 300, 50); + + fail_unless (segment.start == 50); + fail_unless (segment.stop == 300); + fail_unless (segment.time == 50); + fail_unless (segment.base == 50); + fail_unless (segment.position == 50); + + /* and a new accumulated one */ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, + GST_FORMAT_BYTES, 100, 400, 300); + + fail_unless (segment.start == 100); + fail_unless (segment.stop == 400); + fail_unless (segment.time == 300); + fail_unless (segment.base == 300); + + /* and a new updated one */ + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, + GST_FORMAT_BYTES, 100, 500, 300); + + fail_unless (segment.start == 100); + fail_unless (segment.stop == 500); + fail_unless (segment.time == 300); + fail_unless (segment.base == 300); + + /* and a new partially updated one */ + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, + GST_FORMAT_BYTES, 200, 500, 400); + + fail_unless (segment.start == 200); + fail_unless (segment.stop == 500); + fail_unless (segment.time == 400); + fail_unless (segment.base == 400); +} + +GST_END_TEST; + +/* mess with the segment structure in the time format */ +GST_START_TEST (segment_newsegment_streamtime) +{ + GstSegment segment; + guint64 result; + + gst_segment_init (&segment, GST_FORMAT_TIME); + + /*************************** + * Normal segment + ***************************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, + GST_FORMAT_TIME, 0, 200, 0); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 0); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 100); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 200); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /********************* + * time shifted by 500 + *********************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, + GST_FORMAT_TIME, 0, 200, 500); + + fail_unless (segment.base == 200); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 500); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 600); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 500); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /********************* + * time offset by 500 + *********************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, + GST_FORMAT_TIME, 500, 700, 0); + + fail_unless (segment.base == 400); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* before segment is invalid */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 400); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 500); + fail_unless (result == 0); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 600); + fail_unless (result == 100); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 700); + fail_unless (result == 200); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 800); + fail_unless (result == -1); + + /************************************* + * time offset by 500, shifted by 200 + *************************************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, + GST_FORMAT_TIME, 500, 700, 200); + + fail_unless (segment.base == 600); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* before segment is invalid */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 400); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 500); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 600); + fail_unless (result == 300); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 700); + fail_unless (result == 400); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 800); + fail_unless (result == -1); +} + +GST_END_TEST; + +/* mess with the segment structure in the time format */ +GST_START_TEST (segment_newsegment_streamtime_rate) +{ + GstSegment segment; + guint64 result; + + gst_segment_init (&segment, GST_FORMAT_TIME); + + /*************************** + * Normal segment rate 2.0 + ***************************/ + gst_segment_set_newsegment (&segment, FALSE, 2.0, 1.0, + GST_FORMAT_TIME, 0, 200, 0); + + fail_unless (segment.rate == 2.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 0); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 100); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 150); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 200); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /*************************************** + * Normal segment rate 2.0, offset + ***************************************/ + gst_segment_set_newsegment (&segment, FALSE, 2.0, 1.0, + GST_FORMAT_TIME, 100, 300, 0); + + fail_unless (segment.base == 100); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 0); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 100); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 250); + fail_unless (result == 150); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == 200); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 400); + fail_unless (result == -1); + + /*************************************** + * Normal segment rate -1.0, offset + ***************************************/ + + /* buffers will arrive from 300 to 100 in a sink, stream time + * calculation is unaffected by the rate */ + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, + GST_FORMAT_TIME, 100, 300, 0); + + fail_unless (segment.base == 200); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 0); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 100); + + /*********************************************** + * Normal segment rate -1.0, offset, time = 200 + ***********************************************/ + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, + GST_FORMAT_TIME, 100, 300, 200); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 300); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == 400); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 400); + fail_unless (result == -1); +} + +GST_END_TEST; + +/* mess with the segment structure in the time format */ +GST_START_TEST (segment_newsegment_streamtime_applied_rate) +{ + GstSegment segment; + guint64 result; + + gst_segment_init (&segment, GST_FORMAT_TIME); + + /*********************************************************** + * Normal segment rate 1.0, applied rate -1.0 + * This means the timestamps represents a stream going backwards + * starting from @time to 0. + ************************************************************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, -1.0, + GST_FORMAT_TIME, 0, 200, 200); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.applied_rate == -1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 200); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* we count backwards from 200 */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 100); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 50); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 0); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /*********************************************************** + * Normal segment rate 1.0, applied rate 2.0 + * This means the timestamps represents a stream at twice the + * normal rate + ************************************************************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 2.0, + GST_FORMAT_TIME, 0, 200, 0); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.applied_rate == 2.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 200); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 0); + + /* the stream prepresents a stream going twice as fast, the position + * in the segment is therefore scaled by the applied rate */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 300); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 400); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /*********************************************************** + * Normal segment rate 1.0, applied rate -2.0 + * This means the timestamps represents a stream at twice the + * reverse rate + ************************************************************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, -2.0, + GST_FORMAT_TIME, 0, 200, 400); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.applied_rate == -2.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 400); + /* previous segment lasted 200, rate of 2.0 was already applied */ + fail_unless (segment.base == 400); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* we count backwards from 400 */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 400); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 100); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 0); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /*********************************************************** + * Normal segment rate 1.0, applied rate -2.0 + * This means the timestamps represents a stream at twice the + * reverse rate, start time cannot compensate the complete + * duration of the segment so we stop at 0 + ************************************************************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, -2.0, + GST_FORMAT_TIME, 0, 200, 200); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.applied_rate == -2.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 200); + fail_unless (segment.base == 600); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* we count backwards from 200 */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 0); + + /* clamp at 0 */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 0); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 0); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); +} + +GST_END_TEST; + +/* mess with the segment structure in the time format */ +GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) +{ + GstSegment segment; + guint64 result; + + gst_segment_init (&segment, GST_FORMAT_TIME); + + /*********************************************************** + * Segment rate 2.0, applied rate 2.0 + * this means we have a double speed stream that we should + * speed up by a factor of 2.0 some more. the resulting + * stream will be played at four times the speed. + ************************************************************/ + gst_segment_set_newsegment (&segment, FALSE, 2.0, 2.0, + GST_FORMAT_TIME, 0, 200, 0); + + fail_unless (segment.rate == 2.0); + fail_unless (segment.applied_rate == 2.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* only applied rate affects our calculation of the stream time */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 0); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 300); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 400); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /*********************************************************** + * Segment rate 2.0, applied rate -1.0 + * this means we have a reverse stream that we should + * speed up by a factor of 2.0 + ************************************************************/ + gst_segment_set_newsegment (&segment, FALSE, 2.0, -1.0, + GST_FORMAT_TIME, 0, 200, 200); + + fail_unless (segment.rate == 2.0); + fail_unless (segment.applied_rate == -1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 200); + /* previous segment lasted 100 */ + fail_unless (segment.base == 100); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* only applied rate affects our calculation of the stream time */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 100); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 50); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 0); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /*********************************************************** + * Segment rate -1.0, applied rate -1.0 + * this means we have a reverse stream that we should + * reverse to get the normal stream again. + ************************************************************/ + gst_segment_set_newsegment (&segment, FALSE, -1.0, -1.0, + GST_FORMAT_TIME, 0, 200, 200); + + fail_unless (segment.rate == -1.0); + fail_unless (segment.applied_rate == -1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 200); + /* accumulated 100 of previous segment to make 200 */ + fail_unless (segment.base == 200); + fail_unless (segment.position == 200); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* only applied rate affects our calculation of the stream time */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 100); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 50); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 0); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /*********************************************************** + * Segment rate -1.0, applied rate -1.0 + * this means we have a reverse stream that we should + * reverse to get the normal stream again. + ************************************************************/ + gst_segment_set_newsegment (&segment, FALSE, -1.0, 2.0, + GST_FORMAT_TIME, 0, 200, 0); + + fail_unless (segment.rate == -1.0); + fail_unless (segment.applied_rate == 2.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 400); + fail_unless (segment.position == 200); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* only applied rate affects our calculation of the stream time */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 0); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 200); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 300); + + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 400); + + /* outside of the segment */ + result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); +} + +GST_END_TEST; + +/* mess with the segment structure in the time format */ +GST_START_TEST (segment_newsegment_runningtime) +{ + GstSegment segment; + guint64 result; + + gst_segment_init (&segment, GST_FORMAT_TIME); + + /*************************** + * Normal segment + ***************************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, + GST_FORMAT_TIME, 0, 200, 0); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 0); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 0); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 100); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 100); + + /* at edge is exactly the segment duration */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 200); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 200); + + /* outside of the segment */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 300); + fail_unless (result == -1); + + /*********************************************************** + * time shifted by 500, check if accumulation worked. + * Rate convert to twice the speed which means scaling down + * all positions by 2.0 in this segment. + * Then time argument is not used at all here. + ***********************************************************/ + gst_segment_set_newsegment (&segment, FALSE, 2.0, 1.0, + GST_FORMAT_TIME, 0, 200, 500); + + /* normal speed gives elapsed of 200 */ + fail_unless (segment.base == 200); + + /* invalid time gives invalid result */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 0); + fail_unless (result == 200); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 0); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 250); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 100); + + /* outside of the segment */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 500); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 310); + fail_unless (result == -1); + + /******************************************** + * time offset by 500 + * applied rate is not used for running time + ********************************************/ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 2.0, + GST_FORMAT_TIME, 500, 700, 0); + + /* previous segment played at double speed gives elapsed time of + * 100 added to previous accum of 200 gives 300. */ + fail_unless (segment.base == 300); + + /* invalid time gives invalid result */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* before segment is invalid */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 400); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 500); + fail_unless (result == 300); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 500); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 600); + fail_unless (result == 400); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 600); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 700); + fail_unless (result == 500); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 700); + + /* outside of the segment */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 800); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 600); + fail_unless (result == -1); + + /********************************************************** + * time offset by 500, shifted by 200 + * Negative rate makes the running time go backwards + * relative to the segment stop position. again time + * is ignored. + **********************************************************/ + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, + GST_FORMAT_TIME, 500, 700, 200); + + fail_unless (segment.base == 500); + + /* invalid time gives invalid result */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* before segment is invalid */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 400); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 400); + fail_unless (result == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 500); + fail_unless (result == 700); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 500); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 600); + fail_unless (result == 600); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 600); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 700); + fail_unless (result == 500); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 700); + + /* outside of the segment */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 800); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 800); + fail_unless (result == -1); + + /********************************************************** + * time offset by 500, shifted by 200 + * Negative rate makes the running time go backwards at + * twice speed relative to the segment stop position. again + * time is ignored. + **********************************************************/ + gst_segment_set_newsegment (&segment, FALSE, -2.0, -2.0, + GST_FORMAT_TIME, 500, 700, 200); + + fail_unless (segment.base == 700); + + /* invalid time gives invalid result */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + /* before segment is invalid */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 400); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 600); + fail_unless (result == -1); + + /* total scaled segment time is 100, accum is 700, so we get 800 */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 500); + fail_unless (result == 800); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 500); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 600); + fail_unless (result == 750); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 600); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 700); + fail_unless (result == 700); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 700); + + /* outside of the segment */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 800); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 900); + fail_unless (result == -1); + + /* see if negative rate closed segment correctly */ + gst_segment_set_newsegment (&segment, FALSE, -2.0, -1.0, + GST_FORMAT_TIME, 500, 700, 200); + + /* previous segment lasted 100, and was at 700 so we should get 800 */ + fail_unless (segment.base == 800); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 800); + fail_unless (result == 700); +} + +GST_END_TEST; + +/* mess with the segment structure in the time format */ +GST_START_TEST (segment_newsegment_accum) +{ + GstSegment segment; + guint64 result; + + gst_segment_init (&segment, GST_FORMAT_TIME); + + /*************************** + * Normal reverse segment + ***************************/ + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, + GST_FORMAT_TIME, 0, 200, 0); + + fail_unless (segment.rate == -1.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 200); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 0); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 200); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 50); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 150); + + /* update segment, this accumulates 50 from the previous segment. */ + gst_segment_set_newsegment (&segment, TRUE, -2.0, 1.0, + GST_FORMAT_TIME, 0, 150, 0); + + fail_unless (segment.rate == -2.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 150); + fail_unless (segment.time == 0); + fail_unless (segment.base == 50); + fail_unless (segment.position == 150); + fail_unless (segment.duration == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 50); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 150); + + /* 50 accumulated + 50 / 2 */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 75); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 100); + + /* update segment, this does not accumulate anything. */ + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, + GST_FORMAT_TIME, 100, 200, 100); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 100); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 100); + fail_unless (segment.base == 50); + fail_unless (segment.position == 150); + fail_unless (segment.duration == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 100); + fail_unless (result == 50); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 100); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 100); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 150); +} + +GST_END_TEST; + +/* mess with the segment structure in the time format */ +GST_START_TEST (segment_newsegment_accum2) +{ + GstSegment segment; + guint64 result; + + gst_segment_init (&segment, GST_FORMAT_TIME); + + /*************************** + * Normal reverse segment + ***************************/ + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, + GST_FORMAT_TIME, 0, 200, 0); + + fail_unless (segment.rate == -1.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 0); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 200); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 0); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 200); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 50); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 150); + + /* close segment, this accumulates nothing. */ + gst_segment_set_newsegment (&segment, TRUE, -1.0, 1.0, + GST_FORMAT_TIME, 150, 200, 0); + + fail_unless (segment.rate == -1.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 150); + fail_unless (segment.stop == 200); + fail_unless (segment.time == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 200); + fail_unless (segment.duration == -1); + + /* new segment, this accumulates 50. */ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, + GST_FORMAT_TIME, 150, 300, 150); + + fail_unless (segment.rate == 1.0); + fail_unless (segment.applied_rate == 1.0); + fail_unless (segment.format == GST_FORMAT_TIME); + fail_unless (segment.flags == 0); + fail_unless (segment.start == 150); + fail_unless (segment.stop == 300); + fail_unless (segment.time == 150); + fail_unless (segment.base == 50); + fail_unless (segment.position == 150); + fail_unless (segment.duration == -1); + + /* invalid time gives invalid result */ + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); + fail_unless (result == -1); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 150); + fail_unless (result == 50); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 150); + + result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 200); + fail_unless (result == 100); + result = gst_segment_to_position (&segment, GST_FORMAT_TIME, result); + fail_unless (result == 200); +} + +GST_END_TEST; +#endif + +GST_START_TEST (segment_copy) +{ + GstSegment *copy; + GstSegment segment = { 0.0, }; + + /* this is a boxed type copy function, we support copying NULL */ + fail_unless (gst_segment_copy (NULL) == NULL); + + gst_segment_init (&segment, GST_FORMAT_TIME); + + segment.rate = -1.0; + segment.applied_rate = 1.0; + segment.start = 0; + segment.stop = 200; + segment.time = 0; + + copy = gst_segment_copy (&segment); + fail_unless (copy != NULL); + /* we inited the struct on the stack to zeroes, so direct comparison should + * be ok here despite the padding field and regardless of implementation */ + fail_unless (memcmp (copy, &segment, sizeof (GstSegment)) == 0); + gst_segment_free (copy); +} + +GST_END_TEST; + +static Suite * +gst_segment_suite (void) +{ + Suite *s = suite_create ("GstSegment"); + TCase *tc_chain = tcase_create ("segments"); + + tcase_set_timeout (tc_chain, 20); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, segment_seek_nosize); + tcase_add_test (tc_chain, segment_seek_size); + tcase_add_test (tc_chain, segment_seek_reverse); + tcase_add_test (tc_chain, segment_seek_rate); +#if 0 + tcase_add_test (tc_chain, segment_newsegment_open); + tcase_add_test (tc_chain, segment_newsegment_closed); + tcase_add_test (tc_chain, segment_newsegment_streamtime); + tcase_add_test (tc_chain, segment_newsegment_streamtime_rate); + tcase_add_test (tc_chain, segment_newsegment_streamtime_applied_rate); + tcase_add_test (tc_chain, segment_newsegment_streamtime_applied_rate_rate); + tcase_add_test (tc_chain, segment_newsegment_runningtime); + tcase_add_test (tc_chain, segment_newsegment_accum); + tcase_add_test (tc_chain, segment_newsegment_accum2); +#endif + tcase_add_test (tc_chain, segment_copy); + + return s; +} + +GST_CHECK_MAIN (gst_segment); diff --git a/tests/check/gst/gststructure.c b/tests/check/gst/gststructure.c new file mode 100644 index 0000000..4608ec8 --- /dev/null +++ b/tests/check/gst/gststructure.c @@ -0,0 +1,613 @@ +/* GStreamer + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * + * gststructure.c: Unit tests for GstStructure + * + * 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 <gst/gststructure.h> +#include <gst/check/gstcheck.h> + + +GST_START_TEST (test_from_string_int) +{ + const char *strings[] = { + "video/x-raw-rgb, width = (int) 123456", + "video/x-raw-rgb, stride = (int) -123456", + "video/x-raw-rgb, red_mask = (int) 0xFFFF", + "video/x-raw-rgb, red_mask = (int) 0x0000FFFF", + "video/x-raw-rgb, red_mask = (int) 0x7FFFFFFF", + "video/x-raw-rgb, red_mask = (int) 0x80000000", + "video/x-raw-rgb, red_mask = (int) 0xFF000000", + /* result from + * gst-launch ... ! "video/x-raw-rgb, red_mask=(int)0xFF000000" ! ... */ + "video/x-raw-rgb,\\ red_mask=(int)0xFF000000", + }; + gint results[] = { + 123456, + -123456, + 0xFFFF, + 0xFFFF, + 0x7FFFFFFF, + (gint) 0x80000000, + (gint) 0xFF000000, + (gint) 0xFF000000, + }; + GstStructure *structure; + int i; + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + const char *s; + const gchar *name; + gint value; + + s = strings[i]; + + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + name = gst_structure_nth_field_name (structure, 0); + fail_unless (gst_structure_get_int (structure, name, &value)); + fail_unless (value == results[i], + "Value %d is not the expected result %d for string %s", + value, results[i], s); + + /* cleanup */ + gst_structure_free (structure); + } +} + +GST_END_TEST; + +GST_START_TEST (test_from_string_uint) +{ + const char *strings[] = { + "taglist, bar = (uint) 123456", + "taglist, bar = (uint) 0xFFFF", + "taglist, bar = (uint) 0x0000FFFF", + "taglist, bar = (uint) 0x7FFFFFFF", + "taglist, bar = (uint) 0x80000000", + "taglist, bar = (uint) 0xFF000000" + }; + guint results[] = { + 123456, + 0xFFFF, + 0xFFFF, + 0x7FFFFFFF, + 0x80000000, + 0xFF000000, + }; + GstStructure *structure; + int i; + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + const char *s; + const gchar *name; + guint value; + + s = strings[i]; + + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + name = gst_structure_nth_field_name (structure, 0); + fail_unless (gst_structure_get_uint (structure, name, &value)); + fail_unless (value == results[i], + "Value %u is not the expected result %u for string %s", + value, results[i], s); + + /* cleanup */ + gst_structure_free (structure); + } +} + +GST_END_TEST; + +/* Test type conversions from string */ +GST_START_TEST (test_from_string) +{ + GstStructure *structure; + const gchar *s; + const GValue *val; + + s = "test-string,value=1"; + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); + fail_unless (G_VALUE_HOLDS_INT (val)); + gst_structure_free (structure); + + s = "test-string,value=1.0"; + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); + fail_unless (G_VALUE_HOLDS_DOUBLE (val)); + gst_structure_free (structure); + + s = "test-string,value=1/1"; + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); + fail_unless (GST_VALUE_HOLDS_FRACTION (val)); + gst_structure_free (structure); + + s = "test-string,value=bar"; + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); + fail_unless (G_VALUE_HOLDS_STRING (val)); + gst_structure_free (structure); + + s = "test-string,value=true"; + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); + fail_unless (G_VALUE_HOLDS_BOOLEAN (val)); + fail_unless_equals_int (g_value_get_boolean (val), TRUE); + gst_structure_free (structure); + + s = "0.10:decoder-video/mpeg, abc=(boolean)false"; + ASSERT_CRITICAL (structure = gst_structure_from_string (s, NULL)); + fail_unless (structure == NULL, "Could not get structure from string %s", s); + + /* make sure we bail out correctly in case of an error or if parsing fails */ + s = "***foo***, abc=(boolean)false"; + structure = gst_structure_from_string (s, NULL); + fail_unless (structure == NULL); + + /* assert that we get a warning if the structure wasn't entirely consumed, but + * we didn't provide an end pointer */ + s = "foo/bar; other random data"; + ASSERT_WARNING (structure = gst_structure_from_string (s, NULL)); + fail_if (structure == NULL, "Could not get structure from string %s", s); + gst_structure_free (structure); +} + +GST_END_TEST; + + +GST_START_TEST (test_to_string) +{ + GstStructure *st1; + + ASSERT_CRITICAL (st1 = gst_structure_new ("Foo\nwith-newline", NULL)); + fail_unless (st1 == NULL); + + ASSERT_CRITICAL (st1 = gst_structure_new ("Foo with whitespace", NULL)); + fail_unless (st1 == NULL); + ASSERT_CRITICAL (st1 = gst_structure_new ("1st", NULL)); + fail_unless (st1 == NULL); +} + +GST_END_TEST; + + +GST_START_TEST (test_to_from_string) +{ + GstCaps *caps1, *caps2; + GstStructure *st1, *st2; + gchar *str, *res1, *res2; + + /* test escaping/unescaping */ + st1 = gst_structure_new ("FooBar-123/0_1", "num", G_TYPE_INT, 9173, + "string", G_TYPE_STRING, "Something Like Face/Off", NULL); + str = gst_structure_to_string (st1); + st2 = gst_structure_from_string (str, NULL); + g_free (str); + + fail_unless (st2 != NULL); + + /* need to put stuctures into caps to compare */ + caps1 = gst_caps_new_empty (); + gst_caps_append_structure (caps1, st1); + caps2 = gst_caps_new_empty (); + gst_caps_append_structure (caps2, st2); + res1 = gst_caps_to_string (caps1); + res2 = gst_caps_to_string (caps2); + fail_unless (gst_caps_is_equal (caps1, caps2), + "Structures did not match:\n\tStructure 1: %s\n\tStructure 2: %s\n", + res1, res2); + gst_caps_unref (caps1); + gst_caps_unref (caps2); + g_free (res1); + g_free (res2); +} + +GST_END_TEST; + +GST_START_TEST (test_complete_structure) +{ + GstStructure *structure; + const gchar *s; + + s = "GstEventSeek, rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAGS_NONE, cur_type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop_type=(GstSeekType)GST_SEEK_TYPE_NONE, stop=(gint64)0"; + structure = gst_structure_from_string (s, NULL); + fail_if (structure == NULL, "Could not get structure from string %s", s); + /* FIXME: TODO: add checks for correct serialization of members ? */ + gst_structure_free (structure); +} + +GST_END_TEST; + +GST_START_TEST (test_string_properties) +{ + GstCaps *caps1, *caps2; + GstStructure *st1, *st2; + gchar *str, *res1, *res2; + + /* test escaping/unescaping */ + st1 = gst_structure_new ("RandomStructure", "prop1", G_TYPE_STRING, "foo", + "prop2", G_TYPE_STRING, "", "prop3", G_TYPE_STRING, NULL, + "prop4", G_TYPE_STRING, "NULL", NULL); + str = gst_structure_to_string (st1); + st2 = gst_structure_from_string (str, NULL); + g_free (str); + + fail_unless (st2 != NULL); + + /* need to put stuctures into caps to compare */ + caps1 = gst_caps_new_empty (); + gst_caps_append_structure (caps1, st1); + caps2 = gst_caps_new_empty (); + gst_caps_append_structure (caps2, st2); + res1 = gst_caps_to_string (caps1); + res2 = gst_caps_to_string (caps2); + fail_unless (gst_caps_is_equal (caps1, caps2), + "Structures did not match:\n\tStructure 1: %s\n\tStructure 2: %s\n", + res1, res2); + gst_caps_unref (caps1); + gst_caps_unref (caps2); + g_free (res1); + g_free (res2); +} + +GST_END_TEST; + +GST_START_TEST (test_structure_new) +{ + GstStructure *s; + GError *e; + GQuark domain; + gboolean bool; + gint num, den; + GstClockTime clocktime; + + s = gst_structure_new ("name", + "key", G_TYPE_STRING, "value", + "bool", G_TYPE_BOOLEAN, TRUE, + "fraction", GST_TYPE_FRACTION, 1, 5, + "clocktime", GST_TYPE_CLOCK_TIME, GST_CLOCK_TIME_NONE, NULL); + + fail_unless (gst_structure_get_field_type (s, "unknown") == G_TYPE_INVALID); + /* test setting a different name */ + gst_structure_set_name (s, "newname"); + fail_unless (strcmp (gst_structure_get_string (s, "key"), "value") == 0); + fail_unless (gst_structure_has_field (s, "key")); + fail_unless_equals_int (gst_structure_n_fields (s), 4); + /* test removing a field */ + gst_structure_remove_field (s, "key"); + fail_if (gst_structure_get_string (s, "key")); + fail_if (gst_structure_has_field (s, "key")); + fail_unless_equals_int (gst_structure_n_fields (s), 3); + + fail_unless (gst_structure_get_boolean (s, "bool", &bool)); + fail_unless (bool); + + fail_unless (gst_structure_get_fraction (s, "fraction", &num, &den)); + fail_unless_equals_int (num, 1); + fail_unless_equals_int (den, 5); + + fail_unless (gst_structure_get_clock_time (s, "clocktime", &clocktime)); + fail_unless_equals_uint64 (clocktime, GST_CLOCK_TIME_NONE); + + gst_structure_free (s); + + domain = g_quark_from_static_string ("test"); + e = g_error_new (domain, 0, "a test error"); + s = gst_structure_new ("name", "key", GST_TYPE_G_ERROR, e, NULL); + g_error_free (e); + gst_structure_free (s); + + ASSERT_CRITICAL (gst_structure_free (gst_structure_new + ("0.10:decoder-video/mpeg", NULL))); + + /* make sure we bail out correctly in case of an error or if parsing fails */ + ASSERT_CRITICAL (s = gst_structure_new ("^joo\nba\ndoo^", + "abc", G_TYPE_BOOLEAN, FALSE, NULL)); + fail_unless (s == NULL); +} + +GST_END_TEST; + +GST_START_TEST (test_fixate) +{ + GstStructure *s; + + s = gst_structure_new ("name", + "int", G_TYPE_INT, 5, + "intrange", GST_TYPE_INT_RANGE, 5, 10, + "intrange2", GST_TYPE_INT_RANGE, 5, 10, NULL); + + fail_if (gst_structure_fixate_field_nearest_int (s, "int", 5)); + fail_unless (gst_structure_fixate_field_nearest_int (s, "intrange", 5)); + fail_if (gst_structure_fixate_field_nearest_int (s, "intrange", 5)); + fail_unless (gst_structure_fixate_field_nearest_int (s, "intrange2", 15)); + fail_if (gst_structure_fixate_field_nearest_int (s, "intrange2", 15)); + gst_structure_free (s); +} + +GST_END_TEST; + +GST_START_TEST (test_fixate_frac_list) +{ + GstStructure *s, *s2; + GValue list = { 0 }; + GValue frac = { 0 }; + gchar *str; + gint num, denom; + + g_value_init (&list, GST_TYPE_LIST); + g_value_init (&frac, GST_TYPE_FRACTION); + + gst_value_set_fraction (&frac, 30, 1); + gst_value_list_append_value (&list, &frac); + gst_value_set_fraction (&frac, 15, 1); + gst_value_list_append_value (&list, &frac); + gst_value_set_fraction (&frac, 10, 1); + gst_value_list_append_value (&list, &frac); + + s = gst_structure_new ("name", NULL); + gst_structure_set_value (s, "frac", &list); + g_value_unset (&frac); + g_value_unset (&list); + + str = gst_structure_to_string (s); + GST_DEBUG ("list %s", str); + g_free (str); + + /* take copy */ + s2 = gst_structure_copy (s); + + /* fixate to the nearest fraction, this should give 15/1 */ + fail_unless (gst_structure_fixate_field_nearest_fraction (s, "frac", 14, 1)); + + fail_unless (gst_structure_get_fraction (s, "frac", &num, &denom)); + fail_unless (num == 15); + fail_unless (denom == 1); + + gst_structure_free (s); + s = s2; + + /* fixate to the nearest fraction, this should give 30/1 */ + fail_unless (gst_structure_fixate_field_nearest_fraction (s, "frac", G_MAXINT, + 1)); + + fail_unless (gst_structure_get_fraction (s, "frac", &num, &denom)); + fail_unless (num == 30); + fail_unless (denom == 1); + gst_structure_free (s); +} + +GST_END_TEST; + +GST_START_TEST (test_structure_nested) +{ + GstStructure *sp, *sc1, *sc2; + gchar *str; + + sc1 = gst_structure_new ("Camera", + "XResolution", G_TYPE_INT, 72, "YResolution", G_TYPE_INT, 73, NULL); + fail_unless (sc1 != NULL); + + sc2 = gst_structure_new ("Image-Data", + "Orientation", G_TYPE_STRING, "top-left", + "Comment", G_TYPE_STRING, "super photo", NULL); + fail_unless (sc2 != NULL); + + sp = gst_structure_new ("Exif", "Camera", GST_TYPE_STRUCTURE, sc1, + "Image Data", GST_TYPE_STRUCTURE, sc2, NULL); + fail_unless (sp != NULL); + + fail_unless (gst_structure_n_fields (sp) == 2); + + fail_unless (gst_structure_has_field_typed (sp, "Camera", + GST_TYPE_STRUCTURE)); + + str = gst_structure_to_string (sp); + fail_unless (str != NULL); + + GST_DEBUG ("serialized to '%s'", str); + + fail_unless (g_str_equal (str, + "Exif" + ", Camera=(structure)\"Camera\\,\\ XResolution\\=\\(int\\)72\\,\\ YResolution\\=\\(int\\)73\\;\"" + ", Image Data=(structure)\"Image-Data\\,\\ Orientation\\=\\(string\\)top-left\\,\\ Comment\\=\\(string\\)\\\"super\\\\\\ photo\\\"\\;\";")); + + g_free (str); + str = NULL; + + gst_structure_free (sc1); + gst_structure_free (sc2); + gst_structure_free (sp); +} + +GST_END_TEST; + +GST_START_TEST (test_structure_nested_from_and_to_string) +{ + GstStructure *s; + const gchar *str1; + gchar *str2, *end = NULL; + + str1 = "main" + ", main-sub1=(structure)\"type-b\\,\\ machine-type\\=\\(int\\)0\\;\"" + ", main-sub2=(structure)\"type-a\\,\\ plugin-filename\\=\\(string\\)\\\"/home/user/lib/lib\\\\\\ with\\\\\\ spaces.dll\\\"\\,\\ machine-type\\=\\(int\\)1\\;\"" + ", main-sub3=(structure)\"type-b\\,\\ plugin-filename\\=\\(string\\)/home/user/lib/lib_no_spaces.so\\,\\ machine-type\\=\\(int\\)1\\;\"" + ";"; + + s = gst_structure_from_string (str1, &end); + fail_unless (s != NULL); + + GST_DEBUG ("not parsed part : %s", end); + fail_unless (*end == '\0'); + + fail_unless (gst_structure_n_fields (s) == 3); + + fail_unless (gst_structure_has_field_typed (s, "main-sub1", + GST_TYPE_STRUCTURE)); + + str2 = gst_structure_to_string (s); + fail_unless (str2 != NULL); + + fail_unless (g_str_equal (str1, str2)); + + g_free (str2); + + gst_structure_free (s); +} + +GST_END_TEST; + +GST_START_TEST (test_vararg_getters) +{ + GstStructure *s; + GstBuffer *buf, *buf2; + gboolean ret; + GstCaps *caps, *caps2; + gdouble d; + gint64 i64; + gchar *c; + gint i, num, denom; + guint8 *data; + + buf = gst_buffer_new_and_alloc (3); + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + data[0] = 0xf0; + data[1] = 0x66; + data[2] = 0x0d; + gst_buffer_unmap (buf, data, 3); + + caps = gst_caps_new_simple ("video/x-foo", NULL); + + s = gst_structure_new ("test", "int", G_TYPE_INT, 12345678, "string", + G_TYPE_STRING, "Hello World!", "buf", GST_TYPE_BUFFER, buf, "caps", + GST_TYPE_CAPS, caps, "int64", G_TYPE_INT64, G_GINT64_CONSTANT (-99), + "double", G_TYPE_DOUBLE, G_MAXDOUBLE, "frag", GST_TYPE_FRACTION, 39, 14, + NULL); + + /* first the plain one */ + ret = gst_structure_get (s, "double", G_TYPE_DOUBLE, &d, "string", + G_TYPE_STRING, &c, "caps", GST_TYPE_CAPS, &caps2, "buf", + GST_TYPE_BUFFER, &buf2, "frag", GST_TYPE_FRACTION, &num, &denom, "int", + G_TYPE_INT, &i, "int64", G_TYPE_INT64, &i64, NULL); + + fail_unless (ret); + fail_unless_equals_string (c, "Hello World!"); + fail_unless_equals_int (i, 12345678); + fail_unless_equals_float (d, G_MAXDOUBLE); + fail_unless_equals_int (num, 39); + fail_unless_equals_int (denom, 14); + fail_unless (i64 == -99); + fail_unless (caps == caps2); + fail_unless (buf == buf2); + + /* expected failures */ + ASSERT_CRITICAL (gst_structure_get (s, NULL, G_TYPE_INT, &i, NULL)); + fail_if (gst_structure_get (s, "int", G_TYPE_INT, &i, "double", + G_TYPE_FLOAT, &d, NULL)); + fail_if (gst_structure_get (s, "int", G_TYPE_INT, &i, "dooble", + G_TYPE_DOUBLE, &d, NULL)); + + g_free (c); + c = NULL; + gst_caps_unref (caps2); + caps2 = NULL; + gst_buffer_unref (buf2); + buf2 = NULL; + + /* and now the _id variant */ + ret = gst_structure_id_get (s, g_quark_from_static_string ("double"), + G_TYPE_DOUBLE, &d, g_quark_from_static_string ("string"), G_TYPE_STRING, + &c, g_quark_from_static_string ("caps"), GST_TYPE_CAPS, &caps2, + g_quark_from_static_string ("buf"), GST_TYPE_BUFFER, &buf2, + g_quark_from_static_string ("int"), G_TYPE_INT, &i, + g_quark_from_static_string ("int64"), G_TYPE_INT64, &i64, NULL); + + fail_unless (ret); + fail_unless_equals_string (c, "Hello World!"); + fail_unless_equals_int (i, 12345678); + fail_unless_equals_float (d, G_MAXDOUBLE); + fail_unless (i64 == -99); + fail_unless (caps == caps2); + fail_unless (buf == buf2); + + /* expected failures */ + ASSERT_CRITICAL (gst_structure_get (s, 0, G_TYPE_INT, &i, NULL)); + fail_if (gst_structure_id_get (s, g_quark_from_static_string ("int"), + G_TYPE_INT, &i, g_quark_from_static_string ("double"), G_TYPE_FLOAT, + &d, NULL)); + fail_if (gst_structure_id_get (s, g_quark_from_static_string ("int"), + G_TYPE_INT, &i, g_quark_from_static_string ("dooble"), G_TYPE_DOUBLE, + &d, NULL)); + + g_free (c); + gst_caps_unref (caps2); + gst_buffer_unref (buf2); + + /* finally make sure NULL as return location is handled gracefully */ + ret = gst_structure_get (s, "double", G_TYPE_DOUBLE, NULL, "string", + G_TYPE_STRING, NULL, "caps", GST_TYPE_CAPS, NULL, "buf", + GST_TYPE_BUFFER, NULL, "int", G_TYPE_INT, &i, "frag", GST_TYPE_FRACTION, + NULL, NULL, "int64", G_TYPE_INT64, &i64, NULL); + + ASSERT_WARNING (gst_structure_get (s, "frag", GST_TYPE_FRACTION, NULL, + &denom, NULL)); + ASSERT_WARNING (gst_structure_get (s, "frag", GST_TYPE_FRACTION, &num, + NULL, NULL)); + + /* clean up */ + gst_caps_unref (caps); + gst_buffer_unref (buf); + gst_structure_free (s); +} + +GST_END_TEST; + +static Suite * +gst_structure_suite (void) +{ + Suite *s = suite_create ("GstStructure"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_from_string_int); + tcase_add_test (tc_chain, test_from_string_uint); + tcase_add_test (tc_chain, test_from_string); + tcase_add_test (tc_chain, test_to_string); + tcase_add_test (tc_chain, test_to_from_string); + tcase_add_test (tc_chain, test_string_properties); + tcase_add_test (tc_chain, test_complete_structure); + tcase_add_test (tc_chain, test_structure_new); + tcase_add_test (tc_chain, test_fixate); + tcase_add_test (tc_chain, test_fixate_frac_list); + tcase_add_test (tc_chain, test_structure_nested); + tcase_add_test (tc_chain, test_structure_nested_from_and_to_string); + tcase_add_test (tc_chain, test_vararg_getters); + return s; +} + +GST_CHECK_MAIN (gst_structure); diff --git a/tests/check/gst/gstsystemclock.c b/tests/check/gst/gstsystemclock.c new file mode 100644 index 0000000..2207667 --- /dev/null +++ b/tests/check/gst/gstsystemclock.c @@ -0,0 +1,668 @@ +/* GStreamer + * Copyright (C) 2005 Wim Taymans <wim@fluendo.com> + * + * gstsystemclock.c: Unit test for GstSystemClock + * + * 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 <gst/check/gstcheck.h> + +static GMutex *af_lock; +static GCond *af_cond; + +/* see if the defines make sense */ +GST_START_TEST (test_range) +{ + GstClockTime time, time2; + + time = GST_SECOND; + fail_unless (time == G_GUINT64_CONSTANT (1000000000)); + + time2 = time / 1000; + fail_unless (time2 == 1000000); + fail_unless (time2 == GST_MSECOND); + fail_unless (time2 == GST_TIME_AS_USECONDS (time)); + + time2 = time / 1000000; + fail_unless (time2 == 1000); + fail_unless (time2 == GST_USECOND); + fail_unless (time2 == GST_TIME_AS_MSECONDS (time)); +} + +GST_END_TEST; + +GST_START_TEST (test_signedness) +{ + GstClockTime time[] = { 0, 1, G_MAXUINT64 / GST_SECOND }; + GstClockTimeDiff diff[] = + { 0, 1, -1, G_MAXINT64 / GST_SECOND, G_MININT64 / GST_SECOND }; + guint i; + + for (i = 0; i < G_N_ELEMENTS (time); i++) { + fail_if (time[i] != (time[i] * GST_SECOND / GST_SECOND)); + } + for (i = 0; i < G_N_ELEMENTS (diff); i++) { + fail_if (diff[i] != (diff[i] * GST_SECOND / GST_SECOND)); + } +} + +GST_END_TEST; + +#define TIME_UNIT (GST_SECOND / 5) +static void +gst_clock_debug (GstClock * clock) +{ + GstClockTime time; + + time = gst_clock_get_time (clock); + GST_DEBUG ("Clock info: time %" GST_TIME_FORMAT, GST_TIME_ARGS (time)); +} + +static gboolean +ok_callback (GstClock * clock, GstClockTime time, + GstClockID id, gpointer user_data) +{ + GST_LOG ("unlocked async id %p", id); + return FALSE; +} + +static gboolean +error_callback (GstClock * clock, GstClockTime time, + GstClockID id, gpointer user_data) +{ + GST_WARNING ("unlocked unscheduled async id %p, this is wrong", id); + fail_if (TRUE); + + return FALSE; +} + +GMutex *store_lock; + +static gboolean +store_callback (GstClock * clock, GstClockTime time, + GstClockID id, gpointer user_data) +{ + GList **list = user_data; + + GST_DEBUG ("unlocked async id %p", id); + g_mutex_lock (store_lock); + *list = g_list_append (*list, id); + g_mutex_unlock (store_lock); + return FALSE; +} + +static gboolean +notify_callback (GstClock * clock, GstClockTime time, + GstClockID id, gpointer user_data) +{ + gboolean *ret = (gboolean *) user_data; + + if (ret != NULL) + *ret = TRUE; + + return FALSE; +} + +GST_START_TEST (test_single_shot) +{ + GstClock *clock; + GstClockID id, id2; + GstClockTime base; + GstClockReturn result; + + clock = gst_system_clock_obtain (); + fail_unless (clock != NULL, "Could not create instance of GstSystemClock"); + + gst_clock_debug (clock); + base = gst_clock_get_time (clock); + + id = gst_clock_new_single_shot_id (clock, base + TIME_UNIT); + fail_unless (id != NULL, "Could not create single shot id"); + + GST_DEBUG ("waiting one time unit"); + result = gst_clock_id_wait (id, NULL); + gst_clock_debug (clock); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK (result=%d)", + result); + fail_unless (gst_clock_get_time (clock) > (base + TIME_UNIT), + "target time has not been reached"); + + GST_DEBUG ("waiting in the past"); + result = gst_clock_id_wait (id, NULL); + gst_clock_debug (clock); + fail_unless (result == GST_CLOCK_EARLY, + "Waiting did not return EARLY(result=%d)", result); + gst_clock_id_unref (id); + + id = gst_clock_new_single_shot_id (clock, base + 2 * TIME_UNIT); + GST_DEBUG ("waiting one second async id %p", id); + result = gst_clock_id_wait_async (id, ok_callback, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + g_usleep (TIME_UNIT / (2 * 1000)); + gst_clock_id_unschedule (id); + gst_clock_id_unref (id); + + id = gst_clock_new_single_shot_id (clock, base + 5 * TIME_UNIT); + GST_DEBUG ("waiting one second async, with cancel on id %p", id); + result = gst_clock_id_wait_async (id, error_callback, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + g_usleep (TIME_UNIT / (2 * 1000)); + GST_DEBUG ("cancel id %p after half a time unit", id); + gst_clock_id_unschedule (id); + gst_clock_id_unref (id); + GST_DEBUG ("canceled id %p", id); + + GST_DEBUG ("waiting multiple one second async, with cancel"); + id = gst_clock_new_single_shot_id (clock, base + 5 * TIME_UNIT); + id2 = gst_clock_new_single_shot_id (clock, base + 6 * TIME_UNIT); + GST_DEBUG ("waiting id %p", id); + result = gst_clock_id_wait_async (id, ok_callback, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + + GST_DEBUG ("waiting id %p", id2); + result = gst_clock_id_wait_async (id2, error_callback, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + g_usleep (TIME_UNIT / (2 * 1000)); + GST_DEBUG ("cancel id %p after half a time unit", id2); + gst_clock_id_unschedule (id2); + GST_DEBUG ("canceled id %p", id2); + gst_clock_id_unref (id2); + + /* wait for the entry to time out */ + g_usleep (TIME_UNIT / 1000 * 5); + fail_unless (((GstClockEntry *) id)->status == GST_CLOCK_OK, + "Waiting did not finish"); + gst_clock_id_unref (id); + + gst_object_unref (clock); +} + +GST_END_TEST; + +GST_START_TEST (test_periodic_shot) +{ + GstClock *clock; + GstClockID id, id2; + GstClockTime base; + GstClockReturn result; + + clock = gst_system_clock_obtain (); + fail_unless (clock != NULL, "Could not create instance of GstSystemClock"); + + gst_clock_debug (clock); + base = gst_clock_get_time (clock); + + /* signal every half a time unit */ + id = gst_clock_new_periodic_id (clock, base + TIME_UNIT, TIME_UNIT / 2); + fail_unless (id != NULL, "Could not create periodic id"); + + GST_DEBUG ("waiting one time unit"); + result = gst_clock_id_wait (id, NULL); + gst_clock_debug (clock); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + + GST_DEBUG ("waiting for the next"); + result = gst_clock_id_wait (id, NULL); + gst_clock_debug (clock); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + + GST_DEBUG ("waiting for the next async %p", id); + result = gst_clock_id_wait_async (id, ok_callback, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + g_usleep (TIME_UNIT / (2 * 1000)); + + GST_DEBUG ("waiting some more for the next async %p", id); + result = gst_clock_id_wait_async (id, ok_callback, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + g_usleep (TIME_UNIT / (2 * 1000)); + + id2 = gst_clock_new_periodic_id (clock, base + TIME_UNIT, TIME_UNIT / 2); + fail_unless (id2 != NULL, "Could not create second periodic id"); + + GST_DEBUG ("waiting some more for another async %p", id2); + result = gst_clock_id_wait_async (id2, ok_callback, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + g_usleep (TIME_UNIT / (2 * 1000)); + + GST_DEBUG ("unschedule %p", id); + gst_clock_id_unschedule (id); + + /* entry cannot be used again */ + result = gst_clock_id_wait_async (id, error_callback, NULL); + fail_unless (result == GST_CLOCK_UNSCHEDULED, + "Waiting did not return UNSCHEDULED"); + result = gst_clock_id_wait (id, NULL); + fail_unless (result == GST_CLOCK_UNSCHEDULED, + "Waiting did not return UNSCHEDULED"); + g_usleep (TIME_UNIT / (2 * 1000)); + + /* clean up */ + gst_clock_id_unref (id); + gst_clock_id_unschedule (id2); + gst_clock_id_unref (id2); + + gst_object_unref (clock); +} + +GST_END_TEST; + +GST_START_TEST (test_async_order) +{ + GstClock *clock; + GstClockID id1, id2; + GList *cb_list = NULL, *next; + GstClockTime base; + GstClockReturn result; + + store_lock = g_mutex_new (); + + clock = gst_system_clock_obtain (); + fail_unless (clock != NULL, "Could not create instance of GstSystemClock"); + + gst_clock_debug (clock); + base = gst_clock_get_time (clock); + + id1 = gst_clock_new_single_shot_id (clock, base + 2 * TIME_UNIT); + id2 = gst_clock_new_single_shot_id (clock, base + 1 * TIME_UNIT); + result = gst_clock_id_wait_async (id1, store_callback, &cb_list); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + g_usleep (TIME_UNIT / (2 * 1000)); + result = gst_clock_id_wait_async (id2, store_callback, &cb_list); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + g_usleep (TIME_UNIT / 1000); + /* at this point at least one of the timers should have timed out */ + g_mutex_lock (store_lock); + fail_unless (cb_list != NULL, "expected notification"); + fail_unless (cb_list->data == id2, + "Expected notification for id2 to come first"); + g_mutex_unlock (store_lock); + g_usleep (TIME_UNIT / 1000); + g_mutex_lock (store_lock); + /* now both should have timed out */ + next = g_list_next (cb_list); + fail_unless (next != NULL, "expected second notification"); + fail_unless (next->data == id1, "Missing notification for id1"); + g_mutex_unlock (store_lock); + + gst_clock_id_unref (id1); + gst_clock_id_unref (id2); + g_list_free (cb_list); + + gst_object_unref (clock); + g_mutex_free (store_lock); +} + +GST_END_TEST; + +struct test_async_sync_interaction_data +{ + GMutex *lock; + + GstClockID sync_id; + GstClockID sync_id2; + + GstClockID async_id; + GstClockID async_id2; + GstClockID async_id3; +}; + +static gboolean +test_async_sync_interaction_cb (GstClock * clock, GstClockTime time, + GstClockID id, gpointer user_data) +{ + struct test_async_sync_interaction_data *td = + (struct test_async_sync_interaction_data *) (user_data); + + g_mutex_lock (td->lock); + /* The first async callback is ignored */ + if (id == td->async_id) + goto out; + + if (id != td->async_id2 && id != td->async_id3) + goto out; + + /* Unschedule the sync callback */ + if (id == td->async_id3) { + gst_clock_id_unschedule (td->sync_id); + gst_clock_id_unschedule (td->async_id2); + } +out: + g_mutex_unlock (td->lock); + return FALSE; +} + +GST_START_TEST (test_async_sync_interaction) +{ + /* This test schedules an async callback, then before it completes, schedules + * an earlier async callback, and quickly unschedules the first, and inserts + * a THIRD even earlier async callback. It then attempts to wait on a + * sync clock ID. While that's sleeping, the 3rd async callback should fire + * and unschedule it. This tests for problems with unscheduling async and + * sync callbacks on the system clock. */ + GstClock *clock; + GstClockReturn result; + GstClockTime base; + GstClockTimeDiff jitter; + struct test_async_sync_interaction_data td; + int i; + + clock = gst_system_clock_obtain (); + fail_unless (clock != NULL, "Could not create instance of GstSystemClock"); + + td.lock = g_mutex_new (); + + for (i = 0; i < 50; i++) { + gst_clock_debug (clock); + base = gst_clock_get_time (clock); + g_mutex_lock (td.lock); + td.async_id = gst_clock_new_single_shot_id (clock, base + 40 * GST_MSECOND); + td.async_id2 = + gst_clock_new_single_shot_id (clock, base + 30 * GST_MSECOND); + td.async_id3 = + gst_clock_new_single_shot_id (clock, base + 20 * GST_MSECOND); + td.sync_id2 = gst_clock_new_single_shot_id (clock, base + 10 * GST_MSECOND); + td.sync_id = gst_clock_new_single_shot_id (clock, base + 50 * GST_MSECOND); + g_mutex_unlock (td.lock); + + result = gst_clock_id_wait_async (td.async_id, + test_async_sync_interaction_cb, &td); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + + /* Wait 10ms, then unschedule async_id and schedule async_id2 */ + result = gst_clock_id_wait (td.sync_id2, &jitter); + fail_unless (result == GST_CLOCK_OK || result == GST_CLOCK_EARLY, + "Waiting did not return OK or EARLY"); + /* async_id2 is earlier than async_id - should become head of the queue */ + result = gst_clock_id_wait_async (td.async_id2, + test_async_sync_interaction_cb, &td); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + gst_clock_id_unschedule (td.async_id); + + /* async_id3 is earlier than async_id2 - should become head of the queue */ + result = gst_clock_id_wait_async (td.async_id3, + test_async_sync_interaction_cb, &td); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + + /* While this is sleeping, the async3 id should fire and unschedule it */ + result = gst_clock_id_wait (td.sync_id, &jitter); + fail_unless (result == GST_CLOCK_UNSCHEDULED || result == GST_CLOCK_EARLY, + "Waiting did not return UNSCHEDULED (was %d)", result); + + gst_clock_id_unschedule (td.async_id3); + g_mutex_lock (td.lock); + + gst_clock_id_unref (td.sync_id); + gst_clock_id_unref (td.sync_id2); + gst_clock_id_unref (td.async_id); + gst_clock_id_unref (td.async_id2); + gst_clock_id_unref (td.async_id3); + g_mutex_unlock (td.lock); + } + + g_mutex_free (td.lock); + gst_object_unref (clock); +} + +GST_END_TEST; + +GST_START_TEST (test_periodic_multi) +{ + GstClock *clock; + GstClockID clock_id; + GstClockID clock_id_async; + GstClockTime base; + GstClockReturn result; + gboolean got_callback = FALSE; + + clock = gst_system_clock_obtain (); + fail_unless (clock != NULL, "Could not create instance of GstSystemClock"); + + gst_clock_debug (clock); + base = gst_clock_get_time (clock); + + clock_id = gst_clock_new_periodic_id (clock, base + TIME_UNIT, TIME_UNIT); + gst_clock_id_wait (clock_id, NULL); + fail_unless (gst_clock_get_time (clock) >= base + TIME_UNIT); + fail_unless (gst_clock_get_time (clock) < base + 2 * TIME_UNIT); + + /* now perform a concurrent wait and wait_async */ + + clock_id_async = + gst_clock_new_periodic_id (clock, base + TIME_UNIT, TIME_UNIT); + result = + gst_clock_id_wait_async (clock_id_async, notify_callback, &got_callback); + fail_unless (result == GST_CLOCK_OK, "Async waiting did not return OK"); + + result = gst_clock_id_wait (clock_id, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + fail_unless (gst_clock_get_time (clock) >= base + 2 * TIME_UNIT); + /* give the async thread some time to call our callback: */ + g_usleep (TIME_UNIT / (10 * 1000)); + fail_unless (got_callback == TRUE, "got no async callback (1)"); + fail_unless (gst_clock_get_time (clock) < base + 3 * TIME_UNIT); + got_callback = FALSE; + + result = gst_clock_id_wait (clock_id, NULL); + fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); + fail_unless (gst_clock_get_time (clock) >= base + 3 * TIME_UNIT); + /* give the async thread some time to call our callback: */ + g_usleep (TIME_UNIT / (10 * 1000)); + fail_unless (got_callback == TRUE, "got no async callback (2)"); + fail_unless (gst_clock_get_time (clock) < base + 4 * TIME_UNIT); + + /* clean up */ + gst_clock_id_unref (clock_id); + gst_clock_id_unschedule (clock_id_async); + gst_clock_id_unref (clock_id_async); + gst_object_unref (clock); +} + +GST_END_TEST; + +GST_START_TEST (test_diff) +{ + GstClockTime time1[] = { 0, (GstClockTime) - 1, 0, 1, 2 * GST_SECOND, + (GstClockTime) - GST_SECOND, (GstClockTime) - GST_SECOND + }; + GstClockTime time2[] = + { 0, 1, 1, 0, 1 * GST_SECOND, (GstClockTime) - GST_SECOND, GST_SECOND }; + GstClockTimeDiff d[] = { 0, 2, 1, -1, -GST_SECOND, 0, 2 * GST_SECOND }; + guint i; + + for (i = 0; i < G_N_ELEMENTS (d); i++) { + fail_if (d[i] != GST_CLOCK_DIFF (time1[i], time2[i])); + } +} + +GST_END_TEST; + +/* test if a blocking wait, unblocked by an async entry continues to be + * scheduled */ +typedef struct +{ + GstClock *clock; + GstClockID id; + GstClockTimeDiff jitter; + GstClockReturn ret; +} MixedInfo; + +static gpointer +mixed_thread (MixedInfo * info) +{ + info->ret = gst_clock_id_wait (info->id, &info->jitter); + return NULL; +} + +static gboolean +mixed_async_cb (GstClock * clock, GstClockTime time, + GstClockID id, gpointer user_data) +{ + return TRUE; +} + +GST_START_TEST (test_mixed) +{ + GThread *thread; + GError *error = NULL; + MixedInfo info; + GstClockTime base; + GstClockID id; + + info.clock = gst_system_clock_obtain (); + fail_unless (info.clock != NULL, + "Could not create instance of GstSystemClock"); + + /* get current time of the clock as base time */ + base = gst_clock_get_time (info.clock); + + /* create entry to wait for 1 second */ + info.id = gst_clock_new_single_shot_id (info.clock, base + GST_SECOND); + + /* make and start an entry that is scheduled every 10ms */ + id = gst_clock_new_periodic_id (info.clock, base, 10 * GST_MSECOND); + + /* start waiting for the entry */ + thread = g_thread_create ((GThreadFunc) mixed_thread, &info, TRUE, &error); + fail_unless (error == NULL, "error creating thread"); + fail_unless (thread != NULL, "Could not create thread"); + + /* wait half a second so we are sure to be in the thread */ + g_usleep (G_USEC_PER_SEC / 2); + + /* start scheduling the entry */ + gst_clock_id_wait_async (id, mixed_async_cb, NULL); + + /* wait for thread to finish */ + g_thread_join (thread); + /* entry must have timed out correctly */ + fail_unless (info.ret == GST_CLOCK_OK, "clock return was %d", info.ret); + + gst_clock_id_unschedule (id); + gst_clock_id_unref (id); + gst_clock_id_unref (info.id); + gst_object_unref (info.clock); +} + +GST_END_TEST; + +static gboolean +test_async_full_slave_callback (GstClock * master, GstClockTime time, + GstClockID id, GstClock * clock) +{ + GstClockTime stime, mtime; + gdouble r_squared; + + /* notify the test case that we started */ + GST_INFO ("callback started"); + g_mutex_lock (af_lock); + g_cond_signal (af_cond); + + /* wait for the test case to unref "clock" and signal */ + GST_INFO ("waiting for test case to signal"); + g_cond_wait (af_cond, af_lock); + + stime = gst_clock_get_internal_time (clock); + mtime = gst_clock_get_time (master); + + gst_clock_add_observation (clock, stime, mtime, &r_squared); + + g_cond_signal (af_cond); + g_mutex_unlock (af_lock); + GST_INFO ("callback finished"); + + return TRUE; +} + +GST_START_TEST (test_async_full) +{ + GstClock *master, *slave; + GstClockID *clockid; + + af_lock = g_mutex_new (); + af_cond = g_cond_new (); + + /* create master and slave */ + master = + g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "TestClockMaster", NULL); + slave = g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "TestClockMaster", NULL); + GST_OBJECT_FLAG_SET (slave, GST_CLOCK_FLAG_CAN_SET_MASTER); + g_object_set (slave, "timeout", 50 * GST_MSECOND, NULL); + + fail_unless (GST_OBJECT_REFCOUNT (master) == 1); + fail_unless (GST_OBJECT_REFCOUNT (slave) == 1); + + /* register a periodic shot on the master to calibrate the slave */ + g_mutex_lock (af_lock); + clockid = gst_clock_new_periodic_id (master, + gst_clock_get_time (master), slave->timeout); + gst_clock_id_wait_async_full (clockid, + (GstClockCallback) test_async_full_slave_callback, + gst_object_ref (slave), (GDestroyNotify) gst_object_unref); + + /* wait for the shot to be fired and test_async_full_slave_callback to be + * called */ + GST_INFO ("waiting for the slave callback to start"); + g_cond_wait (af_cond, af_lock); + GST_INFO ("slave callback running, unreffing slave"); + + /* unref the slave clock while the slave_callback is running. This should be + * safe since the master clock now stores a ref to the slave */ + gst_object_unref (slave); + + /* unref the clock entry. This should be safe as well since the clock thread + * refs the entry before executing it */ + gst_clock_id_unschedule (clockid); + gst_clock_id_unref (clockid); + + /* signal and wait for the callback to complete */ + g_cond_signal (af_cond); + + GST_INFO ("waiting for callback to finish"); + g_cond_wait (af_cond, af_lock); + GST_INFO ("callback finished"); + g_mutex_unlock (af_lock); + + gst_object_unref (master); + + g_mutex_free (af_lock); + g_cond_free (af_cond); +} + +GST_END_TEST; + +static Suite * +gst_systemclock_suite (void) +{ + Suite *s = suite_create ("GstSystemClock"); + TCase *tc_chain = tcase_create ("waiting"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_range); + tcase_add_test (tc_chain, test_signedness); + tcase_add_test (tc_chain, test_single_shot); + tcase_add_test (tc_chain, test_periodic_shot); + tcase_add_test (tc_chain, test_periodic_multi); + tcase_add_test (tc_chain, test_async_order); + tcase_add_test (tc_chain, test_async_sync_interaction); + tcase_add_test (tc_chain, test_diff); + tcase_add_test (tc_chain, test_mixed); + tcase_add_test (tc_chain, test_async_full); + + return s; +} + +GST_CHECK_MAIN (gst_systemclock); diff --git a/tests/check/gst/gsttag.c b/tests/check/gst/gsttag.c new file mode 100644 index 0000000..11249df --- /dev/null +++ b/tests/check/gst/gsttag.c @@ -0,0 +1,476 @@ +/* + * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> + * + * 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 <gst/check/gstcheck.h> + +#include <string.h> + +/* multiple artists are possible (unfixed) */ +#define UTAG GST_TAG_ARTIST +#define UNFIXED1 "Britney Spears" +#define UNFIXED2 "Evanescence" +#define UNFIXED3 "AC/DC" +#define UNFIXED4 "The Prodigy" + +/* license is fixed */ +#define FTAG GST_TAG_LICENSE +#define FIXED1 "Lesser General Public License" +#define FIXED2 "Microsoft End User License Agreement" +#define FIXED3 "Mozilla Public License" +#define FIXED4 "Public Domain" + +/* checks that a tag contains the given values and not more values */ +static void +check_tags (const GstTagList * list, const gchar * tag, const gchar * value, + ...) +{ + va_list args; + gchar *str; + guint i = 0; + + va_start (args, value); + while (value != NULL) { + fail_unless (gst_tag_list_get_string_index (list, tag, i, &str)); + fail_unless (strcmp (value, str) == 0); + g_free (str); + + value = va_arg (args, gchar *); + i++; + } + fail_unless (i == gst_tag_list_get_tag_size (list, tag)); + va_end (args); +} + +static void +check_tags_empty (const GstTagList * list) +{ + GST_DEBUG ("taglist: %" GST_PTR_FORMAT, list); + fail_unless ((list == NULL) || (gst_tag_list_is_empty (list))); +} + +#define NEW_LIST_FIXED(mode) \ +G_STMT_START { \ + if (list) gst_tag_list_free (list); \ + list = gst_tag_list_new (); \ + gst_tag_list_add (list, mode, FTAG, FIXED1, FTAG, FIXED2, \ + FTAG, FIXED3, FTAG, FIXED4, NULL); \ + mark_point(); \ +} G_STMT_END; + +#define NEW_LIST_UNFIXED(mode) \ +G_STMT_START { \ + if (list) gst_tag_list_free (list); \ + list = gst_tag_list_new (); \ + gst_tag_list_add (list, mode, UTAG, UNFIXED1, UTAG, UNFIXED2, \ + UTAG, UNFIXED3, UTAG, UNFIXED4, NULL); \ + mark_point(); \ +} G_STMT_END; + +#define NEW_LISTS_FIXED(mode) \ +G_STMT_START { \ + if (list) gst_tag_list_free (list); \ + list = gst_tag_list_new (); \ + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, FTAG, FIXED1, \ + FTAG, FIXED2, NULL); \ + if (list2) gst_tag_list_free (list2); \ + list2 = gst_tag_list_new (); \ + gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, FTAG, FIXED3, \ + FTAG, FIXED4, NULL); \ + if (merge) gst_tag_list_free (merge); \ + merge = gst_tag_list_merge (list, list2, mode); \ + mark_point(); \ +} G_STMT_END; + +#define NEW_LISTS_UNFIXED(mode) \ +G_STMT_START { \ + if (list) gst_tag_list_free (list); \ + list = gst_tag_list_new (); \ + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, UTAG, UNFIXED1, \ + UTAG, UNFIXED2, NULL); \ + if (list2) gst_tag_list_free (list2); \ + list2 = gst_tag_list_new (); \ + gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, UTAG, UNFIXED3,\ + UTAG, UNFIXED4, NULL); \ + if (merge) gst_tag_list_free (merge); \ + merge = gst_tag_list_merge (list, list2, mode); \ + mark_point(); \ +} G_STMT_END; + +#define NEW_LISTS_EMPTY1(mode) \ +G_STMT_START { \ + if (list) gst_tag_list_free (list); \ + list = NULL; \ + if (list2) gst_tag_list_free (list2); \ + list2 = gst_tag_list_new (); \ + gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, FTAG, FIXED3, \ + FTAG, FIXED4, NULL); \ + if (merge) gst_tag_list_free (merge); \ + merge = gst_tag_list_merge (list, list2, mode); \ + mark_point(); \ +} G_STMT_END; + +#define NEW_LISTS_EMPTY2(mode) \ +G_STMT_START { \ + if (list) gst_tag_list_free (list); \ + list = gst_tag_list_new (); \ + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, FTAG, FIXED1, \ + FTAG, FIXED2, NULL); \ + if (list2) gst_tag_list_free (list2); \ + list2 = NULL; \ + if (merge) gst_tag_list_free (merge); \ + merge = gst_tag_list_merge (list, list2, mode); \ + mark_point(); \ +} G_STMT_END; + + +GST_START_TEST (test_basics) +{ + /* make sure the assumptions work */ + fail_unless (gst_tag_is_fixed (FTAG)); + fail_unless (!gst_tag_is_fixed (UTAG)); + /* we check string here only */ + fail_unless (gst_tag_get_type (FTAG) == G_TYPE_STRING); + fail_unless (gst_tag_get_type (UTAG) == G_TYPE_STRING); +} + +GST_END_TEST +GST_START_TEST (test_add) +{ + GstTagList *list = NULL; + + /* check additions */ + /* unfixed */ + NEW_LIST_UNFIXED (GST_TAG_MERGE_REPLACE_ALL); + check_tags (list, UTAG, UNFIXED4, NULL); + NEW_LIST_UNFIXED (GST_TAG_MERGE_REPLACE); + check_tags (list, UTAG, UNFIXED4, NULL); + NEW_LIST_UNFIXED (GST_TAG_MERGE_PREPEND); + check_tags (list, UTAG, UNFIXED4, UNFIXED3, UNFIXED2, UNFIXED1, NULL); + NEW_LIST_UNFIXED (GST_TAG_MERGE_APPEND); + check_tags (list, UTAG, UNFIXED1, UNFIXED2, UNFIXED3, UNFIXED4, NULL); + NEW_LIST_UNFIXED (GST_TAG_MERGE_KEEP); + check_tags (list, UTAG, UNFIXED1, NULL); + NEW_LIST_UNFIXED (GST_TAG_MERGE_KEEP_ALL); + check_tags (list, UTAG, NULL); + + /* fixed */ + NEW_LIST_FIXED (GST_TAG_MERGE_REPLACE_ALL); + check_tags (list, FTAG, FIXED4, NULL); + NEW_LIST_FIXED (GST_TAG_MERGE_REPLACE); + check_tags (list, FTAG, FIXED4, NULL); + NEW_LIST_FIXED (GST_TAG_MERGE_PREPEND); + check_tags (list, FTAG, FIXED4, NULL); + NEW_LIST_FIXED (GST_TAG_MERGE_APPEND); + check_tags (list, FTAG, FIXED1, NULL); + NEW_LIST_FIXED (GST_TAG_MERGE_KEEP); + check_tags (list, FTAG, FIXED1, NULL); + NEW_LIST_FIXED (GST_TAG_MERGE_KEEP_ALL); + check_tags (list, FTAG, NULL); + + /* clean up */ + if (list) + gst_tag_list_free (list); +} + +GST_END_TEST +GST_START_TEST (test_merge) +{ + GstTagList *list = NULL, *list2 = NULL, *merge = NULL; + + /* check merging */ + /* unfixed */ + GST_DEBUG ("unfixed"); + NEW_LISTS_UNFIXED (GST_TAG_MERGE_REPLACE_ALL); + check_tags (merge, UTAG, UNFIXED3, UNFIXED4, NULL); + NEW_LISTS_UNFIXED (GST_TAG_MERGE_REPLACE); + check_tags (merge, UTAG, UNFIXED3, UNFIXED4, NULL); + NEW_LISTS_UNFIXED (GST_TAG_MERGE_PREPEND); + check_tags (merge, UTAG, UNFIXED3, UNFIXED4, UNFIXED1, UNFIXED2, NULL); + NEW_LISTS_UNFIXED (GST_TAG_MERGE_APPEND); + check_tags (merge, UTAG, UNFIXED1, UNFIXED2, UNFIXED3, UNFIXED4, NULL); + NEW_LISTS_UNFIXED (GST_TAG_MERGE_KEEP); + check_tags (merge, UTAG, UNFIXED1, UNFIXED2, NULL); + NEW_LISTS_UNFIXED (GST_TAG_MERGE_KEEP_ALL); + check_tags (merge, UTAG, UNFIXED1, UNFIXED2, NULL); + + /* fixed */ + GST_DEBUG ("fixed"); + NEW_LISTS_FIXED (GST_TAG_MERGE_REPLACE_ALL); + check_tags (merge, FTAG, FIXED3, NULL); + NEW_LISTS_FIXED (GST_TAG_MERGE_REPLACE); + check_tags (merge, FTAG, FIXED3, NULL); + NEW_LISTS_FIXED (GST_TAG_MERGE_PREPEND); + check_tags (merge, FTAG, FIXED3, NULL); + NEW_LISTS_FIXED (GST_TAG_MERGE_APPEND); + check_tags (merge, FTAG, FIXED1, NULL); + NEW_LISTS_FIXED (GST_TAG_MERGE_KEEP); + check_tags (merge, FTAG, FIXED1, NULL); + NEW_LISTS_FIXED (GST_TAG_MERGE_KEEP_ALL); + check_tags (merge, FTAG, FIXED1, NULL); + + /* first list empty */ + GST_DEBUG ("first empty"); + NEW_LISTS_EMPTY1 (GST_TAG_MERGE_REPLACE_ALL); + check_tags (merge, FTAG, FIXED3, NULL); + NEW_LISTS_EMPTY1 (GST_TAG_MERGE_REPLACE); + check_tags (merge, FTAG, FIXED3, NULL); + NEW_LISTS_EMPTY1 (GST_TAG_MERGE_PREPEND); + check_tags (merge, FTAG, FIXED3, NULL); + NEW_LISTS_EMPTY1 (GST_TAG_MERGE_APPEND); + check_tags (merge, FTAG, FIXED3, NULL); + NEW_LISTS_EMPTY1 (GST_TAG_MERGE_KEEP); + check_tags (merge, FTAG, FIXED3, NULL); + NEW_LISTS_EMPTY1 (GST_TAG_MERGE_KEEP_ALL); + check_tags_empty (merge); + + /* second list empty */ + GST_DEBUG ("second empty"); + NEW_LISTS_EMPTY2 (GST_TAG_MERGE_REPLACE_ALL); + check_tags_empty (merge); + NEW_LISTS_EMPTY2 (GST_TAG_MERGE_REPLACE); + check_tags (merge, FTAG, FIXED1, NULL); + NEW_LISTS_EMPTY2 (GST_TAG_MERGE_PREPEND); + check_tags (merge, FTAG, FIXED1, NULL); + NEW_LISTS_EMPTY2 (GST_TAG_MERGE_APPEND); + check_tags (merge, FTAG, FIXED1, NULL); + NEW_LISTS_EMPTY2 (GST_TAG_MERGE_KEEP); + check_tags (merge, FTAG, FIXED1, NULL); + NEW_LISTS_EMPTY2 (GST_TAG_MERGE_KEEP_ALL); + check_tags (merge, FTAG, FIXED1, NULL); + + /* clean up */ + if (list) + gst_tag_list_free (list); + if (list2) + gst_tag_list_free (list2); + if (merge) + gst_tag_list_free (merge); +} + +GST_END_TEST +GST_START_TEST (test_date_tags) +{ + GstTagList *tag_list, *tag_list2; + GDate *date, *date2; + gchar *str; + + date = g_date_new_dmy (14, 10, 2005); + tag_list = gst_tag_list_new (); + gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_DATE, date, NULL); + + str = gst_structure_to_string (tag_list); + fail_if (str == NULL); + fail_if (strstr (str, "2005-10-14") == NULL); + + tag_list2 = gst_structure_from_string (str, NULL); + fail_if (tag_list2 == NULL); + fail_if (!gst_tag_list_get_date (tag_list2, GST_TAG_DATE, &date2)); + gst_tag_list_free (tag_list2); + g_free (str); + + fail_if (g_date_compare (date, date2) != 0); + fail_if (g_date_get_day (date) != 14); + fail_if (g_date_get_month (date) != 10); + fail_if (g_date_get_year (date) != 2005); + fail_if (g_date_get_day (date2) != 14); + fail_if (g_date_get_month (date2) != 10); + fail_if (g_date_get_year (date2) != 2005); + g_date_free (date2); + + gst_tag_list_free (tag_list); + g_date_free (date); +} + +GST_END_TEST; + +GST_START_TEST (test_type) +{ + GstTagList *taglist; + + taglist = gst_tag_list_new (); + fail_unless (GST_IS_TAG_LIST (taglist)); + fail_unless (gst_is_tag_list (taglist)); + gst_tag_list_free (taglist); + + /* this isn't okay */ + ASSERT_CRITICAL (fail_if (gst_is_tag_list (NULL))); + + /* this however should be fine */ + fail_if (GST_IS_TAG_LIST (NULL)); + + /* check gst_tag_list_is_empty */ + ASSERT_CRITICAL (gst_tag_list_is_empty (NULL)); + taglist = gst_tag_list_new (); + fail_unless (gst_tag_list_is_empty (taglist)); + gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "JD", NULL); + fail_if (gst_tag_list_is_empty (taglist)); + gst_tag_list_free (taglist); +} + +GST_END_TEST; + +GST_START_TEST (test_set_non_utf8_string) +{ + GstTagList *taglist; + guint8 foobar[2] = { 0xff, 0x00 }; /* not UTF-8 */ + + taglist = gst_tag_list_new (); + fail_unless (taglist != NULL); + + ASSERT_WARNING (gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, + GST_TAG_ARTIST, (gchar *) foobar, NULL)); + + /* That string field with a non-UTF8 string should not have been added */ + fail_unless (gst_tag_list_is_empty (taglist)); + + gst_tag_list_free (taglist); +} + +GST_END_TEST; + +GST_START_TEST (test_buffer_tags) +{ + GstTagList *tags; + GstBuffer *buf1, *buf2; + + tags = gst_tag_list_new (); + buf1 = gst_buffer_new_and_alloc (222); + buf2 = gst_buffer_new_and_alloc (100); + gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_IMAGE, buf1, + GST_TAG_PREVIEW_IMAGE, buf2, NULL); + gst_buffer_unref (buf1); + gst_buffer_unref (buf2); + + buf1 = buf2 = NULL; + fail_if (!gst_tag_list_get_buffer (tags, GST_TAG_IMAGE, &buf1)); + gst_buffer_unref (buf1); + fail_if (!gst_tag_list_get_buffer (tags, GST_TAG_PREVIEW_IMAGE, &buf2)); + gst_buffer_unref (buf2); + + fail_if (gst_tag_list_get_buffer_index (tags, GST_TAG_IMAGE, 1, &buf1)); + fail_if (gst_tag_list_get_buffer_index (tags, GST_TAG_IMAGE, 2, &buf1)); + fail_if (gst_tag_list_get_buffer_index (tags, GST_TAG_PREVIEW_IMAGE, 1, + &buf1)); + fail_if (gst_tag_list_get_buffer_index (tags, GST_TAG_PREVIEW_IMAGE, 2, + &buf1)); + + fail_if (!gst_tag_list_get_buffer_index (tags, GST_TAG_IMAGE, 0, &buf1)); + fail_if (!gst_tag_list_get_buffer_index (tags, GST_TAG_PREVIEW_IMAGE, 0, + &buf2)); + fail_unless_equals_int (gst_buffer_get_size (buf1), 222); + fail_unless_equals_int (gst_buffer_get_size (buf2), 100); + + gst_buffer_unref (buf1); + gst_buffer_unref (buf2); + + gst_tag_list_free (tags); +} + +GST_END_TEST; + +GST_START_TEST (test_empty_tags) +{ + GstTagList *tags; + + /* only get g_warnings() with git */ + if (GST_VERSION_NANO != 1) + return; + + tags = gst_tag_list_new (); + ASSERT_WARNING (gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, + GST_TAG_ARTIST, NULL, NULL)); + ASSERT_WARNING (gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, + GST_TAG_ARTIST, "", NULL)); + gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "xyz", NULL); + gst_tag_list_free (tags); +} + +GST_END_TEST; + +GST_START_TEST (test_new_full) +{ + GstTagList *tags; + gchar *artist, *title; + gdouble track_gain; + guint track_num; + + tags = gst_tag_list_new_full (GST_TAG_ARTIST, "Arty Ist", + GST_TAG_TRACK_NUMBER, 9, GST_TAG_TRACK_GAIN, 4.242, GST_TAG_TITLE, + "Title!", NULL); + + fail_unless (gst_tag_list_get_string (tags, GST_TAG_ARTIST, &artist)); + fail_unless_equals_string (artist, "Arty Ist"); + fail_unless (gst_tag_list_get_string (tags, GST_TAG_TITLE, &title)); + fail_unless_equals_string (title, "Title!"); + fail_unless (gst_tag_list_get_uint (tags, GST_TAG_TRACK_NUMBER, &track_num)); + fail_unless_equals_int (track_num, 9); + fail_unless (gst_tag_list_get_double (tags, GST_TAG_TRACK_GAIN, &track_gain)); + fail_unless_equals_float (track_gain, 4.242); + fail_unless (tags != NULL); + + gst_tag_list_free (tags); + g_free (artist); + g_free (title); +} + +GST_END_TEST; + +GST_START_TEST (test_merge_strings_with_comma) +{ + GstTagList *tags; + gchar *artists = NULL; + + tags = gst_tag_list_new (); + gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Foo", NULL); + gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Bar", NULL); + gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Yay", NULL); + gst_tag_list_get_string (tags, GST_TAG_ARTIST, &artists); + fail_unless (artists != NULL); + /* can't check for exact string since the comma separator is i18n-ed */ + fail_unless (strstr (artists, "Foo") != NULL); + fail_unless (strstr (artists, "Bar") != NULL); + fail_unless (strstr (artists, "Yay") != NULL); + g_free (artists); + gst_tag_list_free (tags); +} + +GST_END_TEST; + +static Suite * +gst_tag_suite (void) +{ + Suite *s = suite_create ("GstTag"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_basics); + tcase_add_test (tc_chain, test_add); + tcase_add_test (tc_chain, test_merge); + tcase_add_test (tc_chain, test_merge_strings_with_comma); + tcase_add_test (tc_chain, test_date_tags); + tcase_add_test (tc_chain, test_type); + tcase_add_test (tc_chain, test_set_non_utf8_string); + tcase_add_test (tc_chain, test_buffer_tags); + tcase_add_test (tc_chain, test_empty_tags); + tcase_add_test (tc_chain, test_new_full); + + return s; +} + +GST_CHECK_MAIN (gst_tag); diff --git a/tests/check/gst/gsttagsetter.c b/tests/check/gst/gsttagsetter.c new file mode 100644 index 0000000..b25ea8d --- /dev/null +++ b/tests/check/gst/gsttagsetter.c @@ -0,0 +1,334 @@ +/* GStreamer GstTagSetter interface unit tests + * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> +#include <gst/gst.h> +#include <string.h> + +/* some minimal GstTagSetter object */ +#define GST_TYPE_DUMMY_ENC gst_dummy_enc_get_type() + +typedef GstElement GstDummyEnc; +typedef GstElementClass GstDummyEncClass; + +GType gst_dummy_enc_get_type (void); +G_DEFINE_TYPE_WITH_CODE (GstDummyEnc, gst_dummy_enc, + GST_TYPE_ELEMENT, G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL)); + +static void +gst_dummy_enc_class_init (GstDummyEncClass * klass) +{ +} + +static void +gst_dummy_enc_init (GstDummyEnc * enc) +{ +} + +static void +tag_list_foreach (const GstTagList * taglist, const gchar * tag, guint * p_num) +{ + guint tag_size; + + tag_size = gst_tag_list_get_tag_size (taglist, tag); + GST_LOG ("%u+%u tag = %s", *p_num, tag_size, tag); + *p_num += tag_size; +} + +static guint +tag_setter_list_length (GstTagSetter * setter) +{ + guint len = 0; + + if (gst_tag_setter_get_tag_list (setter) == NULL) + return 0; + + gst_tag_list_foreach (gst_tag_setter_get_tag_list (setter), + (GstTagForeachFunc) tag_list_foreach, &len); + return len; +} + +static guint +tag_list_length (const GstTagList * tag_list) +{ + guint len = 0; + + if (tag_list == NULL) + return 0; + + gst_tag_list_foreach (tag_list, (GstTagForeachFunc) tag_list_foreach, &len); + return len; +} + +#define assert_tag_setter_list_length(setter,len) \ + fail_unless_equals_int (tag_setter_list_length(setter), len); + +GST_START_TEST (test_merge) +{ + GstTagSetter *setter; + GstTagList *list1, *list2; + GstElement *enc; + + enc = g_object_new (GST_TYPE_DUMMY_ENC, NULL); + fail_unless (enc != NULL); + + setter = GST_TAG_SETTER (enc); + + list1 = gst_tag_list_new (); + gst_tag_list_add (list1, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "artist1", + NULL); + gst_tag_setter_merge_tags (setter, list1, GST_TAG_MERGE_APPEND); + assert_tag_setter_list_length (setter, 1); + + list2 = gst_tag_list_new (); + gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "artist2", + GST_TAG_TITLE, "title1", NULL); + gst_tag_setter_merge_tags (setter, list2, GST_TAG_MERGE_APPEND); + assert_tag_setter_list_length (setter, 3); + + gst_tag_setter_merge_tags (setter, list2, GST_TAG_MERGE_REPLACE_ALL); + assert_tag_setter_list_length (setter, 2); + + gst_tag_setter_merge_tags (setter, list1, GST_TAG_MERGE_REPLACE_ALL); + assert_tag_setter_list_length (setter, 1); + + gst_tag_setter_add_tags (setter, GST_TAG_MERGE_APPEND, GST_TAG_ALBUM, "xyz", + NULL); + assert_tag_setter_list_length (setter, 2); + + gst_tag_list_free (list2); + gst_tag_list_free (list1); + + g_object_unref (enc); +} + +GST_END_TEST +GST_START_TEST (test_merge_modes) +{ + GstTagMergeMode mode; + + for (mode = GST_TAG_MERGE_REPLACE_ALL; mode < GST_TAG_MERGE_COUNT; mode++) { + gint i; + + for (i = 0; i < 4; i++) { + GstElement *enc; + GstTagSetter *setter; + GstTagList *list1, *list2, *merged; + + enc = g_object_new (GST_TYPE_DUMMY_ENC, NULL); + fail_unless (enc != NULL); + + setter = GST_TAG_SETTER (enc); + list1 = gst_tag_list_new (); + list2 = gst_tag_list_new (); + + /* i = 0: - - + * i = 1: list1 - + * i = 2: - list2 + * i = 3: list1 list2 */ + + if (i % 2 == 1) { + gst_tag_list_add (list1, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, + "artist1", NULL); + } + if (i > 1) { + gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, + "artist2", NULL); + } + + gst_tag_setter_merge_tags (setter, list1, GST_TAG_MERGE_APPEND); + gst_tag_setter_merge_tags (setter, list2, mode); + + merged = gst_tag_list_merge (list1, list2, mode); + + fail_unless_equals_int (tag_list_length (gst_tag_setter_get_tag_list + (setter)), tag_list_length (merged)); + + gst_tag_list_free (list1); + gst_tag_list_free (list2); + gst_tag_list_free (merged); + gst_object_unref (enc); + } + } +} + +GST_END_TEST +GST_START_TEST (test_merge_modes_skip_empty) +{ + GstTagMergeMode mode; + + for (mode = GST_TAG_MERGE_REPLACE_ALL; mode < GST_TAG_MERGE_COUNT; mode++) { + gint i; + + for (i = 0; i < 2; i++) { + GstElement *enc; + GstTagSetter *setter; + GstTagList *list1, *list2, *merged; + + enc = g_object_new (GST_TYPE_DUMMY_ENC, NULL); + fail_unless (enc != NULL); + + setter = GST_TAG_SETTER (enc); + list1 = gst_tag_list_new (); + list2 = gst_tag_list_new (); + + if (i == 1) { + gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, + "artist2", NULL); + } + + gst_tag_setter_merge_tags (setter, list2, mode); + + merged = gst_tag_list_merge (list1, list2, mode); + + fail_unless_equals_int (tag_list_length (gst_tag_setter_get_tag_list + (setter)), tag_list_length (merged)); + + gst_tag_list_free (list1); + gst_tag_list_free (list2); + gst_tag_list_free (merged); + gst_object_unref (enc); + } + } +} + +GST_END_TEST static int spin_and_wait = 1; +static int threads_running = 0; + +#define THREADS_TEST_SECONDS 1.5 + +static gpointer +test_threads_thread_func1 (gpointer data) +{ + GstTagSetter *setter = GST_TAG_SETTER (data); + GTimer *timer; + + timer = g_timer_new (); + + g_atomic_int_inc (&threads_running); + while (g_atomic_int_get (&spin_and_wait)) + g_usleep (0); + + GST_INFO ("Go!"); + g_timer_start (timer); + + while (g_timer_elapsed (timer, NULL) < THREADS_TEST_SECONDS) { + gst_tag_setter_add_tags (setter, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, + "some artist", GST_TAG_TITLE, "some title", GST_TAG_TRACK_NUMBER, 6, + NULL); + } + + g_timer_destroy (timer); + GST_INFO ("Done"); + + return NULL; +} + +static gpointer +test_threads_thread_func2 (gpointer data) +{ + GstTagSetter *setter = GST_TAG_SETTER (data); + GTimer *timer; + + timer = g_timer_new (); + + g_atomic_int_inc (&threads_running); + while (g_atomic_int_get (&spin_and_wait)) + g_usleep (0); + + GST_INFO ("Go!"); + g_timer_start (timer); + + while (g_timer_elapsed (timer, NULL) < THREADS_TEST_SECONDS) { + gst_tag_setter_add_tags (setter, GST_TAG_MERGE_PREPEND, GST_TAG_CODEC, + "MP42", GST_TAG_COMMENT, "deep insights go here", GST_TAG_TRACK_COUNT, + 10, NULL); + } + + g_timer_destroy (timer); + GST_INFO ("Done"); + + return NULL; +} + +static gpointer +test_threads_thread_func3 (gpointer data) +{ + GstTagSetter *setter = GST_TAG_SETTER (data); + GTimer *timer; + + timer = g_timer_new (); + + g_atomic_int_inc (&threads_running); + while (g_atomic_int_get (&spin_and_wait)) + g_usleep (0); + + GST_INFO ("Go!"); + g_timer_start (timer); + + while (g_timer_elapsed (timer, NULL) < THREADS_TEST_SECONDS) { + gst_tag_setter_reset_tags (setter); + } + + g_timer_destroy (timer); + GST_INFO ("Done"); + + return NULL; +} + +GST_START_TEST (test_threads) +{ + GstTagSetter *setter; + GThread *threads[3]; + + setter = GST_TAG_SETTER (g_object_new (GST_TYPE_DUMMY_ENC, NULL)); + + spin_and_wait = TRUE; + threads[0] = g_thread_create (test_threads_thread_func1, setter, TRUE, NULL); + threads[1] = g_thread_create (test_threads_thread_func2, setter, TRUE, NULL); + threads[2] = g_thread_create (test_threads_thread_func3, setter, TRUE, NULL); + + while (g_atomic_int_get (&threads_running) < 3) + g_usleep (10); + + g_atomic_int_set (&spin_and_wait, FALSE); + + g_thread_join (threads[0]); + g_thread_join (threads[1]); + g_thread_join (threads[2]); + + g_object_unref (G_OBJECT (setter)); +} + +GST_END_TEST static Suite * +gst_tag_setter_suite (void) +{ + Suite *s = suite_create ("GstTagSetter"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_merge); + tcase_add_test (tc_chain, test_merge_modes); + tcase_add_test (tc_chain, test_merge_modes_skip_empty); + tcase_add_test (tc_chain, test_threads); + + return s; +} + +GST_CHECK_MAIN (gst_tag_setter); diff --git a/tests/check/gst/gsttask.c b/tests/check/gst/gsttask.c new file mode 100644 index 0000000..e7b169a --- /dev/null +++ b/tests/check/gst/gsttask.c @@ -0,0 +1,207 @@ +/* GStreamer + * Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart dot org> + * + * gsttask.c: Unit test for GstTask + * + * 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 <gst/check/gstcheck.h> + +static GMutex *task_lock; +static GCond *task_cond; + +static GStaticRecMutex task_mutex = G_STATIC_REC_MUTEX_INIT; + +static void +task_func2 (void *data) +{ + gboolean ret; + GstTask *t = *((GstTask **) data); + + g_mutex_lock (task_lock); + GST_DEBUG ("signal"); + g_cond_signal (task_cond); + g_mutex_unlock (task_lock); + + ASSERT_WARNING (ret = gst_task_join (t)); + fail_unless (ret == FALSE); +} + +GST_START_TEST (test_join) +{ + GstTask *t; + gboolean ret; + + t = gst_task_create (task_func2, &t); + fail_if (t == NULL); + + gst_task_set_lock (t, &task_mutex); + + task_cond = g_cond_new (); + task_lock = g_mutex_new (); + + g_mutex_lock (task_lock); + GST_DEBUG ("starting"); + ret = gst_task_start (t); + fail_unless (ret == TRUE); + /* wait for it to spin up */ + GST_DEBUG ("waiting"); + g_cond_wait (task_cond, task_lock); + GST_DEBUG ("done waiting"); + g_mutex_unlock (task_lock); + + GST_DEBUG ("joining"); + ret = gst_task_join (t); + fail_unless (ret == TRUE); + + gst_task_cleanup_all (); + + gst_object_unref (t); +} + +GST_END_TEST; + +static void +task_func (void *data) +{ + g_mutex_lock (task_lock); + GST_DEBUG ("signal"); + g_cond_signal (task_cond); + g_mutex_unlock (task_lock); +} + +GST_START_TEST (test_lock_start) +{ + GstTask *t; + gboolean ret; + + t = gst_task_create (task_func, NULL); + fail_if (t == NULL); + + gst_task_set_lock (t, &task_mutex); + + task_cond = g_cond_new (); + task_lock = g_mutex_new (); + + g_mutex_lock (task_lock); + GST_DEBUG ("starting"); + ret = gst_task_start (t); + fail_unless (ret == TRUE); + /* wait for it to spin up */ + GST_DEBUG ("waiting"); + g_cond_wait (task_cond, task_lock); + GST_DEBUG ("done waiting"); + g_mutex_unlock (task_lock); + + /* cannot set mutex now */ + ASSERT_WARNING (gst_task_set_lock (t, &task_mutex)); + + GST_DEBUG ("joining"); + ret = gst_task_join (t); + fail_unless (ret == TRUE); + + gst_task_cleanup_all (); + + gst_object_unref (t); +} + +GST_END_TEST; + +GST_START_TEST (test_lock) +{ + GstTask *t; + gboolean ret; + + t = gst_task_create (task_func, NULL); + fail_if (t == NULL); + + gst_task_set_lock (t, &task_mutex); + + GST_DEBUG ("pause"); + ret = gst_task_pause (t); + fail_unless (ret == TRUE); + + g_usleep (1 * G_USEC_PER_SEC / 2); + + GST_DEBUG ("joining"); + ret = gst_task_join (t); + fail_unless (ret == TRUE); + + g_usleep (1 * G_USEC_PER_SEC / 2); + + gst_object_unref (t); +} + +GST_END_TEST; + +GST_START_TEST (test_no_lock) +{ + GstTask *t; + gboolean ret; + + t = gst_task_create (task_func, NULL); + fail_if (t == NULL); + + /* stop should be possible without lock */ + gst_task_stop (t); + + /* pause should give a warning */ + ASSERT_WARNING (ret = gst_task_pause (t)); + fail_unless (ret == FALSE); + + /* start should give a warning */ + ASSERT_WARNING (ret = gst_task_start (t)); + fail_unless (ret == FALSE); + + /* stop should be possible without lock */ + gst_task_stop (t); + + gst_object_unref (t); +} + +GST_END_TEST; + +GST_START_TEST (test_create) +{ + GstTask *t; + + t = gst_task_create (task_func, NULL); + fail_if (t == NULL); + + gst_object_unref (t); +} + +GST_END_TEST; + + +static Suite * +gst_task_suite (void) +{ + Suite *s = suite_create ("GstTask"); + TCase *tc_chain = tcase_create ("task tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_create); + tcase_add_test (tc_chain, test_no_lock); + tcase_add_test (tc_chain, test_lock); + tcase_add_test (tc_chain, test_lock_start); + tcase_add_test (tc_chain, test_join); + + return s; +} + +GST_CHECK_MAIN (gst_task); diff --git a/tests/check/gst/gsturi.c b/tests/check/gst/gsturi.c new file mode 100644 index 0000000..ca6c2c9 --- /dev/null +++ b/tests/check/gst/gsturi.c @@ -0,0 +1,126 @@ +/* GStreamer unit tests for GstURI + * + * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> + +GST_START_TEST (test_protocol_case) +{ + GstElement *element; + + element = gst_element_make_from_uri (GST_URI_SRC, "file:///foo/bar", NULL); + + /* no element? probably no registry, bail out */ + if (element == NULL) + return; + + gst_object_unref (element); + element = gst_element_make_from_uri (GST_URI_SRC, "FILE:///foo/bar", NULL); + fail_unless (element != NULL, + "Got source for 'file://' URI but not for 'FILE://' URI"); + gst_object_unref (element); +} + +GST_END_TEST; + +GST_START_TEST (test_uri_get_location) +{ + gchar *l; + + /* URI with no location should return empty string */ + l = gst_uri_get_location ("dvd://"); + fail_unless (l != NULL); + fail_unless_equals_string (l, ""); + g_free (l); + + /* URI with hostname */ + l = gst_uri_get_location ("smb://supercomputer/path/to/file"); + fail_unless (l != NULL); + fail_unless_equals_string (l, "supercomputer/path/to/file"); + g_free (l); + + /* URI */ + l = gst_uri_get_location ("file:///path/to/file"); + fail_unless (l != NULL); + fail_unless_equals_string (l, "/path/to/file"); + g_free (l); + + /* unescaping */ + l = gst_uri_get_location ("file:///path/to/some%20file"); + fail_unless (l != NULL); + fail_unless_equals_string (l, "/path/to/some file"); + g_free (l); +} + +GST_END_TEST; + +#ifdef G_OS_WIN32 + +GST_START_TEST (test_win32_uri) +{ + gchar *uri, *l; + + uri = g_strdup ("file:///c:/my%20music/foo.ogg"); + l = gst_uri_get_location (uri); + fail_unless (l != NULL); + /* fail_unless_equals_string will screw up here in the failure case + * because the string constant will be appended to the printf format + * message string and contains a '%', that's why we use fail_unless here */ + fail_unless (g_str_equal (l, "c:/my music/foo.ogg"), + "wrong location '%s' returned for URI '%s'", l, uri); + g_free (l); + g_free (uri); + + /* make sure the other variant with two slashes before the C: (which was + * needed before because of a bug in _get_location()) still works */ + uri = g_strdup ("file://c:/my%20music/foo.ogg"); + l = gst_uri_get_location (uri); + fail_unless (l != NULL); + /* fail_unless_equals_string will screw up here in the failure case + * because the string constant will be appended to the printf format + * message string and contains a '%', that's why we use fail_unless here */ + fail_unless (g_str_equal (l, "c:/my music/foo.ogg"), + "wrong location '%s' returned for URI '%s'", l, uri); + g_free (l); + g_free (uri); +} + +GST_END_TEST; + +#endif /* G_OS_WIN32 */ + +static Suite * +gst_uri_suite (void) +{ + Suite *s = suite_create ("GstURI"); + TCase *tc_chain = tcase_create ("uri"); + + tcase_set_timeout (tc_chain, 20); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_protocol_case); + tcase_add_test (tc_chain, test_uri_get_location); +#ifdef G_OS_WIN32 + tcase_add_test (tc_chain, test_win32_uri); +#endif + + return s; +} + +GST_CHECK_MAIN (gst_uri); diff --git a/tests/check/gst/gstutils.c b/tests/check/gst/gstutils.c new file mode 100644 index 0000000..9498c04 --- /dev/null +++ b/tests/check/gst/gstutils.c @@ -0,0 +1,1116 @@ +/* GStreamer + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * Copyright (C) <2006> Tim-Philipp Müller <tim centricular net> + * + * gstutils.c: Unit test for functions in gstutils + * + * 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/check/gstcheck.h> + +#define SPECIAL_POINTER(x) ((void*)(19283847+(x))) + +static int n_data_probes = 0; +static int n_buffer_probes = 0; +static int n_event_probes = 0; + +static GstProbeReturn +probe_do_nothing (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer data) +{ + GstMiniObject *obj = type_data; + GST_DEBUG_OBJECT (pad, "is buffer:%d", GST_IS_BUFFER (obj)); + return GST_PROBE_OK; +} + +static GstProbeReturn +data_probe (GstPad * pad, GstProbeType type, gpointer type_data, gpointer data) +{ + GstMiniObject *obj = type_data; + n_data_probes++; + GST_DEBUG_OBJECT (pad, "data probe %d", n_data_probes); + g_assert (GST_IS_BUFFER (obj) || GST_IS_EVENT (obj)); + g_assert (data == SPECIAL_POINTER (0)); + return GST_PROBE_OK; +} + +static GstProbeReturn +buffer_probe (GstPad * pad, GstProbeType type, gpointer type_data, + gpointer data) +{ + GstBuffer *obj = type_data; + n_buffer_probes++; + GST_DEBUG_OBJECT (pad, "buffer probe %d", n_buffer_probes); + g_assert (GST_IS_BUFFER (obj)); + g_assert (data == SPECIAL_POINTER (1)); + return GST_PROBE_OK; +} + +static GstProbeReturn +event_probe (GstPad * pad, GstProbeType type, gpointer type_data, gpointer data) +{ + GstEvent *obj = type_data; + n_event_probes++; + GST_DEBUG_OBJECT (pad, "event probe %d [%s]", + n_event_probes, GST_EVENT_TYPE_NAME (obj)); + g_assert (GST_IS_EVENT (obj)); + g_assert (data == SPECIAL_POINTER (2)); + return GST_PROBE_OK; +} + +GST_START_TEST (test_buffer_probe_n_times) +{ + GstElement *pipeline, *fakesrc, *fakesink; + GstBus *bus; + GstMessage *message; + GstPad *pad; + + pipeline = gst_element_factory_make ("pipeline", NULL); + fakesrc = gst_element_factory_make ("fakesrc", NULL); + fakesink = gst_element_factory_make ("fakesink", NULL); + + g_object_set (fakesrc, "num-buffers", (int) 10, NULL); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); + gst_element_link (fakesrc, fakesink); + + pad = gst_element_get_static_pad (fakesink, "sink"); + + /* add the probes we need for the test */ + gst_pad_add_probe (pad, GST_PROBE_TYPE_DATA, data_probe, SPECIAL_POINTER (0), + NULL); + gst_pad_add_probe (pad, GST_PROBE_TYPE_BUFFER, buffer_probe, + SPECIAL_POINTER (1), NULL); + gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, event_probe, + SPECIAL_POINTER (2), NULL); + + /* add some string probes just to test that the data is free'd + * properly as it should be */ + gst_pad_add_probe (pad, GST_PROBE_TYPE_DATA, probe_do_nothing, + g_strdup ("data probe string"), (GDestroyNotify) g_free); + gst_pad_add_probe (pad, GST_PROBE_TYPE_BUFFER, probe_do_nothing, + g_strdup ("buffer probe string"), (GDestroyNotify) g_free); + gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, probe_do_nothing, + g_strdup ("event probe string"), (GDestroyNotify) g_free); + + gst_object_unref (pad); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + bus = gst_element_get_bus (pipeline); + message = gst_bus_poll (bus, GST_MESSAGE_EOS, -1); + gst_message_unref (message); + gst_object_unref (bus); + + g_assert (n_buffer_probes == 10); /* one for every buffer */ + g_assert (n_event_probes == 3); /* new segment, latency and eos */ + g_assert (n_data_probes == 13); /* duh */ + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); + + /* make sure nothing was sent in addition to the above when shutting down */ + g_assert (n_buffer_probes == 10); /* one for every buffer */ + g_assert (n_event_probes == 3); /* new segment, latency and eos */ + g_assert (n_data_probes == 13); /* duh */ +} GST_END_TEST; + +static int n_data_probes_once = 0; +static int n_buffer_probes_once = 0; +static int n_event_probes_once = 0; + +static GstProbeReturn +data_probe_once (GstPad * pad, GstProbeType type, GstMiniObject * obj, + guint * data) +{ + n_data_probes_once++; + g_assert (GST_IS_BUFFER (obj) || GST_IS_EVENT (obj)); + + gst_pad_remove_probe (pad, *data); + + return GST_PROBE_OK; +} + +static GstProbeReturn +buffer_probe_once (GstPad * pad, GstProbeType type, GstBuffer * obj, + guint * data) +{ + n_buffer_probes_once++; + g_assert (GST_IS_BUFFER (obj)); + + gst_pad_remove_probe (pad, *data); + + return GST_PROBE_OK; +} + +static GstProbeReturn +event_probe_once (GstPad * pad, GstProbeType type, GstEvent * obj, guint * data) +{ + n_event_probes_once++; + g_assert (GST_IS_EVENT (obj)); + + gst_pad_remove_probe (pad, *data); + + return GST_PROBE_OK; +} + +GST_START_TEST (test_buffer_probe_once) +{ + GstElement *pipeline, *fakesrc, *fakesink; + GstBus *bus; + GstMessage *message; + GstPad *pad; + guint id1, id2, id3; + + pipeline = gst_element_factory_make ("pipeline", NULL); + fakesrc = gst_element_factory_make ("fakesrc", NULL); + fakesink = gst_element_factory_make ("fakesink", NULL); + + g_object_set (fakesrc, "num-buffers", (int) 10, NULL); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); + gst_element_link (fakesrc, fakesink); + + pad = gst_element_get_static_pad (fakesink, "sink"); + id1 = + gst_pad_add_probe (pad, GST_PROBE_TYPE_DATA, + (GstPadProbeCallback) data_probe_once, &id1, NULL); + id2 = + gst_pad_add_probe (pad, GST_PROBE_TYPE_BUFFER, + (GstPadProbeCallback) buffer_probe_once, &id2, NULL); + id3 = + gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) event_probe_once, &id3, NULL); + gst_object_unref (pad); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + bus = gst_element_get_bus (pipeline); + message = gst_bus_poll (bus, GST_MESSAGE_EOS, -1); + gst_message_unref (message); + gst_object_unref (bus); + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); + + g_assert (n_buffer_probes_once == 1); /* can we hit it and quit? */ + g_assert (n_event_probes_once == 1); /* i said, can we hit it and quit? */ + g_assert (n_data_probes_once == 1); /* let's hit it and quit!!! */ +} GST_END_TEST; + +GST_START_TEST (test_math_scale) +{ + fail_if (gst_util_uint64_scale_int (1, 1, 1) != 1); + + fail_if (gst_util_uint64_scale_int (10, 10, 1) != 100); + fail_if (gst_util_uint64_scale_int (10, 10, 2) != 50); + + fail_if (gst_util_uint64_scale_int (0, 10, 2) != 0); + fail_if (gst_util_uint64_scale_int (0, 0, 2) != 0); + + fail_if (gst_util_uint64_scale_int (G_MAXUINT32, 5, 1) != G_MAXUINT32 * 5LL); + fail_if (gst_util_uint64_scale_int (G_MAXUINT32, 10, 2) != G_MAXUINT32 * 5LL); + + fail_if (gst_util_uint64_scale_int (G_MAXUINT32, 1, 5) != G_MAXUINT32 / 5LL); + fail_if (gst_util_uint64_scale_int (G_MAXUINT32, 2, 10) != G_MAXUINT32 / 5LL); + + /* not quite overflow */ + fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 1, 10, + 10) != G_MAXUINT64 - 1); + fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 1, G_MAXINT32, + G_MAXINT32) != G_MAXUINT64 - 1); + fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 100, G_MAXINT32, + G_MAXINT32) != G_MAXUINT64 - 100); + + /* overflow */ + fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 1, 10, 1) != G_MAXUINT64); + fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 1, G_MAXINT32, + 1) != G_MAXUINT64); + +} GST_END_TEST; + +GST_START_TEST (test_math_scale_round) +{ + fail_if (gst_util_uint64_scale_int_round (2, 1, 2) != 1); + fail_if (gst_util_uint64_scale_int_round (3, 1, 2) != 2); + fail_if (gst_util_uint64_scale_int_round (4, 1, 2) != 2); + + fail_if (gst_util_uint64_scale_int_round (200, 100, 20000) != 1); + fail_if (gst_util_uint64_scale_int_round (299, 100, 20000) != 1); + fail_if (gst_util_uint64_scale_int_round (300, 100, 20000) != 2); + fail_if (gst_util_uint64_scale_int_round (301, 100, 20000) != 2); + fail_if (gst_util_uint64_scale_int_round (400, 100, 20000) != 2); +} GST_END_TEST; + +GST_START_TEST (test_math_scale_ceil) +{ + fail_if (gst_util_uint64_scale_int_ceil (2, 1, 2) != 1); + fail_if (gst_util_uint64_scale_int_ceil (3, 1, 2) != 2); + fail_if (gst_util_uint64_scale_int_ceil (4, 1, 2) != 2); + + fail_if (gst_util_uint64_scale_int_ceil (200, 100, 20000) != 1); + fail_if (gst_util_uint64_scale_int_ceil (299, 100, 20000) != 2); + fail_if (gst_util_uint64_scale_int_ceil (300, 100, 20000) != 2); + fail_if (gst_util_uint64_scale_int_ceil (301, 100, 20000) != 2); + fail_if (gst_util_uint64_scale_int_ceil (400, 100, 20000) != 2); +} GST_END_TEST; + +GST_START_TEST (test_math_scale_uint64) +{ + fail_if (gst_util_uint64_scale (1, 1, 1) != 1); + + fail_if (gst_util_uint64_scale (10, 10, 1) != 100); + fail_if (gst_util_uint64_scale (10, 10, 2) != 50); + + fail_if (gst_util_uint64_scale (0, 10, 2) != 0); + fail_if (gst_util_uint64_scale (0, 0, 2) != 0); + + fail_if (gst_util_uint64_scale (G_MAXUINT32, 5, 1) != G_MAXUINT32 * 5LL); + fail_if (gst_util_uint64_scale (G_MAXUINT32, 10, 2) != G_MAXUINT32 * 5LL); + + fail_if (gst_util_uint64_scale (G_MAXUINT32, 1, 5) != G_MAXUINT32 / 5LL); + fail_if (gst_util_uint64_scale (G_MAXUINT32, 2, 10) != G_MAXUINT32 / 5LL); + + /* not quite overflow */ + fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, 10, 10) != G_MAXUINT64 - 1); + fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, G_MAXUINT32, + G_MAXUINT32) != G_MAXUINT64 - 1); + fail_if (gst_util_uint64_scale (G_MAXUINT64 - 100, G_MAXUINT32, + G_MAXUINT32) != G_MAXUINT64 - 100); + + fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, 10, 10) != G_MAXUINT64 - 1); + fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, G_MAXUINT64, + G_MAXUINT64) != G_MAXUINT64 - 1); + fail_if (gst_util_uint64_scale (G_MAXUINT64 - 100, G_MAXUINT64, + G_MAXUINT64) != G_MAXUINT64 - 100); + + /* overflow */ + fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, 10, 1) != G_MAXUINT64); + fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, G_MAXUINT64, + 1) != G_MAXUINT64); + +} GST_END_TEST; + +GST_START_TEST (test_math_scale_random) +{ + guint64 val, num, denom, res; + GRand *rand; + gint i; + + rand = g_rand_new (); + + i = 100000; + while (i--) { + guint64 check, diff; + + val = ((guint64) g_rand_int (rand)) << 32 | g_rand_int (rand); + num = ((guint64) g_rand_int (rand)) << 32 | g_rand_int (rand); + denom = ((guint64) g_rand_int (rand)) << 32 | g_rand_int (rand); + + res = gst_util_uint64_scale (val, num, denom); + check = gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) * + gst_guint64_to_gdouble (num) / gst_guint64_to_gdouble (denom)); + + if (res < G_MAXUINT64 && check < G_MAXUINT64) { + if (res > check) + diff = res - check; + else + diff = check - res; + + /* some arbitrary value, really.. someone do the proper math to get + * the upper bound */ + if (diff > 20000) + fail_if (diff > 20000); + } + } + g_rand_free (rand); + +} + +GST_END_TEST; + +GST_START_TEST (test_guint64_to_gdouble) +{ + guint64 from[] = { 0, 1, 100, 10000, (guint64) (1) << 63, + ((guint64) (1) << 63) + 1, + ((guint64) (1) << 63) + (G_GINT64_CONSTANT (1) << 62) + }; + gdouble to[] = { 0., 1., 100., 10000., 9223372036854775808., + 9223372036854775809., 13835058055282163712. + }; + gdouble tolerance[] = { 0., 0., 0., 0., 0., 1., 1. }; + gint i; + gdouble result; + gdouble delta; + + for (i = 0; i < G_N_ELEMENTS (from); ++i) { + result = gst_util_guint64_to_gdouble (from[i]); + delta = ABS (to[i] - result); + fail_unless (delta <= tolerance[i], + "Could not convert %d: %" G_GUINT64_FORMAT + " -> %f, got %f instead, delta of %e with tolerance of %e", + i, from[i], to[i], result, delta, tolerance[i]); + } +} + +GST_END_TEST; + +GST_START_TEST (test_gdouble_to_guint64) +{ + gdouble from[] = { 0., 1., 100., 10000., 9223372036854775808., + 9223372036854775809., 13835058055282163712. + }; + guint64 to[] = { 0, 1, 100, 10000, (guint64) (1) << 63, + ((guint64) (1) << 63) + 1, + ((guint64) (1) << 63) + (G_GINT64_CONSTANT (1) << 62) + }; + guint64 tolerance[] = { 0, 0, 0, 0, 0, 1, 1 }; + gint i; + gdouble result; + guint64 delta; + + for (i = 0; i < G_N_ELEMENTS (from); ++i) { + result = gst_util_gdouble_to_guint64 (from[i]); + delta = ABS (to[i] - result); + fail_unless (delta <= tolerance[i], + "Could not convert %f: %" G_GUINT64_FORMAT + " -> %d, got %d instead, delta of %e with tolerance of %e", + i, from[i], to[i], result, delta, tolerance[i]); + } +} + +GST_END_TEST; + +#ifndef GST_DISABLE_PARSE +GST_START_TEST (test_parse_bin_from_description) +{ + struct + { + const gchar *bin_desc; + const gchar *pad_names; + } bin_tests[] = { + { + "identity", "identity0/sink,identity0/src"}, { + "identity ! identity ! identity", "identity1/sink,identity3/src"}, { + "identity ! fakesink", "identity4/sink"}, { + "fakesrc ! identity", "identity5/src"}, { + "fakesrc ! fakesink", ""} + }; + gint i; + + for (i = 0; i < G_N_ELEMENTS (bin_tests); ++i) { + GstElement *bin, *parent; + GString *s; + GstPad *ghost_pad, *target_pad; + GError *err = NULL; + + bin = gst_parse_bin_from_description (bin_tests[i].bin_desc, TRUE, &err); + if (err) { + g_error ("ERROR in gst_parse_bin_from_description (%s): %s", + bin_tests[i].bin_desc, err->message); + } + g_assert (bin != NULL); + + s = g_string_new (""); + if ((ghost_pad = gst_element_get_static_pad (bin, "sink"))) { + g_assert (GST_IS_GHOST_PAD (ghost_pad)); + + target_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (ghost_pad)); + g_assert (target_pad != NULL); + g_assert (GST_IS_PAD (target_pad)); + + parent = gst_pad_get_parent_element (target_pad); + g_assert (parent != NULL); + + g_string_append_printf (s, "%s/sink", GST_ELEMENT_NAME (parent)); + + gst_object_unref (parent); + gst_object_unref (target_pad); + gst_object_unref (ghost_pad); + } + + if ((ghost_pad = gst_element_get_static_pad (bin, "src"))) { + g_assert (GST_IS_GHOST_PAD (ghost_pad)); + + target_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (ghost_pad)); + g_assert (target_pad != NULL); + g_assert (GST_IS_PAD (target_pad)); + + parent = gst_pad_get_parent_element (target_pad); + g_assert (parent != NULL); + + if (s->len > 0) { + g_string_append (s, ","); + } + + g_string_append_printf (s, "%s/src", GST_ELEMENT_NAME (parent)); + + gst_object_unref (parent); + gst_object_unref (target_pad); + gst_object_unref (ghost_pad); + } + + if (strcmp (s->str, bin_tests[i].pad_names) != 0) { + g_error ("FAILED: expected '%s', got '%s' for bin '%s'", + bin_tests[i].pad_names, s->str, bin_tests[i].bin_desc); + } + g_string_free (s, TRUE); + + gst_object_unref (bin); + } +} + +GST_END_TEST; +#endif + +GST_START_TEST (test_element_found_tags) +{ + GstElement *pipeline, *fakesrc, *fakesink; + GstTagList *list; + GstBus *bus; + GstMessage *message; + + pipeline = gst_element_factory_make ("pipeline", NULL); + fakesrc = gst_element_factory_make ("fakesrc", NULL); + fakesink = gst_element_factory_make ("fakesink", NULL); + list = gst_tag_list_new (); + + g_object_set (fakesrc, "num-buffers", (int) 10, NULL); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); + gst_element_link (fakesrc, fakesink); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + gst_element_found_tags (GST_ELEMENT (fakesrc), list); + + bus = gst_element_get_bus (pipeline); + message = gst_bus_poll (bus, GST_MESSAGE_EOS, -1); + gst_message_unref (message); + gst_object_unref (bus); + + /* FIXME: maybe also check if the fakesink receives the message */ + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_element_unlink) +{ + GstElement *src, *sink; + + src = gst_element_factory_make ("fakesrc", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + fail_unless (gst_element_link (src, sink) != FALSE); + gst_element_unlink (src, sink); + gst_object_unref (src); + gst_object_unref (sink); +} + +GST_END_TEST; + +GST_START_TEST (test_set_value_from_string) +{ + GValue val = { 0, }; + + /* g_return_if_fail */ + ASSERT_CRITICAL (gst_util_set_value_from_string (NULL, "xyz")); + + g_value_init (&val, G_TYPE_STRING); + ASSERT_CRITICAL (gst_util_set_value_from_string (&val, NULL)); + g_value_unset (&val); + + /* string => string */ + g_value_init (&val, G_TYPE_STRING); + gst_util_set_value_from_string (&val, "Y00"); + fail_unless (g_value_get_string (&val) != NULL); + fail_unless_equals_string (g_value_get_string (&val), "Y00"); + g_value_unset (&val); + + /* string => int */ + g_value_init (&val, G_TYPE_INT); + gst_util_set_value_from_string (&val, "987654321"); + fail_unless (g_value_get_int (&val) == 987654321); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_INT); + ASSERT_CRITICAL (gst_util_set_value_from_string (&val, "xyz")); + g_value_unset (&val); + + /* string => uint */ + g_value_init (&val, G_TYPE_UINT); + gst_util_set_value_from_string (&val, "987654321"); + fail_unless (g_value_get_uint (&val) == 987654321); + g_value_unset (&val); + + /* CHECKME: is this really desired behaviour? (tpm) */ + g_value_init (&val, G_TYPE_UINT); + gst_util_set_value_from_string (&val, "-999"); + fail_unless (g_value_get_uint (&val) == ((guint) 0 - (guint) 999)); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_UINT); + ASSERT_CRITICAL (gst_util_set_value_from_string (&val, "xyz")); + g_value_unset (&val); + + /* string => long */ + g_value_init (&val, G_TYPE_LONG); + gst_util_set_value_from_string (&val, "987654321"); + fail_unless (g_value_get_long (&val) == 987654321); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_LONG); + ASSERT_CRITICAL (gst_util_set_value_from_string (&val, "xyz")); + g_value_unset (&val); + + /* string => ulong */ + g_value_init (&val, G_TYPE_ULONG); + gst_util_set_value_from_string (&val, "987654321"); + fail_unless (g_value_get_ulong (&val) == 987654321); + g_value_unset (&val); + + /* CHECKME: is this really desired behaviour? (tpm) */ + g_value_init (&val, G_TYPE_ULONG); + gst_util_set_value_from_string (&val, "-999"); + fail_unless (g_value_get_ulong (&val) == ((gulong) 0 - (gulong) 999)); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_ULONG); + ASSERT_CRITICAL (gst_util_set_value_from_string (&val, "xyz")); + g_value_unset (&val); + + /* string => boolean */ + g_value_init (&val, G_TYPE_BOOLEAN); + gst_util_set_value_from_string (&val, "true"); + fail_unless_equals_int (g_value_get_boolean (&val), TRUE); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_BOOLEAN); + gst_util_set_value_from_string (&val, "TRUE"); + fail_unless_equals_int (g_value_get_boolean (&val), TRUE); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_BOOLEAN); + gst_util_set_value_from_string (&val, "false"); + fail_unless_equals_int (g_value_get_boolean (&val), FALSE); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_BOOLEAN); + gst_util_set_value_from_string (&val, "FALSE"); + fail_unless_equals_int (g_value_get_boolean (&val), FALSE); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_BOOLEAN); + gst_util_set_value_from_string (&val, "bleh"); + fail_unless_equals_int (g_value_get_boolean (&val), FALSE); + g_value_unset (&val); + +#if 0 + /* string => float (yay, localisation issues involved) */ + g_value_init (&val, G_TYPE_FLOAT); + gst_util_set_value_from_string (&val, "987.654"); + fail_unless (g_value_get_float (&val) >= 987.653 && + g_value_get_float (&val) <= 987.655); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_FLOAT); + gst_util_set_value_from_string (&val, "987,654"); + fail_unless (g_value_get_float (&val) >= 987.653 && + g_value_get_float (&val) <= 987.655); + g_value_unset (&val); + + /* string => double (yay, localisation issues involved) */ + g_value_init (&val, G_TYPE_DOUBLE); + gst_util_set_value_from_string (&val, "987.654"); + fail_unless (g_value_get_double (&val) >= 987.653 && + g_value_get_double (&val) <= 987.655); + g_value_unset (&val); + + g_value_init (&val, G_TYPE_DOUBLE); + gst_util_set_value_from_string (&val, "987,654"); + fail_unless (g_value_get_double (&val) >= 987.653 && + g_value_get_double (&val) <= 987.655); + g_value_unset (&val); +#endif +} + +GST_END_TEST; + +static gint +_binary_search_compare (guint32 * a, guint32 * b) +{ + return *a - *b; +} + +GST_START_TEST (test_binary_search) +{ + guint32 data[257]; + guint32 *match; + guint32 search_element = 121 * 2; + guint i; + + for (i = 0; i < 257; i++) + data[i] = (i + 1) * 2; + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_EXACT, + &search_element, NULL); + fail_unless (match != NULL); + fail_unless_equals_int (match - data, 120); + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_BEFORE, + &search_element, NULL); + fail_unless (match != NULL); + fail_unless_equals_int (match - data, 120); + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_AFTER, + &search_element, NULL); + fail_unless (match != NULL); + fail_unless_equals_int (match - data, 120); + + search_element = 0; + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_EXACT, + &search_element, NULL); + fail_unless (match == NULL); + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_AFTER, + &search_element, NULL); + fail_unless (match != NULL); + fail_unless_equals_int (match - data, 0); + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_BEFORE, + &search_element, NULL); + fail_unless (match == NULL); + + search_element = 1000; + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_EXACT, + &search_element, NULL); + fail_unless (match == NULL); + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_AFTER, + &search_element, NULL); + fail_unless (match == NULL); + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_BEFORE, + &search_element, NULL); + fail_unless (match != NULL); + fail_unless_equals_int (match - data, 256); + + search_element = 121 * 2 - 1; + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_EXACT, + &search_element, NULL); + fail_unless (match == NULL); + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_AFTER, + &search_element, NULL); + fail_unless (match != NULL); + fail_unless_equals_int (match - data, 120); + + match = + (guint32 *) gst_util_array_binary_search (data, 257, sizeof (guint32), + (GCompareDataFunc) _binary_search_compare, GST_SEARCH_MODE_BEFORE, + &search_element, NULL); + fail_unless (match != NULL); + fail_unless_equals_int (match - data, 119); + +} + +GST_END_TEST; + +#ifdef HAVE_GSL +#ifdef HAVE_GMP + +#include <gsl/gsl_rng.h> +#include <gmp.h> + +static guint64 +randguint64 (gsl_rng * rng, guint64 n) +{ + union + { + guint64 x; + struct + { + guint16 a, b, c, d; + } parts; + } x; + x.parts.a = gsl_rng_uniform_int (rng, 1 << 16); + x.parts.b = gsl_rng_uniform_int (rng, 1 << 16); + x.parts.c = gsl_rng_uniform_int (rng, 1 << 16); + x.parts.d = gsl_rng_uniform_int (rng, 1 << 16); + return x.x % n; +} + + +enum round_t +{ + ROUND_TONEAREST = 0, + ROUND_UP, + ROUND_DOWN +}; + +static void +gmp_set_uint64 (mpz_t mp, guint64 x) +{ + mpz_t two_32, tmp; + + mpz_init (two_32); + mpz_init (tmp); + + mpz_ui_pow_ui (two_32, 2, 32); + mpz_set_ui (mp, (unsigned long) ((x >> 32) & G_MAXUINT32)); + mpz_mul (tmp, mp, two_32); + mpz_add_ui (mp, tmp, (unsigned long) (x & G_MAXUINT32)); + mpz_clear (two_32); + mpz_clear (tmp); +} + +static guint64 +gmp_get_uint64 (mpz_t mp) +{ + mpz_t two_64, two_32, tmp; + guint64 ret; + + mpz_init (two_64); + mpz_init (two_32); + mpz_init (tmp); + + mpz_ui_pow_ui (two_64, 2, 64); + mpz_ui_pow_ui (two_32, 2, 32); + if (mpz_cmp (tmp, two_64) >= 0) + return G_MAXUINT64; + mpz_clear (two_64); + + mpz_tdiv_q (tmp, mp, two_32); + ret = mpz_get_ui (tmp); + ret <<= 32; + ret |= mpz_get_ui (mp); + mpz_clear (two_32); + mpz_clear (tmp); + + return ret; +} + +static guint64 +gmp_scale (guint64 x, guint64 a, guint64 b, enum round_t mode) +{ + mpz_t mp1, mp2, mp3; + if (!b) + /* overflow */ + return G_MAXUINT64; + mpz_init (mp1); + mpz_init (mp2); + mpz_init (mp3); + + gmp_set_uint64 (mp1, x); + gmp_set_uint64 (mp3, a); + mpz_mul (mp2, mp1, mp3); + switch (mode) { + case ROUND_TONEAREST: + gmp_set_uint64 (mp1, b); + mpz_tdiv_q_ui (mp3, mp1, 2); + mpz_add (mp1, mp2, mp3); + mpz_set (mp2, mp1); + break; + case ROUND_UP: + gmp_set_uint64 (mp1, b); + mpz_sub_ui (mp3, mp1, 1); + mpz_add (mp1, mp2, mp3); + mpz_set (mp2, mp1); + break; + case ROUND_DOWN: + break; + } + gmp_set_uint64 (mp3, b); + mpz_tdiv_q (mp1, mp2, mp3); + x = gmp_get_uint64 (mp1); + mpz_clear (mp1); + mpz_clear (mp2); + mpz_clear (mp3); + return x; +} + +static void +_gmp_test_scale (gsl_rng * rng) +{ + guint64 bygst, bygmp; + guint64 a = randguint64 (rng, gsl_rng_uniform_int (rng, + 2) ? G_MAXUINT64 : G_MAXUINT32); + guint64 b = randguint64 (rng, gsl_rng_uniform_int (rng, 2) ? G_MAXUINT64 - 1 : G_MAXUINT32 - 1) + 1; /* 0 not allowed */ + guint64 val = randguint64 (rng, gmp_scale (G_MAXUINT64, b, a, ROUND_DOWN)); + enum round_t mode = gsl_rng_uniform_int (rng, 3); + const char *func; + + bygmp = gmp_scale (val, a, b, mode); + switch (mode) { + case ROUND_TONEAREST: + bygst = gst_util_uint64_scale_round (val, a, b); + func = "gst_util_uint64_scale_round"; + break; + case ROUND_UP: + bygst = gst_util_uint64_scale_ceil (val, a, b); + func = "gst_util_uint64_scale_ceil"; + break; + case ROUND_DOWN: + bygst = gst_util_uint64_scale (val, a, b); + func = "gst_util_uint64_scale"; + break; + default: + g_assert_not_reached (); + break; + } + fail_unless (bygst == bygmp, + "error: %s(): %" G_GUINT64_FORMAT " * %" G_GUINT64_FORMAT " / %" + G_GUINT64_FORMAT " = %" G_GUINT64_FORMAT ", correct = %" G_GUINT64_FORMAT + "\n", func, val, a, b, bygst, bygmp); +} + +static void +_gmp_test_scale_int (gsl_rng * rng) +{ + guint64 bygst, bygmp; + gint32 a = randguint64 (rng, G_MAXINT32); + gint32 b = randguint64 (rng, G_MAXINT32 - 1) + 1; /* 0 not allowed */ + guint64 val = randguint64 (rng, gmp_scale (G_MAXUINT64, b, a, ROUND_DOWN)); + enum round_t mode = gsl_rng_uniform_int (rng, 3); + const char *func; + + bygmp = gmp_scale (val, a, b, mode); + switch (mode) { + case ROUND_TONEAREST: + bygst = gst_util_uint64_scale_int_round (val, a, b); + func = "gst_util_uint64_scale_int_round"; + break; + case ROUND_UP: + bygst = gst_util_uint64_scale_int_ceil (val, a, b); + func = "gst_util_uint64_scale_int_ceil"; + break; + case ROUND_DOWN: + bygst = gst_util_uint64_scale_int (val, a, b); + func = "gst_util_uint64_scale_int"; + break; + default: + g_assert_not_reached (); + break; + } + fail_unless (bygst == bygmp, + "error: %s(): %" G_GUINT64_FORMAT " * %d / %d = %" G_GUINT64_FORMAT + ", correct = %" G_GUINT64_FORMAT "\n", func, val, a, b, bygst, bygmp); +} + +#define GMP_TEST_RUNS 100000 + +GST_START_TEST (test_math_scale_gmp) +{ + gsl_rng *rng = gsl_rng_alloc (gsl_rng_mt19937); + gint n; + + for (n = 0; n < GMP_TEST_RUNS; n++) + _gmp_test_scale (rng); + + gsl_rng_free (rng); +} + +GST_END_TEST; + +GST_START_TEST (test_math_scale_gmp_int) +{ + gsl_rng *rng = gsl_rng_alloc (gsl_rng_mt19937); + gint n; + + for (n = 0; n < GMP_TEST_RUNS; n++) + _gmp_test_scale_int (rng); + + gsl_rng_free (rng); +} + +GST_END_TEST; + +#endif +#endif + +GST_START_TEST (test_pad_proxy_getcaps_aggregation) +{ + GstElement *tee, *sink1, *sink2; + GstCaps *caps; + GstPad *tee_src1, *tee_src2, *tee_sink, *sink1_sink, *sink2_sink; + + tee = gst_element_factory_make ("tee", "tee"); + + sink1 = gst_element_factory_make ("fakesink", "sink1"); + tee_src1 = gst_element_get_request_pad (tee, "src%d"); + sink1_sink = gst_element_get_static_pad (sink1, "sink"); + fail_unless_equals_int (gst_pad_link (tee_src1, sink1_sink), GST_PAD_LINK_OK); + + sink2 = gst_element_factory_make ("fakesink", "sink2"); + tee_src2 = gst_element_get_request_pad (tee, "src%d"); + sink2_sink = gst_element_get_static_pad (sink2, "sink"); + fail_unless_equals_int (gst_pad_link (tee_src2, sink2_sink), GST_PAD_LINK_OK); + + tee_sink = gst_element_get_static_pad (tee, "sink"); + + gst_element_set_state (sink1, GST_STATE_PAUSED); + gst_element_set_state (sink2, GST_STATE_PAUSED); + gst_element_set_state (tee, GST_STATE_PAUSED); + + /* by default, ANY caps should intersect to ANY */ + caps = gst_pad_get_caps (tee_sink, NULL); + GST_INFO ("got caps: %" GST_PTR_FORMAT, caps); + fail_unless (caps != NULL); + fail_unless (gst_caps_is_any (caps)); + gst_caps_unref (caps); + + /* these don't intersect we should get empty caps */ + caps = gst_caps_new_simple ("foo/bar", NULL); + fail_unless (gst_pad_set_caps (sink1_sink, caps)); + gst_pad_use_fixed_caps (sink1_sink); + gst_caps_unref (caps); + + caps = gst_caps_new_simple ("bar/ter", NULL); + fail_unless (gst_pad_set_caps (sink2_sink, caps)); + gst_pad_use_fixed_caps (sink2_sink); + gst_caps_unref (caps); + + caps = gst_pad_get_caps (tee_sink, NULL); + GST_INFO ("got caps: %" GST_PTR_FORMAT, caps); + fail_unless (caps != NULL); + fail_unless (gst_caps_is_empty (caps)); + gst_caps_unref (caps); + + /* test intersection */ + caps = gst_caps_new_simple ("foo/bar", "barversion", G_TYPE_INT, 1, NULL); + fail_unless (gst_pad_set_caps (sink2_sink, caps)); + gst_pad_use_fixed_caps (sink2_sink); + gst_caps_unref (caps); + + caps = gst_pad_get_caps (tee_sink, NULL); + GST_INFO ("got caps: %" GST_PTR_FORMAT, caps); + fail_unless (caps != NULL); + fail_if (gst_caps_is_empty (caps)); + { + GstStructure *s = gst_caps_get_structure (caps, 0); + + fail_unless_equals_string (gst_structure_get_name (s), "foo/bar"); + fail_unless (gst_structure_has_field_typed (s, "barversion", G_TYPE_INT)); + } + gst_caps_unref (caps); + + gst_element_set_state (sink1, GST_STATE_NULL); + gst_element_set_state (sink2, GST_STATE_NULL); + gst_element_set_state (tee, GST_STATE_NULL); + + /* clean up */ + gst_element_release_request_pad (tee, tee_src1); + gst_object_unref (tee_src1); + gst_element_release_request_pad (tee, tee_src2); + gst_object_unref (tee_src2); + gst_object_unref (tee_sink); + gst_object_unref (tee); + gst_object_unref (sink1_sink); + gst_object_unref (sink1); + gst_object_unref (sink2_sink); + gst_object_unref (sink2); +} + +GST_END_TEST; + +GST_START_TEST (test_greatest_common_divisor) +{ + fail_if (gst_util_greatest_common_divisor (1, 1) != 1); + fail_if (gst_util_greatest_common_divisor (2, 3) != 1); + fail_if (gst_util_greatest_common_divisor (3, 5) != 1); + fail_if (gst_util_greatest_common_divisor (-1, 1) != 1); + fail_if (gst_util_greatest_common_divisor (-2, 3) != 1); + fail_if (gst_util_greatest_common_divisor (-3, 5) != 1); + fail_if (gst_util_greatest_common_divisor (-1, -1) != 1); + fail_if (gst_util_greatest_common_divisor (-2, -3) != 1); + fail_if (gst_util_greatest_common_divisor (-3, -5) != 1); + fail_if (gst_util_greatest_common_divisor (1, -1) != 1); + fail_if (gst_util_greatest_common_divisor (2, -3) != 1); + fail_if (gst_util_greatest_common_divisor (3, -5) != 1); + fail_if (gst_util_greatest_common_divisor (2, 2) != 2); + fail_if (gst_util_greatest_common_divisor (2, 4) != 2); + fail_if (gst_util_greatest_common_divisor (1001, 11) != 11); + +} + +GST_END_TEST; + +static Suite * +gst_utils_suite (void) +{ + Suite *s = suite_create ("GstUtils"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_buffer_probe_n_times); + tcase_add_test (tc_chain, test_buffer_probe_once); + tcase_add_test (tc_chain, test_math_scale); + tcase_add_test (tc_chain, test_math_scale_round); + tcase_add_test (tc_chain, test_math_scale_ceil); + tcase_add_test (tc_chain, test_math_scale_uint64); + tcase_add_test (tc_chain, test_math_scale_random); +#ifdef HAVE_GSL +#ifdef HAVE_GMP + tcase_add_test (tc_chain, test_math_scale_gmp); + tcase_add_test (tc_chain, test_math_scale_gmp_int); +#endif +#endif + + tcase_add_test (tc_chain, test_guint64_to_gdouble); + tcase_add_test (tc_chain, test_gdouble_to_guint64); +#ifndef GST_DISABLE_PARSE + tcase_add_test (tc_chain, test_parse_bin_from_description); +#endif + tcase_add_test (tc_chain, test_element_found_tags); + tcase_add_test (tc_chain, test_element_unlink); + tcase_add_test (tc_chain, test_set_value_from_string); + tcase_add_test (tc_chain, test_binary_search); + + tcase_add_test (tc_chain, test_pad_proxy_getcaps_aggregation); + tcase_add_test (tc_chain, test_greatest_common_divisor); + return s; +} + +GST_CHECK_MAIN (gst_utils); diff --git a/tests/check/gst/gstvalue.c b/tests/check/gst/gstvalue.c new file mode 100644 index 0000000..11a5584 --- /dev/null +++ b/tests/check/gst/gstvalue.c @@ -0,0 +1,2545 @@ +/* GStreamer + * Copyright (C) <2004> David Schleef <david at schleef dot org> + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * + * gstvalue.c: Unit tests for GstValue + * + * 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 <gst/check/gstcheck.h> + + +GST_START_TEST (test_deserialize_buffer) +{ + GValue value = { 0 }; + GstBuffer *buf; + + g_value_init (&value, GST_TYPE_BUFFER); + fail_unless (gst_value_deserialize (&value, "1234567890abcdef")); + /* does not increase the refcount */ + buf = GST_BUFFER (g_value_get_boxed (&value)); + ASSERT_MINI_OBJECT_REFCOUNT (buf, "buffer", 1); + + /* does not increase the refcount */ + buf = gst_value_get_buffer (&value); + ASSERT_MINI_OBJECT_REFCOUNT (buf, "buffer", 1); + + /* cleanup */ + g_value_unset (&value); +} + +GST_END_TEST; + +/* create and serialize a buffer */ +GST_START_TEST (test_serialize_buffer) +{ + GValue value = { 0 }; + GstBuffer *buf; + gchar *serialized; + static const char *buf_data = "1234567890abcdef"; + gint len; + gpointer data; + + len = strlen (buf_data); + buf = gst_buffer_new_and_alloc (len); + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + memcpy (data, buf_data, len); + gst_buffer_unmap (buf, data, len); + + ASSERT_MINI_OBJECT_REFCOUNT (buf, "buffer", 1); + + /* and assign buffer to mini object */ + g_value_init (&value, GST_TYPE_BUFFER); + gst_value_take_buffer (&value, buf); + ASSERT_MINI_OBJECT_REFCOUNT (buf, "buffer", 1); + + /* now serialize it */ + serialized = gst_value_serialize (&value); + GST_DEBUG ("serialized buffer to %s", serialized); + fail_unless (serialized != NULL); + + /* refcount should not change */ + ASSERT_MINI_OBJECT_REFCOUNT (buf, "buffer", 1); + + /* cleanup */ + g_free (serialized); + g_value_unset (&value); + + /* take NULL buffer */ + g_value_init (&value, GST_TYPE_BUFFER); + GST_DEBUG ("setting NULL buffer"); + gst_value_take_buffer (&value, NULL); + + /* now serialize it */ + GST_DEBUG ("serializing NULL buffer"); + serialized = gst_value_serialize (&value); + /* should return NULL */ + fail_unless (serialized == NULL); + + g_free (serialized); + g_value_unset (&value); +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_gint64) +{ + GValue value = { 0 }; + const char *strings[] = { + "12345678901", + "-12345678901", + "1152921504606846976", + "-1152921504606846976", + }; + gint64 results[] = { + 12345678901LL, + -12345678901LL, + 1152921504606846976LL, + -1152921504606846976LL, + }; + int i; + + g_value_init (&value, G_TYPE_INT64); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_unless (gst_value_deserialize (&value, strings[i]), + "could not deserialize %s (%d)", strings[i], i); + fail_unless (g_value_get_int64 (&value) == results[i], + "resulting value is %" G_GINT64_FORMAT ", not %" G_GINT64_FORMAT + ", for string %s (%d)", g_value_get_int64 (&value), + results[i], strings[i], i); + } +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_guint64) +{ + GValue value = { 0 }; + const char *strings[] = { + "0xffffffffffffffff", + "9223372036854775810", + "-9223372036854775810", + "-1", + "1", + "-0", + }; + guint64 results[] = { + 0xffffffffffffffffULL, + 9223372036854775810ULL, + 9223372036854775806ULL, + (guint64) - 1, + 1, + 0, + }; + int i; + + g_value_init (&value, G_TYPE_UINT64); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_unless (gst_value_deserialize (&value, strings[i]), + "could not deserialize %s (%d)", strings[i], i); + fail_unless (g_value_get_uint64 (&value) == results[i], + "resulting value is %" G_GUINT64_FORMAT ", not %" G_GUINT64_FORMAT + ", for string %s (%d)", g_value_get_uint64 (&value), + results[i], strings[i], i); + } +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_guchar) +{ + GValue value = { 0 }; + const char *strings[] = { + "0xff", + "255", + "-1", + "1", + "-0", + }; + guchar results[] = { + 0xff, + 255, + (guchar) - 1, + 1, + 0, + }; + int i; + + g_value_init (&value, G_TYPE_UCHAR); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_unless (gst_value_deserialize (&value, strings[i]), + "could not deserialize %s (%d)", strings[i], i); + fail_unless (g_value_get_uchar (&value) == results[i], + "resulting value is %u not %u, for string %s (%d)", + g_value_get_uchar (&value), results[i], strings[i], i); + } + + /* test serialisation as well while we're at it */ + { + gchar *str; + GValue value = { 0 }; + g_value_init (&value, G_TYPE_UCHAR); + + g_value_set_uchar (&value, 255); + str = gst_value_serialize (&value); + + fail_unless_equals_string (str, "255"); + g_free (str); + } +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_gstfraction) +{ + GValue value = { 0 }; + const char *strings[] = { + "4/5", + "-8/9" + }; + gint64 result_numers[] = { + 4, + -8 + }; + gint64 result_denoms[] = { + 5, + 9 + }; + + int i; + + g_value_init (&value, GST_TYPE_FRACTION); + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_unless (gst_value_deserialize (&value, strings[i]), + "could not deserialize %s (%d)", strings[i], i); + fail_unless (gst_value_get_fraction_numerator (&value) == result_numers[i], + "resulting numerator value is %d, not %d" + ", for string %s (%d)", gst_value_get_fraction_numerator (&value), + result_numers[i], strings[i], i); + fail_unless (gst_value_get_fraction_denominator (&value) == + result_denoms[i], "resulting denominator value is %d, not %d" + ", for string %s (%d)", gst_value_get_fraction_denominator (&value), + result_denoms[i], strings[i], i); + } +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_gint) +{ + GValue value = { 0 }; + const char *strings[] = { + "123456", + "-123456", + "0xFFFF", + "0x0000FFFF", + /* a positive long long, serializing to highest possible positive sint */ + "0x7FFFFFFF", + /* a positive long long, serializing to lowest possible negative sint */ + "0x80000000", + /* a negative long long, serializing to lowest possible negative sint */ + "0xFFFFFFFF80000000", + "0xFF000000", + /* a positive long long serializing to -1 */ + "0xFFFFFFFF", + "0xFFFFFFFF", + /* a negative long long serializing to -1 */ + "0xFFFFFFFFFFFFFFFF", + "0xFFFFFFFFFFFFFFFF", + "0xEFFFFFFF", + }; + /* some casts need to be explicit because of unsigned -> signed */ + gint results[] = { + 123456, + -123456, + 0xFFFF, + 0xFFFF, + 0x7FFFFFFF, + (gint) 0x80000000, + (gint) 0x80000000, + (gint) 0xFF000000, + -1, + (gint) 0xFFFFFFFF, + -1, + (gint) 0xFFFFFFFFFFFFFFFFLL, + (gint) 0xEFFFFFFF, + }; + int i; + + g_value_init (&value, G_TYPE_INT); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_unless (gst_value_deserialize (&value, strings[i]), + "could not deserialize %s (%d)", strings[i], i); + fail_unless (g_value_get_int (&value) == results[i], + "resulting value is %d, not %d, for string %s (%d)", + g_value_get_int (&value), results[i], strings[i], i); + } +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_gint_failures) +{ + GValue value = { 0 }; + const char *strings[] = { + "-", /* not a complete number */ + "- TEST", /* not a complete number */ + "0x0000000100000000", /* lowest long long that cannot fit in 32 bits */ + "0xF000000000000000", + "0xFFFFFFF000000000", + "0xFFFFFFFF00000000", + "0x10000000000000000", /* first number too long to fit into a long long */ + /* invent a new processor first before trying to make this one pass */ + "0x10000000000000000000000000000000000000000000", + }; + int i; + + g_value_init (&value, G_TYPE_INT); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_if (gst_value_deserialize (&value, strings[i]), + "deserialized %s (%d), while it should have failed", strings[i], i); + } +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_guint) +{ + GValue value = { 0 }; + const char *strings[] = { + "123456", + "-123456", + "0xFFFF", + "0x0000FFFF", + /* a positive long long, serializing to highest possible positive sint */ + "0x7FFFFFFF", + /* a positive long long, serializing to lowest possible negative sint */ + "0x80000000", + "2147483648", + /* a negative long long, serializing to lowest possible negative sint */ + "0xFFFFFFFF80000000", + /* a value typically used for rgb masks */ + "0xFF000000", + /* a positive long long serializing to highest possible positive uint */ + "0xFFFFFFFF", + "0xFFFFFFFF", + /* a negative long long serializing to highest possible positive uint */ + "0xFFFFFFFFFFFFFFFF", + "0xEFFFFFFF", + }; + guint results[] = { + 123456, + (guint) - 123456, + 0xFFFF, + 0xFFFF, + 0x7FFFFFFF, + 0x80000000, + (guint) 2147483648LL, + 0x80000000, + 0xFF000000, + 0xFFFFFFFF, + G_MAXUINT, + (guint) 0xFFFFFFFFFFFFFFFFLL, + 0xEFFFFFFF, + }; + int i; + + g_value_init (&value, G_TYPE_UINT); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_unless (gst_value_deserialize (&value, strings[i]), + "could not deserialize %s (%d)", strings[i], i); + fail_unless (g_value_get_uint (&value) == results[i], + "resulting value is %d, not %d, for string %s (%d)", + g_value_get_uint (&value), results[i], strings[i], i); + } +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_guint_failures) +{ + GValue value = { 0 }; + const char *strings[] = { + "-", /* not a complete number */ + "- TEST", /* not a complete number */ +#if 0 +/* FIXME: these values should not be deserializable, since they overflow + * the target format */ + "0x0000000100000000", /* lowest long long that cannot fit in 32 bits */ + "0xF000000000000000", + "0xFFFFFFF000000000", + "0xFFFFFFFF00000000", + "0x10000000000000000", /* first number too long to fit into a long long */ + /* invent a new processor first before trying to make this one pass */ + "0x10000000000000000000000000000000000000000000", +#endif + }; + int i; + + g_value_init (&value, G_TYPE_UINT); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_if (gst_value_deserialize (&value, strings[i]), + "deserialized %s (%d), while it should have failed", strings[i], i); + } +} + +GST_END_TEST; + +GST_START_TEST (test_serialize_flags) +{ + GValue value = { 0 }; + gchar *string; + GstSeekFlags flags[] = { + 0, + GST_SEEK_FLAG_NONE, + GST_SEEK_FLAG_FLUSH, + GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, + }; + const char *results[] = { + "GST_SEEK_FLAG_NONE", + "GST_SEEK_FLAG_NONE", + "GST_SEEK_FLAG_FLUSH", + "GST_SEEK_FLAG_FLUSH+GST_SEEK_FLAG_ACCURATE", + }; + int i; + + g_value_init (&value, GST_TYPE_SEEK_FLAGS); + + for (i = 0; i < G_N_ELEMENTS (flags); ++i) { + g_value_set_flags (&value, flags[i]); + string = gst_value_serialize (&value); + fail_if (string == NULL, "could not serialize flags %d", i); + fail_unless (strcmp (string, results[i]) == 0, + "resulting value is %s, not %s, for flags #%d", string, results[i], i); + g_free (string); + } +} + +GST_END_TEST; + + +GST_START_TEST (test_deserialize_flags) +{ + GValue value = { 0 }; + const char *strings[] = { + "", + "0", + "GST_SEEK_FLAG_NONE", + "GST_SEEK_FLAG_FLUSH", + "GST_SEEK_FLAG_FLUSH+GST_SEEK_FLAG_ACCURATE", + }; + GstSeekFlags results[] = { + GST_SEEK_FLAG_NONE, + GST_SEEK_FLAG_NONE, + GST_SEEK_FLAG_NONE, + GST_SEEK_FLAG_FLUSH, + GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, + }; + int i; + + g_value_init (&value, GST_TYPE_SEEK_FLAGS); + + for (i = 0; i < G_N_ELEMENTS (strings); ++i) { + fail_unless (gst_value_deserialize (&value, strings[i]), + "could not deserialize %s (%d)", strings[i], i); + fail_unless (g_value_get_flags (&value) == results[i], + "resulting value is %d, not %d, for string %s (%d)", + g_value_get_flags (&value), results[i], strings[i], i); + } +} + +GST_END_TEST; + +GST_START_TEST (test_string) +{ + const gchar *try[] = { + "Dude", + "Hi, I'm a string", + "tüüüt!", + "\"\"" /* Empty string */ + }; + gchar *tmp; + GValue v = { 0, }; + guint i; + + g_value_init (&v, G_TYPE_STRING); + for (i = 0; i < G_N_ELEMENTS (try); i++) { + g_value_set_string (&v, try[i]); + tmp = gst_value_serialize (&v); + fail_if (tmp == NULL, "couldn't serialize: %s\n", try[i]); + fail_unless (gst_value_deserialize (&v, tmp), + "couldn't deserialize: %s\n", tmp); + g_free (tmp); + + fail_unless (g_str_equal (g_value_get_string (&v), try[i]), + "\nserialized : %s\ndeserialized: %s", try[i], + g_value_get_string (&v)); + } + /* NULL strings should not be serializable */ + g_value_set_string (&v, NULL); + fail_unless (gst_value_serialize (&v) == NULL); + g_value_unset (&v); +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_string) +{ + struct + { + const gchar *from; + const gchar *to; + } tests[] = { + { + "", ""}, /* empty strings */ + { + "\"\"", ""}, /* quoted empty string -> empty string */ + /* Expected FAILURES: */ + { + "\"", NULL}, /* missing second quote */ + { + "\"Hello\\ World", NULL}, /* missing second quote */ + { + "\"\\", NULL}, /* quote at end, missing second quote */ + { + "\"\\0", NULL}, /* missing second quote */ + { + "\"\\0\"", NULL}, /* unfinished escaped character */ + { + "\" \"", NULL}, /* spaces must be escaped */ +#if 0 + /* FIXME 0.9: this test should fail, but it doesn't */ + { + "tüüt", NULL} /* string with special chars must be escaped */ +#endif + }; + guint i; + GValue v = { 0, }; + + g_value_init (&v, G_TYPE_STRING); + for (i = 0; i < G_N_ELEMENTS (tests); i++) { + if (gst_value_deserialize (&v, tests[i].from)) { + fail_if (tests[i].to == NULL, + "I got %s instead of a failure", g_value_get_string (&v)); + fail_unless (g_str_equal (g_value_get_string (&v), tests[i].to), + "\nwanted: %s\ngot : %s", tests[i].to, g_value_get_string (&v)); + } else { + fail_if (tests[i].to != NULL, "failed, but wanted: %s", tests[i].to); + } + } + g_value_unset (&v); +} + +GST_END_TEST; + +GST_START_TEST (test_value_compare) +{ + GValue value1 = { 0 }; + GValue value2 = { 0 }; + GValue tmp = { 0 }; + + g_value_init (&value1, G_TYPE_INT); + g_value_set_int (&value1, 10); + g_value_init (&value2, G_TYPE_INT); + g_value_set_int (&value2, 20); + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); + fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); + fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); + g_value_unset (&value1); + g_value_unset (&value2); + + g_value_init (&value1, G_TYPE_DOUBLE); + g_value_set_double (&value1, 10); + g_value_init (&value2, G_TYPE_DOUBLE); + g_value_set_double (&value2, 20); + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); + fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); + fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); + g_value_unset (&value1); + g_value_unset (&value2); + + g_value_init (&value1, G_TYPE_STRING); + g_value_set_string (&value1, "a"); + g_value_init (&value2, G_TYPE_STRING); + g_value_set_string (&value2, "b"); + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); + fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); + fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); + /* Test some NULL string comparisons */ + g_value_set_string (&value2, NULL); + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_UNORDERED); + fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_UNORDERED); + fail_unless (gst_value_compare (&value2, &value2) == GST_VALUE_EQUAL); + + g_value_unset (&value1); + g_value_unset (&value2); + + /* comparing 2/3 with 3/4 */ + g_value_init (&value1, GST_TYPE_FRACTION); + gst_value_set_fraction (&value1, 2, 3); + g_value_init (&value2, GST_TYPE_FRACTION); + gst_value_set_fraction (&value2, 3, 4); + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); + fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); + fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); + g_value_unset (&value1); + g_value_unset (&value2); + + /* comparing -4/5 with 2/-3 */ + g_value_init (&value1, GST_TYPE_FRACTION); + gst_value_set_fraction (&value1, -4, 5); + g_value_init (&value2, GST_TYPE_FRACTION); + gst_value_set_fraction (&value2, 2, -3); + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); + fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); + fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); + g_value_unset (&value1); + g_value_unset (&value2); + + /* comparing 10/100 with 200/2000 */ + g_value_init (&value1, GST_TYPE_FRACTION); + gst_value_set_fraction (&value1, 10, 100); + g_value_init (&value2, GST_TYPE_FRACTION); + gst_value_set_fraction (&value2, 200, 2000); + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL); + g_value_unset (&value1); + g_value_unset (&value2); + + /* comparing -4/5 with 2/-3 */ + g_value_init (&value1, GST_TYPE_FRACTION); + gst_value_set_fraction (&value1, -4, 5); + g_value_init (&value2, GST_TYPE_FRACTION); + gst_value_set_fraction (&value2, 2, -3); + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); + fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); + fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); + g_value_unset (&value1); + g_value_unset (&value2); + + /* Check that lists are equal regardless of order */ + g_value_init (&value1, GST_TYPE_LIST); + g_value_init (&tmp, G_TYPE_INT); + g_value_set_int (&tmp, 1); + gst_value_list_append_value (&value1, &tmp); + g_value_set_int (&tmp, 2); + gst_value_list_append_value (&value1, &tmp); + g_value_set_int (&tmp, 3); + gst_value_list_append_value (&value1, &tmp); + g_value_set_int (&tmp, 4); + gst_value_list_append_value (&value1, &tmp); + + g_value_init (&value2, GST_TYPE_LIST); + g_value_set_int (&tmp, 4); + gst_value_list_append_value (&value2, &tmp); + g_value_set_int (&tmp, 3); + gst_value_list_append_value (&value2, &tmp); + g_value_set_int (&tmp, 2); + gst_value_list_append_value (&value2, &tmp); + g_value_set_int (&tmp, 1); + gst_value_list_append_value (&value2, &tmp); + + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL, + "value lists with different order were not equal when they should be"); + fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL, + "value lists with same order were not equal when they should be"); + fail_unless (gst_value_compare (&value2, &value2) == GST_VALUE_EQUAL, + "value lists with same order were not equal when they should be"); + + /* Carry over the lists to this next check: */ + /* Lists with different sizes are unequal */ + g_value_set_int (&tmp, 1); + gst_value_list_append_value (&value2, &tmp); + + fail_if (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL, + "Value lists with different size were equal when they shouldn't be"); + + /* Carry over the lists to this next check: */ + /* Lists with same size but list1 contains one more element not in list2 */ + g_value_set_int (&tmp, 5); + gst_value_list_append_value (&value1, &tmp); + + fail_if (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL, + "Value lists with different elements were equal when they shouldn't be"); + fail_if (gst_value_compare (&value2, &value1) == GST_VALUE_EQUAL, + "Value lists with different elements were equal when they shouldn't be"); + + g_value_unset (&value1); + g_value_unset (&value2); + g_value_unset (&tmp); + + /* Arrays are only equal when in the same order */ + g_value_init (&value1, GST_TYPE_ARRAY); + g_value_init (&tmp, G_TYPE_INT); + g_value_set_int (&tmp, 1); + gst_value_array_append_value (&value1, &tmp); + g_value_set_int (&tmp, 2); + gst_value_array_append_value (&value1, &tmp); + g_value_set_int (&tmp, 3); + gst_value_array_append_value (&value1, &tmp); + g_value_set_int (&tmp, 4); + gst_value_array_append_value (&value1, &tmp); + + g_value_init (&value2, GST_TYPE_ARRAY); + g_value_set_int (&tmp, 4); + gst_value_array_append_value (&value2, &tmp); + g_value_set_int (&tmp, 3); + gst_value_array_append_value (&value2, &tmp); + g_value_set_int (&tmp, 2); + gst_value_array_append_value (&value2, &tmp); + g_value_set_int (&tmp, 1); + gst_value_array_append_value (&value2, &tmp); + + fail_if (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL, + "Value arrays with different order were equal when they shouldn't be"); + fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL, + "Identical value arrays were not equal when they should be"); + fail_unless (gst_value_compare (&value2, &value2) == GST_VALUE_EQUAL, + "Identical value arrays were not equal when they should be"); + + /* Carry over the arrays to this next check: */ + /* Arrays with different sizes are unequal */ + g_value_unset (&value2); + g_value_init (&value2, GST_TYPE_ARRAY); + g_value_copy (&value1, &value2); + + g_value_set_int (&tmp, 1); + gst_value_array_append_value (&value2, &tmp); + + fail_if (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL, + "Value arrays with different size were equal when they shouldn't be"); + /* order should not matter */ + fail_if (gst_value_compare (&value2, &value1) == GST_VALUE_EQUAL, + "Value arrays with different size were equal when they shouldn't be"); + + g_value_unset (&value1); + g_value_unset (&value2); + g_value_unset (&tmp); +} + +GST_END_TEST; + +GST_START_TEST (test_value_intersect) +{ + GValue dest = { 0 }; + GValue src1 = { 0 }; + GValue src2 = { 0 }; + GValue item = { 0 }; + gboolean ret; + + g_value_init (&src1, G_TYPE_INT); + g_value_set_int (&src1, 10); + g_value_init (&src2, G_TYPE_INT); + g_value_set_int (&src2, 20); + ret = gst_value_intersect (&dest, &src1, &src2); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + g_value_init (&src1, G_TYPE_STRING); + g_value_set_string (&src1, "YUY2"); + g_value_init (&src2, GST_TYPE_LIST); + g_value_init (&item, G_TYPE_STRING); + g_value_set_string (&item, "YUY2"); + gst_value_list_append_value (&src2, &item); + g_value_set_string (&item, "I420"); + gst_value_list_append_value (&src2, &item); + g_value_set_string (&item, "ABCD"); + gst_value_list_append_value (&src2, &item); + + fail_unless (gst_value_intersect (&dest, &src1, &src2)); + fail_unless (G_VALUE_HOLDS_STRING (&dest)); + fail_unless (g_str_equal (g_value_get_string (&dest), "YUY2")); + + g_value_unset (&src1); + g_value_unset (&src2); +} + +GST_END_TEST; + + +GST_START_TEST (test_value_subtract_int) +{ + GValue dest = { 0 }; + GValue src1 = { 0 }; + GValue src2 = { 0 }; + const GValue *tmp; + gboolean ret; + + /* int <-> int + */ + g_value_init (&src1, G_TYPE_INT); + g_value_set_int (&src1, 10); + g_value_init (&src2, G_TYPE_INT); + g_value_set_int (&src2, 20); + /* subtract as in sets, result is 10 */ + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* same values, yields empty set */ + ret = gst_value_subtract (&dest, &src1, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* int <-> int_range + */ + + /* would yield an empty set */ + g_value_init (&src1, G_TYPE_INT); + g_value_set_int (&src1, 10); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 0, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should create a list of two ranges. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int_range_min (tmp) == 0); + fail_unless (gst_value_get_int_range_max (tmp) == 9); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int_range_min (tmp) == 11); + fail_unless (gst_value_get_int_range_max (tmp) == 20); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* border case 1, empty set */ + g_value_init (&src1, G_TYPE_INT); + g_value_set_int (&src1, 10); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 10, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should create a new range. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int_range_min (&dest) == 11); + fail_unless (gst_value_get_int_range_max (&dest) == 20); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* border case 2, empty set */ + g_value_init (&src1, G_TYPE_INT); + g_value_set_int (&src1, 20); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 10, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should create a new range. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int_range_min (&dest) == 10); + fail_unless (gst_value_get_int_range_max (&dest) == 19); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* case 3, valid set */ + g_value_init (&src1, G_TYPE_INT); + g_value_set_int (&src1, 0); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 10, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (G_VALUE_HOLDS_INT (&dest) == TRUE); + fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* and the other way around, should keep the range. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int_range_min (&dest) == 10); + fail_unless (gst_value_get_int_range_max (&dest) == 20); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* int_range <-> int_range + */ + + /* same range, empty set */ + g_value_init (&src1, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src1, 10, 20); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 10, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* non overlapping ranges */ + g_value_init (&src1, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src1, 10, 20); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 30, 40); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int_range_min (&dest) == 10); + fail_unless (gst_value_get_int_range_max (&dest) == 20); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int_range_min (&dest) == 30); + fail_unless (gst_value_get_int_range_max (&dest) == 40); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* completely overlapping ranges */ + g_value_init (&src1, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src1, 10, 20); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 10, 30); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int_range_min (&dest) == 21); + fail_unless (gst_value_get_int_range_max (&dest) == 30); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* partially overlapping ranges */ + g_value_init (&src1, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src1, 10, 20); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 15, 30); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int_range_min (&dest) == 10); + fail_unless (gst_value_get_int_range_max (&dest) == 14); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int_range_min (&dest) == 21); + fail_unless (gst_value_get_int_range_max (&dest) == 30); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole { int_range, int_range } */ + g_value_init (&src1, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src1, 10, 30); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 15, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int_range_min (tmp) == 10); + fail_unless (gst_value_get_int_range_max (tmp) == 14); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int_range_min (tmp) == 21); + fail_unless (gst_value_get_int_range_max (tmp) == 30); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole, { int, int } */ + g_value_init (&src1, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src1, 10, 30); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 11, 29); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (G_VALUE_HOLDS_INT (tmp) == TRUE); + fail_unless (g_value_get_int (tmp) == 10); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (G_VALUE_HOLDS_INT (tmp) == TRUE); + fail_unless (g_value_get_int (tmp) == 30); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole, { int, int_range } */ + g_value_init (&src1, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src1, 10, 30); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 11, 28); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (G_VALUE_HOLDS_INT (tmp) == TRUE); + fail_unless (g_value_get_int (tmp) == 10); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int_range_min (tmp) == 29); + fail_unless (gst_value_get_int_range_max (tmp) == 30); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole, { int_range, int } */ + g_value_init (&src1, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src1, 10, 30); + g_value_init (&src2, GST_TYPE_INT_RANGE); + gst_value_set_int_range (&src2, 12, 29); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int_range_min (tmp) == 10); + fail_unless (gst_value_get_int_range_max (tmp) == 11); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (G_VALUE_HOLDS_INT (tmp) == TRUE); + fail_unless (g_value_get_int (tmp) == 30); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); +} + +GST_END_TEST; + +GST_START_TEST (test_value_subtract_int64) +{ + GValue dest = { 0 }; + GValue src1 = { 0 }; + GValue src2 = { 0 }; + const GValue *tmp; + gboolean ret; + + /* int64 <-> int64 + */ + g_value_init (&src1, G_TYPE_INT64); + g_value_set_int64 (&src1, 10); + g_value_init (&src2, G_TYPE_INT64); + g_value_set_int64 (&src2, 20); + /* subtract as in sets, result is 10 */ + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* same values, yields empty set */ + ret = gst_value_subtract (&dest, &src1, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* int64 <-> int64_range + */ + + /* would yield an empty set */ + g_value_init (&src1, G_TYPE_INT64); + g_value_set_int64 (&src1, 10); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 0, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should create a list of two ranges. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int64_range_min (tmp) == 0); + fail_unless (gst_value_get_int64_range_max (tmp) == 9); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int64_range_min (tmp) == 11); + fail_unless (gst_value_get_int64_range_max (tmp) == 20); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* border case 1, empty set */ + g_value_init (&src1, G_TYPE_INT64); + g_value_set_int64 (&src1, 10); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 10, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should create a new range. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int64_range_min (&dest) == 11); + fail_unless (gst_value_get_int64_range_max (&dest) == 20); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* border case 2, empty set */ + g_value_init (&src1, G_TYPE_INT64); + g_value_set_int64 (&src1, 20); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 10, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should create a new range. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int64_range_min (&dest) == 10); + fail_unless (gst_value_get_int64_range_max (&dest) == 19); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* case 3, valid set */ + g_value_init (&src1, G_TYPE_INT64); + g_value_set_int64 (&src1, 0); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 10, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (G_VALUE_HOLDS_INT64 (&dest) == TRUE); + fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* and the other way around, should keep the range. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int64_range_min (&dest) == 10); + fail_unless (gst_value_get_int64_range_max (&dest) == 20); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* int64_range <-> int64_range + */ + + /* same range, empty set */ + g_value_init (&src1, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src1, 10, 20); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 10, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* non overlapping ranges */ + g_value_init (&src1, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src1, 10, 20); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 30, 40); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int64_range_min (&dest) == 10); + fail_unless (gst_value_get_int64_range_max (&dest) == 20); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int64_range_min (&dest) == 30); + fail_unless (gst_value_get_int64_range_max (&dest) == 40); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* completely overlapping ranges */ + g_value_init (&src1, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src1, 10, 20); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 10, 30); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int64_range_min (&dest) == 21); + fail_unless (gst_value_get_int64_range_max (&dest) == 30); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* partially overlapping ranges */ + g_value_init (&src1, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src1, 10, 20); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 15, 30); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int64_range_min (&dest) == 10); + fail_unless (gst_value_get_int64_range_max (&dest) == 14); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_int64_range_min (&dest) == 21); + fail_unless (gst_value_get_int64_range_max (&dest) == 30); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole { int64_range, int64_range } */ + g_value_init (&src1, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src1, 10, 30); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 15, 20); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int64_range_min (tmp) == 10); + fail_unless (gst_value_get_int64_range_max (tmp) == 14); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int64_range_min (tmp) == 21); + fail_unless (gst_value_get_int64_range_max (tmp) == 30); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole, { int64, int64 } */ + g_value_init (&src1, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src1, 10, 30); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 11, 29); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (G_VALUE_HOLDS_INT64 (tmp) == TRUE); + fail_unless (g_value_get_int64 (tmp) == 10); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (G_VALUE_HOLDS_INT64 (tmp) == TRUE); + fail_unless (g_value_get_int64 (tmp) == 30); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole, { int64, int64_range } */ + g_value_init (&src1, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src1, 10, 30); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 11, 28); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (G_VALUE_HOLDS_INT64 (tmp) == TRUE); + fail_unless (g_value_get_int64 (tmp) == 10); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int64_range_min (tmp) == 29); + fail_unless (gst_value_get_int64_range_max (tmp) == 30); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole, { int64_range, int64 } */ + g_value_init (&src1, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src1, 10, 30); + g_value_init (&src2, GST_TYPE_INT64_RANGE); + gst_value_set_int64_range (&src2, 12, 29); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_int64_range_min (tmp) == 10); + fail_unless (gst_value_get_int64_range_max (tmp) == 11); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (G_VALUE_HOLDS_INT64 (tmp) == TRUE); + fail_unless (g_value_get_int64 (tmp) == 30); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); +} + +GST_END_TEST; + +GST_START_TEST (test_value_subtract_double) +{ + GValue dest = { 0 }; + GValue src1 = { 0 }; + GValue src2 = { 0 }; + const GValue *tmp; + gboolean ret; + + /* double <-> double + */ + g_value_init (&src1, G_TYPE_DOUBLE); + g_value_set_double (&src1, 10.0); + g_value_init (&src2, G_TYPE_DOUBLE); + g_value_set_double (&src2, 20.0); + /* subtract as in sets, result is 10 */ + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* same values, yields empty set */ + ret = gst_value_subtract (&dest, &src1, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* double <-> double_range + */ + + /* would yield an empty set */ + g_value_init (&src1, G_TYPE_DOUBLE); + g_value_set_double (&src1, 10.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 0.0, 20.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, we cannot create open ranges + * so the result is the range again */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 0.0); + fail_unless (gst_value_get_double_range_max (&dest) == 20.0); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* border case 1, empty set */ + g_value_init (&src1, G_TYPE_DOUBLE); + g_value_set_double (&src1, 10.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 10.0, 20.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should keep same range as + * we don't have open ranges. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 10.0); + fail_unless (gst_value_get_double_range_max (&dest) == 20.0); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* border case 2, empty set */ + g_value_init (&src1, G_TYPE_DOUBLE); + g_value_set_double (&src1, 20.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 10.0, 20.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should keep same range as + * we don't have open ranges. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 10.0); + fail_unless (gst_value_get_double_range_max (&dest) == 20.0); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* case 3, valid set */ + g_value_init (&src1, G_TYPE_DOUBLE); + g_value_set_double (&src1, 0.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 10.0, 20.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (G_VALUE_HOLDS_DOUBLE (&dest) == TRUE); + fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* and the other way around, should keep the range. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 10.0); + fail_unless (gst_value_get_double_range_max (&dest) == 20.0); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* double_range <-> double_range + */ + + /* same range, empty set */ + g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src1, 10.0, 20.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 10.0, 20.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* non overlapping ranges */ + g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src1, 10.0, 20.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 30.0, 40.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 10.0); + fail_unless (gst_value_get_double_range_max (&dest) == 20.0); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 30.0); + fail_unless (gst_value_get_double_range_max (&dest) == 40.0); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* completely overlapping ranges */ + g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src1, 10.0, 20.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 10.0, 30.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 20.0); + fail_unless (gst_value_get_double_range_max (&dest) == 30.0); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* partially overlapping ranges */ + g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src1, 10.0, 20.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 15.0, 30.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 10.0); + fail_unless (gst_value_get_double_range_max (&dest) == 15.0); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); + fail_unless (gst_value_get_double_range_min (&dest) == 20.0); + fail_unless (gst_value_get_double_range_max (&dest) == 30.0); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole { double_range, double_range } */ + g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src1, 10.0, 30.0); + g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); + gst_value_set_double_range (&src2, 15.0, 20.0); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_double_range_min (tmp) == 10.0); + fail_unless (gst_value_get_double_range_max (tmp) == 15.0); + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (tmp) == TRUE); + fail_unless (gst_value_get_double_range_min (tmp) == 20.0); + fail_unless (gst_value_get_double_range_max (tmp) == 30.0); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); +} + +GST_END_TEST; + +/* Test arithmetic subtraction of fractions */ +GST_START_TEST (test_value_subtract_fraction) +{ + GValue result = { 0 }; + GValue src1 = { 0 }; + GValue src2 = { 0 }; + + /* Subtract 1/4 from 1/2 */ + g_value_init (&src1, GST_TYPE_FRACTION); + g_value_init (&src2, GST_TYPE_FRACTION); + g_value_init (&result, GST_TYPE_FRACTION); + gst_value_set_fraction (&src1, 1, 2); + gst_value_set_fraction (&src2, 1, 4); + fail_unless (gst_value_fraction_subtract (&result, &src1, &src2) == TRUE); + fail_unless (gst_value_get_fraction_numerator (&result) == 1); + fail_unless (gst_value_get_fraction_denominator (&result) == 4); + + g_value_unset (&src1); + g_value_unset (&src2); + g_value_unset (&result); + + /* Subtract 1/12 from 7/8 */ + g_value_init (&src1, GST_TYPE_FRACTION); + g_value_init (&src2, GST_TYPE_FRACTION); + g_value_init (&result, GST_TYPE_FRACTION); + gst_value_set_fraction (&src1, 7, 8); + gst_value_set_fraction (&src2, 1, 12); + fail_unless (gst_value_fraction_subtract (&result, &src1, &src2) == TRUE); + fail_unless (gst_value_get_fraction_numerator (&result) == 19); + fail_unless (gst_value_get_fraction_denominator (&result) == 24); + + g_value_unset (&src1); + g_value_unset (&src2); + g_value_unset (&result); + + /* Subtract 12/13 from 4/3 */ + g_value_init (&src1, GST_TYPE_FRACTION); + g_value_init (&src2, GST_TYPE_FRACTION); + g_value_init (&result, GST_TYPE_FRACTION); + gst_value_set_fraction (&src1, 4, 3); + gst_value_set_fraction (&src2, 12, 13); + fail_unless (gst_value_fraction_subtract (&result, &src1, &src2) == TRUE); + fail_unless (gst_value_get_fraction_numerator (&result) == 16); + fail_unless (gst_value_get_fraction_denominator (&result) == 39); + + g_value_unset (&src1); + g_value_unset (&src2); + g_value_unset (&result); + + /* Subtract 1/12 from 7/8 */ +} + +GST_END_TEST; + +/* Test set subtraction operations on fraction ranges */ +GST_START_TEST (test_value_subtract_fraction_range) +{ + GValue dest = { 0 }; + GValue src1 = { 0 }; + GValue src2 = { 0 }; + GValue cmp = { 0 }; + const GValue *tmp; + gboolean ret; + + /* Value for tests */ + g_value_init (&cmp, GST_TYPE_FRACTION); + + /* fraction <-> fraction + */ + g_value_init (&src1, GST_TYPE_FRACTION); + gst_value_set_fraction (&src1, 10, 1); + g_value_init (&src2, GST_TYPE_FRACTION); + gst_value_set_fraction (&src2, 20, 1); + gst_value_set_fraction (&src1, 10, 1); + + /* subtract as in sets, result is 10 */ + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* same values, yields empty set */ + ret = gst_value_subtract (&dest, &src1, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* fraction <-> fraction_range + */ + + /* would yield an empty set */ + g_value_init (&src1, GST_TYPE_FRACTION); + gst_value_set_fraction (&src1, 10, 1); + g_value_init (&src2, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src2, 0, 1, 20, 1); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, we cannot create open ranges + * so the result is the range again */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); + gst_value_set_fraction (&cmp, 0, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 20, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), + &cmp) == GST_VALUE_EQUAL); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* border case 1, empty set */ + g_value_init (&src1, GST_TYPE_FRACTION); + gst_value_set_fraction (&src1, 10, 1); + g_value_init (&src2, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src2, 10, 1, 20, 1); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + + /* and the other way around, should keep same range as + * we don't have open ranges. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); + gst_value_set_fraction (&cmp, 10, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 20, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), + &cmp) == GST_VALUE_EQUAL); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* case 2, valid set */ + g_value_init (&src1, GST_TYPE_FRACTION); + gst_value_set_fraction (&src1, 0, 1); + g_value_init (&src2, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src2, 10, 1, 20, 1); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION (&dest) == TRUE); + fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* and the other way around, should keep the range. */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); + fail_unless (gst_value_compare (&dest, &src2) == GST_VALUE_EQUAL); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* fraction_range <-> fraction_range + */ + + /* same range, empty set */ + g_value_init (&src1, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src1, 10, 2, 20, 2); + g_value_init (&src2, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src2, 10, 2, 20, 2); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + /* non overlapping ranges */ + g_value_init (&src1, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src1, 10, 2, 10, 1); + g_value_init (&src2, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src2, 30, 2, 40, 2); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); + gst_value_set_fraction (&cmp, 5, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 10, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), + &cmp) == GST_VALUE_EQUAL); + + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); + gst_value_set_fraction (&cmp, 15, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 20, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), + &cmp) == GST_VALUE_EQUAL); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* completely overlapping ranges */ + g_value_init (&src1, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src1, 10, 1, 20, 1); + g_value_init (&src2, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src2, 10, 1, 30, 1); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == FALSE); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); + gst_value_set_fraction (&cmp, 20, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 30, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), + &cmp) == GST_VALUE_EQUAL); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* partially overlapping ranges */ + g_value_init (&src1, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src1, 10, 1, 20, 1); + g_value_init (&src2, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src2, 15, 1, 30, 1); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); + gst_value_set_fraction (&cmp, 10, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 15, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), + &cmp) == GST_VALUE_EQUAL); + g_value_unset (&dest); + + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); + gst_value_set_fraction (&cmp, 20, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 30, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), + &cmp) == GST_VALUE_EQUAL); + g_value_unset (&dest); + g_value_unset (&src1); + g_value_unset (&src2); + + /* create a hole { double_range, double_range } */ + g_value_init (&src1, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src1, 10, 1, 30, 1); + g_value_init (&src2, GST_TYPE_FRACTION_RANGE); + gst_value_set_fraction_range_full (&src2, 15, 1, 20, 1); + ret = gst_value_subtract (&dest, &src1, &src2); + fail_unless (ret == TRUE); + fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); + /* 1st list entry */ + tmp = gst_value_list_get_value (&dest, 0); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (tmp) == TRUE); + gst_value_set_fraction (&cmp, 10, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (tmp), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 15, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (tmp), + &cmp) == GST_VALUE_EQUAL); + /* 2nd list entry */ + tmp = gst_value_list_get_value (&dest, 1); + fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (tmp) == TRUE); + gst_value_set_fraction (&cmp, 20, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_min (tmp), + &cmp) == GST_VALUE_EQUAL); + gst_value_set_fraction (&cmp, 30, 1); + fail_unless (gst_value_compare (gst_value_get_fraction_range_max (tmp), + &cmp) == GST_VALUE_EQUAL); + g_value_unset (&dest); + /* the other way */ + ret = gst_value_subtract (&dest, &src2, &src1); + fail_unless (ret == FALSE); + g_value_unset (&src1); + g_value_unset (&src2); + + g_value_unset (&cmp); +} + +GST_END_TEST; + +/* Test set subtraction operations on fraction lists */ +GST_START_TEST (test_value_subtract_fraction_list) +{ + GValue list1 = { 0 }; + GValue list2 = { 0 }; + GValue val1 = { 0 }; + GValue val2 = { 0 }; + GValue tmp = { 0 }; + gboolean ret; + + g_value_init (&list1, GST_TYPE_LIST); + g_value_init (&val1, GST_TYPE_FRACTION); + gst_value_set_fraction (&val1, 15, 2); + gst_value_list_append_value (&list1, &val1); + g_value_init (&tmp, GST_TYPE_FRACTION); + gst_value_set_fraction (&tmp, 5, 1); + gst_value_list_append_value (&list1, &tmp); + g_value_unset (&tmp); + + g_value_init (&list2, GST_TYPE_LIST); + g_value_init (&val2, GST_TYPE_FRACTION); + gst_value_set_fraction (&val2, 15, 1); + gst_value_list_append_value (&list2, &val2); + g_value_init (&tmp, GST_TYPE_FRACTION); + gst_value_set_fraction (&tmp, 5, 1); + gst_value_list_append_value (&list2, &tmp); + g_value_unset (&tmp); + + /* should subtract all common elements */ + ret = gst_value_subtract (&tmp, &list1, &list2); + fail_unless (ret == TRUE); + fail_unless (gst_value_compare (&tmp, &val1) == GST_VALUE_EQUAL); + g_value_unset (&val1); + g_value_unset (&tmp); + + ret = gst_value_subtract (&tmp, &list2, &list1); + fail_unless (ret == TRUE); + fail_unless (gst_value_compare (&tmp, &val2) == GST_VALUE_EQUAL); + g_value_unset (&val2); + g_value_unset (&tmp); + + g_value_unset (&list1); + g_value_unset (&list2); +} + +GST_END_TEST; + + +GST_START_TEST (test_date) +{ + GstStructure *s; + GDate *date, *date2; + gchar *str; + + date = g_date_new_dmy (22, 9, 2005); + + s = gst_structure_new ("media/x-type", "SOME_DATE_TAG", GST_TYPE_DATE, + date, NULL); + + fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TAG", + GST_TYPE_DATE)); + fail_unless (gst_structure_get_date (s, "SOME_DATE_TAG", &date2)); + fail_unless (date2 != NULL); + fail_unless (g_date_valid (date2)); + fail_unless (g_date_compare (date, date2) == 0); + + g_date_free (date); + g_date_free (date2); + date = NULL; + date2 = NULL; + + str = gst_structure_to_string (s); + gst_structure_free (s); + s = NULL; + + fail_unless (g_str_equal (str, + "media/x-type, SOME_DATE_TAG=(date)2005-09-22;")); + + s = gst_structure_from_string (str, NULL); + g_free (str); + str = NULL; + + fail_unless (s != NULL); + fail_unless (gst_structure_has_name (s, "media/x-type")); + fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TAG", + GST_TYPE_DATE)); + fail_unless (gst_structure_get_date (s, "SOME_DATE_TAG", &date)); + fail_unless (date != NULL); + fail_unless (g_date_valid (date)); + fail_unless (g_date_get_day (date) == 22); + fail_unless (g_date_get_month (date) == 9); + fail_unless (g_date_get_year (date) == 2005); + g_date_free (date); + date = NULL; + + str = gst_structure_to_string (s); + gst_structure_free (s); + s = NULL; + + fail_unless (g_str_equal (str, + "media/x-type, SOME_DATE_TAG=(date)2005-09-22;")); + g_free (str); + str = NULL; +} + +GST_END_TEST; + +static gboolean +date_time_equal (GstDateTime * a, GstDateTime * b) +{ + if (gst_date_time_get_year (a) != gst_date_time_get_year (b) || + gst_date_time_get_month (a) != gst_date_time_get_month (b) || + gst_date_time_get_day (a) != gst_date_time_get_day (b)) + return FALSE; + + if (gst_date_time_get_hour (a) != gst_date_time_get_hour (b) || + gst_date_time_get_minute (a) != gst_date_time_get_minute (b) || + gst_date_time_get_second (a) != gst_date_time_get_second (b) || + gst_date_time_get_microsecond (a) != gst_date_time_get_microsecond (b)) + return FALSE; + + if (gst_date_time_get_time_zone_offset (a) != + gst_date_time_get_time_zone_offset (b)) + return FALSE; + + return TRUE; +} + +GST_START_TEST (test_date_time) +{ + GstStructure *s; + GstDateTime *datetime, *datetime2; + gchar *str; + + /* utc timezone */ + datetime = gst_date_time_new (0, 2010, 6, 23, 7, 40, 10); + + s = gst_structure_new ("media/x-type", "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME, datetime, NULL); + + fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME)); + fail_unless (gst_structure_get_date_time (s, "SOME_DATE_TIME_TAG", + &datetime2)); + fail_unless (datetime2 != NULL); + fail_unless (date_time_equal (datetime, datetime2)); + + gst_date_time_unref (datetime); + gst_date_time_unref (datetime2); + datetime = NULL; + datetime2 = NULL; + + str = gst_structure_to_string (s); + gst_structure_free (s); + s = NULL; + + fail_unless (g_str_equal (str, + "media/x-type, SOME_DATE_TIME_TAG=(datetime)\"2010-06-23T07:40:10.000000+0000\";")); + + s = gst_structure_from_string (str, NULL); + g_free (str); + str = NULL; + + fail_unless (s != NULL); + fail_unless (gst_structure_has_name (s, "media/x-type")); + fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME)); + fail_unless (gst_structure_get_date_time (s, "SOME_DATE_TIME_TAG", + &datetime)); + fail_unless (datetime != NULL); + fail_unless (gst_date_time_get_year (datetime) == 2010); + fail_unless (gst_date_time_get_month (datetime) == 6); + fail_unless (gst_date_time_get_day (datetime) == 23); + fail_unless (gst_date_time_get_hour (datetime) == 7); + fail_unless (gst_date_time_get_minute (datetime) == 40); + fail_unless (gst_date_time_get_second (datetime) == 10); + fail_unless (gst_date_time_get_microsecond (datetime) == 0); + fail_unless (gst_date_time_get_time_zone_offset (datetime) == 0); + gst_date_time_unref (datetime); + datetime = NULL; + + str = gst_structure_to_string (s); + gst_structure_free (s); + s = NULL; + + fail_unless (g_str_equal (str, + "media/x-type, SOME_DATE_TIME_TAG=(datetime)\"2010-06-23T07:40:10.000000+0000\";")); + g_free (str); + str = NULL; + + /* with timezone */ + datetime = gst_date_time_new (-3.0, 2010, 6, 23, 7, 40, 10.000001); + + s = gst_structure_new ("media/x-type", "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME, datetime, NULL); + + fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME)); + fail_unless (gst_structure_get_date_time (s, "SOME_DATE_TIME_TAG", + &datetime2)); + fail_unless (datetime2 != NULL); + fail_unless (date_time_equal (datetime, datetime2)); + + gst_date_time_unref (datetime); + gst_date_time_unref (datetime2); + datetime = NULL; + datetime2 = NULL; + + str = gst_structure_to_string (s); + gst_structure_free (s); + s = NULL; + + fail_unless (g_str_equal (str, + "media/x-type, SOME_DATE_TIME_TAG=(datetime)\"2010-06-23T07:40:10.000001-0300\";")); + + s = gst_structure_from_string (str, NULL); + g_free (str); + str = NULL; + + fail_unless (s != NULL); + fail_unless (gst_structure_has_name (s, "media/x-type")); + fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME)); + fail_unless (gst_structure_get_date_time (s, "SOME_DATE_TIME_TAG", + &datetime)); + fail_unless (datetime != NULL); + fail_unless (gst_date_time_get_year (datetime) == 2010); + fail_unless (gst_date_time_get_month (datetime) == 6); + fail_unless (gst_date_time_get_day (datetime) == 23); + fail_unless (gst_date_time_get_hour (datetime) == 7); + fail_unless (gst_date_time_get_minute (datetime) == 40); + fail_unless (gst_date_time_get_second (datetime) == 10); + fail_unless (gst_date_time_get_microsecond (datetime) == 1); + fail_unless (gst_date_time_get_time_zone_offset (datetime) == -3); + gst_date_time_unref (datetime); + datetime = NULL; + + str = gst_structure_to_string (s); + gst_structure_free (s); + s = NULL; + fail_unless (g_str_equal (str, + "media/x-type, SOME_DATE_TIME_TAG=(datetime)\"2010-06-23T07:40:10.000001-0300\";")); + + g_free (str); + str = NULL; + + /* with positive timezone */ + datetime = gst_date_time_new (2.0, 2010, 6, 23, 7, 40, 10.000001); + + s = gst_structure_new ("media/x-type", "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME, datetime, NULL); + + fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME)); + fail_unless (gst_structure_get_date_time (s, "SOME_DATE_TIME_TAG", + &datetime2)); + fail_unless (datetime2 != NULL); + fail_unless (date_time_equal (datetime, datetime2)); + + gst_date_time_unref (datetime); + gst_date_time_unref (datetime2); + datetime = NULL; + datetime2 = NULL; + + str = gst_structure_to_string (s); + gst_structure_free (s); + s = NULL; + + fail_unless (g_str_equal (str, + "media/x-type, SOME_DATE_TIME_TAG=(datetime)\"2010-06-23T07:40:10.000001+0200\";")); + + s = gst_structure_from_string (str, NULL); + g_free (str); + str = NULL; + + fail_unless (s != NULL); + fail_unless (gst_structure_has_name (s, "media/x-type")); + fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TIME_TAG", + GST_TYPE_DATE_TIME)); + fail_unless (gst_structure_get_date_time (s, "SOME_DATE_TIME_TAG", + &datetime)); + fail_unless (datetime != NULL); + fail_unless (gst_date_time_get_year (datetime) == 2010); + fail_unless (gst_date_time_get_month (datetime) == 6); + fail_unless (gst_date_time_get_day (datetime) == 23); + fail_unless (gst_date_time_get_hour (datetime) == 7); + fail_unless (gst_date_time_get_minute (datetime) == 40); + fail_unless (gst_date_time_get_second (datetime) == 10); + fail_unless (gst_date_time_get_microsecond (datetime) == 1); + fail_unless (gst_date_time_get_time_zone_offset (datetime) == 2); + gst_date_time_unref (datetime); + datetime = NULL; + + str = gst_structure_to_string (s); + gst_structure_free (s); + s = NULL; + fail_unless (g_str_equal (str, + "media/x-type, SOME_DATE_TIME_TAG=(datetime)\"2010-06-23T07:40:10.000001+0200\";")); + + g_free (str); + str = NULL; + +} + +GST_END_TEST; + +GST_START_TEST (test_fraction_range) +{ + GValue range = { 0, }; + GValue start = { 0, }; + GValue end = { 0, }; + GValue src = { 0, }; + GValue dest = { 0, }; + GValue range2 = { 0, }; + + g_value_init (&range, GST_TYPE_FRACTION_RANGE); + g_value_init (&range2, GST_TYPE_FRACTION_RANGE); + g_value_init (&start, GST_TYPE_FRACTION); + g_value_init (&end, GST_TYPE_FRACTION); + g_value_init (&src, GST_TYPE_FRACTION); + + gst_value_set_fraction (&src, 1, 2); + + /* Check that a intersection of fraction & range = fraction */ + gst_value_set_fraction (&start, 1, 4); + gst_value_set_fraction (&end, 2, 3); + gst_value_set_fraction_range (&range, &start, &end); + + fail_unless (gst_value_intersect (&dest, &src, &range) == TRUE); + fail_unless (G_VALUE_TYPE (&dest) == GST_TYPE_FRACTION); + fail_unless (gst_value_compare (&dest, &src) == GST_VALUE_EQUAL); + + /* Check that a intersection selects the overlapping range */ + gst_value_set_fraction (&start, 1, 3); + gst_value_set_fraction (&end, 2, 3); + gst_value_set_fraction_range (&range2, &start, &end); + g_value_unset (&dest); + fail_unless (gst_value_intersect (&dest, &range, &range2) == TRUE); + fail_unless (G_VALUE_TYPE (&dest) == GST_TYPE_FRACTION_RANGE); + + gst_value_set_fraction_range (&range2, &start, &end); + fail_unless (gst_value_compare (&dest, &range2) == GST_VALUE_EQUAL); + + /* Check that non intersection ranges don't intersect */ + gst_value_set_fraction (&start, 4, 2); + gst_value_set_fraction (&end, 5, 2); + gst_value_set_fraction_range (&range2, &start, &end); + g_value_unset (&dest); + fail_unless (gst_value_intersect (&dest, &range, &range2) == FALSE); + + g_value_unset (&start); + g_value_unset (&end); + g_value_unset (&range); + g_value_unset (&range2); + g_value_unset (&src); +} + +GST_END_TEST; + +GST_START_TEST (test_serialize_deserialize_format_enum) +{ + GstStructure *s, *s2; + GstFormat foobar_fmt; + gchar *str, *str2, *end = NULL; + + /* make sure custom formats are serialised properly as well */ + foobar_fmt = gst_format_register ("foobar", "GST_FORMAT_FOOBAR"); + fail_unless (foobar_fmt != GST_FORMAT_UNDEFINED); + + s = gst_structure_new ("foo/bar", "format1", GST_TYPE_FORMAT, + GST_FORMAT_BYTES, "format2", GST_TYPE_FORMAT, GST_FORMAT_TIME, + "format3", GST_TYPE_FORMAT, GST_FORMAT_DEFAULT, "format4", + GST_TYPE_FORMAT, foobar_fmt, NULL); + + str = gst_structure_to_string (s); + GST_LOG ("Got structure string '%s'", GST_STR_NULL (str)); + fail_unless (str != NULL); + fail_unless (strstr (str, "TIME") != NULL); + fail_unless (strstr (str, "BYTE") != NULL); + fail_unless (strstr (str, "DEFAULT") != NULL); + fail_unless (strstr (str, "FOOBAR") != NULL); + + s2 = gst_structure_from_string (str, &end); + fail_unless (s2 != NULL); + + str2 = gst_structure_to_string (s2); + fail_unless (str2 != NULL); + + fail_unless (g_str_equal (str, str2)); + + g_free (str); + g_free (str2); + gst_structure_free (s); + gst_structure_free (s2); +} + +GST_END_TEST; + +GST_START_TEST (test_serialize_deserialize_caps) +{ + GValue value = { 0 } + , value2 = { + 0}; + GstCaps *caps, *caps2; + gchar *serialized; + + caps = gst_caps_new_simple ("test/caps", + "foo", G_TYPE_INT, 10, "bar", G_TYPE_STRING, "test", NULL); + fail_if (GST_CAPS_REFCOUNT_VALUE (caps) != 1); + + /* and assign caps to gvalue */ + g_value_init (&value, GST_TYPE_CAPS); + g_value_take_boxed (&value, caps); + fail_if (GST_CAPS_REFCOUNT_VALUE (caps) != 1); + + /* now serialize it */ + serialized = gst_value_serialize (&value); + GST_DEBUG ("serialized caps to %s", serialized); + fail_unless (serialized != NULL); + + /* refcount should not change */ + fail_if (GST_CAPS_REFCOUNT_VALUE (caps) != 1); + + /* now deserialize again */ + g_value_init (&value2, GST_TYPE_CAPS); + gst_value_deserialize (&value2, serialized); + + caps2 = g_value_get_boxed (&value2); + fail_if (GST_CAPS_REFCOUNT_VALUE (caps2) != 1); + + /* they should be equal */ + fail_unless (gst_caps_is_equal (caps, caps2)); + + /* cleanup */ + g_value_unset (&value); + g_value_unset (&value2); + g_free (serialized); +} + +GST_END_TEST; + +GST_START_TEST (test_int_range) +{ + GValue range = { 0, }; + GValue start = { 0, }; + GValue end = { 0, }; + GValue src = { 0, }; + GValue dest = { 0, }; + GValue range2 = { 0, }; + + g_value_init (&range, GST_TYPE_INT_RANGE); + g_value_init (&range2, GST_TYPE_INT_RANGE); + g_value_init (&start, G_TYPE_INT); + g_value_init (&end, G_TYPE_INT); + g_value_init (&src, G_TYPE_INT); + + g_value_set_int (&src, 2); + + /* Check that a intersection of int & range = int */ + gst_value_set_int_range (&range, 1, 5); + + fail_unless (gst_value_intersect (&dest, &src, &range) == TRUE); + fail_unless (G_VALUE_TYPE (&dest) == G_TYPE_INT); + fail_unless (gst_value_compare (&dest, &src) == GST_VALUE_EQUAL); + + /* Check that a intersection selects the overlapping range */ + gst_value_set_int_range (&range2, 2, 3); + g_value_unset (&dest); + fail_unless (gst_value_intersect (&dest, &range, &range2) == TRUE); + fail_unless (G_VALUE_TYPE (&dest) == GST_TYPE_INT_RANGE); + + fail_unless (gst_value_compare (&dest, &range2) == GST_VALUE_EQUAL); + + /* Check that non intersection ranges don't intersect */ + gst_value_set_int_range (&range2, 6, 7); + g_value_unset (&dest); + fail_unless (gst_value_intersect (&dest, &range, &range2) == FALSE); + + g_value_unset (&start); + g_value_unset (&end); + g_value_unset (&range); + g_value_unset (&range2); + g_value_unset (&src); +} + +GST_END_TEST; + +GST_START_TEST (test_int64_range) +{ + GValue range = { 0, }; + GValue start = { 0, }; + GValue end = { 0, }; + GValue src = { 0, }; + GValue dest = { 0, }; + GValue range2 = { 0, }; + + g_value_init (&range, GST_TYPE_INT64_RANGE); + g_value_init (&range2, GST_TYPE_INT64_RANGE); + g_value_init (&start, G_TYPE_INT64); + g_value_init (&end, G_TYPE_INT64); + g_value_init (&src, G_TYPE_INT64); + + g_value_set_int64 (&src, 2); + + /* Check that a intersection of int64 & range = int64 */ + gst_value_set_int64_range (&range, 1, 5); + + fail_unless (gst_value_intersect (&dest, &src, &range) == TRUE); + fail_unless (G_VALUE_TYPE (&dest) == G_TYPE_INT64); + fail_unless (gst_value_compare (&dest, &src) == GST_VALUE_EQUAL); + + /* Check that a intersection selects the overlapping range */ + gst_value_set_int64_range (&range2, 2, 3); + g_value_unset (&dest); + fail_unless (gst_value_intersect (&dest, &range, &range2) == TRUE); + fail_unless (G_VALUE_TYPE (&dest) == GST_TYPE_INT64_RANGE); + + fail_unless (gst_value_compare (&dest, &range2) == GST_VALUE_EQUAL); + + /* Check that non intersection ranges don't intersect */ + gst_value_set_int64_range (&range2, 6, 7); + g_value_unset (&dest); + fail_unless (gst_value_intersect (&dest, &range, &range2) == FALSE); + + g_value_unset (&start); + g_value_unset (&end); + g_value_unset (&range); + g_value_unset (&range2); + g_value_unset (&src); +} + +GST_END_TEST; + +GST_START_TEST (test_serialize_int64_range) +{ + int i = 0; + + gint64 int64_ranges[] = { + 0, 5, + 0, G_MAXINT, + 5, G_MAXINT32, + 5, G_MAXINT64, + }; + gint int64_ranges_size = sizeof (int64_ranges) / sizeof (int64_ranges[0]) / 2; + + gchar *int64_range_strings[] = { + g_strdup ("[ 0, 5 ]"), + g_strdup_printf ("[ 0, %" G_GINT64_FORMAT " ]", (gint64) G_MAXINT), + g_strdup_printf ("[ 5, %" G_GINT64_FORMAT " ]", (gint64) G_MAXINT32), + g_strdup_printf ("[ 5, %" G_GINT64_FORMAT " ]", G_MAXINT64), + }; + gint int64_range_strings_size = + sizeof (int64_range_strings) / sizeof (int64_range_strings[0]); + + fail_unless (int64_ranges_size == int64_range_strings_size); + + while (i + 1 < (int64_ranges_size * 2)) { + if ((i + 1) % 2) { + gchar *str; + gchar *str2; + GValue value = { 0 }; + const GValue *deserialized_value; + int idx = i / 2; + GstStructure *s; + + g_value_init (&value, GST_TYPE_INT64_RANGE); + + /* check serialization */ + gst_value_set_int64_range (&value, int64_ranges[i], int64_ranges[i + 1]); + str = gst_value_serialize (&value); + fail_unless (strcmp (str, int64_range_strings[idx]) == 0); + g_free (int64_range_strings[idx]); + + /* now deserialize again to an int64 range */ + s = gst_structure_new ("foo/bar", "range", GST_TYPE_INT64_RANGE, + int64_ranges[i], int64_ranges[i + 1], NULL); + deserialized_value = gst_structure_get_value (s, "range"); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (deserialized_value) == TRUE); + str2 = gst_value_serialize (deserialized_value); + + fail_unless (gst_value_get_int64_range_min (deserialized_value) == + int64_ranges[i]); + fail_unless (gst_value_get_int64_range_max (deserialized_value) == + int64_ranges[i + 1]); + + gst_structure_free (s); + g_free (str); + g_free (str2); + } + i++; + } +} + +GST_END_TEST; + +GST_START_TEST (test_deserialize_int_range) +{ + GstStructure *s; + gchar *str, *str2; + gchar *end = NULL; + const GValue *deserialized_value; + + /* check a valid int_range deserialization */ + str = g_strdup_printf ("foo/bar, range=[ 1, %d ];", G_MAXINT); + s = gst_structure_from_string (str, &end); + fail_unless (*end == '\0'); + deserialized_value = gst_structure_get_value (s, "range"); + fail_unless (GST_VALUE_HOLDS_INT_RANGE (deserialized_value) == TRUE); + fail_unless (gst_value_get_int_range_min (deserialized_value) == 1); + fail_unless (gst_value_get_int_range_max (deserialized_value) == G_MAXINT); + gst_structure_free (s); + end = NULL; + g_free (str); + + /* check invalid int_range deserialization */ + str = + g_strdup_printf ("foo/bar, range=[ 1, %" G_GINT64_FORMAT " ];", + (gint64) G_MAXINT + 1); + ASSERT_CRITICAL (s = gst_structure_from_string (str, &end)); + g_free (str); + gst_structure_free (s); + str = + g_strdup_printf ("foo/bar, range=[ %" G_GINT64_FORMAT ", %" + G_GINT64_FORMAT " ];", (gint64) G_MAXINT, (gint64) G_MAXINT + 1); + ASSERT_CRITICAL (s = gst_structure_from_string (str, NULL)); + end = NULL; + g_free (str); + gst_structure_free (s); + + /* check a valid int64_range deserialization. Those ranges need to + * be explicit about their storage type. */ + str = g_strdup_printf ("foo/bar, range=(gint64)[ 1, %d ];", G_MAXINT); + s = gst_structure_from_string (str, &end); + fail_unless (*end == '\0'); + deserialized_value = gst_structure_get_value (s, "range"); + fail_unless (GST_VALUE_HOLDS_INT64_RANGE (deserialized_value) == TRUE); + fail_unless (gst_value_get_int64_range_min (deserialized_value) == 1); + fail_unless (gst_value_get_int64_range_max (deserialized_value) == G_MAXINT); + str2 = gst_structure_to_string (s); + fail_unless (strcmp (str, str2) == 0); + gst_structure_free (s); + end = NULL; + g_free (str); + g_free (str2); + + /* check invalid int64_range (starting with a gint) deserialization */ + str = + g_strdup_printf ("foo/bar, range=(gint64)[ 1, %" G_GUINT64_FORMAT " ];", + (guint64) G_MAXINT64 + 1); + ASSERT_CRITICAL (s = gst_structure_from_string (str, &end)); + fail_unless (*end == '\0'); + gst_structure_free (s); + end = NULL; + g_free (str); + + /* check invalid int64_range deserialization into a int64_range */ + str = + g_strdup_printf ("foo/bar, range=(gint64)[ %" G_GINT64_FORMAT ", %" + G_GUINT64_FORMAT " ];", (gint64) G_MAXINT, (guint64) G_MAXINT64 + 1); + ASSERT_CRITICAL (s = gst_structure_from_string (str, NULL)); + g_free (str); + gst_structure_free (s); + + /* check invalid int64_range deserialization into a int_range */ + str = + g_strdup_printf ("foo/bar, range=[ %" G_GINT64_FORMAT ", %" + G_GUINT64_FORMAT " ];", (gint64) G_MAXINT, (guint64) G_MAXINT64 + 1); + s = gst_structure_from_string (str, &end); + fail_unless (s == NULL); + fail_unless (end == NULL); + g_free (str); +} + +GST_END_TEST static Suite * +gst_value_suite (void) +{ + Suite *s = suite_create ("GstValue"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_deserialize_buffer); + tcase_add_test (tc_chain, test_serialize_buffer); + tcase_add_test (tc_chain, test_deserialize_gint); + tcase_add_test (tc_chain, test_deserialize_gint_failures); + tcase_add_test (tc_chain, test_deserialize_guint); + tcase_add_test (tc_chain, test_deserialize_guint_failures); + tcase_add_test (tc_chain, test_deserialize_gint64); + tcase_add_test (tc_chain, test_deserialize_guint64); + tcase_add_test (tc_chain, test_deserialize_guchar); + tcase_add_test (tc_chain, test_deserialize_gstfraction); + tcase_add_test (tc_chain, test_serialize_flags); + tcase_add_test (tc_chain, test_deserialize_flags); + tcase_add_test (tc_chain, test_serialize_deserialize_format_enum); + tcase_add_test (tc_chain, test_string); + tcase_add_test (tc_chain, test_deserialize_string); + tcase_add_test (tc_chain, test_value_compare); + tcase_add_test (tc_chain, test_value_intersect); + tcase_add_test (tc_chain, test_value_subtract_int); + tcase_add_test (tc_chain, test_value_subtract_int64); + tcase_add_test (tc_chain, test_value_subtract_double); + tcase_add_test (tc_chain, test_value_subtract_fraction); + tcase_add_test (tc_chain, test_value_subtract_fraction_range); + tcase_add_test (tc_chain, test_value_subtract_fraction_list); + tcase_add_test (tc_chain, test_date); + tcase_add_test (tc_chain, test_date_time); + tcase_add_test (tc_chain, test_fraction_range); + tcase_add_test (tc_chain, test_serialize_deserialize_caps); + tcase_add_test (tc_chain, test_int_range); + tcase_add_test (tc_chain, test_int64_range); + tcase_add_test (tc_chain, test_serialize_int64_range); + tcase_add_test (tc_chain, test_deserialize_int_range); + + return s; +} + +GST_CHECK_MAIN (gst_value); diff --git a/tests/check/gst/struct_arm.h b/tests/check/gst/struct_arm.h new file mode 100644 index 0000000..73764c9 --- /dev/null +++ b/tests/check/gst/struct_arm.h @@ -0,0 +1,70 @@ + +GstCheckABIStruct list[] = { + {"GstBin", sizeof (GstBin), 192}, + {"GstBinClass", sizeof (GstBinClass), 288}, + {"GstBuffer", sizeof (GstBuffer), 88}, + {"GstBufferClass", sizeof (GstBufferClass), 16}, + {"GstBus", sizeof (GstBus), 80}, + {"GstBusClass", sizeof (GstBusClass), 144}, + {"GstCaps", sizeof (GstCaps), 32}, + {"GstStaticCaps", sizeof (GstStaticCaps), 52}, + {"GstChildProxyInterface", sizeof (GstChildProxyInterface), 40}, + {"GstClock", sizeof (GstClock), 176}, + {"GstClockClass", sizeof (GstClockClass), 160}, + {"GstElement", sizeof (GstElement), 136}, + {"GstElementClass", sizeof (GstElementClass), 248}, + {"GstElementFactory", sizeof (GstElementFactory), 144}, + {"GstElementFactoryClass", sizeof (GstElementFactoryClass), 152}, + {"GstElementDetails", sizeof (GstElementDetails), 32}, + {"GstEvent", sizeof (GstEvent), 48}, + {"GstEventClass", sizeof (GstEventClass), 32}, + {"GstFormatDefinition", sizeof (GstFormatDefinition), 16}, + {"GstIndexEntry", sizeof (GstIndexEntry), 20}, + {"GstIndexGroup", sizeof (GstIndexGroup), 16}, + {"GstIndex", sizeof (GstIndex), 100}, + {"GstIndexClass", sizeof (GstIndexClass), 156}, + {"GstIndexAssociation", sizeof (GstIndexAssociation), 16}, + {"GstIndexFactory", sizeof (GstIndexFactory), 96}, + {"GstIndexFactoryClass", sizeof (GstIndexFactoryClass), 152}, + {"GstDebugCategory", sizeof (GstDebugCategory), 16}, + {"GstIterator", sizeof (GstIterator), 52}, + {"GstMessage", sizeof (GstMessage), 64}, + {"GstMessageClass", sizeof (GstMessageClass), 32}, + {"GstMiniObject", sizeof (GstMiniObject), 16}, + {"GstMiniObjectClass", sizeof (GstMiniObjectClass), 16}, + {"GstObject", sizeof (GstObject), 40}, + {"GstObjectClass", sizeof (GstObjectClass), 120}, + {"GstPad", sizeof (GstPad), 188}, + {"GstPadClass", sizeof (GstPadClass), 152}, + {"GstPadTemplate", sizeof (GstPadTemplate), 72}, + {"GstPadTemplateClass", sizeof (GstPadTemplateClass), 140}, + {"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 64}, + {"GstPipeline", sizeof (GstPipeline), 232}, + {"GstPipelineClass", sizeof (GstPipelineClass), 304}, + {"GstPlugin", sizeof (GstPlugin), 152}, + {"GstPluginClass", sizeof (GstPluginClass), 136}, + {"GstPluginDesc", sizeof (GstPluginDesc), 56}, + {"GstPluginFeature", sizeof (GstPluginFeature), 72}, + {"GstPluginFeatureClass", sizeof (GstPluginFeatureClass), 136}, + {"GstQueryTypeDefinition", sizeof (GstQueryTypeDefinition), 16}, + {"GstQuery", sizeof (GstQuery), 28}, + {"GstQueryClass", sizeof (GstQueryClass), 32}, + {"GstRegistry", sizeof (GstRegistry), 72}, + {"GstRegistryClass", sizeof (GstRegistryClass), 144}, + {"GstSegment", sizeof (GstSegment), 88}, + {"GstStructure", sizeof (GstStructure), 20}, + {"GstSystemClock", sizeof (GstSystemClock), 200}, + {"GstSystemClockClass", sizeof (GstSystemClockClass), 176}, + {"GstTagSetterIFace", sizeof (GstTagSetterIFace), 8}, + {"GstTask", sizeof (GstTask), 80}, + {"GstTaskClass", sizeof (GstTaskClass), 140}, + {"GstTrace", sizeof (GstTrace), 20}, + {"GstTraceEntry", sizeof (GstTraceEntry), 128}, + {"GstAllocTrace", sizeof (GstAllocTrace), 16}, + {"GstTypeFind", sizeof (GstTypeFind), 32}, + {"GstTypeFindFactory", sizeof (GstTypeFindFactory), 108}, + {"GstTypeFindFactoryClass", sizeof (GstTypeFindFactoryClass), 152}, + {"GstURIHandlerInterface", sizeof (GstURIHandlerInterface), 44}, + {"GstValueTable", sizeof (GstValueTable), 32}, + {NULL, 0, 0} +}; diff --git a/tests/check/gst/struct_hppa.h b/tests/check/gst/struct_hppa.h new file mode 100644 index 0000000..7f325f3 --- /dev/null +++ b/tests/check/gst/struct_hppa.h @@ -0,0 +1,69 @@ +static GstCheckABIStruct list[] = { + {"GstBin", sizeof (GstBin), 192}, + {"GstBinClass", sizeof (GstBinClass), 288}, + {"GstBuffer", sizeof (GstBuffer), 88}, + {"GstBufferClass", sizeof (GstBufferClass), 16}, + {"GstBus", sizeof (GstBus), 80}, + {"GstBusClass", sizeof (GstBusClass), 144}, + {"GstCaps", sizeof (GstCaps), 32}, + {"GstStaticCaps", sizeof (GstStaticCaps), 52}, + {"GstChildProxyInterface", sizeof (GstChildProxyInterface), 40}, + {"GstClock", sizeof (GstClock), 176}, + {"GstClockClass", sizeof (GstClockClass), 160}, + {"GstElement", sizeof (GstElement), 136}, + {"GstElementClass", sizeof (GstElementClass), 248}, + {"GstElementFactory", sizeof (GstElementFactory), 144}, + {"GstElementFactoryClass", sizeof (GstElementFactoryClass), 152}, + {"GstElementDetails", sizeof (GstElementDetails), 32}, + {"GstEvent", sizeof (GstEvent), 48}, + {"GstEventClass", sizeof (GstEventClass), 32}, + {"GstFormatDefinition", sizeof (GstFormatDefinition), 16}, + {"GstIndexEntry", sizeof (GstIndexEntry), 20}, + {"GstIndexGroup", sizeof (GstIndexGroup), 16}, + {"GstIndex", sizeof (GstIndex), 100}, + {"GstIndexClass", sizeof (GstIndexClass), 156}, + {"GstIndexAssociation", sizeof (GstIndexAssociation), 16}, + {"GstIndexFactory", sizeof (GstIndexFactory), 96}, + {"GstIndexFactoryClass", sizeof (GstIndexFactoryClass), 152}, + {"GstDebugCategory", sizeof (GstDebugCategory), 16}, + {"GstIterator", sizeof (GstIterator), 52}, + {"GstMessage", sizeof (GstMessage), 64}, + {"GstMessageClass", sizeof (GstMessageClass), 32}, + {"GstMiniObject", sizeof (GstMiniObject), 16}, + {"GstMiniObjectClass", sizeof (GstMiniObjectClass), 16}, + {"GstObject", sizeof (GstObject), 40}, + {"GstObjectClass", sizeof (GstObjectClass), 120}, + {"GstPad", sizeof (GstPad), 188}, + {"GstPadClass", sizeof (GstPadClass), 152}, + {"GstPadTemplate", sizeof (GstPadTemplate), 72}, + {"GstPadTemplateClass", sizeof (GstPadTemplateClass), 140}, + {"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 64}, + {"GstPipeline", sizeof (GstPipeline), 232}, + {"GstPipelineClass", sizeof (GstPipelineClass), 304}, + {"GstPlugin", sizeof (GstPlugin), 152}, + {"GstPluginClass", sizeof (GstPluginClass), 136}, + {"GstPluginDesc", sizeof (GstPluginDesc), 56}, + {"GstPluginFeature", sizeof (GstPluginFeature), 72}, + {"GstPluginFeatureClass", sizeof (GstPluginFeatureClass), 136}, + {"GstQueryTypeDefinition", sizeof (GstQueryTypeDefinition), 16}, + {"GstQuery", sizeof (GstQuery), 28}, + {"GstQueryClass", sizeof (GstQueryClass), 32}, + {"GstRegistry", sizeof (GstRegistry), 72}, + {"GstRegistryClass", sizeof (GstRegistryClass), 144}, + {"GstSegment", sizeof (GstSegment), 88}, + {"GstStructure", sizeof (GstStructure), 20}, + {"GstSystemClock", sizeof (GstSystemClock), 200}, + {"GstSystemClockClass", sizeof (GstSystemClockClass), 176}, + {"GstTagSetterIFace", sizeof (GstTagSetterIFace), 8}, + {"GstTask", sizeof (GstTask), 80}, + {"GstTaskClass", sizeof (GstTaskClass), 140}, + {"GstTrace", sizeof (GstTrace), 20}, + {"GstTraceEntry", sizeof (GstTraceEntry), 128}, + {"GstAllocTrace", sizeof (GstAllocTrace), 16}, + {"GstTypeFind", sizeof (GstTypeFind), 32}, + {"GstTypeFindFactory", sizeof (GstTypeFindFactory), 108}, + {"GstTypeFindFactoryClass", sizeof (GstTypeFindFactoryClass), 152}, + {"GstURIHandlerInterface", sizeof (GstURIHandlerInterface), 44}, + {"GstValueTable", sizeof (GstValueTable), 32}, + {NULL, 0, 0} +}; diff --git a/tests/check/gst/struct_i386.h b/tests/check/gst/struct_i386.h new file mode 100644 index 0000000..87868b9 --- /dev/null +++ b/tests/check/gst/struct_i386.h @@ -0,0 +1,69 @@ +static GstCheckABIStruct list[] = { + {"GstBin", sizeof (GstBin), 184}, + {"GstBinClass", sizeof(GstBinClass), 288}, + {"GstBuffer", sizeof(GstBuffer), 80}, + {"GstBufferClass", sizeof(GstBufferClass), 16}, + {"GstBus", sizeof(GstBus), 80}, + {"GstBusClass", sizeof(GstBusClass), 144}, + {"GstCaps", sizeof(GstCaps), 32}, + {"GstStaticCaps", sizeof(GstStaticCaps), 52}, + {"GstChildProxyInterface", sizeof(GstChildProxyInterface), 40}, + {"GstClock", sizeof(GstClock), 172}, + {"GstClockClass", sizeof(GstClockClass), 160}, + {"GstElement", sizeof(GstElement), 128}, + {"GstElementClass", sizeof(GstElementClass), 248}, + {"GstElementFactory", sizeof(GstElementFactory), 144}, + {"GstElementFactoryClass", sizeof(GstElementFactoryClass), 152}, + {"GstElementDetails", sizeof(GstElementDetails), 32}, + {"GstEvent", sizeof(GstEvent), 40}, + {"GstEventClass", sizeof(GstEventClass), 32}, + {"GstFormatDefinition", sizeof(GstFormatDefinition), 16}, + {"GstIndexEntry", sizeof(GstIndexEntry), 20}, + {"GstIndexGroup", sizeof(GstIndexGroup), 16}, + {"GstIndex", sizeof(GstIndex), 100}, + {"GstIndexClass", sizeof(GstIndexClass), 156}, + {"GstIndexAssociation", sizeof(GstIndexAssociation), 12}, + {"GstIndexFactory", sizeof(GstIndexFactory), 96}, + {"GstIndexFactoryClass", sizeof(GstIndexFactoryClass), 152}, + {"GstDebugCategory", sizeof(GstDebugCategory), 16}, + {"GstIterator", sizeof(GstIterator), 52}, + {"GstMessage", sizeof(GstMessage), 60}, + {"GstMessageClass", sizeof(GstMessageClass), 32}, + {"GstMiniObject", sizeof(GstMiniObject), 16}, + {"GstMiniObjectClass", sizeof(GstMiniObjectClass), 16}, + {"GstObject", sizeof(GstObject), 40}, + {"GstObjectClass", sizeof(GstObjectClass), 120}, + {"GstPad", sizeof(GstPad), 188}, + {"GstPadClass", sizeof(GstPadClass), 152}, + {"GstPadTemplate", sizeof(GstPadTemplate), 72}, + {"GstPadTemplateClass", sizeof(GstPadTemplateClass), 140}, + {"GstStaticPadTemplate", sizeof(GstStaticPadTemplate), 64}, + {"GstPipeline", sizeof(GstPipeline), 220}, + {"GstPipelineClass", sizeof(GstPipelineClass), 304}, + {"GstPlugin", sizeof(GstPlugin), 148}, + {"GstPluginClass", sizeof(GstPluginClass), 136}, + {"GstPluginDesc", sizeof(GstPluginDesc), 56}, + {"GstPluginFeature", sizeof(GstPluginFeature), 72}, + {"GstPluginFeatureClass", sizeof(GstPluginFeatureClass), 136}, + {"GstQueryTypeDefinition", sizeof(GstQueryTypeDefinition), 16}, + {"GstQuery", sizeof(GstQuery), 28}, + {"GstQueryClass", sizeof(GstQueryClass), 32}, + {"GstRegistry", sizeof(GstRegistry), 72}, + {"GstRegistryClass", sizeof(GstRegistryClass), 144}, + {"GstSegment", sizeof(GstSegment), 88}, + {"GstStructure", sizeof(GstStructure), 20}, + {"GstSystemClock", sizeof(GstSystemClock), 196}, + {"GstSystemClockClass", sizeof(GstSystemClockClass), 176}, + {"GstTagSetterIFace", sizeof(GstTagSetterIFace), 8}, + {"GstTask", sizeof(GstTask), 80}, + {"GstTaskClass", sizeof(GstTaskClass), 140}, + {"GstTrace", sizeof(GstTrace), 20}, + {"GstTraceEntry", sizeof(GstTraceEntry), 128}, + {"GstAllocTrace", sizeof(GstAllocTrace), 16}, + {"GstTypeFind", sizeof(GstTypeFind), 32}, + {"GstTypeFindFactory", sizeof(GstTypeFindFactory), 108}, + {"GstTypeFindFactoryClass", sizeof(GstTypeFindFactoryClass), 152}, + {"GstURIHandlerInterface", sizeof(GstURIHandlerInterface), 44}, + {"GstValueTable", sizeof(GstValueTable), 32}, + {NULL, 0, 0} +}; diff --git a/tests/check/gst/struct_ppc32.h b/tests/check/gst/struct_ppc32.h new file mode 100644 index 0000000..7f325f3 --- /dev/null +++ b/tests/check/gst/struct_ppc32.h @@ -0,0 +1,69 @@ +static GstCheckABIStruct list[] = { + {"GstBin", sizeof (GstBin), 192}, + {"GstBinClass", sizeof (GstBinClass), 288}, + {"GstBuffer", sizeof (GstBuffer), 88}, + {"GstBufferClass", sizeof (GstBufferClass), 16}, + {"GstBus", sizeof (GstBus), 80}, + {"GstBusClass", sizeof (GstBusClass), 144}, + {"GstCaps", sizeof (GstCaps), 32}, + {"GstStaticCaps", sizeof (GstStaticCaps), 52}, + {"GstChildProxyInterface", sizeof (GstChildProxyInterface), 40}, + {"GstClock", sizeof (GstClock), 176}, + {"GstClockClass", sizeof (GstClockClass), 160}, + {"GstElement", sizeof (GstElement), 136}, + {"GstElementClass", sizeof (GstElementClass), 248}, + {"GstElementFactory", sizeof (GstElementFactory), 144}, + {"GstElementFactoryClass", sizeof (GstElementFactoryClass), 152}, + {"GstElementDetails", sizeof (GstElementDetails), 32}, + {"GstEvent", sizeof (GstEvent), 48}, + {"GstEventClass", sizeof (GstEventClass), 32}, + {"GstFormatDefinition", sizeof (GstFormatDefinition), 16}, + {"GstIndexEntry", sizeof (GstIndexEntry), 20}, + {"GstIndexGroup", sizeof (GstIndexGroup), 16}, + {"GstIndex", sizeof (GstIndex), 100}, + {"GstIndexClass", sizeof (GstIndexClass), 156}, + {"GstIndexAssociation", sizeof (GstIndexAssociation), 16}, + {"GstIndexFactory", sizeof (GstIndexFactory), 96}, + {"GstIndexFactoryClass", sizeof (GstIndexFactoryClass), 152}, + {"GstDebugCategory", sizeof (GstDebugCategory), 16}, + {"GstIterator", sizeof (GstIterator), 52}, + {"GstMessage", sizeof (GstMessage), 64}, + {"GstMessageClass", sizeof (GstMessageClass), 32}, + {"GstMiniObject", sizeof (GstMiniObject), 16}, + {"GstMiniObjectClass", sizeof (GstMiniObjectClass), 16}, + {"GstObject", sizeof (GstObject), 40}, + {"GstObjectClass", sizeof (GstObjectClass), 120}, + {"GstPad", sizeof (GstPad), 188}, + {"GstPadClass", sizeof (GstPadClass), 152}, + {"GstPadTemplate", sizeof (GstPadTemplate), 72}, + {"GstPadTemplateClass", sizeof (GstPadTemplateClass), 140}, + {"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 64}, + {"GstPipeline", sizeof (GstPipeline), 232}, + {"GstPipelineClass", sizeof (GstPipelineClass), 304}, + {"GstPlugin", sizeof (GstPlugin), 152}, + {"GstPluginClass", sizeof (GstPluginClass), 136}, + {"GstPluginDesc", sizeof (GstPluginDesc), 56}, + {"GstPluginFeature", sizeof (GstPluginFeature), 72}, + {"GstPluginFeatureClass", sizeof (GstPluginFeatureClass), 136}, + {"GstQueryTypeDefinition", sizeof (GstQueryTypeDefinition), 16}, + {"GstQuery", sizeof (GstQuery), 28}, + {"GstQueryClass", sizeof (GstQueryClass), 32}, + {"GstRegistry", sizeof (GstRegistry), 72}, + {"GstRegistryClass", sizeof (GstRegistryClass), 144}, + {"GstSegment", sizeof (GstSegment), 88}, + {"GstStructure", sizeof (GstStructure), 20}, + {"GstSystemClock", sizeof (GstSystemClock), 200}, + {"GstSystemClockClass", sizeof (GstSystemClockClass), 176}, + {"GstTagSetterIFace", sizeof (GstTagSetterIFace), 8}, + {"GstTask", sizeof (GstTask), 80}, + {"GstTaskClass", sizeof (GstTaskClass), 140}, + {"GstTrace", sizeof (GstTrace), 20}, + {"GstTraceEntry", sizeof (GstTraceEntry), 128}, + {"GstAllocTrace", sizeof (GstAllocTrace), 16}, + {"GstTypeFind", sizeof (GstTypeFind), 32}, + {"GstTypeFindFactory", sizeof (GstTypeFindFactory), 108}, + {"GstTypeFindFactoryClass", sizeof (GstTypeFindFactoryClass), 152}, + {"GstURIHandlerInterface", sizeof (GstURIHandlerInterface), 44}, + {"GstValueTable", sizeof (GstValueTable), 32}, + {NULL, 0, 0} +}; diff --git a/tests/check/gst/struct_ppc64.h b/tests/check/gst/struct_ppc64.h new file mode 100644 index 0000000..3c3dbcd --- /dev/null +++ b/tests/check/gst/struct_ppc64.h @@ -0,0 +1,69 @@ +static GstCheckABIStruct list[] = { + {"GstBin", sizeof (GstBin), 336}, + {"GstBinClass", sizeof (GstBinClass), 568}, + {"GstBuffer", sizeof (GstBuffer), 120} , + {"GstBufferClass", sizeof (GstBufferClass), 32} , + {"GstBus", sizeof (GstBus), 152} , + {"GstBusClass", sizeof (GstBusClass), 288} , + {"GstCaps", sizeof (GstCaps), 56} , + {"GstStaticCaps", sizeof (GstStaticCaps), 96} , + {"GstChildProxyInterface", sizeof (GstChildProxyInterface), 80} , + {"GstClock", sizeof (GstClock), 240} , + {"GstClockClass", sizeof (GstClockClass), 320} , + {"GstElement", sizeof (GstElement), 232} , + {"GstElementClass", sizeof (GstElementClass), 488} , + {"GstElementFactory", sizeof (GstElementFactory), 280} , + {"GstElementFactoryClass", sizeof (GstElementFactoryClass), 304} , + {"GstElementDetails", sizeof (GstElementDetails), 64} , + {"GstEvent", sizeof (GstEvent), 64} , + {"GstEventClass", sizeof (GstEventClass), 64} , + {"GstFormatDefinition", sizeof (GstFormatDefinition), 32} , + {"GstIndexEntry", sizeof (GstIndexEntry), 32} , + {"GstIndexGroup", sizeof (GstIndexGroup), 24} , + {"GstIndex", sizeof (GstIndex), 192} , + {"GstIndexClass", sizeof (GstIndexClass), 312} , + {"GstIndexAssociation", sizeof (GstIndexAssociation), 16} , + {"GstIndexFactory", sizeof (GstIndexFactory), 192} , + {"GstIndexFactoryClass", sizeof (GstIndexFactoryClass), 304} , + {"GstDebugCategory", sizeof (GstDebugCategory), 24} , + {"GstIterator", sizeof (GstIterator), 104} , + {"GstMessage", sizeof (GstMessage), 104} , + {"GstMessageClass", sizeof (GstMessageClass), 64} , + {"GstMiniObject", sizeof (GstMiniObject), 24} , + {"GstMiniObjectClass", sizeof (GstMiniObjectClass), 32} , + {"GstObject", sizeof (GstObject), 80} , + {"GstObjectClass", sizeof (GstObjectClass), 240} , + {"GstPad", sizeof (GstPad), 368} , + {"GstPadClass", sizeof (GstPadClass), 304} , + {"GstPadTemplate", sizeof (GstPadTemplate), 136} , + {"GstPadTemplateClass", sizeof (GstPadTemplateClass), 280} , + {"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 112} , + {"GstPipeline", sizeof (GstPipeline), 392} , + {"GstPipelineClass", sizeof (GstPipelineClass), 600} , + {"GstPlugin", sizeof (GstPlugin), 280} , + {"GstPluginClass", sizeof (GstPluginClass), 272} , + {"GstPluginDesc", sizeof (GstPluginDesc), 104} , + {"GstPluginFeature", sizeof (GstPluginFeature), 144} , + {"GstPluginFeatureClass", sizeof (GstPluginFeatureClass), 272} , + {"GstQueryTypeDefinition", sizeof (GstQueryTypeDefinition), 32} , + {"GstQuery", sizeof (GstQuery), 48} , + {"GstQueryClass", sizeof (GstQueryClass), 64} , + {"GstRegistry", sizeof (GstRegistry), 144} , + {"GstRegistryClass", sizeof (GstRegistryClass), 288} , + {"GstSegment", sizeof (GstSegment), 104} , + {"GstStructure", sizeof (GstStructure), 40} , + {"GstSystemClock", sizeof (GstSystemClock), 288} , + {"GstSystemClockClass", sizeof (GstSystemClockClass), 352} , + {"GstTagSetterIFace", sizeof (GstTagSetterIFace), 16} , + {"GstTask", sizeof (GstTask), 160} , + {"GstTaskClass", sizeof (GstTaskClass), 280} , + {"GstTrace", sizeof (GstTrace), 32} , + {"GstTraceEntry", sizeof (GstTraceEntry), 128} , + {"GstAllocTrace", sizeof (GstAllocTrace), 24} , + {"GstTypeFind", sizeof (GstTypeFind), 64} , + {"GstTypeFindFactory", sizeof (GstTypeFindFactory), 216} , + {"GstTypeFindFactoryClass", sizeof (GstTypeFindFactoryClass), 304} , + {"GstURIHandlerInterface", sizeof (GstURIHandlerInterface), 88} , + {"GstValueTable", sizeof (GstValueTable), 64} , + {NULL, 0, 0} +}; diff --git a/tests/check/gst/struct_sparc.h b/tests/check/gst/struct_sparc.h new file mode 100644 index 0000000..73764c9 --- /dev/null +++ b/tests/check/gst/struct_sparc.h @@ -0,0 +1,70 @@ + +GstCheckABIStruct list[] = { + {"GstBin", sizeof (GstBin), 192}, + {"GstBinClass", sizeof (GstBinClass), 288}, + {"GstBuffer", sizeof (GstBuffer), 88}, + {"GstBufferClass", sizeof (GstBufferClass), 16}, + {"GstBus", sizeof (GstBus), 80}, + {"GstBusClass", sizeof (GstBusClass), 144}, + {"GstCaps", sizeof (GstCaps), 32}, + {"GstStaticCaps", sizeof (GstStaticCaps), 52}, + {"GstChildProxyInterface", sizeof (GstChildProxyInterface), 40}, + {"GstClock", sizeof (GstClock), 176}, + {"GstClockClass", sizeof (GstClockClass), 160}, + {"GstElement", sizeof (GstElement), 136}, + {"GstElementClass", sizeof (GstElementClass), 248}, + {"GstElementFactory", sizeof (GstElementFactory), 144}, + {"GstElementFactoryClass", sizeof (GstElementFactoryClass), 152}, + {"GstElementDetails", sizeof (GstElementDetails), 32}, + {"GstEvent", sizeof (GstEvent), 48}, + {"GstEventClass", sizeof (GstEventClass), 32}, + {"GstFormatDefinition", sizeof (GstFormatDefinition), 16}, + {"GstIndexEntry", sizeof (GstIndexEntry), 20}, + {"GstIndexGroup", sizeof (GstIndexGroup), 16}, + {"GstIndex", sizeof (GstIndex), 100}, + {"GstIndexClass", sizeof (GstIndexClass), 156}, + {"GstIndexAssociation", sizeof (GstIndexAssociation), 16}, + {"GstIndexFactory", sizeof (GstIndexFactory), 96}, + {"GstIndexFactoryClass", sizeof (GstIndexFactoryClass), 152}, + {"GstDebugCategory", sizeof (GstDebugCategory), 16}, + {"GstIterator", sizeof (GstIterator), 52}, + {"GstMessage", sizeof (GstMessage), 64}, + {"GstMessageClass", sizeof (GstMessageClass), 32}, + {"GstMiniObject", sizeof (GstMiniObject), 16}, + {"GstMiniObjectClass", sizeof (GstMiniObjectClass), 16}, + {"GstObject", sizeof (GstObject), 40}, + {"GstObjectClass", sizeof (GstObjectClass), 120}, + {"GstPad", sizeof (GstPad), 188}, + {"GstPadClass", sizeof (GstPadClass), 152}, + {"GstPadTemplate", sizeof (GstPadTemplate), 72}, + {"GstPadTemplateClass", sizeof (GstPadTemplateClass), 140}, + {"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 64}, + {"GstPipeline", sizeof (GstPipeline), 232}, + {"GstPipelineClass", sizeof (GstPipelineClass), 304}, + {"GstPlugin", sizeof (GstPlugin), 152}, + {"GstPluginClass", sizeof (GstPluginClass), 136}, + {"GstPluginDesc", sizeof (GstPluginDesc), 56}, + {"GstPluginFeature", sizeof (GstPluginFeature), 72}, + {"GstPluginFeatureClass", sizeof (GstPluginFeatureClass), 136}, + {"GstQueryTypeDefinition", sizeof (GstQueryTypeDefinition), 16}, + {"GstQuery", sizeof (GstQuery), 28}, + {"GstQueryClass", sizeof (GstQueryClass), 32}, + {"GstRegistry", sizeof (GstRegistry), 72}, + {"GstRegistryClass", sizeof (GstRegistryClass), 144}, + {"GstSegment", sizeof (GstSegment), 88}, + {"GstStructure", sizeof (GstStructure), 20}, + {"GstSystemClock", sizeof (GstSystemClock), 200}, + {"GstSystemClockClass", sizeof (GstSystemClockClass), 176}, + {"GstTagSetterIFace", sizeof (GstTagSetterIFace), 8}, + {"GstTask", sizeof (GstTask), 80}, + {"GstTaskClass", sizeof (GstTaskClass), 140}, + {"GstTrace", sizeof (GstTrace), 20}, + {"GstTraceEntry", sizeof (GstTraceEntry), 128}, + {"GstAllocTrace", sizeof (GstAllocTrace), 16}, + {"GstTypeFind", sizeof (GstTypeFind), 32}, + {"GstTypeFindFactory", sizeof (GstTypeFindFactory), 108}, + {"GstTypeFindFactoryClass", sizeof (GstTypeFindFactoryClass), 152}, + {"GstURIHandlerInterface", sizeof (GstURIHandlerInterface), 44}, + {"GstValueTable", sizeof (GstValueTable), 32}, + {NULL, 0, 0} +}; diff --git a/tests/check/gst/struct_x86_64.h b/tests/check/gst/struct_x86_64.h new file mode 100644 index 0000000..91cdcf5 --- /dev/null +++ b/tests/check/gst/struct_x86_64.h @@ -0,0 +1,83 @@ +static GstCheckABIStruct list[] = { + {"GstAllocTrace", sizeof (GstAllocTrace), 24}, + {"GstBinClass", sizeof (GstBinClass), 568}, + {"GstBin", sizeof (GstBin), 336}, + {"GstBufferClass", sizeof (GstBufferClass), 32}, + {"GstBuffer", sizeof (GstBuffer), 120}, + {"GstBusClass", sizeof (GstBusClass), 288}, + {"GstBus", sizeof (GstBus), 152}, + {"GstCaps", sizeof (GstCaps), 56}, + {"GstChildProxyInterface", sizeof (GstChildProxyInterface), 80}, + {"GstClockClass", sizeof (GstClockClass), 320}, + {"GstClockEntry", sizeof (GstClockEntry), 80}, + {"GstClock", sizeof (GstClock), 240}, + {"GstDebugCategory", sizeof (GstDebugCategory), 24}, + {"GstElementClass", sizeof (GstElementClass), 488}, + {"GstElementDetails", sizeof (GstElementDetails), 64}, + {"GstElementFactoryClass", sizeof (GstElementFactoryClass), 304}, + {"GstElementFactory", sizeof (GstElementFactory), 280}, + {"GstElement", sizeof (GstElement), 232}, + {"GstEventClass", sizeof (GstEventClass), 64}, + {"GstEvent", sizeof (GstEvent), 64}, + {"GstFormatDefinition", sizeof (GstFormatDefinition), 32}, + {"GstGhostPadClass", sizeof (GstGhostPadClass), 344}, + {"GstGhostPad", sizeof (GstGhostPad), 384}, + {"GstIndexAssociation", sizeof (GstIndexAssociation), 16}, + {"GstIndexClass", sizeof (GstIndexClass), 312}, + {"GstIndexEntry", sizeof (GstIndexEntry), 32}, + {"GstIndexFactoryClass", sizeof (GstIndexFactoryClass), 304}, + {"GstIndexFactory", sizeof (GstIndexFactory), 192}, + {"GstIndexGroup", sizeof (GstIndexGroup), 24}, + {"GstIndex", sizeof (GstIndex), 192}, + {"GstIterator", sizeof (GstIterator), 104}, + {"GstMessageClass", sizeof (GstMessageClass), 64}, + {"GstMessage", sizeof (GstMessage), 104}, + {"GstMiniObjectClass", sizeof (GstMiniObjectClass), 32}, + {"GstMiniObject", sizeof (GstMiniObject), 24}, + {"GstObjectClass", sizeof (GstObjectClass), 240}, + {"GstObject", sizeof (GstObject), 80}, + {"GstPadClass", sizeof (GstPadClass), 304}, + {"GstPad", sizeof (GstPad), 368}, + {"GstPadTemplateClass", sizeof (GstPadTemplateClass), 280}, + {"GstPadTemplate", sizeof (GstPadTemplate), 136}, + {"GstPadTemplate", sizeof (GstPadTemplate), 136}, + {"GstParamSpecFraction", sizeof (GstParamSpecFraction), 96}, + {"GstParamSpecMiniObject", sizeof (GstParamSpecMiniObject), 72}, + {"GstPipelineClass", sizeof (GstPipelineClass), 600}, + {"GstPipeline", sizeof (GstPipeline), 392}, + {"GstPluginClass", sizeof (GstPluginClass), 272}, + {"GstPluginDesc", sizeof (GstPluginDesc), 104}, + {"GstPluginFeatureClass", sizeof (GstPluginFeatureClass), 272}, + {"GstPluginFeature", sizeof (GstPluginFeature), 144}, + {"GstPlugin", sizeof (GstPlugin), 280}, + {"GstPresetInterface", sizeof (GstPresetInterface), 112}, + {"GstProxyPadClass", sizeof (GstProxyPadClass), 312}, + {"GstProxyPad", sizeof (GstProxyPad), 376}, + {"GstQueryClass", sizeof (GstQueryClass), 64}, + {"GstQuery", sizeof (GstQuery), 48}, + {"GstQueryTypeDefinition", sizeof (GstQueryTypeDefinition), 32}, + {"GstRegistryClass", sizeof (GstRegistryClass), 288}, + {"GstRegistry", sizeof (GstRegistry), 144}, + {"GstSegment", sizeof (GstSegment), 104}, + {"GstStaticCaps", sizeof (GstStaticCaps), 96}, + {"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 112}, + {"GstStructure", sizeof (GstStructure), 40}, + {"GstSystemClockClass", sizeof (GstSystemClockClass), 352}, + {"GstSystemClock", sizeof (GstSystemClock), 288}, + {"GstTagList", sizeof (GstTagList), 40}, + {"GstTagSetterIFace", sizeof (GstTagSetterIFace), 16}, + {"GstTaskClass", sizeof (GstTaskClass), 280}, + {"GstTask", sizeof (GstTask), 160}, + {"GstTaskPoolClass", sizeof (GstTaskPoolClass), 304}, + {"GstTaskPool", sizeof (GstTaskPool), 120}, + {"GstTaskThreadCallbacks", sizeof (GstTaskThreadCallbacks), 48}, + {"GstTraceEntry", sizeof (GstTraceEntry), 128}, + {"GstTrace", sizeof (GstTrace), 32}, + {"GstTypeFindFactoryClass", sizeof (GstTypeFindFactoryClass), 304}, + {"GstTypeFindFactory", sizeof (GstTypeFindFactory), 216}, + {"GstTypeFind", sizeof (GstTypeFind), 64}, + {"GstTypeNameData", sizeof (GstTypeNameData), 16}, + {"GstURIHandlerInterface", sizeof (GstURIHandlerInterface), 88}, + {"GstValueTable", sizeof (GstValueTable), 64}, + {NULL, 0, 0} +}; diff --git a/tests/check/libs/adapter.c b/tests/check/libs/adapter.c new file mode 100644 index 0000000..b456473 --- /dev/null +++ b/tests/check/libs/adapter.c @@ -0,0 +1,823 @@ +/* GStreamer + * + * unit test for adapter + * + * Copyright (C) <2005> Wim Taymans <wim at fluendo dot 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. + */ + +#include <gst/check/gstcheck.h> + +#include <gst/base/gstadapter.h> + +/* does some implementation dependent checking that should + * also be optimal + */ + +/* + * Start peeking on an adapter with 1 buffer pushed. + */ +GST_START_TEST (test_peek1) +{ + GstAdapter *adapter; + GstBuffer *buffer; + guint avail; + const guint8 *bufdata, *data1, *data2; + + adapter = gst_adapter_new (); + fail_if (adapter == NULL); + + /* push single buffer in adapter */ + buffer = gst_buffer_new_and_alloc (512); + + bufdata = gst_buffer_map (buffer, NULL, NULL, GST_MAP_READ); + + fail_if (buffer == NULL); + gst_adapter_push (adapter, buffer); + + /* available and available_fast should return the size of the + * buffer */ + avail = gst_adapter_available (adapter); + fail_if (avail != 512); + avail = gst_adapter_available_fast (adapter); + fail_if (avail != 512); + + /* should g_critical with NULL as result */ + ASSERT_CRITICAL (data1 = gst_adapter_map (adapter, 0)); + fail_if (data1 != NULL); + + /* should return NULL as result */ + data1 = gst_adapter_map (adapter, 513); + fail_if (data1 != NULL); + + /* this should work */ + data1 = gst_adapter_map (adapter, 512); + fail_if (data1 == NULL); + /* it should point to the buffer data as well */ + fail_if (data1 != bufdata); + gst_adapter_unmap (adapter, 0); + + data2 = gst_adapter_map (adapter, 512); + fail_if (data2 == NULL); + /* second peek should return the same pointer */ + fail_if (data2 != data1); + gst_adapter_unmap (adapter, 0); + + /* this should fail since we don't have that many bytes */ + ASSERT_CRITICAL (gst_adapter_flush (adapter, 513)); + + /* this should work fine */ + gst_adapter_flush (adapter, 10); + + /* see if we have 10 bytes less available */ + avail = gst_adapter_available (adapter); + fail_if (avail != 502); + avail = gst_adapter_available_fast (adapter); + fail_if (avail != 502); + + /* should return NULL as result */ + data2 = gst_adapter_map (adapter, 503); + fail_if (data2 != NULL); + + /* should work fine */ + data2 = gst_adapter_map (adapter, 502); + fail_if (data2 == NULL); + /* peek should return the same old pointer + 10 */ + fail_if (data2 != data1 + 10); + fail_if (data2 != bufdata + 10); + gst_adapter_unmap (adapter, 0); + + /* flush some more */ + gst_adapter_flush (adapter, 500); + + /* see if we have 2 bytes available */ + avail = gst_adapter_available (adapter); + fail_if (avail != 2); + avail = gst_adapter_available_fast (adapter); + fail_if (avail != 2); + + data2 = gst_adapter_map (adapter, 2); + fail_if (data2 == NULL); + fail_if (data2 != data1 + 510); + fail_if (data2 != bufdata + 510); + gst_adapter_unmap (adapter, 0); + + /* flush some more */ + gst_adapter_flush (adapter, 2); + + /* see if we have 0 bytes available */ + avail = gst_adapter_available (adapter); + fail_if (avail != 0); + avail = gst_adapter_available_fast (adapter); + fail_if (avail != 0); + + /* silly clear just for fun */ + gst_adapter_clear (adapter); + + g_object_unref (adapter); +} + +GST_END_TEST; + +/* Start peeking on an adapter with 2 non-mergeable buffers + * pushed. + */ +GST_START_TEST (test_peek2) +{ +} + +GST_END_TEST; + +/* Start peeking on an adapter with 2 mergeable buffers + * pushed. + */ +GST_START_TEST (test_peek3) +{ +} + +GST_END_TEST; + +/* take data from an adapter with 1 buffer pushed. + */ +GST_START_TEST (test_take1) +{ + GstAdapter *adapter; + GstBuffer *buffer, *buffer2; + guint avail; + guint8 *data, *data2; + gsize size, size2; + + adapter = gst_adapter_new (); + fail_unless (adapter != NULL); + + buffer = gst_buffer_new_and_alloc (100); + fail_unless (buffer != NULL); + data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); + fail_unless (data != NULL); + fail_unless (size == 100); + + /* push in the adapter */ + gst_adapter_push (adapter, buffer); + + avail = gst_adapter_available (adapter); + fail_unless (avail == 100); + + /* take out buffer */ + buffer2 = gst_adapter_take_buffer (adapter, 100); + fail_unless (buffer2 != NULL); + + data2 = gst_buffer_map (buffer2, &size2, NULL, GST_MAP_READ); + fail_unless (data2 != NULL); + fail_unless (size2 == 100); + + avail = gst_adapter_available (adapter); + fail_unless (avail == 0); + + /* the buffer should be the same */ + fail_unless (buffer == buffer2); + fail_unless (data == data2); + + gst_buffer_unmap (buffer, data, size); + gst_buffer_unmap (buffer2, data2, size2); + + gst_buffer_unref (buffer2); + + g_object_unref (adapter); +} + +GST_END_TEST; + +/* take data from an adapter with 2 non-mergeable buffers + * pushed. + */ +GST_START_TEST (test_take2) +{ +} + +GST_END_TEST; + +/* take data from an adapter with 2 mergeable buffers + * pushed. + */ +GST_START_TEST (test_take3) +{ + GstAdapter *adapter; + GstBuffer *buffer, *buffer2; + guint avail; + guint8 *data, *data2; + gsize size, size2; + + adapter = gst_adapter_new (); + fail_unless (adapter != NULL); + + buffer = gst_buffer_new_and_alloc (100); + fail_unless (buffer != NULL); + data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); + fail_unless (data != NULL); + fail_unless (size == 100); + + /* set up and push subbuffers */ + buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 0, 25); + gst_adapter_push (adapter, buffer2); + buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 25, 25); + gst_adapter_push (adapter, buffer2); + buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 50, 25); + gst_adapter_push (adapter, buffer2); + buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 75, 25); + gst_adapter_push (adapter, buffer2); + + gst_buffer_unref (buffer); + + avail = gst_adapter_available (adapter); + fail_unless (avail == 100); + + /* take out buffer */ + buffer2 = gst_adapter_take_buffer (adapter, 100); + fail_unless (buffer2 != NULL); + data2 = gst_buffer_map (buffer2, &size2, NULL, GST_MAP_READ); + fail_unless (data2 != NULL); + fail_unless (size2 == 100); + + avail = gst_adapter_available (adapter); + fail_unless (avail == 0); + + /* the data should be the same */ + fail_unless (data == data2); + + gst_buffer_unref (buffer2); + + g_object_unref (adapter); +} + +GST_END_TEST; + +static GstAdapter * +create_and_fill_adapter (void) +{ + GstAdapter *adapter; + gint i, j; + + adapter = gst_adapter_new (); + fail_unless (adapter != NULL); + + for (i = 0; i < 10000; i += 4) { + GstBuffer *buf; + guint8 *data, *ptr; + + buf = gst_buffer_new_and_alloc (sizeof (guint32) * 4); + fail_unless (buf != NULL); + + ptr = data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + + for (j = 0; j < 4; j++) { + GST_WRITE_UINT32_LE (ptr, i + j); + ptr += sizeof (guint32); + } + gst_buffer_unmap (buf, data, sizeof (guint32) * 4); + + gst_adapter_push (adapter, buf); + } + + return adapter; +} + +/* Fill a buffer with a sequence of 32 bit ints and read them back out, + * checking that they're still in the right order */ +GST_START_TEST (test_take_order) +{ + GstAdapter *adapter; + int i = 0; + + adapter = create_and_fill_adapter (); + while (gst_adapter_available (adapter) >= sizeof (guint32)) { + guint8 *data = gst_adapter_take (adapter, sizeof (guint32)); + guint32 val = GST_READ_UINT32_LE (data); + + GST_DEBUG ("val %8u", val); + fail_unless (val == i); + i++; + g_free (data); + } + fail_unless (gst_adapter_available (adapter) == 0, + "Data was left in the adapter"); + + g_object_unref (adapter); +} + +GST_END_TEST; + +/* Fill a buffer with a sequence of 32 bit ints and read them back out + * using take_buffer, checking that they're still in the right order */ +GST_START_TEST (test_take_buf_order) +{ + GstAdapter *adapter; + int i = 0; + + adapter = create_and_fill_adapter (); + while (gst_adapter_available (adapter) >= sizeof (guint32)) { + GstBuffer *buf = gst_adapter_take_buffer (adapter, sizeof (guint32)); + gpointer data; + gsize size; + + data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ); + fail_unless (GST_READ_UINT32_LE (data) == i); + gst_buffer_unmap (buf, data, size); + + i++; + + gst_buffer_unref (buf); + } + fail_unless (gst_adapter_available (adapter) == 0, + "Data was left in the adapter"); + + g_object_unref (adapter); +} + +GST_END_TEST; + +GST_START_TEST (test_timestamp) +{ + GstAdapter *adapter; + GstBuffer *buffer; + guint avail; + GstClockTime timestamp; + guint64 dist; + guint8 *data; + const guint8 *cdata; + + adapter = gst_adapter_new (); + fail_unless (adapter != NULL); + + buffer = gst_buffer_new_and_alloc (100); + + /* push in the adapter */ + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 100); + + /* timestamp is now undefined */ + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + fail_unless (dist == 0); + + gst_adapter_flush (adapter, 50); + avail = gst_adapter_available (adapter); + fail_unless (avail == 50); + + /* still undefined, dist changed, though */ + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + fail_unless (dist == 50); + + buffer = gst_buffer_new_and_alloc (100); + GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND; + + /* push in the adapter */ + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 150); + + /* timestamp is still undefined */ + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + fail_unless (dist == 50); + + /* flush out first buffer we are now at the second buffer timestamp */ + gst_adapter_flush (adapter, 50); + avail = gst_adapter_available (adapter); + fail_unless (avail == 100); + + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 1 * GST_SECOND); + fail_unless (dist == 0); + + /* move some more, still the same timestamp but further away */ + gst_adapter_flush (adapter, 50); + avail = gst_adapter_available (adapter); + fail_unless (avail == 50); + + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 1 * GST_SECOND); + fail_unless (dist == 50); + + /* push a buffer without timestamp in the adapter */ + buffer = gst_buffer_new_and_alloc (100); + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 150); + /* push a buffer with timestamp in the adapter */ + buffer = gst_buffer_new_and_alloc (100); + GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND; + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 250); + + /* timestamp still as it was before the push */ + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 1 * GST_SECOND); + fail_unless (dist == 50); + + /* flush away buffer with the timestamp */ + gst_adapter_flush (adapter, 50); + avail = gst_adapter_available (adapter); + fail_unless (avail == 200); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 1 * GST_SECOND); + fail_unless (dist == 100); + + /* move into the second buffer */ + gst_adapter_flush (adapter, 50); + avail = gst_adapter_available (adapter); + fail_unless (avail == 150); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 1 * GST_SECOND); + fail_unless (dist == 150); + + /* move to third buffer we move to the new timestamp */ + gst_adapter_flush (adapter, 50); + avail = gst_adapter_available (adapter); + fail_unless (avail == 100); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 2 * GST_SECOND); + fail_unless (dist == 0); + + /* move everything out */ + gst_adapter_flush (adapter, 100); + avail = gst_adapter_available (adapter); + fail_unless (avail == 0); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 2 * GST_SECOND); + fail_unless (dist == 100); + + /* clear everything */ + gst_adapter_clear (adapter); + avail = gst_adapter_available (adapter); + fail_unless (avail == 0); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + fail_unless (dist == 0); + + /* push an empty buffer with timestamp in the adapter */ + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND; + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 0); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 2 * GST_SECOND); + fail_unless (dist == 0); + + /* push another empty buffer */ + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 3 * GST_SECOND; + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 0); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 2 * GST_SECOND); + fail_unless (dist == 0); + + /* push a buffer with timestamp in the adapter */ + buffer = gst_buffer_new_and_alloc (100); + GST_BUFFER_TIMESTAMP (buffer) = 4 * GST_SECOND; + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 100); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 2 * GST_SECOND); + fail_unless (dist == 0); + + gst_adapter_flush (adapter, 1); + avail = gst_adapter_available (adapter); + fail_unless (avail == 99); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 4 * GST_SECOND); + fail_unless (dist == 1); + + /* push an empty buffer with timestamp in the adapter */ + buffer = gst_buffer_new (); + GST_BUFFER_TIMESTAMP (buffer) = 5 * GST_SECOND; + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 99); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 4 * GST_SECOND); + fail_unless (dist == 1); + + /* push buffer without timestamp */ + buffer = gst_buffer_new_and_alloc (100); + gst_adapter_push (adapter, buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 199); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 4 * GST_SECOND); + fail_unless (dist == 1); + + /* remove first buffer, timestamp of empty buffer is visible */ + buffer = gst_adapter_take_buffer (adapter, 99); + fail_unless (buffer != NULL); + fail_unless (gst_buffer_get_size (buffer) == 99); + gst_buffer_unref (buffer); + avail = gst_adapter_available (adapter); + fail_unless (avail == 100); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 5 * GST_SECOND); + fail_unless (dist == 0); + + /* remove empty buffer, timestamp still visible */ + cdata = gst_adapter_map (adapter, 50); + fail_unless (cdata != NULL); + gst_adapter_unmap (adapter, 0); + + data = gst_adapter_take (adapter, 50); + fail_unless (data != NULL); + g_free (data); + avail = gst_adapter_available (adapter); + fail_unless (avail == 50); + timestamp = gst_adapter_prev_timestamp (adapter, &dist); + fail_unless (timestamp == 5 * GST_SECOND); + fail_unless (dist == 50); + + g_object_unref (adapter); +} + +GST_END_TEST; + +GST_START_TEST (test_scan) +{ + GstAdapter *adapter; + GstBuffer *buffer; + guint8 *data; + guint offset; + guint i; + + adapter = gst_adapter_new (); + fail_unless (adapter != NULL); + + buffer = gst_buffer_new_and_alloc (100); + + data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE); + /* fill with pattern */ + for (i = 0; i < 100; i++) + data[i] = i; + gst_buffer_unmap (buffer, data, 100); + + gst_adapter_push (adapter, buffer); + + /* find first bytes */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 0, 100); + fail_unless (offset == 0); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 0, 100); + fail_unless (offset == 1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 1, 99); + fail_unless (offset == 1); + /* offset is past the pattern start */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 2, 98); + fail_unless (offset == -1); + /* not enough bytes to find the pattern */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x02030405, 2, 3); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x02030405, 2, 4); + fail_unless (offset == 2); + /* size does not include the last scanned byte */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 0, 0x41); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 0, 0x43); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 0, 0x44); + fail_unless (offset == 0x40); + /* past the start */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 65, 10); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 64, 5); + fail_unless (offset == 64); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 65, 35); + fail_unless (offset == 0x60); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 0x60, 4); + fail_unless (offset == 0x60); + /* past the start */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 0x61, 3); + fail_unless (offset == -1); + + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 99, 1); + fail_unless (offset == -1); + + /* add another buffer */ + buffer = gst_buffer_new_and_alloc (100); + + data = gst_buffer_map (buffer, NULL, NULL, GST_MAP_WRITE); + /* fill with pattern */ + for (i = 0; i < 100; i++) + data[i] = i + 100; + gst_buffer_unmap (buffer, data, 100); + + gst_adapter_push (adapter, buffer); + + /* past the start */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 0x61, 6); + fail_unless (offset == -1); + /* this should work */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x61626364, 0x61, 4); + fail_unless (offset == 0x61); + /* not enough data */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x62636465, 0x61, 4); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x62636465, 0x61, 5); + fail_unless (offset == 0x62); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x62636465, 0, 120); + fail_unless (offset == 0x62); + + /* border conditions */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x62636465, 0, 200); + fail_unless (offset == 0x62); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x63646566, 0, 200); + fail_unless (offset == 0x63); + /* we completely searched the first list */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0, 200); + fail_unless (offset == 0x64); + /* skip first buffer */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0x64, + 100); + fail_unless (offset == 0x64); + /* past the start */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0x65, + 10); + fail_unless (offset == -1); + /* not enough data to scan */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0x63, 4); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0x63, 5); + fail_unless (offset == 0x64); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0, 199); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0x62, + 102); + fail_unless (offset == 0xc4); + /* different masks */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0x00ffffff, 0x00656667, 0x64, + 100); + fail_unless (offset == 0x64); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0x000000ff, 0x00000000, 0, 100); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0x000000ff, 0x00000003, 0, 100); + fail_unless (offset == 0); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0x000000ff, 0x00000061, 0x61, + 100); + fail_unless (offset == -1); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xff000000, 0x61000000, 0, 0x62); + fail_unless (offset == -1); + /* does not even exist */ + ASSERT_CRITICAL (offset = + gst_adapter_masked_scan_uint32 (adapter, 0x00ffffff, 0xffffffff, 0x65, + 99)); + fail_unless (offset == -1); + + /* flush some bytes */ + gst_adapter_flush (adapter, 0x20); + + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x20212223, 0, 100); + fail_unless (offset == 0); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x20212223, 0, 4); + fail_unless (offset == 0); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0x62, + 70); + fail_unless (offset == 0xa4); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0, 168); + fail_unless (offset == 0xa4); + + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 164, 4); + fail_unless (offset == 0xa4); + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0x44, + 100); + fail_unless (offset == 0xa4); + /* not enough bytes */ + offset = + gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0x44, + 99); + fail_unless (offset == -1); + + g_object_unref (adapter); +} + +GST_END_TEST; + +/* Fill a buffer with a sequence of 32 bit ints and read them back out + * using take_buffer, checking that they're still in the right order */ +GST_START_TEST (test_take_list) +{ + GstAdapter *adapter; + int i = 0; + + adapter = create_and_fill_adapter (); + while (gst_adapter_available (adapter) >= sizeof (guint32)) { + GList *list, *walk; + GstBuffer *buf; + gsize size, left; + guint8 *data, *ptr; + + list = gst_adapter_take_list (adapter, sizeof (guint32) * 5); + fail_unless (list != NULL); + + for (walk = list; walk; walk = g_list_next (walk)) { + buf = walk->data; + + ptr = data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ); + + left = size; + while (left > 0) { + fail_unless (GST_READ_UINT32_LE (ptr) == i); + i++; + ptr += sizeof (guint32); + left -= sizeof (guint32); + } + gst_buffer_unmap (buf, data, size); + + gst_buffer_unref (buf); + } + g_list_free (list); + } + fail_unless (gst_adapter_available (adapter) == 0, + "Data was left in the adapter"); + + g_object_unref (adapter); +} + +GST_END_TEST; + +static Suite * +gst_adapter_suite (void) +{ + Suite *s = suite_create ("adapter"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_peek1); + tcase_add_test (tc_chain, test_peek2); + tcase_add_test (tc_chain, test_peek3); + tcase_add_test (tc_chain, test_take1); + tcase_add_test (tc_chain, test_take2); + tcase_add_test (tc_chain, test_take3); + tcase_add_test (tc_chain, test_take_order); + tcase_add_test (tc_chain, test_take_buf_order); + tcase_add_test (tc_chain, test_timestamp); + tcase_add_test (tc_chain, test_scan); + tcase_add_test (tc_chain, test_take_list); + + return s; +} + +GST_CHECK_MAIN (gst_adapter); diff --git a/tests/check/libs/basesink.c b/tests/check/libs/basesink.c new file mode 100644 index 0000000..f2a2fce --- /dev/null +++ b/tests/check/libs/basesink.c @@ -0,0 +1,133 @@ +/* GStreamer + * + * Copyright (C) 2010 Alessandro Decina <alessandro.decina@collabora.co.uk> + * + * 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 <gst/check/gstcheck.h> +#include <gst/base/gstbasesink.h> + +GST_START_TEST (basesink_last_buffer_enabled) +{ + GstElement *src, *sink, *pipeline; + GstBus *bus; + GstMessage *msg; + GstBuffer *last_buffer; + + pipeline = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + fail_unless (gst_bin_add (GST_BIN (pipeline), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipeline), sink) == TRUE); + fail_unless (gst_element_link (src, sink) == TRUE); + + bus = gst_element_get_bus (pipeline); + + /* try with enable-last-buffer set to TRUE */ + g_object_set (src, "num-buffers", 1, NULL); + fail_unless (gst_element_set_state (pipeline, GST_STATE_PLAYING) + != GST_STATE_CHANGE_FAILURE); + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_unless (msg != NULL); + fail_unless (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); + gst_message_unref (msg); + + /* last-buffer should be != NULL */ + fail_unless (gst_base_sink_is_last_buffer_enabled (GST_BASE_SINK (sink)) + == TRUE); + g_object_get (sink, "last-buffer", &last_buffer, NULL); + fail_unless (last_buffer != NULL); + gst_buffer_unref (last_buffer); + + /* set enable-last-buffer to FALSE now, this should set last-buffer to NULL */ + g_object_set (sink, "enable-last-buffer", FALSE, NULL); + fail_unless (gst_base_sink_is_last_buffer_enabled (GST_BASE_SINK (sink)) + == FALSE); + g_object_get (sink, "last-buffer", &last_buffer, NULL); + fail_unless (last_buffer == NULL); + + gst_element_set_state (pipeline, GST_STATE_NULL); + + GST_INFO ("stopped"); + + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (basesink_last_buffer_disabled) +{ + GstElement *src, *sink, *pipeline; + GstBus *bus; + GstMessage *msg; + GstBuffer *last_buffer; + + pipeline = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + fail_unless (gst_bin_add (GST_BIN (pipeline), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipeline), sink) == TRUE); + fail_unless (gst_element_link (src, sink) == TRUE); + + bus = gst_element_get_bus (pipeline); + + /* set enable-last-buffer to FALSE */ + g_object_set (src, "num-buffers", 1, NULL); + gst_base_sink_set_last_buffer_enabled (GST_BASE_SINK (sink), FALSE); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_unless (msg != NULL); + fail_unless (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); + gst_message_unref (msg); + + /* last-buffer should be NULL */ + g_object_get (sink, "last-buffer", &last_buffer, NULL); + fail_unless (last_buffer == NULL); + + gst_element_set_state (pipeline, GST_STATE_NULL); + + GST_INFO ("stopped"); + + gst_object_unref (bus); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +gst_basesrc_suite (void) +{ + Suite *s = suite_create ("GstBaseSink"); + TCase *tc = tcase_create ("general"); + + suite_add_tcase (s, tc); + tcase_add_test (tc, basesink_last_buffer_enabled); + tcase_add_test (tc, basesink_last_buffer_disabled); + + return s; +} + +GST_CHECK_MAIN (gst_basesrc); diff --git a/tests/check/libs/basesrc.c b/tests/check/libs/basesrc.c new file mode 100644 index 0000000..8853ee9 --- /dev/null +++ b/tests/check/libs/basesrc.c @@ -0,0 +1,611 @@ +/* GStreamer + * + * some unit tests for GstBaseSrc + * + * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> +#include <gst/base/gstbasesrc.h> + +static GstProbeReturn +eos_event_counter (GstObject * pad, GstProbeType type, GstEvent * event, + guint * p_num_eos) +{ + fail_unless (event != NULL); + fail_unless (GST_IS_EVENT (event)); + + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) + *p_num_eos += 1; + + return GST_PROBE_OK; +} + +/* basesrc_eos_events_push_live_op: + * - make sure source does send an EOS event when operating in push + * mode and being set to READY explicitly (like one might with + * live sources) + */ +GST_START_TEST (basesrc_eos_events_push_live_op) +{ + GstStateChangeReturn state_ret; + GstElement *src, *sink, *pipe; + GstMessage *msg; + GstBus *bus; + GstPad *srcpad; + guint probe, num_eos = 0; + + pipe = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + g_assert (pipe != NULL); + g_assert (sink != NULL); + g_assert (src != NULL); + + fail_unless (gst_bin_add (GST_BIN (pipe), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipe), sink) == TRUE); + + fail_unless (gst_element_link (src, sink) == TRUE); + + g_object_set (sink, "can-activate-push", TRUE, NULL); + g_object_set (sink, "can-activate-pull", FALSE, NULL); + + g_object_set (src, "can-activate-push", TRUE, NULL); + g_object_set (src, "can-activate-pull", FALSE, NULL); + + /* set up event probe to count EOS events */ + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad != NULL); + + probe = gst_pad_add_probe (srcpad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) eos_event_counter, &num_eos, NULL); + + bus = gst_element_get_bus (pipe); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + state_ret = gst_element_get_state (pipe, NULL, NULL, -1); + fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS); + + /* wait a second, then do controlled shutdown */ + g_usleep (GST_USECOND * 1); + + /* shut down pipeline (should send EOS message) ... */ + gst_element_send_event (pipe, gst_event_new_eos ()); + + /* ... and wait for the EOS message from the sink */ + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_unless (msg != NULL); + fail_unless (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); + + /* should be exactly one EOS event */ + fail_unless (num_eos == 1); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_element_get_state (pipe, NULL, NULL, -1); + + /* make sure source hasn't sent a second one when going PAUSED => READY */ + fail_unless (num_eos == 1); + + gst_pad_remove_probe (srcpad, probe); + gst_object_unref (srcpad); + gst_message_unref (msg); + gst_object_unref (bus); + gst_object_unref (pipe); +} + +GST_END_TEST; + + + +/* basesrc_eos_events_push: + * - make sure source only sends one EOS when operating in push-mode, + * reaching the max number of buffers, and is then shut down. + */ +GST_START_TEST (basesrc_eos_events_push) +{ + GstStateChangeReturn state_ret; + GstElement *src, *sink, *pipe; + GstMessage *msg; + GstBus *bus; + GstPad *srcpad; + guint probe, num_eos = 0; + + pipe = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + g_assert (pipe != NULL); + g_assert (sink != NULL); + g_assert (src != NULL); + + fail_unless (gst_bin_add (GST_BIN (pipe), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipe), sink) == TRUE); + + fail_unless (gst_element_link (src, sink) == TRUE); + + g_object_set (sink, "can-activate-push", TRUE, NULL); + g_object_set (sink, "can-activate-pull", FALSE, NULL); + + g_object_set (src, "can-activate-push", TRUE, NULL); + g_object_set (src, "can-activate-pull", FALSE, NULL); + g_object_set (src, "num-buffers", 8, NULL); + + /* set up event probe to count EOS events */ + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad != NULL); + + probe = gst_pad_add_probe (srcpad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) eos_event_counter, &num_eos, NULL); + + bus = gst_element_get_bus (pipe); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + state_ret = gst_element_get_state (pipe, NULL, NULL, -1); + fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS); + + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_unless (msg != NULL); + fail_unless (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); + + /* should be exactly one EOS event */ + fail_unless (num_eos == 1); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_element_get_state (pipe, NULL, NULL, -1); + + /* make sure source hasn't sent a second one when going PAUSED => READY */ + fail_unless (num_eos == 1); + + gst_pad_remove_probe (srcpad, probe); + gst_object_unref (srcpad); + gst_message_unref (msg); + gst_object_unref (bus); + gst_object_unref (pipe); +} + +GST_END_TEST; + +/* basesrc_eos_events_pull_live_op: + * - make sure source doesn't send an EOS event when operating in + * pull mode and being set to READY explicitly (like one might with + * live sources) + */ +GST_START_TEST (basesrc_eos_events_pull_live_op) +{ + GstStateChangeReturn state_ret; + GstElement *src, *sink, *pipe; + GstPad *srcpad; + guint probe, num_eos = 0; + + pipe = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + g_assert (pipe != NULL); + g_assert (sink != NULL); + g_assert (src != NULL); + + fail_unless (gst_bin_add (GST_BIN (pipe), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipe), sink) == TRUE); + + fail_unless (gst_element_link (src, sink) == TRUE); + + g_object_set (sink, "can-activate-push", FALSE, NULL); + g_object_set (sink, "can-activate-pull", TRUE, NULL); + + g_object_set (src, "can-activate-push", FALSE, NULL); + g_object_set (src, "can-activate-pull", TRUE, NULL); + + /* set up event probe to count EOS events */ + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad != NULL); + + probe = gst_pad_add_probe (srcpad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) eos_event_counter, &num_eos, NULL); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + state_ret = gst_element_get_state (pipe, NULL, NULL, -1); + fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS); + + /* wait a second, then do controlled shutdown */ + g_usleep (GST_USECOND * 1); + + /* shut down source only ... */ + gst_element_set_state (src, GST_STATE_NULL); + state_ret = gst_element_get_state (src, NULL, NULL, -1); + fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS); + + fail_unless (gst_element_set_locked_state (src, TRUE) == TRUE); + + /* source shouldn't have sent any EOS event in pull mode */ + fail_unless (num_eos == 0); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_element_get_state (pipe, NULL, NULL, -1); + + /* make sure source hasn't sent an EOS when going PAUSED => READY either */ + fail_unless (num_eos == 0); + + gst_pad_remove_probe (srcpad, probe); + gst_object_unref (srcpad); + gst_object_unref (pipe); +} + +GST_END_TEST; + +/* basesrc_eos_events_pull: + * - makes sure source doesn't send EOS event when reaching the max. + * number of buffers configured in pull-mode + * - make sure source doesn't send EOS event either when being shut down + * (PAUSED => READY state change) after EOSing in pull mode + */ +GST_START_TEST (basesrc_eos_events_pull) +{ + GstStateChangeReturn state_ret; + GstElement *src, *sink, *pipe; + GstMessage *msg; + GstBus *bus; + GstPad *srcpad; + guint probe, num_eos = 0; + + pipe = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + g_assert (pipe != NULL); + g_assert (sink != NULL); + g_assert (src != NULL); + + fail_unless (gst_bin_add (GST_BIN (pipe), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipe), sink) == TRUE); + + fail_unless (gst_element_link (src, sink) == TRUE); + + g_object_set (sink, "can-activate-push", FALSE, NULL); + g_object_set (sink, "can-activate-pull", TRUE, NULL); + + g_object_set (src, "can-activate-push", FALSE, NULL); + g_object_set (src, "can-activate-pull", TRUE, NULL); + g_object_set (src, "num-buffers", 8, NULL); + + /* set up event probe to count EOS events */ + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad != NULL); + + probe = gst_pad_add_probe (srcpad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) eos_event_counter, &num_eos, NULL); + + bus = gst_element_get_bus (pipe); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + state_ret = gst_element_get_state (pipe, NULL, NULL, -1); + fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS); + + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_unless (msg != NULL); + fail_unless (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); + + /* source shouldn't have sent any EOS event in pull mode */ + fail_unless (num_eos == 0); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_element_get_state (pipe, NULL, NULL, -1); + + /* make sure source hasn't sent an EOS when going PAUSED => READY either */ + fail_unless (num_eos == 0); + + gst_pad_remove_probe (srcpad, probe); + gst_object_unref (srcpad); + gst_message_unref (msg); + gst_object_unref (bus); + gst_object_unref (pipe); +} + +GST_END_TEST; + + +/* basesrc_eos_events_push_live_eos: + * - make sure the source stops and emits EOS when we send an EOS event to the + * pipeline. + */ +GST_START_TEST (basesrc_eos_events_push_live_eos) +{ + GstStateChangeReturn state_ret; + GstElement *src, *sink, *pipe; + GstMessage *msg; + GstBus *bus; + GstPad *srcpad; + guint probe, num_eos = 0; + gboolean res; + + pipe = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + g_assert (pipe != NULL); + g_assert (sink != NULL); + g_assert (src != NULL); + + fail_unless (gst_bin_add (GST_BIN (pipe), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipe), sink) == TRUE); + + fail_unless (gst_element_link (src, sink) == TRUE); + + g_object_set (sink, "can-activate-push", TRUE, NULL); + g_object_set (sink, "can-activate-pull", FALSE, NULL); + + g_object_set (src, "can-activate-push", TRUE, NULL); + g_object_set (src, "can-activate-pull", FALSE, NULL); + + /* set up event probe to count EOS events */ + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad != NULL); + + probe = gst_pad_add_probe (srcpad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) eos_event_counter, &num_eos, NULL); + + bus = gst_element_get_bus (pipe); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + state_ret = gst_element_get_state (pipe, NULL, NULL, -1); + fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS); + + /* wait a second, then emit the EOS */ + g_usleep (GST_USECOND * 1); + + /* shut down source only (should send EOS event) ... */ + res = gst_element_send_event (pipe, gst_event_new_eos ()); + fail_unless (res == TRUE); + + /* ... and wait for the EOS message from the sink */ + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_unless (msg != NULL); + fail_unless (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); + + /* should be exactly one EOS event */ + fail_unless (num_eos == 1); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_element_get_state (pipe, NULL, NULL, -1); + + /* make sure source hasn't sent a second one when going PAUSED => READY */ + fail_unless (num_eos == 1); + + gst_pad_remove_probe (srcpad, probe); + gst_object_unref (srcpad); + gst_message_unref (msg); + gst_object_unref (bus); + gst_object_unref (pipe); +} + +GST_END_TEST; + +/* basesrc_eos_events_pull_live_eos: + * - make sure the source stops and emits EOS when we send an EOS event to the + * pipeline. + */ +GST_START_TEST (basesrc_eos_events_pull_live_eos) +{ + GstStateChangeReturn state_ret; + GstElement *src, *sink, *pipe; + GstMessage *msg; + GstBus *bus; + GstPad *srcpad; + guint probe, num_eos = 0; + gboolean res; + + pipe = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + g_assert (pipe != NULL); + g_assert (sink != NULL); + g_assert (src != NULL); + + fail_unless (gst_bin_add (GST_BIN (pipe), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipe), sink) == TRUE); + + fail_unless (gst_element_link (src, sink) == TRUE); + + g_object_set (sink, "can-activate-push", FALSE, NULL); + g_object_set (sink, "can-activate-pull", TRUE, NULL); + + g_object_set (src, "can-activate-push", FALSE, NULL); + g_object_set (src, "can-activate-pull", TRUE, NULL); + + /* set up event probe to count EOS events */ + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad != NULL); + + probe = gst_pad_add_probe (srcpad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) eos_event_counter, &num_eos, NULL); + + bus = gst_element_get_bus (pipe); + + gst_element_set_state (pipe, GST_STATE_PLAYING); + state_ret = gst_element_get_state (pipe, NULL, NULL, -1); + fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS); + + /* wait a second, then emit the EOS */ + g_usleep (GST_USECOND * 1); + + /* shut down source only (should send EOS event) ... */ + res = gst_element_send_event (pipe, gst_event_new_eos ()); + fail_unless (res == TRUE); + + /* ... and wait for the EOS message from the sink */ + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_unless (msg != NULL); + fail_unless (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); + + /* no EOS in pull mode */ + fail_unless (num_eos == 0); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_element_get_state (pipe, NULL, NULL, -1); + + /* make sure source hasn't sent a second one when going PAUSED => READY */ + fail_unless (num_eos == 0); + + gst_pad_remove_probe (srcpad, probe); + gst_object_unref (srcpad); + gst_message_unref (msg); + gst_object_unref (bus); + gst_object_unref (pipe); +} + +GST_END_TEST; + + +static GstProbeReturn +segment_event_catcher (GstObject * pad, GstProbeType type, GstEvent * event, + gpointer * user_data) +{ + GstEvent **last_event = (GstEvent **) user_data; + fail_unless (event != NULL); + fail_unless (GST_IS_EVENT (event)); + fail_unless (user_data != NULL); + + if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) { + if (*last_event) + gst_event_unref (*last_event); + *last_event = gst_event_copy (event); + } + + return GST_PROBE_OK; +} + +/* basesrc_seek_events_rate_update: + * - make sure we get expected segment after sending a seek event + */ +GST_START_TEST (basesrc_seek_events_rate_update) +{ + GstStateChangeReturn state_ret; + GstElement *src, *sink, *pipe; + GstMessage *msg; + GstBus *bus; + GstPad *probe_pad; + guint probe; + GstEvent *seg_event = NULL; + GstEvent *rate_seek; + gboolean event_ret; + const GstSegment *segment; + + pipe = gst_pipeline_new ("pipeline"); + sink = gst_element_factory_make ("fakesink", "sink"); + src = gst_element_factory_make ("fakesrc", "src"); + + g_assert (pipe != NULL); + g_assert (sink != NULL); + g_assert (src != NULL); + + fail_unless (gst_bin_add (GST_BIN (pipe), src) == TRUE); + fail_unless (gst_bin_add (GST_BIN (pipe), sink) == TRUE); + + fail_unless (gst_element_link (src, sink) == TRUE); + + bus = gst_element_get_bus (pipe); + + /* set up event probe to catch new segment event */ + probe_pad = gst_element_get_static_pad (sink, "sink"); + fail_unless (probe_pad != NULL); + + probe = gst_pad_add_probe (probe_pad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) segment_event_catcher, &seg_event, NULL); + + /* prepare the seek */ + rate_seek = gst_event_new_seek (0.5, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE, + GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); + + GST_INFO ("going to playing"); + + /* play */ + gst_element_set_state (pipe, GST_STATE_PLAYING); + state_ret = gst_element_get_state (pipe, NULL, NULL, -1); + fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS); + + GST_INFO ("seeking"); + + /* seek */ + event_ret = gst_element_send_event (pipe, rate_seek); + fail_unless (event_ret == TRUE); + + /* wait a second, then do controlled shutdown */ + g_usleep (GST_USECOND * 1); + + /* shut down pipeline only (should send EOS message) ... */ + gst_element_send_event (pipe, gst_event_new_eos ()); + + /* ... and wait for the EOS message from the sink */ + msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1); + fail_unless (msg != NULL); + fail_unless (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR); + fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_element_get_state (pipe, NULL, NULL, -1); + + GST_INFO ("stopped"); + + /* check that we have go the event */ + fail_unless (seg_event != NULL); + + gst_event_parse_segment (seg_event, &segment); + fail_unless (segment->rate == 0.5); + + gst_pad_remove_probe (probe_pad, probe); + gst_object_unref (probe_pad); + gst_message_unref (msg); + gst_event_unref (seg_event); + gst_object_unref (bus); + gst_object_unref (pipe); +} + +GST_END_TEST; + + +static Suite * +gst_basesrc_suite (void) +{ + Suite *s = suite_create ("GstBaseSrc"); + TCase *tc = tcase_create ("general"); + + suite_add_tcase (s, tc); + tcase_add_test (tc, basesrc_eos_events_pull); + tcase_add_test (tc, basesrc_eos_events_push); + tcase_add_test (tc, basesrc_eos_events_push_live_op); + tcase_add_test (tc, basesrc_eos_events_pull_live_op); + tcase_add_test (tc, basesrc_eos_events_push_live_eos); + tcase_add_test (tc, basesrc_eos_events_pull_live_eos); + tcase_add_test (tc, basesrc_seek_events_rate_update); + + return s; +} + +GST_CHECK_MAIN (gst_basesrc); diff --git a/tests/check/libs/bitreader.c b/tests/check/libs/bitreader.c new file mode 100644 index 0000000..346b00e --- /dev/null +++ b/tests/check/libs/bitreader.c @@ -0,0 +1,254 @@ +/* GStreamer + * + * unit test for GstBitReader + * + * Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk> + * + * 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 <gst/check/gstcheck.h> +#include <gst/base/gstbitreader.h> + +#ifndef fail_unless_equals_int64 +#define fail_unless_equals_int64(a, b) \ +G_STMT_START { \ + gint64 first = a; \ + gint64 second = b; \ + fail_unless(first == second, \ + "'" #a "' (%" G_GINT64_FORMAT ") is not equal to '" #b"' (%" \ + G_GINT64_FORMAT ")", first, second); \ +} G_STMT_END; +#endif + +GST_START_TEST (test_initialization) +{ + guint8 data[] = { 0x01, 0x02, 0x03, 0x04 }; + GstBuffer *buffer = gst_buffer_new (); + GstBitReader reader = GST_BIT_READER_INIT (data, 4); + GstBitReader *reader2; + guint8 x = 0; + guint8 *bdata; + gsize bsize; + + gst_buffer_take_memory (buffer, -1, + gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, data, NULL, 4, 0, 4)); + + fail_unless (gst_bit_reader_get_bits_uint8 (&reader, &x, 8)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_bit_reader_get_bits_uint8 (&reader, &x, 8)); + fail_unless_equals_int (x, 0x02); + + memset (&reader, 0, sizeof (GstBitReader)); + + gst_bit_reader_init (&reader, data, 4); + fail_unless (gst_bit_reader_get_bits_uint8 (&reader, &x, 8)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_bit_reader_get_bits_uint8 (&reader, &x, 8)); + fail_unless_equals_int (x, 0x02); + + bdata = gst_buffer_map (buffer, &bsize, NULL, GST_MAP_READ); + gst_bit_reader_init (&reader, bdata, bsize); + fail_unless (gst_bit_reader_get_bits_uint8 (&reader, &x, 8)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_bit_reader_get_bits_uint8 (&reader, &x, 8)); + fail_unless_equals_int (x, 0x02); + gst_buffer_unmap (buffer, bdata, bsize); + + reader2 = gst_bit_reader_new (data, 4); + fail_unless (gst_bit_reader_get_bits_uint8 (reader2, &x, 8)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_bit_reader_get_bits_uint8 (reader2, &x, 8)); + fail_unless_equals_int (x, 0x02); + gst_bit_reader_free (reader2); + + bdata = gst_buffer_map (buffer, &bsize, NULL, GST_MAP_READ); + reader2 = gst_bit_reader_new (bdata, bsize); + fail_unless (gst_bit_reader_get_bits_uint8 (reader2, &x, 8)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_bit_reader_get_bits_uint8 (reader2, &x, 8)); + fail_unless_equals_int (x, 0x02); + gst_bit_reader_free (reader2); + gst_buffer_unmap (buffer, bdata, bsize); + + gst_buffer_unref (buffer); +} + +GST_END_TEST; + +#define GET_CHECK(reader, dest, bits, nbits, val) { \ + fail_unless (gst_bit_reader_get_bits_uint##bits (reader, &dest, nbits)); \ + fail_unless_equals_uint64 (dest, val); \ +} + +#define PEEK_CHECK(reader, dest, bits, nbits, val) { \ + fail_unless (gst_bit_reader_peek_bits_uint##bits (reader, &dest, nbits)); \ + fail_unless_equals_uint64 (dest, val); \ +} + +#define GET_CHECK_FAIL(reader, dest, bits, nbits) { \ + fail_if (gst_bit_reader_get_bits_uint##bits (reader, &dest, nbits)); \ +} + +#define PEEK_CHECK_FAIL(reader, dest, bits, nbits) { \ + fail_if (gst_bit_reader_peek_bits_uint##bits (reader, &dest, nbits)); \ +} + +GST_START_TEST (test_get_bits) +{ + guint8 data[] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef, + 0xfe, 0xdc, 0xba, 0x09, 0x87, 0x65, 0x43, 0x21 + }; + GstBitReader reader = GST_BIT_READER_INIT (data, 16); + guint8 a = 0; + guint16 b = 0; + guint32 c = 0; + guint64 d = 0; + + /* 8 bit */ + GET_CHECK (&reader, a, 8, 8, 0x12); + GET_CHECK (&reader, a, 8, 4, 0x03); + GET_CHECK (&reader, a, 8, 4, 0x04); + GET_CHECK (&reader, a, 8, 3, 0x02); + GET_CHECK (&reader, a, 8, 1, 0x01); + GET_CHECK (&reader, a, 8, 2, 0x01); + GET_CHECK (&reader, a, 8, 2, 0x02); + + PEEK_CHECK (&reader, a, 8, 8, 0x78); + PEEK_CHECK (&reader, a, 8, 8, 0x78); + fail_unless (gst_bit_reader_skip (&reader, 8)); + + PEEK_CHECK (&reader, a, 8, 8, 0x90); + GET_CHECK (&reader, a, 8, 1, 0x01); + GET_CHECK (&reader, a, 8, 1, 0x00); + GET_CHECK (&reader, a, 8, 1, 0x00); + GET_CHECK (&reader, a, 8, 1, 0x01); + fail_unless (gst_bit_reader_skip (&reader, 4)); + + fail_unless (gst_bit_reader_skip (&reader, 10 * 8)); + GET_CHECK (&reader, a, 8, 8, 0x21); + GET_CHECK_FAIL (&reader, a, 8, 1); + PEEK_CHECK_FAIL (&reader, a, 8, 1); + + /* 16 bit */ + gst_bit_reader_init (&reader, data, 16); + + GET_CHECK (&reader, b, 16, 16, 0x1234); + PEEK_CHECK (&reader, b, 16, 13, 0x0acf); + GET_CHECK (&reader, b, 16, 8, 0x56); + GET_CHECK (&reader, b, 16, 4, 0x07); + GET_CHECK (&reader, b, 16, 2, 0x02); + GET_CHECK (&reader, b, 16, 2, 0x00); + PEEK_CHECK (&reader, b, 16, 8, 0x90); + fail_unless (gst_bit_reader_skip (&reader, 11 * 8)); + GET_CHECK (&reader, b, 16, 8, 0x21); + GET_CHECK_FAIL (&reader, b, 16, 16); + PEEK_CHECK_FAIL (&reader, b, 16, 16); + + /* 32 bit */ + gst_bit_reader_init (&reader, data, 16); + + GET_CHECK (&reader, c, 32, 32, 0x12345678); + GET_CHECK (&reader, c, 32, 24, 0x90abcd); + GET_CHECK (&reader, c, 32, 16, 0xeffe); + GET_CHECK (&reader, c, 32, 8, 0xdc); + GET_CHECK (&reader, c, 32, 4, 0x0b); + GET_CHECK (&reader, c, 32, 2, 0x02); + GET_CHECK (&reader, c, 32, 2, 0x02); + PEEK_CHECK (&reader, c, 32, 8, 0x09); + fail_unless (gst_bit_reader_skip (&reader, 3 * 8)); + GET_CHECK (&reader, c, 32, 15, 0x2190); + GET_CHECK (&reader, c, 32, 1, 0x1); + GET_CHECK_FAIL (&reader, c, 32, 1); + + /* 64 bit */ + gst_bit_reader_init (&reader, data, 16); + + GET_CHECK (&reader, d, 64, 64, G_GINT64_CONSTANT (0x1234567890abcdef)); + GET_CHECK (&reader, d, 64, 7, 0xfe >> 1); + GET_CHECK (&reader, d, 64, 1, 0x00); + GET_CHECK (&reader, d, 64, 24, 0xdcba09); + GET_CHECK (&reader, d, 64, 32, 0x87654321); + GET_CHECK_FAIL (&reader, d, 64, 32); +} + +GST_END_TEST; + +#undef GET_CHECK +#undef PEEK_CHECK +#undef GET_CHECK_FAIL +#undef PEEK_CHECK_FAIL + +GST_START_TEST (test_position_tracking) +{ + guint8 data[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + GstBitReader reader = GST_BIT_READER_INIT (data, 16); + guint8 a = 0; + + fail_unless_equals_int (gst_bit_reader_get_pos (&reader), 0); + fail_unless_equals_int (gst_bit_reader_get_remaining (&reader), 16 * 8); + + fail_unless (gst_bit_reader_get_bits_uint8 (&reader, &a, 3)); + fail_unless_equals_int (gst_bit_reader_get_pos (&reader), 3); + fail_unless_equals_int (gst_bit_reader_get_remaining (&reader), 16 * 8 - 3); + + fail_unless (gst_bit_reader_set_pos (&reader, 9)); + fail_unless_equals_int (gst_bit_reader_get_pos (&reader), 9); + fail_unless_equals_int (gst_bit_reader_get_remaining (&reader), 16 * 8 - 9); + + fail_unless (gst_bit_reader_skip (&reader, 3)); + fail_unless_equals_int (gst_bit_reader_get_pos (&reader), 12); + fail_unless_equals_int (gst_bit_reader_get_remaining (&reader), 16 * 8 - 12); + + fail_unless (gst_bit_reader_skip_to_byte (&reader)); + fail_unless_equals_int (gst_bit_reader_get_pos (&reader), 16); + fail_unless_equals_int (gst_bit_reader_get_remaining (&reader), 16 * 8 - 16); + + fail_unless (gst_bit_reader_set_pos (&reader, 16 * 8)); + fail_unless_equals_int (gst_bit_reader_get_pos (&reader), 16 * 8); + fail_unless_equals_int (gst_bit_reader_get_remaining (&reader), 0); + + fail_unless (gst_bit_reader_skip (&reader, 0)); + fail_if (gst_bit_reader_skip (&reader, 1)); + fail_unless (gst_bit_reader_skip_to_byte (&reader)); +} + +GST_END_TEST; + +static Suite * +gst_bit_reader_suite (void) +{ + Suite *s = suite_create ("GstBitReader"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + + tcase_add_test (tc_chain, test_initialization); + tcase_add_test (tc_chain, test_get_bits); + tcase_add_test (tc_chain, test_position_tracking); + + return s; +} + + +GST_CHECK_MAIN (gst_bit_reader); diff --git a/tests/check/libs/bytereader.c b/tests/check/libs/bytereader.c new file mode 100644 index 0000000..dfb7ef4 --- /dev/null +++ b/tests/check/libs/bytereader.c @@ -0,0 +1,713 @@ +/* GStreamer + * + * unit test for GstByteReader + * + * Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk> + * + * 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 <gst/check/gstcheck.h> +#include <gst/base/gstbytereader.h> + +#ifndef fail_unless_equals_int64 +#define fail_unless_equals_int64(a, b) \ +G_STMT_START { \ + gint64 first = a; \ + gint64 second = b; \ + fail_unless(first == second, \ + "'" #a "' (%" G_GINT64_FORMAT ") is not equal to '" #b"' (%" \ + G_GINT64_FORMAT ")", first, second); \ +} G_STMT_END; +#endif + +GST_START_TEST (test_initialization) +{ + guint8 data[] = { 0x01, 0x02, 0x03, 0x04 }; + GstBuffer *buffer = gst_buffer_new (); + GstByteReader reader = GST_BYTE_READER_INIT (data, 4); + GstByteReader *reader2; + guint8 x = 0; + guint8 *bdata; + gsize bsize; + + gst_buffer_take_memory (buffer, -1, + gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, data, NULL, 4, 0, 4)); + + fail_unless (gst_byte_reader_get_uint8 (&reader, &x)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_byte_reader_get_uint8 (&reader, &x)); + fail_unless_equals_int (x, 0x02); + + memset (&reader, 0, sizeof (GstByteReader)); + + gst_byte_reader_init (&reader, data, 4); + fail_unless (gst_byte_reader_get_uint8 (&reader, &x)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_byte_reader_get_uint8 (&reader, &x)); + fail_unless_equals_int (x, 0x02); + + bdata = gst_buffer_map (buffer, &bsize, NULL, GST_MAP_READ); + gst_byte_reader_init (&reader, bdata, bsize); + fail_unless (gst_byte_reader_get_uint8 (&reader, &x)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_byte_reader_get_uint8 (&reader, &x)); + fail_unless_equals_int (x, 0x02); + gst_buffer_unmap (buffer, bdata, bsize); + + reader2 = gst_byte_reader_new (data, 4); + fail_unless (gst_byte_reader_get_uint8 (reader2, &x)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_byte_reader_get_uint8 (reader2, &x)); + fail_unless_equals_int (x, 0x02); + gst_byte_reader_free (reader2); + + bdata = gst_buffer_map (buffer, &bsize, NULL, GST_MAP_READ); + reader2 = gst_byte_reader_new (bdata, bsize); + fail_unless (gst_byte_reader_get_uint8 (reader2, &x)); + fail_unless_equals_int (x, 0x01); + fail_unless (gst_byte_reader_get_uint8 (reader2, &x)); + fail_unless_equals_int (x, 0x02); + gst_byte_reader_free (reader2); + gst_buffer_unmap (buffer, bdata, bsize); + + gst_buffer_unref (buffer); +} + +GST_END_TEST; + +#define GET_CHECK8(reader, dest, val) { \ + fail_unless (gst_byte_reader_get_uint8 (reader, &dest)); \ + fail_unless_equals_uint64 (dest, val); \ +} + +#define GET_CHECK(reader, dest, bits, endianness, val) { \ + fail_unless (gst_byte_reader_get_uint##bits##_##endianness (reader, &dest)); \ + fail_unless_equals_uint64 (dest, val); \ +} + +#define GET_CHECK_FAIL8(reader, dest) { \ + fail_if (gst_byte_reader_get_uint8 (reader, &dest)); \ +} + +#define GET_CHECK_FAIL(reader, dest, bits, endianness) { \ + fail_if (gst_byte_reader_get_uint##bits##_##endianness (reader, &dest)); \ +} + +#define PEEK_CHECK8(reader, dest, val) { \ + fail_unless (gst_byte_reader_peek_uint8 (reader, &dest)); \ + fail_unless_equals_uint64 (dest, val); \ +} + +#define PEEK_CHECK(reader, dest, bits, endianness, val) { \ + fail_unless (gst_byte_reader_peek_uint##bits##_##endianness (reader, &dest)); \ + fail_unless_equals_uint64 (dest, val); \ +} + +#define PEEK_CHECK_FAIL8(reader, dest) { \ + fail_if (gst_byte_reader_peek_uint8 (reader, &dest)); \ +} + +#define PEEK_CHECK_FAIL(reader, dest, bits, endianness) { \ + fail_if (gst_byte_reader_peek_uint##bits##_##endianness (reader, &dest)); \ +} + +GST_START_TEST (test_get_uint_le) +{ + guint8 data[] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef, + 0xfe, 0xdc, 0xba, 0x09, 0x87, 0x65, 0x43, 0x21 + }; + GstByteReader reader = GST_BYTE_READER_INIT (data, 16); + guint8 a = 0; + guint16 b = 0; + guint32 c = 0; + guint64 d = 0; + + GET_CHECK8 (&reader, a, 0x12); + GET_CHECK (&reader, b, 16, le, 0x5634); + GET_CHECK (&reader, c, 24, le, 0xab9078); + GET_CHECK (&reader, c, 32, le, 0xdcfeefcd); + fail_unless (gst_byte_reader_set_pos (&reader, 0)); + GET_CHECK (&reader, d, 64, le, G_GINT64_CONSTANT (0xefcdab9078563412)); + GET_CHECK (&reader, d, 64, le, G_GINT64_CONSTANT (0x2143658709badcfe)); + + GET_CHECK_FAIL8 (&reader, a); + GET_CHECK_FAIL (&reader, b, 16, le); + GET_CHECK_FAIL (&reader, c, 24, le); + GET_CHECK_FAIL (&reader, c, 32, le); + GET_CHECK_FAIL (&reader, d, 64, le); + + fail_unless (gst_byte_reader_set_pos (&reader, 0)); + + PEEK_CHECK8 (&reader, a, 0x12); + PEEK_CHECK (&reader, b, 16, le, 0x3412); + PEEK_CHECK (&reader, c, 24, le, 0x563412); + PEEK_CHECK (&reader, c, 32, le, 0x78563412); + PEEK_CHECK (&reader, d, 64, le, G_GINT64_CONSTANT (0xefcdab9078563412)); + + fail_unless (gst_byte_reader_set_pos (&reader, 16)); + PEEK_CHECK_FAIL8 (&reader, a); + PEEK_CHECK_FAIL (&reader, b, 16, le); + PEEK_CHECK_FAIL (&reader, c, 24, le); + PEEK_CHECK_FAIL (&reader, c, 32, le); + PEEK_CHECK_FAIL (&reader, d, 64, le); +} + +GST_END_TEST; + +GST_START_TEST (test_get_uint_be) +{ + guint8 data[] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef, + 0xfe, 0xdc, 0xba, 0x09, 0x87, 0x65, 0x43, 0x21 + }; + GstByteReader reader = GST_BYTE_READER_INIT (data, 16); + guint8 a = 0; + guint16 b = 0; + guint32 c = 0; + guint64 d = 0; + + GET_CHECK8 (&reader, a, 0x12); + GET_CHECK (&reader, b, 16, be, 0x3456); + GET_CHECK (&reader, c, 24, be, 0x7890ab); + GET_CHECK (&reader, c, 32, be, 0xcdeffedc); + fail_unless (gst_byte_reader_set_pos (&reader, 0)); + GET_CHECK (&reader, d, 64, be, G_GINT64_CONSTANT (0x1234567890abcdef)); + GET_CHECK (&reader, d, 64, be, G_GINT64_CONSTANT (0xfedcba0987654321)); + + GET_CHECK_FAIL8 (&reader, a); + GET_CHECK_FAIL (&reader, b, 16, be); + GET_CHECK_FAIL (&reader, c, 24, be); + GET_CHECK_FAIL (&reader, c, 32, be); + GET_CHECK_FAIL (&reader, d, 64, be); + + fail_unless (gst_byte_reader_set_pos (&reader, 0)); + + PEEK_CHECK8 (&reader, a, 0x12); + PEEK_CHECK (&reader, b, 16, be, 0x1234); + PEEK_CHECK (&reader, c, 24, be, 0x123456); + PEEK_CHECK (&reader, c, 32, be, 0x12345678); + PEEK_CHECK (&reader, d, 64, be, G_GINT64_CONSTANT (0x1234567890abcdef)); + + fail_unless (gst_byte_reader_set_pos (&reader, 16)); + PEEK_CHECK_FAIL8 (&reader, a); + PEEK_CHECK_FAIL (&reader, b, 16, be); + PEEK_CHECK_FAIL (&reader, c, 24, be); + PEEK_CHECK_FAIL (&reader, c, 32, be); + PEEK_CHECK_FAIL (&reader, d, 64, be); +} + +GST_END_TEST; + +#undef GET_CHECK8 +#undef GET_CHECK +#undef PEEK_CHECK8 +#undef PEEK_CHECK +#undef GET_CHECK_FAIL8 +#undef GET_CHECK_FAIL +#undef PEEK_CHECK_FAIL8 +#undef PEEK_CHECK_FAIL + +#define GET_CHECK8(reader, dest, val) { \ + fail_unless (gst_byte_reader_get_int8 (reader, &dest)); \ + fail_unless_equals_int64 (dest, val); \ +} + +#define GET_CHECK(reader, dest, bits, endianness, val) { \ + fail_unless (gst_byte_reader_get_int##bits##_##endianness (reader, &dest)); \ + fail_unless_equals_int64 (dest, val); \ +} + +#define GET_CHECK_FAIL8(reader, dest) { \ + fail_if (gst_byte_reader_get_int8 (reader, &dest)); \ +} + +#define GET_CHECK_FAIL(reader, dest, bits, endianness) { \ + fail_if (gst_byte_reader_get_int##bits##_##endianness (reader, &dest)); \ +} + +#define PEEK_CHECK8(reader, dest, val) { \ + fail_unless (gst_byte_reader_peek_int8 (reader, &dest)); \ + fail_unless_equals_int64 (dest, val); \ +} + +#define PEEK_CHECK(reader, dest, bits, endianness, val) { \ + fail_unless (gst_byte_reader_peek_int##bits##_##endianness (reader, &dest)); \ + fail_unless_equals_int64 (dest, val); \ +} + +#define PEEK_CHECK_FAIL8(reader, dest) { \ + fail_if (gst_byte_reader_peek_int8 (reader, &dest)); \ +} + +#define PEEK_CHECK_FAIL(reader, dest, bits, endianness) { \ + fail_if (gst_byte_reader_peek_int##bits##_##endianness (reader, &dest)); \ +} + +GST_START_TEST (test_get_int_le) +{ + guint8 data[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + GstByteReader reader = GST_BYTE_READER_INIT (data, 16); + gint8 a = 0; + gint16 b = 0; + gint32 c = 0; + gint64 d = 0; + + GET_CHECK8 (&reader, a, -1); + GET_CHECK (&reader, b, 16, le, -1); + GET_CHECK (&reader, c, 24, le, -1); + GET_CHECK (&reader, c, 32, le, -1); + fail_unless (gst_byte_reader_set_pos (&reader, 0)); + GET_CHECK (&reader, d, 64, le, G_GINT64_CONSTANT (-1)); + GET_CHECK (&reader, d, 64, le, G_GINT64_CONSTANT (-1)); + + GET_CHECK_FAIL8 (&reader, a); + GET_CHECK_FAIL (&reader, b, 16, le); + GET_CHECK_FAIL (&reader, c, 24, le); + GET_CHECK_FAIL (&reader, c, 32, le); + GET_CHECK_FAIL (&reader, d, 64, le); + + fail_unless (gst_byte_reader_set_pos (&reader, 0)); + + PEEK_CHECK8 (&reader, a, -1); + PEEK_CHECK (&reader, b, 16, le, -1); + PEEK_CHECK (&reader, c, 24, le, -1); + PEEK_CHECK (&reader, c, 32, le, -1); + PEEK_CHECK (&reader, d, 64, le, G_GINT64_CONSTANT (-1)); + + fail_unless (gst_byte_reader_set_pos (&reader, 16)); + PEEK_CHECK_FAIL8 (&reader, a); + PEEK_CHECK_FAIL (&reader, b, 16, le); + PEEK_CHECK_FAIL (&reader, c, 24, le); + PEEK_CHECK_FAIL (&reader, c, 32, le); + PEEK_CHECK_FAIL (&reader, d, 64, le); + +} + +GST_END_TEST; + +GST_START_TEST (test_get_int_be) +{ + guint8 data[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + GstByteReader reader = GST_BYTE_READER_INIT (data, 16); + gint8 a = 0; + gint16 b = 0; + gint32 c = 0; + gint64 d = 0; + + GET_CHECK8 (&reader, a, -1); + GET_CHECK (&reader, b, 16, be, -1); + GET_CHECK (&reader, c, 24, be, -1); + GET_CHECK (&reader, c, 32, be, -1); + fail_unless (gst_byte_reader_set_pos (&reader, 0)); + GET_CHECK (&reader, d, 64, be, G_GINT64_CONSTANT (-1)); + GET_CHECK (&reader, d, 64, be, G_GINT64_CONSTANT (-1)); + + GET_CHECK_FAIL8 (&reader, a); + GET_CHECK_FAIL (&reader, b, 16, be); + GET_CHECK_FAIL (&reader, c, 24, be); + GET_CHECK_FAIL (&reader, c, 32, be); + GET_CHECK_FAIL (&reader, d, 64, be); + + fail_unless (gst_byte_reader_set_pos (&reader, 0)); + + PEEK_CHECK8 (&reader, a, -1); + PEEK_CHECK (&reader, b, 16, be, -1); + PEEK_CHECK (&reader, c, 24, be, -1); + PEEK_CHECK (&reader, c, 32, be, -1); + PEEK_CHECK (&reader, d, 64, be, G_GINT64_CONSTANT (-1)); + + fail_unless (gst_byte_reader_set_pos (&reader, 16)); + PEEK_CHECK_FAIL8 (&reader, a); + PEEK_CHECK_FAIL (&reader, b, 16, be); + PEEK_CHECK_FAIL (&reader, c, 24, be); + PEEK_CHECK_FAIL (&reader, c, 32, be); + PEEK_CHECK_FAIL (&reader, d, 64, be); + +} + +GST_END_TEST; + +#undef GET_CHECK8 +#undef GET_CHECK +#undef PEEK_CHECK8 +#undef PEEK_CHECK +#undef GET_CHECK_FAIL8 +#undef GET_CHECK_FAIL +#undef PEEK_CHECK_FAIL8 +#undef PEEK_CHECK_FAIL + +#define GET_CHECK(reader, dest, bits, endianness, val) { \ + fail_unless (gst_byte_reader_get_float##bits##_##endianness (reader, &dest)); \ + fail_unless_equals_float (dest, val); \ +} + +#define GET_CHECK_FAIL(reader, dest, bits, endianness) { \ + fail_if (gst_byte_reader_get_float##bits##_##endianness (reader, &dest)); \ +} + +#define PEEK_CHECK(reader, dest, bits, endianness, val) { \ + fail_unless (gst_byte_reader_peek_float##bits##_##endianness (reader, &dest)); \ + fail_unless_equals_float (dest, val); \ +} + +#define PEEK_CHECK_FAIL(reader, dest, bits, endianness) { \ + fail_if (gst_byte_reader_peek_float##bits##_##endianness (reader, &dest)); \ +} + +GST_START_TEST (test_get_float_le) +{ + guint8 data[] = { + 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x80, 0xbf, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf, + }; + GstByteReader reader = GST_BYTE_READER_INIT (data, 24); + gfloat a = 0.0; + gdouble b = 0.0; + + PEEK_CHECK (&reader, a, 32, le, 1.0); + GET_CHECK (&reader, a, 32, le, 1.0); + GET_CHECK (&reader, a, 32, le, -1.0); + PEEK_CHECK (&reader, b, 64, le, 1.0); + GET_CHECK (&reader, b, 64, le, 1.0); + GET_CHECK (&reader, b, 64, le, -1.0); + GET_CHECK_FAIL (&reader, a, 32, le); + GET_CHECK_FAIL (&reader, b, 64, le); + PEEK_CHECK_FAIL (&reader, a, 32, le); + PEEK_CHECK_FAIL (&reader, b, 64, le); +} + +GST_END_TEST; + +GST_START_TEST (test_get_float_be) +{ + guint8 data[] = { + 0x3f, 0x80, 0x00, 0x00, + 0xbf, 0x80, 0x00, 0x00, + 0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xbf, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + GstByteReader reader = GST_BYTE_READER_INIT (data, 24); + gfloat a = 0.0; + gdouble b = 0.0; + + PEEK_CHECK (&reader, a, 32, be, 1.0); + GET_CHECK (&reader, a, 32, be, 1.0); + GET_CHECK (&reader, a, 32, be, -1.0); + PEEK_CHECK (&reader, b, 64, be, 1.0); + GET_CHECK (&reader, b, 64, be, 1.0); + GET_CHECK (&reader, b, 64, be, -1.0); + GET_CHECK_FAIL (&reader, a, 32, be); + GET_CHECK_FAIL (&reader, b, 64, be); + PEEK_CHECK_FAIL (&reader, a, 32, be); + PEEK_CHECK_FAIL (&reader, b, 64, be); +} + +GST_END_TEST; + +#undef GET_CHECK +#undef PEEK_CHECK +#undef GET_CHECK_FAIL +#undef PEEK_CHECK_FAIL + +GST_START_TEST (test_position_tracking) +{ + guint8 data[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + }; + GstByteReader reader = GST_BYTE_READER_INIT (data, 16); + guint8 a = 0; + + fail_unless_equals_int (gst_byte_reader_get_pos (&reader), 0); + fail_unless_equals_int (gst_byte_reader_get_remaining (&reader), 16); + + fail_unless (gst_byte_reader_get_uint8 (&reader, &a)); + fail_unless_equals_int (gst_byte_reader_get_pos (&reader), 1); + fail_unless_equals_int (gst_byte_reader_get_remaining (&reader), 16 - 1); + + fail_unless (gst_byte_reader_set_pos (&reader, 8)); + fail_unless_equals_int (gst_byte_reader_get_pos (&reader), 8); + fail_unless_equals_int (gst_byte_reader_get_remaining (&reader), 16 - 8); + + fail_unless (gst_byte_reader_skip (&reader, 4)); + fail_unless_equals_int (gst_byte_reader_get_pos (&reader), 12); + fail_unless_equals_int (gst_byte_reader_get_remaining (&reader), 16 - 12); + + fail_unless (gst_byte_reader_set_pos (&reader, 16)); + fail_unless_equals_int (gst_byte_reader_get_pos (&reader), 16); + fail_unless_equals_int (gst_byte_reader_get_remaining (&reader), 0); + + fail_unless (gst_byte_reader_skip (&reader, 0)); + fail_if (gst_byte_reader_skip (&reader, 1)); +} + +GST_END_TEST; + +#define do_scan(r,m,p,o,s,x) \ + fail_unless_equals_int (gst_byte_reader_masked_scan_uint32 (r,m,p,o,s), x); + +GST_START_TEST (test_scan) +{ + GstByteReader reader; + guint8 data[200]; + guint i; + + /* fill half the buffer with a pattern */ + for (i = 0; i < 100; i++) + data[i] = i; + + gst_byte_reader_init (&reader, data, 100); + + /* find first bytes */ + do_scan (&reader, 0xffffffff, 0x00010203, 0, 100, 0); + do_scan (&reader, 0xffffffff, 0x01020304, 0, 100, 1); + do_scan (&reader, 0xffffffff, 0x01020304, 1, 99, 1); + /* offset is past the pattern start */ + do_scan (&reader, 0xffffffff, 0x01020304, 2, 98, -1); + /* not enough bytes to find the pattern */ + do_scan (&reader, 0xffffffff, 0x02030405, 2, 3, -1); + do_scan (&reader, 0xffffffff, 0x02030405, 2, 4, 2); + /* size does not include the last scanned byte */ + do_scan (&reader, 0xffffffff, 0x40414243, 0, 0x41, -1); + do_scan (&reader, 0xffffffff, 0x40414243, 0, 0x43, -1); + do_scan (&reader, 0xffffffff, 0x40414243, 0, 0x44, 0x40); + /* past the start */ + do_scan (&reader, 0xffffffff, 0x40414243, 65, 10, -1); + do_scan (&reader, 0xffffffff, 0x40414243, 64, 5, 64); + do_scan (&reader, 0xffffffff, 0x60616263, 65, 35, 0x60); + do_scan (&reader, 0xffffffff, 0x60616263, 0x60, 4, 0x60); + /* past the start */ + do_scan (&reader, 0xffffffff, 0x60616263, 0x61, 3, -1); + do_scan (&reader, 0xffffffff, 0x60616263, 99, 1, -1); + + /* add more data to the buffer */ + for (i = 100; i < 200; i++) + data[i] = i; + gst_byte_reader_init (&reader, data, 200); + + /* past the start */ + do_scan (&reader, 0xffffffff, 0x60616263, 0x61, 6, -1); + /* this should work */ + do_scan (&reader, 0xffffffff, 0x61626364, 0x61, 4, 0x61); + /* not enough data */ + do_scan (&reader, 0xffffffff, 0x62636465, 0x61, 4, -1); + do_scan (&reader, 0xffffffff, 0x62636465, 0x61, 5, 0x62); + do_scan (&reader, 0xffffffff, 0x62636465, 0, 120, 0x62); + + /* border conditions */ + do_scan (&reader, 0xffffffff, 0x62636465, 0, 200, 0x62); + do_scan (&reader, 0xffffffff, 0x63646566, 0, 200, 0x63); + /* we completely searched the first list */ + do_scan (&reader, 0xffffffff, 0x64656667, 0, 200, 0x64); + /* skip first buffer */ + do_scan (&reader, 0xffffffff, 0x64656667, 0x64, 100, 0x64); + /* past the start */ + do_scan (&reader, 0xffffffff, 0x64656667, 0x65, 10, -1); + /* not enough data to scan */ + do_scan (&reader, 0xffffffff, 0x64656667, 0x63, 4, -1); + do_scan (&reader, 0xffffffff, 0x64656667, 0x63, 5, 0x64); + do_scan (&reader, 0xffffffff, 0xc4c5c6c7, 0, 199, -1); + do_scan (&reader, 0xffffffff, 0xc4c5c6c7, 0x62, 102, 0xc4); + /* different masks */ + do_scan (&reader, 0x00ffffff, 0x00656667, 0x64, 100, 0x64); + do_scan (&reader, 0x000000ff, 0x00000000, 0, 100, -1); + do_scan (&reader, 0x000000ff, 0x00000003, 0, 100, 0); + do_scan (&reader, 0x000000ff, 0x00000061, 0x61, 100, -1); + do_scan (&reader, 0xff000000, 0x61000000, 0, 0x62, -1); + /* does not even exist */ + do_scan (&reader, 0x00ffffff, 0xffffffff, 0x65, 99, -1); + + /* flush some bytes */ + fail_unless (gst_byte_reader_skip (&reader, 0x20)); + + do_scan (&reader, 0xffffffff, 0x20212223, 0, 100, 0); + do_scan (&reader, 0xffffffff, 0x20212223, 0, 4, 0); + do_scan (&reader, 0xffffffff, 0xc4c5c6c7, 0x62, 70, 0xa4); + do_scan (&reader, 0xffffffff, 0xc4c5c6c7, 0, 168, 0xa4); + + do_scan (&reader, 0xffffffff, 0xc4c5c6c7, 164, 4, 0xa4); + do_scan (&reader, 0xffffffff, 0xc4c5c6c7, 0x44, 100, 0xa4); + + /* not enough bytes */ + do_scan (&reader, 0xffffffff, 0xc4c5c6c7, 0x44, 99, -1); +} + +GST_END_TEST; + +GST_START_TEST (test_string_funcs) +{ + GstByteReader reader, backup; + const gchar *s8; + guint32 *c32; + guint16 *c16; + gchar *c8; + guint8 data[200], *d = 0; + guint i; + + /* fill half the buffer with a pattern */ + for (i = 0; i < 100; i++) + data[i] = i + 1; + + gst_byte_reader_init (&reader, data, 100); + + /* no NUL terminator, so these should all fail */ + fail_if (gst_byte_reader_get_string (&reader, &s8)); + fail_if (gst_byte_reader_get_string_utf8 (&reader, &s8)); + fail_if (gst_byte_reader_dup_string (&reader, &c8)); + fail_if (gst_byte_reader_dup_string_utf8 (&reader, &c8)); + fail_if (gst_byte_reader_skip_string (&reader)); + fail_if (gst_byte_reader_skip_string_utf8 (&reader)); + fail_if (gst_byte_reader_skip_string_utf16 (&reader)); + fail_if (gst_byte_reader_skip_string_utf32 (&reader)); + fail_if (gst_byte_reader_peek_string (&reader, &s8)); + fail_if (gst_byte_reader_peek_string_utf8 (&reader, &s8)); + fail_if (gst_byte_reader_dup_string_utf16 (&reader, &c16)); + fail_if (gst_byte_reader_dup_string_utf32 (&reader, &c32)); + + /* let's add a single NUL terminator */ + data[80] = '\0'; + backup = reader; + fail_if (gst_byte_reader_skip_string_utf32 (&reader)); + fail_if (gst_byte_reader_skip_string_utf16 (&reader)); + fail_if (gst_byte_reader_dup_string_utf16 (&reader, &c16)); + fail_if (gst_byte_reader_dup_string_utf32 (&reader, &c32)); + fail_unless (gst_byte_reader_skip_string (&reader)); + reader = backup; + fail_unless (gst_byte_reader_skip_string_utf8 (&reader)); + reader = backup; + fail_unless (gst_byte_reader_peek_string (&reader, &s8)); + fail_unless (gst_byte_reader_peek_string_utf8 (&reader, &s8)); + fail_if (gst_byte_reader_dup_string_utf16 (&reader, &c16)); + fail_if (gst_byte_reader_dup_string_utf32 (&reader, &c32)); + + /* let's add another NUL terminator */ + data[81] = '\0'; + reader = backup; + fail_if (gst_byte_reader_skip_string_utf32 (&reader)); + fail_if (gst_byte_reader_dup_string_utf32 (&reader, &c32)); + fail_unless (gst_byte_reader_skip_string_utf16 (&reader)); + reader = backup; + fail_unless (gst_byte_reader_dup_string_utf16 (&reader, &c16)); + g_free (c16); + reader = backup; + fail_unless (gst_byte_reader_skip_string (&reader)); + reader = backup; + fail_unless (gst_byte_reader_skip_string_utf8 (&reader)); + reader = backup; + fail_unless (gst_byte_reader_peek_string (&reader, &s8)); + fail_unless (gst_byte_reader_peek_string_utf8 (&reader, &s8)); + fail_if (gst_byte_reader_dup_string_utf32 (&reader, &c32)); + + /* two more NUL terminators */ + data[79] = '\0'; + data[82] = '\0'; + reader = backup; + /* we're at pos. 80 now, so have only 3 NUL terminators in front of us */ + fail_if (gst_byte_reader_skip_string_utf32 (&reader)); + /* let's rewind */ + gst_byte_reader_init (&reader, data, 100); + backup = reader; + /* oops, 79 is not dividable by 4, so not aligned, so should fail as well! */ + fail_if (gst_byte_reader_skip_string_utf32 (&reader)); + /* let's try that again */ + data[83] = '\0'; + gst_byte_reader_init (&reader, data, 100); + backup = reader; + fail_unless (gst_byte_reader_skip_string_utf16 (&reader)); + reader = backup; + fail_unless (gst_byte_reader_skip_string (&reader)); + reader = backup; + fail_unless (gst_byte_reader_skip_string_utf8 (&reader)); + reader = backup; + fail_unless (gst_byte_reader_peek_string (&reader, &s8)); + fail_unless (gst_byte_reader_peek_string_utf8 (&reader, &s8)); + fail_unless (gst_byte_reader_dup_string_utf16 (&reader, &c16)); + g_free (c16); + reader = backup; + fail_unless (gst_byte_reader_dup_string_utf32 (&reader, &c32)); + g_free (c32); + + /* and again from the start */ + gst_byte_reader_init (&reader, data, 100); + fail_unless (gst_byte_reader_skip_string_utf16 (&reader)); + fail_if (gst_byte_reader_dup_data (&reader, 200, &d)); + fail_if (gst_byte_reader_dup_data (&reader, 100, &d)); + fail_if (gst_byte_reader_dup_data (&reader, 20, &d)); + fail_unless (gst_byte_reader_dup_data (&reader, 10, &d)); + fail_unless_equals_int (d[0], 0); + fail_unless_equals_int (d[1], 0); + fail_unless_equals_int (d[2], 85); + fail_unless_equals_int (d[3], 86); + g_free (d); +} + +GST_END_TEST; + +GST_START_TEST (test_dup_string) +{ + const gchar moredata[] = { 0x99, 0x10, 'f', '0', '0', '!', '\0', 0xff }; + GstByteReader reader; + guint16 num = 0; + guint8 x = 0; + gchar *s; + + gst_byte_reader_init (&reader, (guint8 *) moredata, sizeof (moredata)); + fail_unless (gst_byte_reader_get_uint16_be (&reader, &num)); + fail_unless_equals_int (num, 0x9910); + fail_unless (gst_byte_reader_dup_string (&reader, &s)); + fail_unless_equals_string (s, "f00!"); + fail_unless (gst_byte_reader_get_uint8 (&reader, &x)); + fail_unless_equals_int (x, 0xff); + g_free (s); +} + +GST_END_TEST; + +static Suite * +gst_byte_reader_suite (void) +{ + Suite *s = suite_create ("GstByteReader"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + + tcase_add_test (tc_chain, test_initialization); + tcase_add_test (tc_chain, test_get_uint_le); + tcase_add_test (tc_chain, test_get_uint_be); + tcase_add_test (tc_chain, test_get_int_le); + tcase_add_test (tc_chain, test_get_int_be); + tcase_add_test (tc_chain, test_get_float_le); + tcase_add_test (tc_chain, test_get_float_be); + tcase_add_test (tc_chain, test_position_tracking); + tcase_add_test (tc_chain, test_scan); + tcase_add_test (tc_chain, test_string_funcs); + tcase_add_test (tc_chain, test_dup_string); + + return s; +} + + +GST_CHECK_MAIN (gst_byte_reader); diff --git a/tests/check/libs/bytewriter.c b/tests/check/libs/bytewriter.c new file mode 100644 index 0000000..fab4a5e --- /dev/null +++ b/tests/check/libs/bytewriter.c @@ -0,0 +1,258 @@ +/* GStreamer + * + * unit test for GstByteWriter + * + * Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.co.uk> + * + * 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 <gst/check/gstcheck.h> +#include <gst/base/gstbytewriter.h> + +GST_START_TEST (test_initialization) +{ + GstByteWriter writer, *writer2; + static guint8 sdata[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + guint8 *data, *tmp; + + gst_byte_writer_init_with_size (&writer, 24, FALSE); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), 0); + fail_unless_equals_int (gst_byte_writer_get_size (&writer), 0); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), -1); + fail_unless_equals_int (gst_byte_reader_get_remaining (GST_BYTE_READER + (&writer)), 0); + gst_byte_writer_reset (&writer); + + data = g_memdup (sdata, sizeof (sdata)); + gst_byte_writer_init_with_data (&writer, data, sizeof (sdata), FALSE); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), 0); + fail_unless_equals_int (gst_byte_writer_get_size (&writer), 0); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), + sizeof (sdata)); + fail_unless_equals_int (gst_byte_reader_get_remaining (GST_BYTE_READER + (&writer)), 0) + tmp = gst_byte_writer_reset_and_get_data (&writer); + fail_if (tmp == data); + g_free (tmp); + g_free (data); + data = tmp = NULL; + + data = g_memdup (sdata, sizeof (sdata)); + gst_byte_writer_init_with_data (&writer, data, sizeof (sdata), TRUE); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), 0); + fail_unless_equals_int (gst_byte_writer_get_size (&writer), sizeof (sdata)); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), + sizeof (sdata)); + fail_unless_equals_int (gst_byte_reader_get_remaining (GST_BYTE_READER + (&writer)), sizeof (sdata)); + tmp = gst_byte_writer_reset_and_get_data (&writer); + fail_unless (tmp != data); + g_free (tmp); + g_free (data); + data = tmp = NULL; + + writer2 = gst_byte_writer_new_with_size (24, FALSE); + data = gst_byte_writer_free_and_get_data (writer2); + fail_unless (data != NULL); + g_free (data); +} + +GST_END_TEST; + +GST_START_TEST (test_write_fixed) +{ + GstByteWriter writer; + guint64 end_data = G_GUINT64_CONSTANT (0xff34567890abcdef); + guint8 *data; + guint8 b = 0; + guint64 l = 0; + + end_data = GUINT64_TO_BE (end_data); + + gst_byte_writer_init_with_size (&writer, 8, TRUE); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), 8); + + fail_unless (gst_byte_writer_put_uint8 (&writer, 0x12)); + fail_unless (gst_byte_writer_put_uint16_be (&writer, 0x3456)); + fail_unless (gst_byte_writer_put_uint16_le (&writer, 0x9078)); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), 5); + fail_unless_equals_int (gst_byte_writer_get_size (&writer), 5); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), 8 - 5); + fail_unless_equals_int (gst_byte_reader_get_remaining (GST_BYTE_READER + (&writer)), 0); + fail_if (gst_byte_reader_get_uint8 (GST_BYTE_READER (&writer), &b)); + fail_unless (gst_byte_writer_put_uint24_be (&writer, 0xabcdef)); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), 8); + fail_unless_equals_int (gst_byte_writer_get_size (&writer), 8); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), 8 - 8); + fail_unless_equals_int (gst_byte_reader_get_remaining (GST_BYTE_READER + (&writer)), 0); + fail_if (gst_byte_writer_put_uint8 (&writer, 0x12)); + fail_unless (gst_byte_writer_set_pos (&writer, 0)); + fail_unless (gst_byte_reader_peek_uint64_be (GST_BYTE_READER (&writer), &l)); + fail_unless_equals_uint64 (l, G_GUINT64_CONSTANT (0x1234567890abcdef)); + fail_unless (gst_byte_writer_put_uint8 (&writer, 0xff)); + fail_unless (gst_byte_writer_set_pos (&writer, 0)); + fail_unless (gst_byte_reader_get_uint64_be (GST_BYTE_READER (&writer), &l)); + fail_unless_equals_uint64 (l, G_GUINT64_CONSTANT (0xff34567890abcdef)); + fail_if (gst_byte_writer_put_uint64_be (&writer, + G_GUINT64_CONSTANT (0x1234567890abcdef))); + + data = gst_byte_writer_reset_and_get_data (&writer); + fail_unless (data != NULL); + fail_unless (memcmp (&end_data, data, 8) == 0); + g_free (data); +} + +GST_END_TEST; + +GST_START_TEST (test_write_non_fixed) +{ + GstByteWriter writer; + guint64 end_data = G_GUINT64_CONSTANT (0xff34567890abcdef); + guint8 *data; + guint64 l = 0; + + end_data = GUINT64_TO_BE (end_data); + + gst_byte_writer_init_with_size (&writer, 6, FALSE); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), -1); + + fail_unless (gst_byte_writer_put_uint8 (&writer, 0x12)); + fail_unless (gst_byte_writer_put_uint16_be (&writer, 0x3456)); + fail_unless (gst_byte_writer_put_uint16_le (&writer, 0x9078)); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), 5); + fail_unless_equals_int (gst_byte_writer_get_size (&writer), 5); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), -1); + fail_unless_equals_int (gst_byte_reader_get_remaining (GST_BYTE_READER + (&writer)), 0); + fail_unless (gst_byte_writer_put_uint24_be (&writer, 0xabcdef)); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), 8); + fail_unless_equals_int (gst_byte_writer_get_size (&writer), 8); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), -1); + fail_unless_equals_int (gst_byte_reader_get_remaining (GST_BYTE_READER + (&writer)), 0); + fail_unless (gst_byte_writer_set_pos (&writer, 0)); + fail_unless (gst_byte_reader_peek_uint64_be (GST_BYTE_READER (&writer), &l)); + fail_unless_equals_uint64 (l, G_GUINT64_CONSTANT (0x1234567890abcdef)); + fail_unless (gst_byte_writer_put_uint8 (&writer, 0xff)); + fail_unless (gst_byte_writer_set_pos (&writer, 0)); + fail_unless (gst_byte_reader_get_uint64_be (GST_BYTE_READER (&writer), &l)); + fail_unless_equals_uint64 (l, G_GUINT64_CONSTANT (0xff34567890abcdef)); + fail_unless (gst_byte_writer_set_pos (&writer, 8)); + fail_unless (gst_byte_writer_put_uint64_be (&writer, + G_GUINT64_CONSTANT (0x1234567890abcdef))); + + data = gst_byte_writer_reset_and_get_data (&writer); + fail_unless (data != NULL); + fail_unless (memcmp (&end_data, data, 8) == 0); + end_data = GUINT64_TO_BE (G_GUINT64_CONSTANT (0x1234567890abcdef)); + fail_unless (memcmp (&end_data, data + 8, 8) == 0); + g_free (data); +} + +GST_END_TEST; + +GST_START_TEST (test_from_data) +{ + GstByteWriter writer; + guint8 data[] = { 0x12, 0x34, 0x56, 0x78, + 0x90, 0xab, 0xcd, 0xef + }; + guint8 *data2; + + gst_byte_writer_init_with_data (&writer, data, sizeof (data), TRUE); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), 8); + fail_unless (gst_byte_writer_put_uint8 (&writer, 0xff)); + fail_unless_equals_int (data[0], 0xff); + fail_unless_equals_int (gst_byte_writer_get_remaining (&writer), 7); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), 1); + fail_if (gst_byte_writer_put_uint64_be (&writer, + G_GUINT64_CONSTANT (0x1234567890abcdef))); + data2 = gst_byte_writer_reset_and_get_data (&writer); + fail_unless (data2 != NULL); + fail_if (data2 == data); + fail_unless (memcmp (data, data2, 8) == 0); + g_free (data2); +} + +GST_END_TEST; + +GST_START_TEST (test_put_data_strings) +{ + GstByteWriter writer; + guint8 data[] = { 0x12, 0x34, 0x56, 0x78, + 0x90, 0xab, 0xcd, 0xef + }; + guint8 *data2; + + gst_byte_writer_init (&writer); + fail_unless (gst_byte_writer_put_data (&writer, data, 8)); + fail_unless (gst_byte_writer_put_string (&writer, "somerandomteststring")); + fail_unless_equals_int (gst_byte_writer_get_pos (&writer), + 8 + sizeof ("somerandomteststring")); + + data2 = gst_byte_writer_reset_and_get_data (&writer); + fail_unless (data2 != NULL); + fail_unless (memcmp (data2, data, 8) == 0); + g_free (data2); +} + +GST_END_TEST; + +GST_START_TEST (test_fill) +{ + GstByteWriter writer; + guint8 data[] = { 0x0, 0x0, 0x0, 0x0, 0x5, 0x5 }; + guint8 *data2; + + gst_byte_writer_init (&writer); + fail_unless (gst_byte_writer_fill (&writer, 0, 4)); + fail_unless (gst_byte_writer_fill (&writer, 5, 2)); + + data2 = gst_byte_writer_reset_and_get_data (&writer); + fail_unless (data2 != NULL); + fail_unless (memcmp (data2, data, 6) == 0); + g_free (data2); +} + +GST_END_TEST; +static Suite * +gst_byte_writer_suite (void) +{ + Suite *s = suite_create ("GstByteWriter"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + + tcase_add_test (tc_chain, test_initialization); + tcase_add_test (tc_chain, test_write_fixed); + tcase_add_test (tc_chain, test_write_non_fixed); + tcase_add_test (tc_chain, test_from_data); + tcase_add_test (tc_chain, test_put_data_strings); + tcase_add_test (tc_chain, test_fill); + + return s; +} + + +GST_CHECK_MAIN (gst_byte_writer); diff --git a/tests/check/libs/collectpads.c b/tests/check/libs/collectpads.c new file mode 100644 index 0000000..4a66101 --- /dev/null +++ b/tests/check/libs/collectpads.c @@ -0,0 +1,348 @@ +/* + * collectpads.c - GstCollectPads testsuite + * Copyright (C) 2006 Alessandro Decina <alessandro@nnva.org> + * + * Authors: + * Alessandro Decina <alessandro@nnva.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. + */ + +#include <gst/check/gstcheck.h> +#include <gst/base/gstcollectpads.h> + +#define fail_unless_collected(expected) \ +G_STMT_START { \ + g_mutex_lock (lock); \ + while (expected == TRUE && collected == FALSE) \ + g_cond_wait (cond, lock); \ + fail_unless_equals_int (collected, expected); \ + g_mutex_unlock (lock); \ +} G_STMT_END; + +typedef struct +{ + char foo; +} BadCollectData; + +typedef struct +{ + GstCollectData data; + GstPad *pad; + GstBuffer *buffer; + GstEvent *event; +} TestData; + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstCollectPads *collect; +static gboolean collected; +static GstPad *srcpad1, *srcpad2; +static GstPad *sinkpad1, *sinkpad2; +static TestData *data1, *data2; + +static GMutex *lock; +static GCond *cond; + +static GstFlowReturn +collected_cb (GstCollectPads * pads, gpointer user_data) +{ + g_mutex_lock (lock); + collected = TRUE; + g_cond_signal (cond); + g_mutex_unlock (lock); + + return GST_FLOW_OK; +} + +static gpointer +push_buffer (gpointer user_data) +{ + TestData *test_data = (TestData *) user_data; + + fail_unless (gst_pad_push (test_data->pad, test_data->buffer) + == GST_FLOW_OK); + + return NULL; +} + +static gpointer +push_event (gpointer user_data) +{ + TestData *test_data = (TestData *) user_data; + + fail_unless (gst_pad_push_event (test_data->pad, test_data->event) == TRUE); + + return NULL; +} + +static void +setup (void) +{ + collect = gst_collect_pads_new (); + gst_collect_pads_set_function (collect, collected_cb, NULL); + + srcpad1 = gst_pad_new_from_static_template (&srctemplate, "src1"); + srcpad2 = gst_pad_new_from_static_template (&srctemplate, "src2"); + sinkpad1 = gst_pad_new_from_static_template (&sinktemplate, "sink1"); + sinkpad2 = gst_pad_new_from_static_template (&sinktemplate, "sink2"); + fail_unless (gst_pad_link (srcpad1, sinkpad1) == GST_PAD_LINK_OK); + fail_unless (gst_pad_link (srcpad2, sinkpad2) == GST_PAD_LINK_OK); + + cond = g_cond_new (); + lock = g_mutex_new (); + data1 = NULL; + data2 = NULL; + collected = FALSE; +} + +static void +teardown (void) +{ + gst_object_unref (sinkpad1); + gst_object_unref (sinkpad2); + gst_object_unref (collect); + g_cond_free (cond); + g_mutex_free (lock); +} + +GST_START_TEST (test_pad_add_remove) +{ + ASSERT_CRITICAL (gst_collect_pads_add_pad (collect, sinkpad1, + sizeof (BadCollectData))); + + data1 = (TestData *) gst_collect_pads_add_pad (collect, + sinkpad1, sizeof (TestData)); + fail_unless (data1 != NULL); + + fail_unless (gst_collect_pads_remove_pad (collect, sinkpad2) == FALSE); + fail_unless (gst_collect_pads_remove_pad (collect, sinkpad1) == TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_collect) +{ + GstBuffer *buf1, *buf2, *tmp; + GThread *thread1, *thread2; + + data1 = (TestData *) gst_collect_pads_add_pad (collect, + sinkpad1, sizeof (TestData)); + fail_unless (data1 != NULL); + + data2 = (TestData *) gst_collect_pads_add_pad (collect, + sinkpad2, sizeof (TestData)); + fail_unless (data2 != NULL); + + buf1 = gst_buffer_new (); + buf2 = gst_buffer_new (); + + /* start collect pads */ + gst_collect_pads_start (collect); + + /* push buffers on the pads */ + data1->pad = srcpad1; + data1->buffer = buf1; + thread1 = g_thread_create (push_buffer, data1, TRUE, NULL); + /* here thread1 is blocked and srcpad1 has a queued buffer */ + fail_unless_collected (FALSE); + + data2->pad = srcpad2; + data2->buffer = buf2; + thread2 = g_thread_create (push_buffer, data2, TRUE, NULL); + + /* now both pads have a buffer */ + fail_unless_collected (TRUE); + + tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1); + fail_unless (tmp == buf1); + tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2); + fail_unless (tmp == buf2); + + /* these will return immediately as at this point the threads have been + * unlocked and are finished */ + g_thread_join (thread1); + g_thread_join (thread2); + + gst_collect_pads_stop (collect); + + gst_buffer_unref (buf1); + gst_buffer_unref (buf2); +} + +GST_END_TEST; + +GST_START_TEST (test_collect_eos) +{ + GstBuffer *buf1, *tmp; + GThread *thread1, *thread2; + + data1 = (TestData *) gst_collect_pads_add_pad (collect, + sinkpad1, sizeof (TestData)); + fail_unless (data1 != NULL); + + data2 = (TestData *) gst_collect_pads_add_pad (collect, + sinkpad2, sizeof (TestData)); + fail_unless (data2 != NULL); + + buf1 = gst_buffer_new (); + + /* start collect pads */ + gst_collect_pads_start (collect); + + /* push a buffer on srcpad1 and EOS on srcpad2 */ + data1->pad = srcpad1; + data1->buffer = buf1; + thread1 = g_thread_create (push_buffer, data1, TRUE, NULL); + /* here thread1 is blocked and srcpad1 has a queued buffer */ + fail_unless_collected (FALSE); + + data2->pad = srcpad2; + data2->event = gst_event_new_eos (); + thread2 = g_thread_create (push_event, data2, TRUE, NULL); + /* now sinkpad1 has a buffer and sinkpad2 has EOS */ + fail_unless_collected (TRUE); + + tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1); + fail_unless (tmp == buf1); + /* sinkpad2 has EOS so a NULL buffer is returned */ + tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2); + fail_unless (tmp == NULL); + + /* these will return immediately as when the data is popped the threads are + * unlocked and will terminate */ + g_thread_join (thread1); + g_thread_join (thread2); + + gst_collect_pads_stop (collect); + + gst_buffer_unref (buf1); +} + +GST_END_TEST; + +GST_START_TEST (test_collect_twice) +{ + GstBuffer *buf1, *buf2, *tmp; + GThread *thread1, *thread2; + + data1 = (TestData *) gst_collect_pads_add_pad (collect, + sinkpad1, sizeof (TestData)); + fail_unless (data1 != NULL); + + data2 = (TestData *) gst_collect_pads_add_pad (collect, + sinkpad2, sizeof (TestData)); + fail_unless (data2 != NULL); + + buf1 = gst_buffer_new (); + + /* start collect pads */ + gst_collect_pads_start (collect); + + /* queue a buffer */ + data1->pad = srcpad1; + data1->buffer = buf1; + thread1 = g_thread_create (push_buffer, data1, TRUE, NULL); + /* here thread1 is blocked and srcpad1 has a queued buffer */ + fail_unless_collected (FALSE); + + /* push EOS on the other pad */ + data2->pad = srcpad2; + data2->event = gst_event_new_eos (); + thread2 = g_thread_create (push_event, data2, TRUE, NULL); + + /* one of the pads has a buffer, the other has EOS */ + fail_unless_collected (TRUE); + + tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1); + fail_unless (tmp == buf1); + /* there's nothing to pop from the one which received EOS */ + tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2); + fail_unless (tmp == NULL); + + /* these will return immediately as at this point the threads have been + * unlocked and are finished */ + g_thread_join (thread1); + g_thread_join (thread2); + + gst_collect_pads_stop (collect); + collected = FALSE; + + buf2 = gst_buffer_new (); + + /* start collect pads */ + gst_collect_pads_start (collect); + + /* push buffers on the pads */ + data1->pad = srcpad1; + data1->buffer = buf1; + thread1 = g_thread_create (push_buffer, data1, TRUE, NULL); + /* here thread1 is blocked and srcpad1 has a queued buffer */ + fail_unless_collected (FALSE); + + data2->pad = srcpad2; + data2->buffer = buf2; + thread2 = g_thread_create (push_buffer, data2, TRUE, NULL); + + /* now both pads have a buffer */ + fail_unless_collected (TRUE); + + tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1); + fail_unless (tmp == buf1); + tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2); + fail_unless (tmp == buf2); + + /* these will return immediately as at this point the threads have been + * unlocked and are finished */ + g_thread_join (thread1); + g_thread_join (thread2); + + gst_collect_pads_stop (collect); + + gst_buffer_unref (buf1); + gst_buffer_unref (buf2); + +} + +GST_END_TEST; + +static Suite * +gst_collect_pads_suite (void) +{ + Suite *suite; + TCase *general; + + suite = suite_create ("GstCollectPads"); + general = tcase_create ("general"); + suite_add_tcase (suite, general); + tcase_add_checked_fixture (general, setup, teardown); + tcase_add_test (general, test_pad_add_remove); + tcase_add_test (general, test_collect); + tcase_add_test (general, test_collect_eos); + tcase_add_test (general, test_collect_twice); + + return suite; +} + +GST_CHECK_MAIN (gst_collect_pads); diff --git a/tests/check/libs/controller.c b/tests/check/libs/controller.c new file mode 100644 index 0000000..05cd432 --- /dev/null +++ b/tests/check/libs/controller.c @@ -0,0 +1,2306 @@ +/* GStreamer + * + * unit test for the controller library + * + * Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net> + * Copyright (C) <2006-2007> Sebastian Dröge <slomo@circular-chaos.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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <gst/gst.h> +#include <gst/check/gstcheck.h> +#include <gst/controller/gstcontroller.h> +#include <gst/controller/gstcontrolsource.h> +#include <gst/controller/gstinterpolationcontrolsource.h> +#include <gst/controller/gstlfocontrolsource.h> + +/* LOCAL TEST ELEMENT */ + +enum +{ + ARG_ULONG = 1, + ARG_FLOAT, + ARG_DOUBLE, + ARG_BOOLEAN, + ARG_READONLY, + ARG_STATIC, + ARG_CONSTRUCTONLY, + ARG_COUNT +}; + +#define GST_TYPE_TEST_MONO_SOURCE (gst_test_mono_source_get_type ()) +#define GST_TEST_MONO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TEST_MONO_SOURCE, GstTestMonoSource)) +#define GST_TEST_MONO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TEST_MONO_SOURCE, GstTestMonoSourceClass)) +#define GST_IS_TEST_MONO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TEST_MONO_SOURCE)) +#define GST_IS_TEST_MONO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TEST_MONO_SOURCE)) +#define GST_TEST_MONO_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TEST_MONO_SOURCE, GstTestMonoSourceClass)) + +typedef struct _GstTestMonoSource GstTestMonoSource; +typedef struct _GstTestMonoSourceClass GstTestMonoSourceClass; + +struct _GstTestMonoSource +{ + GstElement parent; + gulong val_ulong; + gfloat val_float; + gdouble val_double; + gboolean val_boolean; +}; +struct _GstTestMonoSourceClass +{ + GstElementClass parent_class; +}; + +static GType gst_test_mono_source_get_type (void); + +static void +gst_test_mono_source_get_property (GObject * object, + guint property_id, GValue * value, GParamSpec * pspec) +{ + GstTestMonoSource *self = GST_TEST_MONO_SOURCE (object); + + switch (property_id) { + case ARG_ULONG: + g_value_set_ulong (value, self->val_ulong); + break; + case ARG_FLOAT: + g_value_set_float (value, self->val_float); + break; + case ARG_DOUBLE: + g_value_set_double (value, self->val_double); + break; + case ARG_BOOLEAN: + g_value_set_boolean (value, self->val_boolean); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gst_test_mono_source_set_property (GObject * object, + guint property_id, const GValue * value, GParamSpec * pspec) +{ + GstTestMonoSource *self = GST_TEST_MONO_SOURCE (object); + + switch (property_id) { + case ARG_ULONG: + self->val_ulong = g_value_get_ulong (value); + GST_DEBUG ("test value ulong=%lu", self->val_ulong); + break; + case ARG_FLOAT: + self->val_float = g_value_get_float (value); + GST_DEBUG ("test value float=%f", self->val_float); + break; + case ARG_DOUBLE: + self->val_double = g_value_get_double (value); + GST_DEBUG ("test value double=%f", self->val_double); + break; + case ARG_BOOLEAN: + self->val_boolean = g_value_get_boolean (value); + GST_DEBUG ("test value boolean=%d", self->val_boolean); + break; + case ARG_CONSTRUCTONLY: + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gst_test_mono_source_class_init (GstTestMonoSourceClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->set_property = gst_test_mono_source_set_property; + gobject_class->get_property = gst_test_mono_source_get_property; + + g_object_class_install_property (gobject_class, ARG_ULONG, + g_param_spec_ulong ("ulong", + "ulong prop", + "ulong number parameter for the test_mono_source", + 0, G_MAXULONG, 0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); + + g_object_class_install_property (gobject_class, ARG_FLOAT, + g_param_spec_float ("float", + "float prop", + "float number parameter for the test_mono_source", + 0.0, 100.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); + + g_object_class_install_property (gobject_class, ARG_DOUBLE, + g_param_spec_double ("double", + "double prop", + "double number parameter for the test_mono_source", + 0.0, 100.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); + + g_object_class_install_property (gobject_class, ARG_BOOLEAN, + g_param_spec_boolean ("boolean", + "boolean prop", + "boolean parameter for the test_mono_source", + FALSE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); + + g_object_class_install_property (gobject_class, ARG_READONLY, + g_param_spec_ulong ("readonly", + "readonly prop", + "readonly parameter for the test_mono_source", + 0, G_MAXULONG, 0, G_PARAM_READABLE | GST_PARAM_CONTROLLABLE)); + + g_object_class_install_property (gobject_class, ARG_STATIC, + g_param_spec_ulong ("static", + "static prop", + "static parameter for the test_mono_source", + 0, G_MAXULONG, 0, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_CONSTRUCTONLY, + g_param_spec_ulong ("construct-only", + "construct-only prop", + "construct-only parameter for the test_mono_source", + 0, G_MAXULONG, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); +} + +static void +gst_test_mono_source_base_init (GstTestMonoSourceClass * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_set_details_simple (element_class, + "Monophonic source for unit tests", + "Source/Audio/MonoSource", + "Use in unit tests", "Stefan Kost <ensonic@users.sf.net>"); +} + +static GType +gst_test_mono_source_get_type (void) +{ + static volatile gsize test_mono_source_type = 0; + + if (g_once_init_enter (&test_mono_source_type)) { + GType type; + static const GTypeInfo info = { + (guint16) sizeof (GstTestMonoSourceClass), + (GBaseInitFunc) gst_test_mono_source_base_init, // base_init + NULL, // base_finalize + (GClassInitFunc) gst_test_mono_source_class_init, // class_init + NULL, // class_finalize + NULL, // class_data + (guint16) sizeof (GstTestMonoSource), + 0, // n_preallocs + NULL, // instance_init + NULL // value_table + }; + type = + g_type_register_static (GST_TYPE_ELEMENT, "GstTestMonoSource", &info, + 0); + g_once_init_leave (&test_mono_source_type, type); + } + return test_mono_source_type; +} + +/* so we don't have to paste the gst_element_register into 50 places below */ +static gboolean +local_gst_controller_init (int *argc, char ***argv) +{ + fail_unless (gst_controller_init (argc, argv)); + + fail_unless (gst_element_register (NULL, "testmonosource", GST_RANK_NONE, + GST_TYPE_TEST_MONO_SOURCE)); + + return TRUE; +} + +#define gst_controller_init(a,b) local_gst_controller_init(a,b) + +/* TESTS */ +/* double init should not harm */ +GST_START_TEST (controller_init) +{ + gst_controller_init (NULL, NULL); + gst_controller_init (NULL, NULL); + gst_controller_init (NULL, NULL); + gst_controller_init (NULL, NULL); +} + +GST_END_TEST; + +/* tests for an element with no controlled params */ +GST_START_TEST (controller_new_fail1) +{ + GstController *ctrl; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("fakesrc", "test_source"); + + /* that property should not exist */ + ctrl = gst_controller_new (G_OBJECT (elem), "_schrompf_", NULL); + fail_unless (ctrl == NULL, NULL); + + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests for an element with controlled params, but none given */ +GST_START_TEST (controller_new_fail2) +{ + GstController *ctrl; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* no property given */ + ctrl = gst_controller_new (G_OBJECT (elem), NULL); + fail_unless (ctrl == NULL, NULL); + + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests for readonly params */ +GST_START_TEST (controller_new_fail3) +{ + GstController *ctrl; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and but is readonly */ + ASSERT_CRITICAL (ctrl = + gst_controller_new (G_OBJECT (elem), "readonly", NULL)); + fail_unless (ctrl == NULL, NULL); + + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests for static params */ +GST_START_TEST (controller_new_fail4) +{ + GstController *ctrl; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and but is not controlable */ + ASSERT_CRITICAL (ctrl = gst_controller_new (G_OBJECT (elem), "static", NULL)); + fail_unless (ctrl == NULL, NULL); + + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests for construct-only params */ +GST_START_TEST (controller_new_fail5) +{ + GstController *ctrl; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and but is construct-only */ + ASSERT_CRITICAL (ctrl = + gst_controller_new (G_OBJECT (elem), "construct-only", NULL)); + fail_unless (ctrl == NULL, NULL); + + gst_object_unref (elem); +} + +GST_END_TEST; + + +/* tests for an element with controlled params */ +GST_START_TEST (controller_new_okay1) +{ + GstController *ctrl; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests for an element with several controlled params */ +GST_START_TEST (controller_new_okay2) +{ + GstController *ctrl, *ctrl2, *ctrl3; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "double", "float", NULL); + fail_unless (ctrl != NULL, NULL); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 1); + + ctrl2 = gst_controller_new (G_OBJECT (elem), "boolean", NULL); + fail_unless (ctrl2 != NULL, NULL); + fail_unless (ctrl2 == ctrl, NULL); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 2); + + /* trying to control the same properties again should correctly + * increase the refcount of the object returned as well */ + ctrl3 = + gst_controller_new (G_OBJECT (elem), "ulong", "double", "float", NULL); + fail_unless (ctrl3 != NULL, NULL); + fail_unless (ctrl3 == ctrl, NULL); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 3); + + g_object_unref (ctrl); + g_object_unref (ctrl2); + g_object_unref (ctrl3); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* controlling several params should return the same controller */ +GST_START_TEST (controller_new_okay3) +{ + GstController *ctrl1, *ctrl2, *ctrl3; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl1 = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl1 != NULL, NULL); + + /* that property should exist and should be controllable */ + ctrl2 = gst_controller_new (G_OBJECT (elem), "double", NULL); + fail_unless (ctrl2 != NULL, NULL); + fail_unless (ctrl1 == ctrl2, NULL); + + /* that property should exist and should be controllable */ + ctrl3 = gst_controller_new (G_OBJECT (elem), "float", NULL); + fail_unless (ctrl3 != NULL, NULL); + fail_unless (ctrl1 == ctrl3, NULL); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl1)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl1)->ref_count, 3); + g_object_unref (ctrl1); + g_object_unref (ctrl2); + g_object_unref (ctrl3); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* controlling a params twice should be handled */ +GST_START_TEST (controller_param_twice) +{ + GstController *ctrl; + GstElement *elem; + gboolean res; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* it should have been added at least once, let remove it */ + res = gst_controller_remove_properties (ctrl, "ulong", NULL); + fail_unless (res, NULL); + + /* removing it again should not work */ + res = gst_controller_remove_properties (ctrl, "ulong", NULL); + fail_unless (!res, NULL); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests if we cleanup properly */ +GST_START_TEST (controller_finalize) +{ + GstController *ctrl; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* free the controller */ + g_object_unref (ctrl); + + /* object shouldn't have a controller anymore */ + ctrl = gst_object_get_controller (G_OBJECT (elem)); + fail_unless (ctrl == NULL, NULL); + + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests if we cleanup properly */ +GST_START_TEST (controller_controlsource_refcounts) +{ + GstController *ctrl; + GstElement *elem; + GstControlSource *csource, *test_csource; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + csource = (GstControlSource *) gst_interpolation_control_source_new (); + fail_unless (csource != NULL, NULL); + + fail_unless_equals_int (G_OBJECT (csource)->ref_count, 1); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", csource)); + fail_unless_equals_int (G_OBJECT (csource)->ref_count, 2); + + g_object_unref (G_OBJECT (csource)); + + test_csource = gst_controller_get_control_source (ctrl, "ulong"); + fail_unless (test_csource != NULL, NULL); + fail_unless (test_csource == csource); + fail_unless_equals_int (G_OBJECT (csource)->ref_count, 2); + g_object_unref (csource); + + /* free the controller */ + g_object_unref (ctrl); + + /* object shouldn't have a controller anymore */ + ctrl = gst_object_get_controller (G_OBJECT (elem)); + fail_unless (ctrl == NULL, NULL); + + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests if we don't fail on empty controllers */ +GST_START_TEST (controller_controlsource_empty1) +{ + GstController *ctrl; + GstElement *elem; + GstControlSource *csource; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + csource = (GstControlSource *) gst_interpolation_control_source_new (); + fail_unless (csource != NULL, NULL); + + fail_unless (gst_controller_set_control_source (ctrl, "ulong", csource)); + + /* don't fail on empty control point lists */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + + /* unref objects */ + g_object_unref (csource); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests if we don't fail on controllers that are empty again */ +GST_START_TEST (controller_controlsource_empty2) +{ + GstController *ctrl; + GstElement *elem; + GstInterpolationControlSource *csource; + GValue val = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + csource = gst_interpolation_control_source_new (); + fail_unless (csource != NULL, NULL); + + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + (GstControlSource *) csource)); + + /* set control values */ + g_value_init (&val, G_TYPE_ULONG); + g_value_set_ulong (&val, 0); + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, &val); + + /* ... and unset the value */ + gst_interpolation_control_source_unset (csource, 0 * GST_SECOND); + + /* don't fail on empty control point lists */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + + /* unref objects */ + g_object_unref (csource); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test timed value handling without interpolation */ +GST_START_TEST (controller_interpolate_none) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_NONE)); + + fail_unless (gst_interpolation_control_source_get_count (csource) == 0); + + /* set control values */ + g_value_init (&val_ulong, G_TYPE_ULONG); + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + fail_unless (gst_interpolation_control_source_get_count (csource) == 1); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + fail_unless (gst_interpolation_control_source_get_count (csource) == 2); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test timed value handling in trigger mode */ +GST_START_TEST (controller_interpolate_trigger) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_TRIGGER)); + + g_value_init (&val_ulong, G_TYPE_ULONG); + fail_if (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), + 0 * GST_SECOND, &val_ulong)); + + /* set control values */ + g_value_set_ulong (&val_ulong, 50); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + + /* now pull in values for some timestamps */ + fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), + 0 * GST_SECOND, &val_ulong)); + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), + 1 * GST_SECOND, &val_ulong)); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), + 2 * GST_SECOND, &val_ulong)); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (G_OBJECT (csource)); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test timed value handling with linear interpolation */ +GST_START_TEST (controller_interpolate_linear) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_LINEAR)); + + /* set control values */ + g_value_init (&val_ulong, G_TYPE_ULONG); + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test timed value handling with cubic interpolation */ +GST_START_TEST (controller_interpolate_cubic) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_double = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "double", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "double", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_CUBIC)); + + /* set control values */ + g_value_init (&val_double, G_TYPE_DOUBLE); + g_value_set_double (&val_double, 0.0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_double); + fail_unless (res, NULL); + g_value_set_double (&val_double, 5.0); + res = + gst_interpolation_control_source_set (csource, 1 * GST_SECOND, + &val_double); + fail_unless (res, NULL); + g_value_set_double (&val_double, 2.0); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_double); + fail_unless (res, NULL); + g_value_set_double (&val_double, 8.0); + res = + gst_interpolation_control_source_set (csource, 4 * GST_SECOND, + &val_double); + fail_unless (res, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 0.0); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 5.0); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 2.0); + gst_controller_sync_values (ctrl, 3 * GST_SECOND); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double > 2.0 && + GST_TEST_MONO_SOURCE (elem)->val_double < 8.0, NULL); + gst_controller_sync_values (ctrl, 4 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 8.0); + gst_controller_sync_values (ctrl, 5 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 8.0); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test timed value handling with cubic interpolation */ +GST_START_TEST (controller_interpolate_cubic_too_few_cp) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_double = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "double", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "double", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_CUBIC)); + + /* set 2 control values */ + g_value_init (&val_double, G_TYPE_DOUBLE); + g_value_set_double (&val_double, 0.0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_double); + fail_unless (res, NULL); + g_value_set_double (&val_double, 4.0); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_double); + fail_unless (res, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps and verify that it used linear + * interpolation as we don't gave enough control points + */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 0.0); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 2.0); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 4.0); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* make sure we don't crash when someone sets an unsupported interpolation + * mode */ +GST_START_TEST (controller_interpolate_unimplemented) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set completely bogus interpolation mode */ + fail_if (gst_interpolation_control_source_set_interpolation_mode (csource, + (GstInterpolateMode) 93871)); + + g_object_unref (G_OBJECT (csource)); + + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test _unset() */ +GST_START_TEST (controller_interpolation_unset) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_NONE)); + + /* set control values */ + g_value_init (&val_ulong, G_TYPE_ULONG); + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 1 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 50); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + /* verify values */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + + /* unset second */ + res = gst_interpolation_control_source_unset (csource, 1 * GST_SECOND); + fail_unless (res, NULL); + + /* verify value again */ + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + + /* unset all values, reset and try to unset again */ + fail_unless (gst_interpolation_control_source_unset (csource, + 0 * GST_SECOND)); + fail_unless (gst_interpolation_control_source_unset (csource, + 2 * GST_SECOND)); + gst_interpolation_control_source_unset_all (csource); + fail_if (gst_interpolation_control_source_unset (csource, 2 * GST_SECOND)); + + g_object_unref (csource); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test _unset_all() */ +GST_START_TEST (controller_interpolation_unset_all) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_NONE)); + + /* set control values */ + g_value_init (&val_ulong, G_TYPE_ULONG); + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 1 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + /* verify values */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + + /* unset all */ + gst_interpolation_control_source_unset_all (csource); + + g_object_unref (csource); + + /* verify value again */ + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test retrieval of an array of values with get_value_array() */ +GST_START_TEST (controller_interpolation_linear_value_array) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + GstValueArray values = { NULL, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_LINEAR)); + + /* set control values */ + g_value_init (&val_ulong, G_TYPE_ULONG); + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + /* now pull in values for some timestamps */ + values.property_name = (char *) "ulong"; + values.nbsamples = 3; + values.sample_interval = GST_SECOND; + values.values = (gpointer) g_new (gulong, 3); + + fail_unless (gst_control_source_get_value_array (GST_CONTROL_SOURCE (csource), + 0, &values)); + fail_unless_equals_int (((gulong *) values.values)[0], 0); + fail_unless_equals_int (((gulong *) values.values)[1], 50); + fail_unless_equals_int (((gulong *) values.values)[2], 100); + + g_object_unref (csource); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_free (values.values); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test if values below minimum and above maximum are clipped */ +GST_START_TEST (controller_interpolation_linear_invalid_values) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_float = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "float", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "float", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_LINEAR)); + + /* set control values */ + g_value_init (&val_float, G_TYPE_FLOAT); + g_value_set_float (&val_float, 200.0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_float); + fail_unless (res, NULL); + g_value_set_float (&val_float, -200.0); + res = + gst_interpolation_control_source_set (csource, 4 * GST_SECOND, + &val_float); + fail_unless (res, NULL); + + g_object_unref (csource); + + /* now pull in values for some timestamps and see if clipping works */ + /* 200.0 */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 100.0); + /* 100.0 */ + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 100.0); + /* 50.0 */ + gst_controller_sync_values (ctrl, 1 * GST_SECOND + 500 * GST_MSECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 50.0); + /* 0.0 */ + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 0.0); + /* -100.0 */ + gst_controller_sync_values (ctrl, 3 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 0.0); + /* -200.0 */ + gst_controller_sync_values (ctrl, 4 * GST_SECOND); + fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 0.0); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +GST_START_TEST (controller_interpolation_linear_default_values) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_LINEAR)); + + g_value_init (&val_ulong, G_TYPE_ULONG); + + /* Should fail if no value was set yet + * FIXME: will not fail, as interpolation assumes val[0]=default_value if + * nothing else is set. + fail_if (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), + 1 * GST_SECOND, &val_ulong)); + */ + + /* set control values */ + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 1 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 3 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + /* now pull in values for some timestamps */ + /* should give the value of the first control point for timestamps before it */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 3 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + + /* set control values */ + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + /* unset the old ones */ + res = gst_interpolation_control_source_unset (csource, 1 * GST_SECOND); + fail_unless (res, NULL); + res = gst_interpolation_control_source_unset (csource, 3 * GST_SECOND); + fail_unless (res, NULL); + + /* now pull in values for some timestamps */ + /* should now give our value for timestamp 0 */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + + g_object_unref (G_OBJECT (csource)); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test gst_controller_set_disabled() with linear interpolation */ +GST_START_TEST (controller_interpolate_linear_disabled) +{ + GstController *ctrl; + GstInterpolationControlSource *csource, *csource2; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, } + , val_double = { + 0,}; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "double", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + csource2 = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + fail_unless (csource2 != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "double", + GST_CONTROL_SOURCE (csource2))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_LINEAR)); + fail_unless (gst_interpolation_control_source_set_interpolation_mode + (csource2, GST_INTERPOLATE_LINEAR)); + + /* set control values */ + g_value_init (&val_ulong, G_TYPE_ULONG); + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + g_object_unref (G_OBJECT (csource)); + +/* set control values */ + g_value_init (&val_double, G_TYPE_DOUBLE); + g_value_set_double (&val_double, 2.0); + res = + gst_interpolation_control_source_set (csource2, 0 * GST_SECOND, + &val_double); + fail_unless (res, NULL); + g_value_set_double (&val_double, 4.0); + res = + gst_interpolation_control_source_set (csource2, 2 * GST_SECOND, + &val_double); + fail_unless (res, NULL); + + g_object_unref (G_OBJECT (csource2)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL); + + /* now pull in values for some timestamps, prop double disabled */ + GST_TEST_MONO_SOURCE (elem)->val_ulong = 0; + GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; + gst_controller_set_property_disabled (ctrl, "double", TRUE); + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); + + /* now pull in values for some timestamps, after enabling double again */ + GST_TEST_MONO_SOURCE (elem)->val_ulong = 0; + GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; + gst_controller_set_property_disabled (ctrl, "double", FALSE); + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL); + + /* now pull in values for some timestamps, after disabling all props */ + GST_TEST_MONO_SOURCE (elem)->val_ulong = 0; + GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; + gst_controller_set_disabled (ctrl, TRUE); + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); + + /* now pull in values for some timestamps, enabling double again */ + GST_TEST_MONO_SOURCE (elem)->val_ulong = 0; + GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; + gst_controller_set_property_disabled (ctrl, "double", FALSE); + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL); + + /* now pull in values for some timestamps, enabling all */ + GST_TEST_MONO_SOURCE (elem)->val_ulong = 0; + GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; + gst_controller_set_disabled (ctrl, FALSE); + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL); + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL); + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + + +GST_START_TEST (controller_interpolation_set_from_list) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstTimedValue *tval; + GstElement *elem; + GSList *list = NULL; + + gst_controller_init (NULL, NULL); + + /* test that an invalid timestamp throws a warning of some sort */ + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_LINEAR)); + + /* set control value */ + tval = g_new0 (GstTimedValue, 1); + tval->timestamp = GST_CLOCK_TIME_NONE; + g_value_init (&tval->value, G_TYPE_ULONG); + g_value_set_ulong (&tval->value, 0); + + list = g_slist_append (list, tval); + + fail_if (gst_interpolation_control_source_set_from_list (csource, list)); + + /* try again with a valid stamp, should work now */ + tval->timestamp = 0; + fail_unless (gst_interpolation_control_source_set_from_list (csource, list)); + + g_object_unref (csource); + + /* allocated GstTimedValue now belongs to the controller, but list not */ + g_value_unset (&tval->value); + g_free (tval); + g_slist_free (list); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test lfo control source with sine waveform */ +GST_START_TEST (controller_lfo_sine) +{ + GstController *ctrl; + GstLFOControlSource *csource; + GstElement *elem; + GValue amp = { 0, } + , off = { + 0,}; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_lfo_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set amplitude and offset values */ + g_value_init (&, G_TYPE_ULONG); + g_value_init (&off, G_TYPE_ULONG); + g_value_set_ulong (&, 100); + g_value_set_ulong (&off, 100); + + /* set waveform mode */ + g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SINE, + "frequency", 1.0, "timeshift", (GstClockTime) 0, + "amplitude", &, "offset", &off, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test lfo control source with sine waveform and timeshift */ +GST_START_TEST (controller_lfo_sine_timeshift) +{ + GstController *ctrl; + GstLFOControlSource *csource; + GstElement *elem; + GValue amp = { 0, } + , off = { + 0,}; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_lfo_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set amplitude and offset values */ + g_value_init (&, G_TYPE_ULONG); + g_value_init (&off, G_TYPE_ULONG); + g_value_set_ulong (&, 100); + g_value_set_ulong (&off, 100); + + /* set waveform mode */ + g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SINE, + "frequency", 1.0, "timeshift", 250 * GST_MSECOND, + "amplitude", &, "offset", &off, NULL); + + g_object_unref (G_OBJECT (csource)); + +/* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test lfo control source with square waveform */ +GST_START_TEST (controller_lfo_square) +{ + GstController *ctrl; + GstLFOControlSource *csource; + GstElement *elem; + GValue amp = { 0, } + , off = { + 0,}; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_lfo_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set amplitude and offset values */ + g_value_init (&, G_TYPE_ULONG); + g_value_init (&off, G_TYPE_ULONG); + g_value_set_ulong (&, 100); + g_value_set_ulong (&off, 100); + + /* set waveform mode */ + g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SQUARE, + "frequency", 1.0, "timeshift", (GstClockTime) 0, + "amplitude", &, "offset", &off, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test lfo control source with saw waveform */ +GST_START_TEST (controller_lfo_saw) +{ + GstController *ctrl; + GstLFOControlSource *csource; + GstElement *elem; + GValue amp = { 0, } + , off = { + 0,}; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_lfo_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set amplitude and offset values */ + g_value_init (&, G_TYPE_ULONG); + g_value_init (&off, G_TYPE_ULONG); + g_value_set_ulong (&, 100); + g_value_set_ulong (&off, 100); + + /* set waveform mode */ + g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SAW, + "frequency", 1.0, "timeshift", (GstClockTime) 0, + "amplitude", &, "offset", &off, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150); + gst_controller_sync_values (ctrl, 500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test lfo control source with reverse saw waveform */ +GST_START_TEST (controller_lfo_rsaw) +{ + GstController *ctrl; + GstLFOControlSource *csource; + GstElement *elem; + GValue amp = { 0, } + , off = { + 0,}; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_lfo_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set amplitude and offset values */ + g_value_init (&, G_TYPE_ULONG); + g_value_init (&off, G_TYPE_ULONG); + g_value_set_ulong (&, 100); + g_value_set_ulong (&off, 100); + + /* set waveform mode */ + g_object_set (csource, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW, + "frequency", 1.0, "timeshift", (GstClockTime) 0, + "amplitude", &, "offset", &off, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150); + gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150); + gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test lfo control source with saw waveform */ +GST_START_TEST (controller_lfo_triangle) +{ + GstController *ctrl; + GstLFOControlSource *csource; + GstElement *elem; + GValue amp = { 0, } + , off = { + 0,}; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_lfo_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set amplitude and offset values */ + g_value_init (&, G_TYPE_ULONG); + g_value_init (&off, G_TYPE_ULONG); + g_value_set_ulong (&, 100); + g_value_set_ulong (&off, 100); + + /* set waveform mode */ + g_object_set (csource, "waveform", GST_LFO_WAVEFORM_TRIANGLE, + "frequency", 1.0, "timeshift", (GstClockTime) 0, + "amplitude", &, "offset", &off, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test lfo control source with nothing set */ +GST_START_TEST (controller_lfo_none) +{ + GstController *ctrl; + GstLFOControlSource *csource; + GstElement *elem; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_lfo_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps */ + gst_controller_sync_values (ctrl, 0 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* tests if we can run helper methods against any GObject */ +GST_START_TEST (controller_helper_any_gobject) +{ + GstElement *elem; + gboolean res; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("bin", "test_elem"); + + /* that element is not controllable */ + res = gst_object_sync_values (G_OBJECT (elem), 0LL); + /* Syncing should still succeed as there's nothing to sync */ + fail_unless (res == TRUE, NULL); + + gst_object_unref (elem); +} + +GST_END_TEST; + +GST_START_TEST (controller_refcount_new_list) +{ + GstController *ctrl, *ctrl2; + GstElement *elem; + GList *list = NULL; + + gst_controller_init (NULL, NULL); + + /* that property should exist and should be controllable */ + elem = gst_element_factory_make ("testmonosource", "test_source"); + list = g_list_append (NULL, (char *) "ulong"); + ctrl = gst_controller_new_list (G_OBJECT (elem), list); + fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 1); + g_list_free (list); + g_object_unref (ctrl); + gst_object_unref (elem); + + /* try the same property twice, make sure the refcount is still 1 */ + elem = gst_element_factory_make ("testmonosource", "test_source"); + list = g_list_append (NULL, (char *) "ulong"); + list = g_list_append (list, (char *) "ulong"); + ctrl = gst_controller_new_list (G_OBJECT (elem), list); + fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 1); + g_list_free (list); + g_object_unref (ctrl); + gst_object_unref (elem); + + /* try two properties, make sure the refcount is still 1 */ + elem = gst_element_factory_make ("testmonosource", "test_source"); + list = g_list_append (NULL, (char *) "ulong"); + list = g_list_append (list, (char *) "boolean"); + ctrl = gst_controller_new_list (G_OBJECT (elem), list); + fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 1); + g_list_free (list); + g_object_unref (ctrl); + gst_object_unref (elem); + + /* try _new_list with existing controller */ + elem = gst_element_factory_make ("testmonosource", "test_source"); + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + list = g_list_append (NULL, (char *) "ulong"); + ctrl2 = gst_controller_new_list (G_OBJECT (elem), list); + fail_unless (ctrl2 != NULL, NULL); + fail_unless (ctrl == ctrl2, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 2); + g_list_free (list); + g_object_unref (ctrl); + g_object_unref (ctrl2); + gst_object_unref (elem); + + /* try _new_list first and then _new */ + elem = gst_element_factory_make ("testmonosource", "test_source"); + list = g_list_append (NULL, (char *) "ulong"); + ctrl = gst_controller_new_list (G_OBJECT (elem), list); + fail_unless (ctrl != NULL, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + ctrl2 = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl2 != NULL, NULL); + fail_unless (ctrl == ctrl2, NULL); + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 2); + g_list_free (list); + g_object_unref (ctrl); + g_object_unref (ctrl2); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test linear interpolation for ts < first control point */ +GST_START_TEST (controller_interpolate_linear_before_ts0) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_LINEAR)); + + /* set control values */ + g_value_init (&val_ulong, G_TYPE_ULONG); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 4 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + + g_object_unref (G_OBJECT (csource)); + + /* now pull in values for some timestamps after first control point */ + gst_controller_sync_values (ctrl, 2 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100); + gst_controller_sync_values (ctrl, 3 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 4 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + + /* now pull in values for some timestamps before first control point */ + gst_controller_sync_values (ctrl, 1 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); + gst_controller_sync_values (ctrl, 0 * GST_SECOND); + fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + +/* test control-point handling in interpolation control source */ +GST_START_TEST (controller_interpolation_cp_count) +{ + GstController *ctrl; + GstInterpolationControlSource *csource; + GstElement *elem; + gboolean res; + GValue val_ulong = { 0, }; + + gst_controller_init (NULL, NULL); + + elem = gst_element_factory_make ("testmonosource", "test_source"); + + /* that property should exist and should be controllable */ + ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); + fail_unless (ctrl != NULL, NULL); + + /* Get interpolation control source */ + csource = gst_interpolation_control_source_new (); + + fail_unless (csource != NULL); + fail_unless (gst_controller_set_control_source (ctrl, "ulong", + GST_CONTROL_SOURCE (csource))); + + /* set interpolation mode */ + fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, + GST_INTERPOLATE_NONE)); + + fail_unless (gst_interpolation_control_source_get_count (csource) == 0); + + /* set control values */ + g_value_init (&val_ulong, G_TYPE_ULONG); + g_value_set_ulong (&val_ulong, 0); + res = + gst_interpolation_control_source_set (csource, 0 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + fail_unless (gst_interpolation_control_source_get_count (csource) == 1); + g_value_set_ulong (&val_ulong, 100); + res = + gst_interpolation_control_source_set (csource, 2 * GST_SECOND, + &val_ulong); + fail_unless (res, NULL); + fail_unless (gst_interpolation_control_source_get_count (csource) == 2); + + /* now unset control values */ + res = gst_interpolation_control_source_unset (csource, 2 * GST_SECOND); + fail_unless (res, NULL); + fail_unless (gst_interpolation_control_source_get_count (csource) == 1); + + res = gst_interpolation_control_source_unset (csource, 0 * GST_SECOND); + fail_unless (res, NULL); + fail_unless (gst_interpolation_control_source_get_count (csource) == 0); + + g_object_unref (G_OBJECT (csource)); + + GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); + g_object_unref (ctrl); + gst_object_unref (elem); +} + +GST_END_TEST; + + +static Suite * +gst_controller_suite (void) +{ + Suite *s = suite_create ("Controller"); + TCase *tc = tcase_create ("general"); + + suite_add_tcase (s, tc); + tcase_add_test (tc, controller_init); + tcase_add_test (tc, controller_refcount_new_list); + tcase_add_test (tc, controller_new_fail1); + tcase_add_test (tc, controller_new_fail2); + tcase_add_test (tc, controller_new_fail3); + tcase_add_test (tc, controller_new_fail4); + tcase_add_test (tc, controller_new_fail5); + tcase_add_test (tc, controller_new_okay1); + tcase_add_test (tc, controller_new_okay2); + tcase_add_test (tc, controller_new_okay3); + tcase_add_test (tc, controller_param_twice); + tcase_add_test (tc, controller_finalize); + tcase_add_test (tc, controller_controlsource_refcounts); + tcase_add_test (tc, controller_controlsource_empty1); + tcase_add_test (tc, controller_controlsource_empty2); + tcase_add_test (tc, controller_interpolate_none); + tcase_add_test (tc, controller_interpolate_trigger); + tcase_add_test (tc, controller_interpolate_linear); + tcase_add_test (tc, controller_interpolate_cubic); + tcase_add_test (tc, controller_interpolate_cubic_too_few_cp); + tcase_add_test (tc, controller_interpolate_unimplemented); + tcase_add_test (tc, controller_interpolation_unset); + tcase_add_test (tc, controller_interpolation_unset_all); + tcase_add_test (tc, controller_interpolation_linear_value_array); + tcase_add_test (tc, controller_interpolation_linear_invalid_values); + tcase_add_test (tc, controller_interpolation_linear_default_values); + tcase_add_test (tc, controller_interpolate_linear_disabled); + tcase_add_test (tc, controller_interpolation_set_from_list); + tcase_add_test (tc, controller_lfo_sine); + tcase_add_test (tc, controller_lfo_sine_timeshift); + tcase_add_test (tc, controller_lfo_square); + tcase_add_test (tc, controller_lfo_saw); + tcase_add_test (tc, controller_lfo_rsaw); + tcase_add_test (tc, controller_lfo_triangle); + tcase_add_test (tc, controller_lfo_none); + tcase_add_test (tc, controller_helper_any_gobject); + tcase_add_test (tc, controller_interpolate_linear_before_ts0); + tcase_add_test (tc, controller_interpolation_cp_count); + + return s; +} + +GST_CHECK_MAIN (gst_controller); diff --git a/tests/check/libs/gdp.c b/tests/check/libs/gdp.c new file mode 100644 index 0000000..fff4ed4 --- /dev/null +++ b/tests/check/libs/gdp.c @@ -0,0 +1,105 @@ +/* GStreamer + * + * unit test for data protocol + * + * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart 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. + */ + +#include "config.h" + +#include <gst/check/gstcheck.h> + +#ifndef GST_REMOVE_DEPRECATED +#undef GST_DISABLE_DEPRECATED +#endif + +#include <gst/dataprotocol/dataprotocol.h> +#include "libs/gst/dataprotocol/dp-private.h" /* private header */ + +/* test our method of reading and writing headers using TO/FROM_BE */ +GST_START_TEST (test_conversion) +{ + guint8 array[9]; + guint8 write_array[9]; + guint16 read_two, expect_two; + guint32 read_four, expect_four; + guint64 read_eight, expect_eight; + int i; + + for (i = 0; i < 9; ++i) { + array[i] = i * 0x10; + } + + /* read 8 16 bits */ + for (i = 0; i < 8; ++i) { + read_two = GST_READ_UINT16_BE (array + i); + expect_two = array[i] * (1 << 8) + array[i + 1]; + fail_unless (read_two == expect_two, + "GST_READ_UINT16_BE %d: read %d != %d", i, read_two, expect_two); + } + + /* write 8 16 bits */ + for (i = 0; i < 8; ++i) { + GST_WRITE_UINT16_BE (&write_array[i], read_two); + fail_unless (memcmp (array + 7, write_array + i, 2) == 0, + "GST_WRITE_UINT16_BE %d: memcmp failed", i); + } + + /* read 5 32 bits */ + for (i = 0; i < 5; ++i) { + read_four = GST_READ_UINT32_BE (array + i); + expect_four = array[i] * (1 << 24) + array[i + 1] * (1 << 16) + + array[i + 2] * (1 << 8) + array[i + 3]; + fail_unless (read_four == expect_four, + "GST_READ_UINT32_BE %d: read %d != %d", i, read_four, expect_four); + } + + /* read 2 64 bits */ + for (i = 0; i < 2; ++i) { + read_eight = GST_READ_UINT64_BE (array + i); + expect_eight = array[i] * (1LL << 56) + array[i + 1] * (1LL << 48) + + array[i + 2] * (1LL << 40) + array[i + 3] * (1LL << 32) + + array[i + 4] * (1 << 24) + array[i + 5] * (1 << 16) + + array[i + 6] * (1 << 8) + array[i + 7]; + fail_unless (read_eight == expect_eight, + "GST_READ_UINT64_BE %d: read %" G_GUINT64_FORMAT + " != %" G_GUINT64_FORMAT, i, read_eight, expect_eight); + } + + /* write 1 64 bit */ + GST_WRITE_UINT64_BE (&write_array[0], read_eight); + fail_unless (memcmp (array + 1, write_array, 8) == 0, + "GST_WRITE_UINT64_BE: memcmp failed"); +} + +GST_END_TEST; + +static Suite * +gst_dp_suite (void) +{ + Suite *s = suite_create ("data protocol"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_checked_fixture (tc_chain, gst_dp_init, NULL); + tcase_add_test (tc_chain, test_conversion); + + return s; +} + +GST_CHECK_MAIN (gst_dp); diff --git a/tests/check/libs/gstlibscpp.cc b/tests/check/libs/gstlibscpp.cc new file mode 100644 index 0000000..23079e8 --- /dev/null +++ b/tests/check/libs/gstlibscpp.cc @@ -0,0 +1,75 @@ +/* GStreamer + * Copyright (C) 2011 Tim-Philipp Müller <tim centricular net> + * + * 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 <gst/check/gstcheck.h> + +#include <gst/base/gstadapter.h> +#include <gst/base/gstbasesink.h> +#include <gst/base/gstbasesrc.h> +#include <gst/base/gstbasetransform.h> +#include <gst/base/gstbitreader.h> +#include <gst/base/gstbytereader.h> +#include <gst/base/gstbytewriter.h> +#include <gst/base/gstcollectpads.h> +#include <gst/base/gstdataqueue.h> +#include <gst/base/gstpushsrc.h> +#include <gst/base/gsttypefindhelper.h> + +#include <gst/controller/gstcontroller.h> +#include <gst/controller/gstcontrollerprivate.h> +#include <gst/controller/gstcontrolsource.h> +#include <gst/controller/gstinterpolationcontrolsource.h> +#include <gst/controller/gstinterpolationcontrolsourceprivate.h> +#include <gst/controller/gstlfocontrolsource.h> +#include <gst/controller/gstlfocontrolsourceprivate.h> + +#include <gst/dataprotocol/dataprotocol.h> + +#include <gst/net/gstnetclientclock.h> +#include <gst/net/gstnet.h> +#include <gst/net/gstnettimepacket.h> +#include <gst/net/gstnettimeprovider.h> + +/* we mostly just want to make sure that our library headers don't + * contain anything a C++ compiler might not like */ +GST_START_TEST (test_nothing) +{ + gst_init (NULL, NULL); +} + +GST_END_TEST; + +static Suite * +libscpp_suite (void) +{ + Suite *s = suite_create ("GstLibsCpp"); + TCase *tc_chain = tcase_create ("C++ libs header tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_nothing); + + return s; +} + +GST_CHECK_MAIN (libscpp); diff --git a/tests/check/libs/gstnetclientclock.c b/tests/check/libs/gstnetclientclock.c new file mode 100644 index 0000000..f72109a --- /dev/null +++ b/tests/check/libs/gstnetclientclock.c @@ -0,0 +1,128 @@ +/* GStreamer + * Copyright (C) 2005 Andy Wingo <wingo@pobox.com> + * + * gstnetclientclock.c: Unit test for the network client clock + * + * 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 <gst/check/gstcheck.h> +#include <gst/net/gstnet.h> + +#include <unistd.h> + +GST_START_TEST (test_instantiation) +{ + GstClock *client, *local; + + local = gst_system_clock_obtain (); + client = gst_net_client_clock_new (NULL, "127.0.0.1", 1234, GST_SECOND); + fail_unless (local != NULL, "failed to get system clock"); + fail_unless (client != NULL, "failed to get network client clock"); + + /* one for gstreamer, one for us */ + ASSERT_OBJECT_REFCOUNT (local, "system clock", 2); + ASSERT_OBJECT_REFCOUNT (client, "network client clock", 1); + + gst_object_unref (client); + + ASSERT_OBJECT_REFCOUNT (local, "system clock", 2); + + gst_object_unref (local); +} + +GST_END_TEST; + +GST_START_TEST (test_functioning) +{ + GstNetTimeProvider *ntp; + GstClock *client, *server; + GstClockTime basex, basey, rate_num, rate_denom; + GstClockTime servtime, clienttime; + gint port; + + server = gst_system_clock_obtain (); + fail_unless (server != NULL, "failed to get system clock"); + + /* move the clock ahead 100 seconds */ + gst_clock_get_calibration (server, &basex, &basey, &rate_num, &rate_denom); + basey += 100 * GST_SECOND; + gst_clock_set_calibration (server, basex, basey, rate_num, rate_denom); + + ntp = gst_net_time_provider_new (server, "127.0.0.1", 0); + fail_unless (ntp != NULL, "failed to create network time provider"); + + g_object_get (ntp, "port", &port, NULL); + + client = gst_net_client_clock_new (NULL, "127.0.0.1", port, GST_SECOND); + fail_unless (client != NULL, "failed to get network client clock"); + + g_object_get (client, "port", &port, NULL); + + /* let the clocks synchronize */ + g_usleep (G_USEC_PER_SEC / 2); + + servtime = gst_clock_get_time (server); + clienttime = gst_clock_get_time (client); + + /* can't in general make a precise assertion here, because this depends on + * system load and a lot of things. however within half a second they should + * at least be within 1/10 of a second of each other... */ + if (servtime > clienttime) + fail_unless (servtime - clienttime < 100 * GST_MSECOND, + "clocks not in sync (%" GST_TIME_FORMAT ")", + GST_TIME_ARGS (servtime - clienttime)); + else + fail_unless (clienttime - servtime < 100 * GST_MSECOND, + "clocks not in sync (%" GST_TIME_FORMAT ")", + GST_TIME_ARGS (clienttime - servtime)); + + /* + g_print ("diff: %" GST_TIME_FORMAT, + GST_TIME_ARGS (servtime > clienttime ? servtime - clienttime + : clienttime - servtime)); + */ + + /* one for gstreamer, one for ntp, one for us */ + ASSERT_OBJECT_REFCOUNT (server, "system clock", 3); + ASSERT_OBJECT_REFCOUNT (client, "network client clock", 1); + + gst_object_unref (ntp); + + ASSERT_OBJECT_REFCOUNT (server, "system clock", 2); + + gst_object_unref (client); + gst_object_unref (server); +} + +GST_END_TEST; + +static Suite * +gst_net_client_clock_suite (void) +{ + Suite *s = suite_create ("GstNetClientClock"); + TCase *tc_chain = tcase_create ("generic tests"); + + tcase_set_timeout (tc_chain, 0); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_instantiation); + tcase_add_test (tc_chain, test_functioning); + + return s; +} + +GST_CHECK_MAIN (gst_net_client_clock); diff --git a/tests/check/libs/gstnettimeprovider.c b/tests/check/libs/gstnettimeprovider.c new file mode 100644 index 0000000..1e63270 --- /dev/null +++ b/tests/check/libs/gstnettimeprovider.c @@ -0,0 +1,129 @@ +/* GStreamer + * Copyright (C) 2005 Andy Wingo <wingo@pobox.com> + * + * gstnettimeprovider.c: Unit test for the network time provider + * + * 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 <gst/check/gstcheck.h> +#include <gst/net/gstnet.h> + +#include <unistd.h> + +GST_START_TEST (test_refcounts) +{ + GstNetTimeProvider *ntp; + GstClock *clock; + + clock = gst_system_clock_obtain (); + fail_unless (clock != NULL, "failed to get system clock"); + + /* one for gstreamer, one for us */ + ASSERT_OBJECT_REFCOUNT (clock, "system clock", 2); + + ntp = gst_net_time_provider_new (clock, NULL, 0); + fail_unless (ntp != NULL, "failed to create net time provider"); + + /* one for ntp, one for gstreamer, one for us */ + ASSERT_OBJECT_REFCOUNT (clock, "system clock", 3); + /* one for us */ + ASSERT_OBJECT_REFCOUNT (ntp, "net time provider", 1); + + gst_object_unref (ntp); + ASSERT_OBJECT_REFCOUNT (clock, "net time provider", 2); + + gst_object_unref (clock); +} + +GST_END_TEST; + +GST_START_TEST (test_functioning) +{ + GstNetTimeProvider *ntp; + GstNetTimePacket *packet; + GstClock *clock; + GstClockTime local; + struct sockaddr_in servaddr; + gint port = -1, sockfd, ret; + socklen_t len; + + clock = gst_system_clock_obtain (); + fail_unless (clock != NULL, "failed to get system clock"); + ntp = gst_net_time_provider_new (clock, "127.0.0.1", 0); + fail_unless (ntp != NULL, "failed to create net time provider"); + + g_object_get (ntp, "port", &port, NULL); + fail_unless (port > 0); + + sockfd = socket (AF_INET, SOCK_DGRAM, 0); + fail_if (sockfd < 0, "socket failed"); + + memset (&servaddr, 0, sizeof (servaddr)); + servaddr.sin_family = AF_INET; + servaddr.sin_port = htons (port); +#ifndef G_OS_WIN32 + inet_aton ("127.0.0.1", &servaddr.sin_addr); +#else + servaddr.sin_addr.s_addr = inet_addr ("127.0.0.1"); +#endif + + packet = gst_net_time_packet_new (NULL); + fail_unless (packet != NULL, "failed to create packet"); + + packet->local_time = local = gst_clock_get_time (clock); + + len = sizeof (servaddr); + ret = gst_net_time_packet_send (packet, sockfd, + (struct sockaddr *) &servaddr, len); + + fail_unless (ret == GST_NET_TIME_PACKET_SIZE, "failed to send packet"); + + g_free (packet); + + packet = gst_net_time_packet_receive (sockfd, (struct sockaddr *) &servaddr, + &len); + + fail_unless (packet != NULL, "failed to receive packet"); + fail_unless (packet->local_time == local, "local time is not the same"); + fail_unless (packet->remote_time > local, "remote time not after local time"); + fail_unless (packet->remote_time < gst_clock_get_time (clock), + "remote time in the future"); + + g_free (packet); + + close (sockfd); + + gst_object_unref (ntp); + gst_object_unref (clock); +} + +GST_END_TEST; + +static Suite * +gst_net_time_provider_suite (void) +{ + Suite *s = suite_create ("GstNetTimeProvider"); + TCase *tc_chain = tcase_create ("generic tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_refcounts); + tcase_add_test (tc_chain, test_functioning); + + return s; +} + +GST_CHECK_MAIN (gst_net_time_provider); diff --git a/tests/check/libs/struct_arm.h b/tests/check/libs/struct_arm.h new file mode 100644 index 0000000..d63c71a --- /dev/null +++ b/tests/check/libs/struct_arm.h @@ -0,0 +1,26 @@ + +GstCheckABIStruct list[] = { + {"GstAdapter", sizeof (GstAdapter), 52}, + {"GstAdapterClass", sizeof (GstAdapterClass), 84}, + {"GstBaseSink", sizeof (GstBaseSink), 408}, + {"GstBaseSinkClass", sizeof (GstBaseSinkClass), 368}, + {"GstBaseSrc", sizeof (GstBaseSrc), 392}, + {"GstBaseSrcClass", sizeof (GstBaseSrcClass), 376}, + {"GstBaseTransform", sizeof (GstBaseTransform), 368}, + {"GstBaseTransformClass", sizeof (GstBaseTransformClass), 376}, + {"GstCollectData", sizeof (GstCollectData), 120}, + {"GstCollectPads", sizeof (GstCollectPads), 92}, + {"GstCollectPadsClass", sizeof (GstCollectPadsClass), 136}, + {"GstPushSrc", sizeof (GstPushSrc), 408}, + {"GstPushSrcClass", sizeof (GstPushSrcClass), 396}, + {"GstTimedValue", sizeof (GstTimedValue), 32}, + {"GstValueArray", sizeof (GstValueArray), 24}, + {"GstController", sizeof (GstController), 40}, + {"GstControllerClass", sizeof (GstControllerClass), 84}, + {"GstNetClientClock", sizeof (GstNetClientClock), 256}, + {"GstNetClientClockClass", sizeof (GstNetClientClockClass), 192}, + {"GstNetTimePacket", sizeof (GstNetTimePacket), 16}, + {"GstNetTimeProvider", sizeof (GstNetTimeProvider), 84}, + {"GstNetTimeProviderClass", sizeof (GstNetTimeProviderClass), 120}, + {NULL, 0, 0} +}; diff --git a/tests/check/libs/struct_hppa.h b/tests/check/libs/struct_hppa.h new file mode 100644 index 0000000..163f8a7 --- /dev/null +++ b/tests/check/libs/struct_hppa.h @@ -0,0 +1,27 @@ +static GstCheckABIStruct list[] = { + {"GstAdapter", sizeof (GstAdapter), 52}, + {"GstAdapterClass", sizeof (GstAdapterClass), 84}, + {"GstBaseSink", sizeof (GstBaseSink), 408}, + {"GstBaseSinkClass", sizeof (GstBaseSinkClass), 368}, + {"GstBaseSrc", sizeof (GstBaseSrc), 392}, + {"GstBaseSrcClass", sizeof (GstBaseSrcClass), 376}, + {"GstBaseTransform", sizeof (GstBaseTransform), 368}, + {"GstBaseTransformClass", sizeof (GstBaseTransformClass), 376}, + {"GstCollectData", sizeof (GstCollectData), 120}, + {"GstCollectPads", sizeof (GstCollectPads), 92}, + {"GstCollectPadsClass", sizeof (GstCollectPadsClass), 136}, + {"GstPushSrc", sizeof (GstPushSrc), 408}, + {"GstPushSrcClass", sizeof (GstPushSrcClass), 396}, + + {"GstTimedValue", sizeof (GstTimedValue), 32}, + {"GstValueArray", sizeof (GstValueArray), 24}, + {"GstController", sizeof (GstController), 40}, + {"GstControllerClass", sizeof (GstControllerClass), 84}, + + {"GstNetClientClock", sizeof (GstNetClientClock), 256}, + {"GstNetClientClockClass", sizeof (GstNetClientClockClass), 192}, + {"GstNetTimePacket", sizeof (GstNetTimePacket), 16}, + {"GstNetTimeProvider", sizeof (GstNetTimeProvider), 84}, + {"GstNetTimeProviderClass", sizeof (GstNetTimeProviderClass), 120}, + {NULL, 0, 0} +}; diff --git a/tests/check/libs/struct_i386.h b/tests/check/libs/struct_i386.h new file mode 100644 index 0000000..7717fdc --- /dev/null +++ b/tests/check/libs/struct_i386.h @@ -0,0 +1,28 @@ +static GstCheckABIStruct list[] = { + {"GstAdapter", sizeof(GstAdapter), 52}, + {"GstAdapterClass", sizeof(GstAdapterClass), 84}, + {"GstBaseSink", sizeof(GstBaseSink), 384}, + {"GstBaseSinkClass", sizeof(GstBaseSinkClass), 368}, + {"GstBaseSrc", sizeof(GstBaseSrc), 376}, + {"GstBaseSrcClass", sizeof(GstBaseSrcClass), 376}, + {"GstBaseTransform", sizeof(GstBaseTransform), 352}, + {"GstBaseTransformClass", sizeof(GstBaseTransformClass), 376}, + {"GstCollectData", sizeof(GstCollectData), 120}, + {"GstCollectPads", sizeof(GstCollectPads), 92}, + {"GstCollectPadsClass", sizeof(GstCollectPadsClass), 136}, + {"GstPushSrc", sizeof(GstPushSrc), 392}, + {"GstPushSrcClass", sizeof(GstPushSrcClass), 396}, + + {"GstTimedValue", sizeof(GstTimedValue), 28}, + {"GstValueArray", sizeof(GstValueArray), 20}, + {"GstController", sizeof(GstController), 40}, + {"GstControllerClass", sizeof(GstControllerClass), 84}, + + {"GstNetClientClock", sizeof(GstNetClientClock), 248}, + {"GstNetClientClockClass", sizeof(GstNetClientClockClass), 192}, + {"GstNetTimePacket", sizeof(GstNetTimePacket), 16}, + {"GstNetTimeProvider", sizeof(GstNetTimeProvider), 84}, + {"GstNetTimeProviderClass", sizeof(GstNetTimeProviderClass), 120}, + + {NULL, 0, 0} +}; diff --git a/tests/check/libs/struct_ppc32.h b/tests/check/libs/struct_ppc32.h new file mode 100644 index 0000000..abf92dc --- /dev/null +++ b/tests/check/libs/struct_ppc32.h @@ -0,0 +1,25 @@ +static GstCheckABIStruct list[] = { + {"GstAdapter", sizeof (GstAdapter), 52}, + {"GstAdapterClass", sizeof (GstAdapterClass), 84}, + {"GstBaseSink", sizeof (GstBaseSink), 408}, + {"GstBaseSinkClass", sizeof (GstBaseSinkClass), 368}, + {"GstBaseSrc", sizeof (GstBaseSrc), 392}, + {"GstBaseSrcClass", sizeof (GstBaseSrcClass), 376}, + {"GstBaseTransform", sizeof (GstBaseTransform), 368}, + {"GstBaseTransformClass", sizeof (GstBaseTransformClass), 376}, + {"GstCollectData", sizeof (GstCollectData), 120}, + {"GstCollectPads", sizeof (GstCollectPads), 92}, + {"GstCollectPadsClass", sizeof (GstCollectPadsClass), 136}, + {"GstPushSrc", sizeof (GstPushSrc), 408}, + {"GstPushSrcClass", sizeof (GstPushSrcClass), 396}, + {"GstTimedValue", sizeof (GstTimedValue), 32}, + {"GstValueArray", sizeof (GstValueArray), 24}, + {"GstController", sizeof (GstController), 40}, + {"GstControllerClass", sizeof (GstControllerClass), 84}, + {"GstNetClientClock", sizeof (GstNetClientClock), 256}, + {"GstNetClientClockClass", sizeof (GstNetClientClockClass), 192}, + {"GstNetTimePacket", sizeof (GstNetTimePacket), 16}, + {"GstNetTimeProvider", sizeof (GstNetTimeProvider), 84}, + {"GstNetTimeProviderClass", sizeof (GstNetTimeProviderClass), 120}, + {NULL, 0, 0} +}; diff --git a/tests/check/libs/struct_ppc64.h b/tests/check/libs/struct_ppc64.h new file mode 100644 index 0000000..21654e8 --- /dev/null +++ b/tests/check/libs/struct_ppc64.h @@ -0,0 +1,47 @@ +static GstCheckABIStruct list[] = { + {"GstAdapter", sizeof (GstAdapter), 88} + , + {"GstAdapterClass", sizeof (GstAdapterClass), 168} + , + {"GstBaseSink", sizeof (GstBaseSink), 600} + , + {"GstBaseSinkClass", sizeof (GstBaseSinkClass), 728} + , + {"GstBaseSrc", sizeof (GstBaseSrc), 600} + , + {"GstBaseSrcClass", sizeof (GstBaseSrcClass), 744} + , + {"GstBaseTransform", sizeof (GstBaseTransform), 576} + , + {"GstBaseTransformClass", sizeof (GstBaseTransformClass), 744} + , + {"GstCollectData", sizeof (GstCollectData), 168} + , + {"GstCollectPads", sizeof (GstCollectPads), 168} + , + {"GstCollectPadsClass", sizeof (GstCollectPadsClass), 272} + , + {"GstPushSrc", sizeof (GstPushSrc), 632} + , + {"GstPushSrcClass", sizeof (GstPushSrcClass), 784} + , + {"GstTimedValue", sizeof (GstTimedValue), 32} + , + {"GstValueArray", sizeof (GstValueArray), 32} + , + {"GstController", sizeof (GstController), 80} + , + {"GstControllerClass", sizeof (GstControllerClass), 168} + , + {"GstNetClientClock", sizeof (GstNetClientClock), 368} + , + {"GstNetClientClockClass", sizeof (GstNetClientClockClass), 384} + , + {"GstNetTimePacket", sizeof (GstNetTimePacket), 16} + , + {"GstNetTimeProvider", sizeof (GstNetTimeProvider), 152} + , + {"GstNetTimeProviderClass", sizeof (GstNetTimeProviderClass), 240} + , + {NULL, 0, 0} +}; diff --git a/tests/check/libs/struct_sparc.h b/tests/check/libs/struct_sparc.h new file mode 100644 index 0000000..d63c71a --- /dev/null +++ b/tests/check/libs/struct_sparc.h @@ -0,0 +1,26 @@ + +GstCheckABIStruct list[] = { + {"GstAdapter", sizeof (GstAdapter), 52}, + {"GstAdapterClass", sizeof (GstAdapterClass), 84}, + {"GstBaseSink", sizeof (GstBaseSink), 408}, + {"GstBaseSinkClass", sizeof (GstBaseSinkClass), 368}, + {"GstBaseSrc", sizeof (GstBaseSrc), 392}, + {"GstBaseSrcClass", sizeof (GstBaseSrcClass), 376}, + {"GstBaseTransform", sizeof (GstBaseTransform), 368}, + {"GstBaseTransformClass", sizeof (GstBaseTransformClass), 376}, + {"GstCollectData", sizeof (GstCollectData), 120}, + {"GstCollectPads", sizeof (GstCollectPads), 92}, + {"GstCollectPadsClass", sizeof (GstCollectPadsClass), 136}, + {"GstPushSrc", sizeof (GstPushSrc), 408}, + {"GstPushSrcClass", sizeof (GstPushSrcClass), 396}, + {"GstTimedValue", sizeof (GstTimedValue), 32}, + {"GstValueArray", sizeof (GstValueArray), 24}, + {"GstController", sizeof (GstController), 40}, + {"GstControllerClass", sizeof (GstControllerClass), 84}, + {"GstNetClientClock", sizeof (GstNetClientClock), 256}, + {"GstNetClientClockClass", sizeof (GstNetClientClockClass), 192}, + {"GstNetTimePacket", sizeof (GstNetTimePacket), 16}, + {"GstNetTimeProvider", sizeof (GstNetTimeProvider), 84}, + {"GstNetTimeProviderClass", sizeof (GstNetTimeProviderClass), 120}, + {NULL, 0, 0} +}; diff --git a/tests/check/libs/struct_x86_64.h b/tests/check/libs/struct_x86_64.h new file mode 100644 index 0000000..2d17aa4 --- /dev/null +++ b/tests/check/libs/struct_x86_64.h @@ -0,0 +1,40 @@ + +GstCheckABIStruct list[] = { + {"GstAdapterClass", sizeof (GstAdapterClass), 168}, + {"GstAdapter", sizeof (GstAdapter), 88}, + {"GstBaseSinkClass", sizeof (GstBaseSinkClass), 728}, + {"GstBaseSink", sizeof (GstBaseSink), 600}, + {"GstBaseSrcClass", sizeof (GstBaseSrcClass), 744}, + {"GstBaseSrc", sizeof (GstBaseSrc), 600}, + {"GstBaseTransformClass", sizeof (GstBaseTransformClass), 744}, + {"GstBaseTransform", sizeof (GstBaseTransform), 576}, + {"GstBitReader", sizeof (GstBitReader), 24}, + {"GstByteReader", sizeof (GstByteReader), 16}, + {"GstByteWriter", sizeof (GstByteWriter), 32}, + {"GstCollectData", sizeof (GstCollectData), 168}, + {"GstCollectPadsClass", sizeof (GstCollectPadsClass), 272}, + {"GstCollectPads", sizeof (GstCollectPads), 168}, + {"GstControllerClass", sizeof (GstControllerClass), 168}, + {"GstController", sizeof (GstController), 80}, + {"GstControlSourceClass", sizeof (GstControlSourceClass), 176}, + {"GstControlSource", sizeof (GstControlSource), 80}, + {"GstDataQueueClass", sizeof (GstDataQueueClass), 184}, + {"GstDataQueueItem", sizeof (GstDataQueueItem), 40}, + {"GstDataQueue", sizeof (GstDataQueue), 128}, + {"GstDataQueueSize", sizeof (GstDataQueueSize), 16}, + {"GstDPPacketizer", sizeof (GstDPPacketizer), 64}, + {"GstInterpolationControlSourceClass", sizeof (GstInterpolationControlSourceClass), 208}, + {"GstInterpolationControlSource", sizeof (GstInterpolationControlSource), 128}, + {"GstLFOControlSourceClass", sizeof (GstLFOControlSourceClass), 208}, + {"GstLFOControlSource", sizeof (GstLFOControlSource), 128}, + {"GstNetClientClockClass", sizeof (GstNetClientClockClass), 384}, + {"GstNetClientClock", sizeof (GstNetClientClock), 368}, + {"GstNetTimePacket", sizeof (GstNetTimePacket), 16}, + {"GstNetTimeProviderClass", sizeof (GstNetTimeProviderClass), 240}, + {"GstNetTimeProvider", sizeof (GstNetTimeProvider), 152}, + {"GstPushSrcClass", sizeof (GstPushSrcClass), 784}, + {"GstPushSrc", sizeof (GstPushSrc), 632}, + {"GstTimedValue", sizeof (GstTimedValue), 32}, + {"GstValueArray", sizeof (GstValueArray), 32}, + {NULL, 0, 0} +}; diff --git a/tests/check/libs/test_transform.c b/tests/check/libs/test_transform.c new file mode 100644 index 0000000..22229d2 --- /dev/null +++ b/tests/check/libs/test_transform.c @@ -0,0 +1,230 @@ + +#include <gst/base/gstbasetransform.h> + +typedef struct +{ + GstPad *srcpad; + GstPad *sinkpad; + GList *events; + GList *buffers; + GstElement *trans; + GstBaseTransformClass *klass; +} TestTransData; + +static GstStaticPadTemplate gst_test_trans_src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("foo/x-bar") + ); + +static GstStaticPadTemplate gst_test_trans_sink_template = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("foo/x-bar") + ); + +typedef struct _GstTestTrans GstTestTrans; +typedef struct _GstTestTransClass GstTestTransClass; + +#define GST_TYPE_TEST_TRANS \ + (gst_test_trans_get_type()) +#define GST_TEST_TRANS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TEST_TRANS,GstTestTrans)) +#define GST_TEST_TRANS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TEST_TRANS,GstTestTransClass)) +#define GST_TEST_TRANS_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_TEST_TRANS, GstTestTransClass)) +#define GST_IS_TEST_TRANS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TEST_TRANS)) +#define GST_IS_TEST_TRANS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TEST_TRANS)) + +struct _GstTestTrans +{ + GstBaseTransform element; + + TestTransData *data; +}; + +struct _GstTestTransClass +{ + GstBaseTransformClass parent_class; +}; + +GType gst_test_trans_get_type (void); + +G_DEFINE_TYPE (GstTestTrans, gst_test_trans, GST_TYPE_BASE_TRANSFORM); + +static GstFlowReturn (*klass_transform) (GstBaseTransform * trans, + GstBuffer * inbuf, GstBuffer * outbuf) = NULL; +static GstFlowReturn (*klass_transform_ip) (GstBaseTransform * trans, + GstBuffer * buf) = NULL; +static gboolean (*klass_set_caps) (GstBaseTransform * trans, GstCaps * incaps, + GstCaps * outcaps) = NULL; +static GstCaps *(*klass_transform_caps) (GstBaseTransform * trans, + GstPadDirection direction, GstCaps * caps, GstCaps * filter) = NULL; +static gboolean (*klass_transform_size) (GstBaseTransform * trans, + GstPadDirection direction, GstCaps * caps, gsize size, GstCaps * othercaps, + gsize * othersize) = NULL; +static gboolean klass_passthrough_on_same_caps = FALSE; + +static GstStaticPadTemplate *sink_template = &gst_test_trans_sink_template; +static GstStaticPadTemplate *src_template = &gst_test_trans_src_template; + +static void +gst_test_trans_class_init (GstTestTransClass * klass) +{ + GstElementClass *element_class; + GstBaseTransformClass *trans_class; + + element_class = (GstElementClass *) klass; + trans_class = (GstBaseTransformClass *) klass; + + gst_element_class_set_details_simple (element_class, "TestTrans", + "Filter/Test", "Test transform", "Wim Taymans <wim.taymans@gmail.com>"); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (sink_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (src_template)); + + trans_class->passthrough_on_same_caps = klass_passthrough_on_same_caps; + trans_class->transform_ip = klass_transform_ip; + trans_class->transform = klass_transform; + trans_class->transform_caps = klass_transform_caps; + trans_class->transform_size = klass_transform_size; + trans_class->set_caps = klass_set_caps; +} + +static void +gst_test_trans_init (GstTestTrans * this) +{ +} + +static void +gst_test_trans_set_data (GstTestTrans * this, TestTransData * data) +{ + this->data = data; +} + +static GstFlowReturn +result_sink_chain (GstPad * pad, GstBuffer * buffer) +{ + TestTransData *data; + + data = gst_pad_get_element_private (pad); + + data->buffers = g_list_append (data->buffers, buffer); + + return GST_FLOW_OK; +} + +#if 0 +static GstFlowReturn +result_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps, + GstBuffer ** buf) +{ + GstFlowReturn res; + TestTransData *data; + + data = gst_pad_get_element_private (pad); + + *buf = gst_buffer_new_and_alloc (size); + gst_buffer_set_caps (*buf, caps); + res = GST_FLOW_OK; + + return res; +} +#endif + +static TestTransData * +gst_test_trans_new (void) +{ + TestTransData *res; + GstPad *tmp; + GstPadTemplate *templ; + + res = g_new0 (TestTransData, 1); + res->trans = g_object_new (GST_TYPE_TEST_TRANS, NULL); + + templ = gst_static_pad_template_get (sink_template); + templ->direction = GST_PAD_SRC; + res->srcpad = gst_pad_new_from_template (templ, "src"); + gst_object_unref (templ); + + templ = gst_static_pad_template_get (src_template); + templ->direction = GST_PAD_SINK; + res->sinkpad = gst_pad_new_from_template (templ, "sink"); + gst_object_unref (templ); + + res->klass = GST_BASE_TRANSFORM_GET_CLASS (res->trans); + + gst_test_trans_set_data (GST_TEST_TRANS (res->trans), res); + gst_pad_set_element_private (res->sinkpad, res); + + gst_pad_set_chain_function (res->sinkpad, result_sink_chain); + + tmp = gst_element_get_static_pad (res->trans, "sink"); + gst_pad_link (res->srcpad, tmp); + gst_object_unref (tmp); + + tmp = gst_element_get_static_pad (res->trans, "src"); + gst_pad_link (tmp, res->sinkpad); + gst_object_unref (tmp); + + gst_pad_set_active (res->sinkpad, TRUE); + gst_element_set_state (res->trans, GST_STATE_PAUSED); + gst_pad_set_active (res->srcpad, TRUE); + + return res; +} + +static void +gst_test_trans_free (TestTransData * data) +{ + GstPad *tmp; + + gst_pad_set_active (data->sinkpad, FALSE); + gst_element_set_state (data->trans, GST_STATE_NULL); + gst_pad_set_active (data->srcpad, FALSE); + + tmp = gst_element_get_static_pad (data->trans, "src"); + gst_pad_unlink (tmp, data->sinkpad); + gst_object_unref (tmp); + + tmp = gst_element_get_static_pad (data->trans, "sink"); + gst_pad_link (data->srcpad, tmp); + gst_object_unref (tmp); + + gst_object_unref (data->srcpad); + gst_object_unref (data->sinkpad); + gst_object_unref (data->trans); + + g_free (data); +} + +static GstFlowReturn +gst_test_trans_push (TestTransData * data, GstBuffer * buffer) +{ + GstFlowReturn ret; + + ret = gst_pad_push (data->srcpad, buffer); + + return ret; +} + +static GstBuffer * +gst_test_trans_pop (TestTransData * data) +{ + GstBuffer *ret; + + if (data->buffers) { + ret = data->buffers->data; + data->buffers = g_list_delete_link (data->buffers, data->buffers); + } else { + ret = NULL; + } + return ret; +} diff --git a/tests/check/libs/transform1.c b/tests/check/libs/transform1.c new file mode 100644 index 0000000..26aa52e --- /dev/null +++ b/tests/check/libs/transform1.c @@ -0,0 +1,1393 @@ +/* GStreamer + * + * some unit tests for GstBaseTransform + * + * Copyright (C) 2008 Wim Taymans <wim.taymans@gmail.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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <gst/gst.h> +#include <gst/check/gstcheck.h> +#include <gst/base/gstbasetransform.h> + +#include "test_transform.c" + +static gboolean buffer_alloc_pt1_called; + +#if 0 +static GstFlowReturn +buffer_alloc_pt1 (GstPad * pad, guint64 offset, guint size, GstCaps * caps, + GstBuffer ** buf) +{ + GST_DEBUG_OBJECT (pad, "buffer_alloc called %" G_GUINT64_FORMAT ", %u, %" + GST_PTR_FORMAT, offset, size, caps); + + buffer_alloc_pt1_called = TRUE; + + *buf = gst_buffer_new_and_alloc (size); + gst_buffer_set_caps (*buf, caps); + + return GST_FLOW_OK; +} +#endif + +static gboolean set_caps_pt1_called; + +static gboolean +set_caps_pt1 (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps) +{ + GST_DEBUG_OBJECT (trans, "set_caps called"); + + set_caps_pt1_called = TRUE; + + return TRUE; +} + +/* basic passthrough, we don't have any transform functions so we can only + * perform passthrough. We also don't have caps, which is fine */ +GST_START_TEST (basetransform_chain_pt1) +{ + TestTransData *trans; + GstBuffer *buffer; + GstFlowReturn res; + //GstCaps *caps; + + klass_set_caps = set_caps_pt1; + trans = gst_test_trans_new (); + + GST_DEBUG_OBJECT (trans, "buffer without caps, size 20"); + + buffer = gst_buffer_new_and_alloc (20); + + buffer_alloc_pt1_called = FALSE; + set_caps_pt1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_OK); + /* FIXME, passthough without pad-alloc, do pad-alloc on the srcpad */ + //fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (set_caps_pt1_called == FALSE); + + buffer = gst_test_trans_pop (trans); + fail_unless (buffer != NULL); + fail_unless (gst_buffer_get_size (buffer) == 20); +#if 0 + /* caps should not have been set */ + fail_unless (GST_BUFFER_CAPS (buffer) == NULL); +#endif + + gst_buffer_unref (buffer); + + GST_DEBUG_OBJECT (trans, "buffer without caps, size 10"); + + buffer = gst_buffer_new_and_alloc (10); + buffer_alloc_pt1_called = FALSE; + set_caps_pt1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_OK); + /* FIXME, passthough without pad-alloc, do pad-alloc on the srcpad */ + //fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (set_caps_pt1_called == FALSE); + + buffer = gst_test_trans_pop (trans); + fail_unless (buffer != NULL); + fail_unless (gst_buffer_get_size (buffer) == 10); +#if 0 + /* caps should not have been set */ + fail_unless (GST_BUFFER_CAPS (buffer) == NULL); +#endif + + gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 10"); + + caps = gst_caps_new_simple ("foo/x-bar", NULL); + buffer_alloc_pt1_called = FALSE; + set_caps_pt1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, caps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (set_caps_pt1_called == FALSE); + gst_buffer_unref (buffer); + + /* once more */ + buffer_alloc_pt1_called = FALSE; + set_caps_pt1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, caps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (set_caps_pt1_called == FALSE); + gst_buffer_unref (buffer); + + gst_caps_unref (caps); +#endif + + gst_test_trans_free (trans); +} + +GST_END_TEST; + +static gboolean set_caps_pt2_called; + +static gboolean +set_caps_pt2 (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps) +{ + GST_DEBUG_OBJECT (trans, "set_caps called"); + + set_caps_pt2_called = TRUE; + + fail_unless (gst_caps_is_equal (incaps, outcaps)); + + return TRUE; +} + +/* basic passthrough, we don't have any transform functions so we can only + * perform passthrough with same caps */ +GST_START_TEST (basetransform_chain_pt2) +{ + TestTransData *trans; + GstBuffer *buffer; + GstCaps *caps; + GstFlowReturn res; + + klass_set_caps = set_caps_pt2; + trans = gst_test_trans_new (); + + /* first buffer */ + caps = gst_caps_new_simple ("foo/x-bar", NULL); + + GST_DEBUG_OBJECT (trans, "buffer with caps, size 20"); + + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, caps); +#endif + + buffer_alloc_pt1_called = FALSE; + set_caps_pt2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_OK); + /* FIXME, passthough without pad-alloc, do pad-alloc on the srcpad */ + //fail_unless (buffer_alloc_pt1_called == TRUE); + //fail_unless (set_caps_pt2_called == TRUE); + + buffer = gst_test_trans_pop (trans); + fail_unless (buffer != NULL); + fail_unless (gst_buffer_get_size (buffer) == 20); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps)); +#endif + + gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 20"); + + buffer_alloc_pt1_called = FALSE; + set_caps_pt2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, caps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (set_caps_pt2_called == FALSE); + gst_buffer_unref (buffer); +#endif + + gst_caps_unref (caps); + + /* second buffer, renegotiates, keeps extra type arg in caps */ + caps = gst_caps_new_simple ("foo/x-bar", "type", G_TYPE_INT, 1, NULL); + + GST_DEBUG_OBJECT (trans, "buffer with caps, size 10"); + + buffer = gst_buffer_new_and_alloc (10); +#if 0 + gst_buffer_set_caps (buffer, caps); +#endif + + buffer_alloc_pt1_called = FALSE; + set_caps_pt2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_OK); + /* FIXME, passthough without pad-alloc, do pad-alloc on the srcpad */ + //fail_unless (buffer_alloc_pt1_called == TRUE); + //fail_unless (set_caps_pt2_called == TRUE); + + buffer = gst_test_trans_pop (trans); + fail_unless (buffer != NULL); + fail_unless (gst_buffer_get_size (buffer) == 10); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps)); +#endif + + gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 20"); + + buffer_alloc_pt1_called = FALSE; + set_caps_pt2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, caps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (set_caps_pt2_called == FALSE); + gst_buffer_unref (buffer); +#endif + + gst_caps_unref (caps); + + /* with caps that is a superset */ + caps = gst_caps_new_simple ("foo/x-bar", NULL); + +#if 0 + GST_DEBUG_OBJECT (trans, "alloc with superset caps, size 20"); + + buffer_alloc_pt1_called = FALSE; + set_caps_pt2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, caps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (set_caps_pt2_called == FALSE); + gst_buffer_unref (buffer); +#endif + + gst_caps_unref (caps); + + gst_test_trans_free (trans); +} + +GST_END_TEST; + +static gboolean transform_ip_1_called; +static gboolean transform_ip_1_writable; + +static GstFlowReturn +transform_ip_1 (GstBaseTransform * trans, GstBuffer * buf) +{ + GST_DEBUG_OBJECT (trans, "transform called"); + + transform_ip_1_called = TRUE; + transform_ip_1_writable = gst_buffer_is_writable (buf); + + GST_DEBUG_OBJECT (trans, "writable: %d", transform_ip_1_writable); + + return GST_FLOW_OK; +} + +/* basic in-place, check if the _ip function is called, buffer should + * be writable. no setcaps is set */ +GST_START_TEST (basetransform_chain_ip1) +{ + TestTransData *trans; + GstBuffer *buffer; + GstFlowReturn res; + + klass_transform_ip = transform_ip_1; + trans = gst_test_trans_new (); + + GST_DEBUG_OBJECT (trans, "buffer without caps, size 20"); + + buffer = gst_buffer_new_and_alloc (20); + + transform_ip_1_called = FALSE; + transform_ip_1_writable = TRUE; + buffer_alloc_pt1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (transform_ip_1_called == TRUE); + fail_unless (transform_ip_1_writable == TRUE); + /* FIXME, in-place without pad-alloc, do pad-alloc on the srcpad */ + //fail_unless (buffer_alloc_pt1_called == TRUE); + + buffer = gst_test_trans_pop (trans); + fail_unless (buffer != NULL); + fail_unless (gst_buffer_get_size (buffer) == 20); + gst_buffer_unref (buffer); + + GST_DEBUG_OBJECT (trans, "buffer without caps extra ref, size 20"); + + buffer = gst_buffer_new_and_alloc (20); + /* take additional ref to make it non-writable */ + gst_buffer_ref (buffer); + + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 2); + + transform_ip_1_called = FALSE; + transform_ip_1_writable = FALSE; + buffer_alloc_pt1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (transform_ip_1_called == TRUE); + /* copy should have been taken with pad-alloc */ + fail_unless (transform_ip_1_writable == TRUE); + //fail_unless (buffer_alloc_pt1_called == TRUE); + /* after push, get rid of the final ref we had */ + gst_buffer_unref (buffer); + + buffer = gst_test_trans_pop (trans); + fail_unless (buffer != NULL); + fail_unless (gst_buffer_get_size (buffer) == 20); + + /* output buffer has refcount 1 */ + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1); + gst_buffer_unref (buffer); + + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc without caps, size 20"); + +#if 0 + buffer_alloc_pt1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, NULL, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + gst_buffer_unref (buffer); +#endif + + gst_test_trans_free (trans); +} + +GST_END_TEST; + +static gboolean set_caps_1_called; + +static gboolean +set_caps_1 (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps) +{ + GstCaps *caps; + + GST_DEBUG_OBJECT (trans, "set_caps called"); + + set_caps_1_called = TRUE; + + caps = gst_caps_new_simple ("foo/x-bar", NULL); + + fail_unless (gst_caps_is_equal (incaps, caps)); + fail_unless (gst_caps_is_equal (outcaps, caps)); + + gst_caps_unref (caps); + + return TRUE; +} + +/* basic in-place, check if the _ip function is called, buffer should be + * writable. we also set a setcaps function and see if it's called. */ +GST_START_TEST (basetransform_chain_ip2) +{ + TestTransData *trans; + GstBuffer *buffer; + GstFlowReturn res; + GstCaps *caps; + + klass_transform_ip = transform_ip_1; + klass_set_caps = set_caps_1; + + trans = gst_test_trans_new (); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc without caps, size 20"); + + buffer_alloc_pt1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, NULL, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (gst_buffer_get_size (buffer) == 20); + fail_unless (GST_BUFFER_CAPS (buffer) == NULL); + gst_buffer_unref (buffer); +#endif + + caps = gst_caps_new_simple ("foo/x-bar", NULL); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 20"); + + buffer_alloc_pt1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, caps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + fail_unless (gst_buffer_get_size (buffer) == 20); + fail_unless (GST_BUFFER_CAPS (buffer) == caps); + gst_buffer_unref (buffer); +#endif + + /* first try to push a buffer without caps, this should fail */ + buffer = gst_buffer_new_and_alloc (20); + + GST_DEBUG_OBJECT (trans, "buffer without caps, size 20"); + + transform_ip_1_called = FALSE; + transform_ip_1_writable = FALSE; + buffer_alloc_pt1_called = FALSE; + set_caps_1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_NOT_NEGOTIATED); + fail_unless (transform_ip_1_called == FALSE); + fail_unless (transform_ip_1_writable == FALSE); + fail_unless (set_caps_1_called == FALSE); + fail_unless (buffer_alloc_pt1_called == FALSE); + + /* try to push a buffer with caps */ + GST_DEBUG_OBJECT (trans, "buffer with caps, size 20"); + + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, caps); +#endif + + transform_ip_1_called = FALSE; + transform_ip_1_writable = FALSE; + set_caps_1_called = FALSE; + buffer_alloc_pt1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ip_1_called == TRUE); + //fail_unless (transform_ip_1_writable == TRUE); + //fail_unless (set_caps_1_called == TRUE); + /* FIXME, in-place without pad-alloc, do pad-alloc on the srcpad */ + //fail_unless (buffer_alloc_pt1_called == TRUE); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 20); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps)); +#endif + //gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 20"); + + buffer_alloc_pt1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, caps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + gst_buffer_unref (buffer); +#endif + + GST_DEBUG_OBJECT (trans, "buffer with caps extra ref, size 20"); + + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, caps); +#endif + /* take additional ref to make it non-writable */ + gst_buffer_ref (buffer); + + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 2); + + transform_ip_1_called = FALSE; + transform_ip_1_writable = FALSE; + buffer_alloc_pt1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ip_1_called == TRUE); + //fail_unless (transform_ip_1_writable == TRUE); + //fail_unless (buffer_alloc_pt1_called == TRUE); + /* after push, get rid of the final ref we had */ + gst_buffer_unref (buffer); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 20); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps)); +#endif + + /* output buffer has refcount 1 */ + //fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1); + //gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 20"); + + buffer_alloc_pt1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, caps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_pt1_called == TRUE); + gst_buffer_unref (buffer); +#endif + + gst_caps_unref (caps); + + gst_test_trans_free (trans); +} + +GST_END_TEST; + +static GstStaticPadTemplate sink_template_ct1 = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("baz/x-foo") + ); + +static gboolean set_caps_ct1_called; + +static gboolean +set_caps_ct1 (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps) +{ + GstCaps *caps1, *caps2; + + GST_DEBUG_OBJECT (trans, "set_caps called"); + + caps1 = gst_caps_new_simple ("baz/x-foo", NULL); + caps2 = gst_caps_new_simple ("foo/x-bar", NULL); + + fail_unless (gst_caps_is_equal (incaps, caps1)); + fail_unless (gst_caps_is_equal (outcaps, caps2)); + + set_caps_ct1_called = TRUE; + + gst_caps_unref (caps1); + gst_caps_unref (caps2); + + return TRUE; +} + +static gboolean transform_ct1_called; +static gboolean transform_ct1_writable; + +static GstFlowReturn +transform_ct1 (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out) +{ + transform_ct1_called = TRUE; + transform_ct1_writable = gst_buffer_is_writable (out); + + GST_DEBUG_OBJECT (trans, "writable: %d", transform_ct1_writable); + + return GST_FLOW_OK; +} + +static GstCaps * +transform_caps_ct1 (GstBaseTransform * trans, GstPadDirection dir, + GstCaps * caps, GstCaps * filter) +{ + GstCaps *res; + + if (dir == GST_PAD_SINK) { + res = gst_caps_new_simple ("foo/x-bar", NULL); + } else { + res = gst_caps_new_simple ("baz/x-foo", NULL); + } + + if (filter) { + GstCaps *temp = + gst_caps_intersect_full (filter, res, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (res); + res = temp; + } + + return res; +} + +static gboolean +transform_size_ct1 (GstBaseTransform * trans, GstPadDirection direction, + GstCaps * caps, gsize size, GstCaps * othercaps, gsize * othersize) +{ + if (direction == GST_PAD_SINK) { + *othersize = size * 2; + } else { + *othersize = size / 2; + } + + return TRUE; +} + +gboolean buffer_alloc_ct1_called; + +#if 0 +static GstFlowReturn +buffer_alloc_ct1 (GstPad * pad, guint64 offset, guint size, GstCaps * caps, + GstBuffer ** buf) +{ + GstCaps *outcaps; + + GST_DEBUG_OBJECT (pad, "buffer_alloc called %" G_GUINT64_FORMAT ", %u, %" + GST_PTR_FORMAT, offset, size, caps); + + buffer_alloc_ct1_called = TRUE; + + outcaps = gst_caps_new_simple ("foo/x-bar", NULL); + fail_unless (gst_caps_is_equal (outcaps, caps)); + gst_caps_unref (outcaps); + + *buf = gst_buffer_new_and_alloc (size); + gst_buffer_set_caps (*buf, caps); + + return GST_FLOW_OK; +} +#endif + +/* basic copy-transform, check if the transform function is called, + * buffer should be writable. we also set a setcaps function and + * see if it's called. */ +GST_START_TEST (basetransform_chain_ct1) +{ + TestTransData *trans; + GstBuffer *buffer; + GstFlowReturn res; + GstCaps *incaps, *outcaps; + + sink_template = &sink_template_ct1; + klass_transform = transform_ct1; + klass_set_caps = set_caps_ct1; + klass_transform_caps = transform_caps_ct1; + klass_transform_size = transform_size_ct1; + + trans = gst_test_trans_new (); + + incaps = gst_caps_new_simple ("baz/x-foo", NULL); + outcaps = gst_caps_new_simple ("foo/x-bar", NULL); + +#if 0 + /* without caps buffer, I think this should fail */ + GST_DEBUG_OBJECT (trans, "alloc without caps, size 20"); + + buffer_alloc_ct1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, NULL, &buffer); + fail_unless (res == GST_FLOW_NOT_NEGOTIATED); + /* should not call pad-alloc because the caps and sizes are different */ + fail_unless (buffer_alloc_ct1_called == FALSE); +#endif + +#if 0 + /* with wrong (unsupported) caps */ + GST_DEBUG_OBJECT (trans, "alloc with wrong caps, size 20"); + + buffer_alloc_ct1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, outcaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_if (buffer == NULL); + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); + gst_buffer_unref (buffer); + /* FIXME, why would this call the alloc function? we try to alloc something + * with caps that are not supported on the sinkpad */ + fail_unless (buffer_alloc_ct1_called == FALSE); + + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 20"); + + buffer_alloc_ct1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, incaps, &buffer); + fail_unless (res == GST_FLOW_OK); + /* should not call pad-alloc because the caps and sizes are different */ + fail_unless (buffer_alloc_ct1_called == FALSE); + gst_buffer_unref (buffer); +#endif + + /* first try to push a buffer without caps, this should fail */ + buffer = gst_buffer_new_and_alloc (20); + + GST_DEBUG_OBJECT (trans, "buffer without caps"); + + transform_ct1_called = FALSE; + transform_ct1_writable = FALSE; + set_caps_ct1_called = FALSE; + buffer_alloc_ct1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_NOT_NEGOTIATED); + fail_unless (transform_ct1_called == FALSE); + fail_unless (transform_ct1_writable == FALSE); + fail_unless (set_caps_ct1_called == FALSE); + fail_unless (buffer_alloc_ct1_called == FALSE); + + /* try to push a buffer with caps */ + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, incaps); +#endif + + GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps); + + transform_ct1_called = FALSE; + transform_ct1_writable = FALSE; + set_caps_ct1_called = FALSE; + buffer_alloc_ct1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ct1_called == TRUE); + //fail_unless (transform_ct1_writable == TRUE); + //fail_unless (set_caps_ct1_called == TRUE); + //fail_unless (buffer_alloc_ct1_called == TRUE); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 40); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps)); +#endif + //gst_buffer_unref (buffer); + + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, incaps); +#endif + /* take additional ref to make it non-writable */ + gst_buffer_ref (buffer); + + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 2); + + GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps); + + transform_ct1_called = FALSE; + transform_ct1_writable = FALSE; + buffer_alloc_ct1_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ct1_called == TRUE); + //fail_unless (transform_ct1_writable == TRUE); + //fail_unless (buffer_alloc_ct1_called == TRUE); + /* after push, get rid of the final ref we had */ + gst_buffer_unref (buffer); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 40); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps)); +#endif + + /* output buffer has refcount 1 */ + //fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1); + //gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 10"); + + buffer_alloc_ct1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, incaps, &buffer); + fail_unless (res == GST_FLOW_OK); + /* should not call pad-alloc because the caps and sizes are different, it + * currently still calls the pad alloc for no reason and then throws away the + * buffer. */ + fail_unless (buffer_alloc_ct1_called == FALSE); + fail_unless (gst_buffer_get_size (buffer) == 10); + gst_buffer_unref (buffer); + + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with wrong caps, size 10"); + + buffer_alloc_ct1_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, outcaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_if (buffer == NULL); + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); + gst_buffer_unref (buffer); + /* should not call the pad-alloc function */ + fail_unless (buffer_alloc_ct1_called == FALSE); +#endif + + gst_caps_unref (incaps); + gst_caps_unref (outcaps); + + gst_test_trans_free (trans); +} + +GST_END_TEST; + +static GstStaticPadTemplate src_template_ct2 = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("baz/x-foo; foo/x-bar") + ); + +static gint set_caps_ct2_case; +static gboolean set_caps_ct2_called; + +static gboolean +set_caps_ct2 (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps) +{ + GstCaps *caps1, *caps2; + + GST_DEBUG_OBJECT (trans, "set_caps called"); + + caps1 = gst_caps_new_simple ("foo/x-bar", NULL); + + if (set_caps_ct2_case == 1) + caps2 = gst_caps_copy (caps1); + else + caps2 = gst_caps_new_simple ("baz/x-foo", NULL); + + fail_unless (gst_caps_is_equal (incaps, caps1)); + fail_unless (gst_caps_is_equal (outcaps, caps2)); + + set_caps_ct2_called = TRUE; + + gst_caps_unref (caps1); + gst_caps_unref (caps2); + + return TRUE; +} + +static gboolean transform_ct2_called; +static gboolean transform_ct2_writable; + +static GstFlowReturn +transform_ct2 (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out) +{ + transform_ct2_called = TRUE; + transform_ct2_writable = gst_buffer_is_writable (out); + + GST_DEBUG_OBJECT (trans, "writable: %d", transform_ct2_writable); + + return GST_FLOW_OK; +} + +static GstCaps * +transform_caps_ct2 (GstBaseTransform * trans, GstPadDirection dir, + GstCaps * caps, GstCaps * filter) +{ + GstCaps *res; + + if (dir == GST_PAD_SINK) { + /* everything on the sinkpad can be transformed to the output formats */ + res = gst_caps_from_string ("foo/x-bar;baz/x-foo"); + } else { + /* all on the srcpad can be transformed to the format of the sinkpad */ + res = gst_caps_new_simple ("foo/x-bar", NULL); + } + + if (filter) { + GstCaps *temp = + gst_caps_intersect_full (filter, res, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (res); + res = temp; + } + + return res; +} + +static gboolean +transform_size_ct2 (GstBaseTransform * trans, GstPadDirection direction, + GstCaps * caps, gsize size, GstCaps * othercaps, gsize * othersize) +{ + if (gst_caps_is_equal (caps, othercaps)) { + *othersize = size; + } else { + if (direction == GST_PAD_SINK) { + *othersize = size * 2; + } else { + *othersize = size / 2; + } + } + + return TRUE; +} + +static gint buffer_alloc_ct2_case; +static gboolean buffer_alloc_ct2_called; +static gboolean buffer_alloc_ct2_suggest; + +#if 0 +static GstFlowReturn +buffer_alloc_ct2 (GstPad * pad, guint64 offset, guint size, GstCaps * caps, + GstBuffer ** buf) +{ + GstCaps *incaps, *outcaps; + + GST_DEBUG_OBJECT (pad, "buffer_alloc called %" G_GUINT64_FORMAT ", %u, %" + GST_PTR_FORMAT, offset, size, caps); + + buffer_alloc_ct2_called = TRUE; + + if (buffer_alloc_ct2_case == 1) { + incaps = gst_caps_new_simple ("foo/x-bar", NULL); + if (buffer_alloc_ct2_suggest) { + outcaps = gst_caps_new_simple ("baz/x-foo", NULL); + size *= 2; + } else + outcaps = gst_caps_ref (incaps); + } else { + incaps = gst_caps_new_simple ("baz/x-foo", NULL); + if (buffer_alloc_ct2_suggest) { + outcaps = gst_caps_new_simple ("foo/x-bar", NULL); + size /= 2; + } else + outcaps = gst_caps_ref (incaps); + } + GST_DEBUG_OBJECT (pad, "expect %" GST_PTR_FORMAT, incaps); + + fail_unless (gst_caps_is_equal (caps, incaps)); + + *buf = gst_buffer_new_and_alloc (size); + gst_buffer_set_caps (*buf, outcaps); + + GST_DEBUG_OBJECT (pad, "return buffer of size %u, caps %" GST_PTR_FORMAT, + size, outcaps); + + gst_caps_unref (outcaps); + gst_caps_unref (incaps); + + return GST_FLOW_OK; +} +#endif + +/* basic copy-transform, check if the transform function is called, + * buffer should be writable. we also set a setcaps function and + * see if it's called. */ +GST_START_TEST (basetransform_chain_ct2) +{ + TestTransData *trans; + GstBuffer *buffer; + GstFlowReturn res; + GstCaps *incaps, *outcaps; + + src_template = &src_template_ct2; + klass_transform = transform_ct2; + klass_set_caps = set_caps_ct2; + klass_transform_caps = transform_caps_ct2; + klass_transform_size = transform_size_ct2; + + trans = gst_test_trans_new (); + + incaps = gst_caps_new_simple ("foo/x-bar", NULL); + outcaps = gst_caps_new_simple ("baz/x-foo", NULL); + +#if 0 + /* without caps buffer, I think this should fail */ + GST_DEBUG_OBJECT (trans, "alloc without caps, size 20"); + + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, NULL, &buffer); + fail_unless (res == GST_FLOW_NOT_NEGOTIATED); + /* should not call pad-alloc because the caps and sizes are different */ + fail_unless (buffer_alloc_ct2_called == FALSE); +#endif + +#if 0 + /* with passthrough caps */ + GST_DEBUG_OBJECT (trans, "alloc size 20, with passthrough caps %" + GST_PTR_FORMAT, incaps); + + buffer_alloc_ct2_case = 1; + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, incaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_ct2_called == TRUE); + gst_buffer_unref (buffer); + + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc size 20, with wrong caps %" GST_PTR_FORMAT, + outcaps); + + buffer_alloc_ct2_case = 2; + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, outcaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_if (buffer == NULL); + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); + gst_buffer_unref (buffer); + /* should not call pad-alloc because the caps and sizes are different */ + fail_unless (buffer_alloc_ct2_called == FALSE); +#endif + + /* first try to push a buffer without caps, this should fail */ + buffer = gst_buffer_new_and_alloc (20); + + GST_DEBUG_OBJECT (trans, "buffer without caps"); + + transform_ct2_called = FALSE; + transform_ct2_writable = FALSE; + set_caps_ct2_called = FALSE; + buffer_alloc_ct2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_NOT_NEGOTIATED); + fail_unless (transform_ct2_called == FALSE); + fail_unless (transform_ct2_writable == FALSE); + fail_unless (set_caps_ct2_called == FALSE); + fail_unless (buffer_alloc_ct2_called == FALSE); + + /* try to push a buffer with caps */ + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, incaps); +#endif + + GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps); + + buffer_alloc_ct2_case = 1; + set_caps_ct2_case = 1; + transform_ct2_called = FALSE; + transform_ct2_writable = FALSE; + set_caps_ct2_called = FALSE; + buffer_alloc_ct2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ct2_called == TRUE); + //fail_unless (transform_ct2_writable == TRUE); + //fail_unless (set_caps_ct2_called == TRUE); + //fail_unless (buffer_alloc_ct2_called == TRUE); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 20); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); +#endif + //gst_buffer_unref (buffer); + + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, incaps); +#endif + /* take additional ref to make it non-writable */ + gst_buffer_ref (buffer); + + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 2); + + GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps); + + transform_ct2_called = FALSE; + transform_ct2_writable = FALSE; + buffer_alloc_ct2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ct2_called == TRUE); + //fail_unless (transform_ct2_writable == TRUE); + //fail_unless (buffer_alloc_ct2_called == TRUE); + /* after push, get rid of the final ref we had */ + gst_buffer_unref (buffer); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 20); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); +#endif + + /* output buffer has refcount 1 */ + //fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1); + //gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 10"); + + buffer_alloc_ct2_case = 1; + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, incaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_ct2_called == TRUE); + fail_unless (gst_buffer_get_size (buffer) == 10); + gst_buffer_unref (buffer); + + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with wrong caps, size 10"); + + buffer_alloc_ct2_case = 2; + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, outcaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_if (buffer == NULL); + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); + gst_buffer_unref (buffer); + /* should not call the pad-alloc function */ + fail_unless (buffer_alloc_ct2_called == FALSE); +#endif + + gst_caps_unref (incaps); + gst_caps_unref (outcaps); + + gst_test_trans_free (trans); +} + +GST_END_TEST; + +/* basic copy-transform, we work in passthrough here. */ +GST_START_TEST (basetransform_chain_ct3) +{ + TestTransData *trans; + GstBuffer *buffer; + GstFlowReturn res; + GstCaps *incaps, *outcaps; + + src_template = &src_template_ct2; + klass_passthrough_on_same_caps = TRUE; + klass_transform = transform_ct2; + klass_set_caps = set_caps_ct2; + klass_transform_caps = transform_caps_ct2; + klass_transform_size = transform_size_ct2; + + trans = gst_test_trans_new (); + + incaps = gst_caps_new_simple ("foo/x-bar", NULL); + outcaps = gst_caps_new_simple ("baz/x-foo", NULL); + +#if 0 + /* without caps buffer, I think this should fail */ + GST_DEBUG_OBJECT (trans, "alloc without caps, size 20"); + + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, NULL, &buffer); + fail_unless (res == GST_FLOW_NOT_NEGOTIATED); + /* should not call pad-alloc because the caps and sizes are different */ + fail_unless (buffer_alloc_ct2_called == FALSE); +#endif + + /* with passthrough caps */ + GST_DEBUG_OBJECT (trans, "alloc size 20, with passthrough caps %" + GST_PTR_FORMAT, incaps); + +#if 0 + buffer_alloc_ct2_case = 1; + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, incaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_ct2_called == TRUE); + gst_buffer_unref (buffer); + + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc size 20, with wrong caps %" GST_PTR_FORMAT, + outcaps); + + buffer_alloc_ct2_case = 2; + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, outcaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_if (buffer == NULL); + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); + gst_buffer_unref (buffer); + /* should not call pad-alloc because the caps and sizes are different */ + fail_unless (buffer_alloc_ct2_called == FALSE); +#endif + + /* first try to push a buffer without caps, this should fail */ + buffer = gst_buffer_new_and_alloc (20); + + GST_DEBUG_OBJECT (trans, "buffer without caps"); + + transform_ct2_called = FALSE; + transform_ct2_writable = FALSE; + set_caps_ct2_called = FALSE; + buffer_alloc_ct2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + fail_unless (res == GST_FLOW_NOT_NEGOTIATED); + fail_unless (transform_ct2_called == FALSE); + fail_unless (transform_ct2_writable == FALSE); + fail_unless (set_caps_ct2_called == FALSE); + fail_unless (buffer_alloc_ct2_called == FALSE); + + /* try to push a buffer with caps */ + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, incaps); +#endif + + GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps); + + buffer_alloc_ct2_case = 1; + set_caps_ct2_case = 1; + transform_ct2_called = FALSE; + set_caps_ct2_called = FALSE; + buffer_alloc_ct2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ct2_called == FALSE); + //fail_unless (set_caps_ct2_called == TRUE); + //fail_unless (buffer_alloc_ct2_called == TRUE); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 20); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); +#endif + //gst_buffer_unref (buffer); + + buffer = gst_buffer_new_and_alloc (20); +#if 0 + gst_buffer_set_caps (buffer, incaps); +#endif + /* take additional ref to make it non-writable */ + gst_buffer_ref (buffer); + + fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 2); + + GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps); + + transform_ct2_called = FALSE; + buffer_alloc_ct2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ct2_called == FALSE); + //fail_unless (buffer_alloc_ct2_called == TRUE); + /* after push, get rid of the final ref we had */ + gst_buffer_unref (buffer); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 20); +#if 0 + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); +#endif + + /* output buffer has refcount 1 */ + //fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1); + //gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 10"); + + buffer_alloc_ct2_case = 1; + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, incaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_ct2_called == TRUE); + fail_unless (gst_buffer_get_size (buffer) == 10); + gst_buffer_unref (buffer); + + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with wrong caps, size 10"); + + buffer_alloc_ct2_case = 2; + buffer_alloc_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, outcaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_if (buffer == NULL); + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); + /* if we don't push here, basetransform will think it doesn't need do a + * pad alloc for downstream caps suggestions */ + res = gst_test_trans_push (trans, buffer); + buffer = gst_test_trans_pop (trans); + gst_buffer_unref (buffer); + /* FIXME should not call the pad-alloc function but it currently does */ + fail_unless (buffer_alloc_ct2_called == FALSE); +#endif + + /* change the return value of the buffer-alloc function */ + GST_DEBUG_OBJECT (trans, "switching transform output"); + buffer_alloc_ct2_suggest = TRUE; + + GST_DEBUG_OBJECT (trans, + "buffer with in passthrough with caps %" GST_PTR_FORMAT, incaps); + buffer = gst_buffer_new_and_alloc (10); +#if 0 + gst_buffer_set_caps (buffer, incaps); +#endif + + /* don't suggest anything else */ + buffer_alloc_ct2_case = 1; + set_caps_ct2_case = 2; + transform_ct2_called = FALSE; + buffer_alloc_ct2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ct2_called == TRUE); + /* FIXME, pad alloc must be called to get the new caps, because we don't call + * pad alloc */ + //fail_unless (buffer_alloc_ct2_called == TRUE); + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + /* FIXME changing src caps should produce converted buffer */ +#if 0 + GST_DEBUG_OBJECT (trans, "received caps %" GST_PTR_FORMAT, + GST_BUFFER_CAPS (buffer)); +#endif + //fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps)); + //fail_unless (gst_buffer_get_size (buffer) == 20); + + /* output buffer has refcount 1 */ + //fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1); + //gst_buffer_unref (buffer); + +#if 0 + /* with caps buffer */ + GST_DEBUG_OBJECT (trans, "alloc with caps, size 10"); + + set_caps_ct2_case = 0; + buffer_alloc_ct2_case = 1; + buffer_alloc_ct2_called = FALSE; + set_caps_ct2_called = FALSE; + res = gst_pad_alloc_buffer (trans->srcpad, 0, 10, incaps, &buffer); + fail_unless (res == GST_FLOW_OK); + fail_unless (buffer_alloc_ct2_called == TRUE); + /* FIXME a buffer alloc should never set caps */ + fail_unless (set_caps_ct2_called == FALSE); + fail_unless (gst_buffer_get_size (buffer) == 10); + /* FIXME, ideally we want to reuse these caps */ + fail_unless (GST_BUFFER_CAPS (buffer) == incaps); + fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps)); + gst_buffer_unref (buffer); +#endif + + GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps); + buffer = gst_buffer_new_and_alloc (10); +#if 0 + gst_buffer_set_caps (buffer, incaps); +#endif + + /* don't suggest anything else */ + buffer_alloc_ct2_suggest = FALSE; + buffer_alloc_ct2_case = 0; + transform_ct2_called = FALSE; + buffer_alloc_ct2_called = FALSE; + res = gst_test_trans_push (trans, buffer); + //fail_unless (res == GST_FLOW_OK); + //fail_unless (transform_ct2_called == TRUE); + //fail_unless (buffer_alloc_ct2_called == TRUE); + /* after push, get rid of the final ref we had */ + + buffer = gst_test_trans_pop (trans); + //fail_unless (buffer != NULL); + //fail_unless (gst_buffer_get_size (buffer) == 20); + //fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps)); + + /* output buffer has refcount 1 */ + //fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1); + //gst_buffer_unref (buffer); + + gst_caps_unref (incaps); + gst_caps_unref (outcaps); + + gst_test_trans_free (trans); +} + +GST_END_TEST; + + +static Suite * +gst_basetransform_suite (void) +{ + Suite *s = suite_create ("GstBaseTransform"); + TCase *tc = tcase_create ("general"); + + suite_add_tcase (s, tc); + /* pass through */ + tcase_add_test (tc, basetransform_chain_pt1); + tcase_add_test (tc, basetransform_chain_pt2); + /* in place */ + tcase_add_test (tc, basetransform_chain_ip1); + tcase_add_test (tc, basetransform_chain_ip2); + /* copy transform */ + tcase_add_test (tc, basetransform_chain_ct1); + tcase_add_test (tc, basetransform_chain_ct2); + tcase_add_test (tc, basetransform_chain_ct3); + + return s; +} + +GST_CHECK_MAIN (gst_basetransform); diff --git a/tests/check/libs/typefindhelper.c b/tests/check/libs/typefindhelper.c new file mode 100644 index 0000000..8a55f84 --- /dev/null +++ b/tests/check/libs/typefindhelper.c @@ -0,0 +1,125 @@ +/* GStreamer + * + * unit test for typefind helper + * + * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net> + * + * 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/check/gstcheck.h> + +#include <gst/base/gsttypefindhelper.h> + +static const guint8 vorbisid[30] = { 0x01, 0x76, 0x6f, 0x72, 0x62, 0x69, 0x73, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x44, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x01 +}; + +static void foobar_typefind (GstTypeFind * tf, gpointer unused); + +static GstStaticCaps foobar_caps = GST_STATIC_CAPS ("foo/x-bar"); + +#define FOOBAR_CAPS (gst_static_caps_get (&foobar_caps)) + +/* make sure the entire data in the buffer is available for peeking */ +GST_START_TEST (test_buffer_range) +{ + static gchar *foobar_exts[] = { (char *) "foobar", NULL }; + + GstStructure *s; + GstBuffer *buf; + GstCaps *caps; + + fail_unless (gst_type_find_register (NULL, "foo/x-bar", + GST_RANK_PRIMARY + 50, foobar_typefind, (gchar **) foobar_exts, + FOOBAR_CAPS, NULL, NULL)); + + buf = gst_buffer_new (); + fail_unless (buf != NULL); + + gst_buffer_take_memory (buf, -1, + gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, + (gpointer) vorbisid, NULL, 30, 0, 30)); + + caps = gst_type_find_helper_for_buffer (NULL, buf, NULL); + fail_unless (caps != NULL); + fail_unless (GST_CAPS_IS_SIMPLE (caps)); + fail_unless (gst_caps_is_fixed (caps)); + + s = gst_caps_get_structure (caps, 0); + fail_unless (s != NULL); + fail_unless (gst_structure_has_name (s, "foo/x-bar")); + + gst_caps_unref (caps); + gst_buffer_unref (buf); +} + +GST_END_TEST; + +static Suite * +gst_typefindhelper_suite (void) +{ + Suite *s = suite_create ("typefindhelper"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_buffer_range); + + return s; +} + +GST_CHECK_MAIN (gst_typefindhelper); + +static void +foobar_typefind (GstTypeFind * tf, gpointer unused) +{ + const guint8 *data; + + data = gst_type_find_peek (tf, 0, 10); + fail_unless (data != NULL); + fail_unless (memcmp (data, vorbisid, 10) == 0); + + data = gst_type_find_peek (tf, 0, 20); + fail_unless (data != NULL); + fail_unless (memcmp (data, vorbisid, 20) == 0); + + data = gst_type_find_peek (tf, 0, 30); + fail_unless (data != NULL); + fail_unless (memcmp (data, vorbisid, 30) == 0); + + fail_unless (gst_type_find_peek (tf, 0, 31) == NULL); + fail_unless (gst_type_find_peek (tf, 1, 30) == NULL); + fail_unless (gst_type_find_peek (tf, 25, 6) == NULL); + + data = gst_type_find_peek (tf, 1, 29); + fail_unless (data != NULL); + fail_unless (memcmp (data, vorbisid + 1, 29) == 0); + + data = gst_type_find_peek (tf, 25, 4); + fail_unless (data != NULL); + fail_unless (memcmp (data, vorbisid + 25, 4) == 0); + + fail_unless (gst_type_find_peek (tf, -1, 29) == NULL); + fail_unless (gst_type_find_peek (tf, -1, 1) == NULL); + fail_unless (gst_type_find_peek (tf, -1, 0) == NULL); + + gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, FOOBAR_CAPS); +} diff --git a/tests/check/pipelines/cleanup.c b/tests/check/pipelines/cleanup.c new file mode 100644 index 0000000..4c7232a --- /dev/null +++ b/tests/check/pipelines/cleanup.c @@ -0,0 +1,119 @@ +/* GStreamer + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * + * cleanup.c: Unit test for cleanup of pipelines + * + * 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 <gst/check/gstcheck.h> + + +static GstElement * +setup_pipeline (const gchar * pipe_descr) +{ + GstElement *pipeline; + + pipeline = gst_parse_launch (pipe_descr, NULL); + g_return_val_if_fail (GST_IS_PIPELINE (pipeline), NULL); + return pipeline; +} + +/* events is a mask of expected events. tevent is the expected terminal event. + the poll call will time out after half a second. + */ +static void +run_pipeline (GstElement * pipeline, const gchar * descr, + GstMessageType events, GstMessageType tevent) +{ + GstBus *bus; + GstMessageType revent; + + bus = gst_element_get_bus (pipeline); + g_assert (bus); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + while (1) { + GstMessage *message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2); + + if (message) { + revent = GST_MESSAGE_TYPE (message); + gst_message_unref (message); + } else { + revent = GST_MESSAGE_UNKNOWN; + } + + if (revent == tevent) { + break; + } else if (revent == GST_MESSAGE_UNKNOWN) { + g_critical ("Unexpected timeout in gst_bus_poll, looking for %d: %s", + tevent, descr); + break; + } else if (revent & events) { + continue; + } + g_critical + ("Unexpected message received of type %d, '%s', looking for %d: %s", + revent, gst_message_type_get_name (revent), tevent, descr); + } + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); + gst_object_unref (bus); +} + +GST_START_TEST (test_pipeline_unref) +{ + const gchar *s; + GstElement *pipeline, *src, *sink; + + s = "fakesrc name=src num-buffers=20 ! fakesink name=sink"; + pipeline = setup_pipeline (s); + /* get_by_name takes a ref */ + src = gst_bin_get_by_name (GST_BIN (pipeline), "src"); + fail_if (src == NULL); + sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); + fail_if (sink == NULL); + + run_pipeline (pipeline, s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED | + GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_EOS); + while (GST_OBJECT_REFCOUNT_VALUE (src) > 1) + THREAD_SWITCH (); + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); + gst_object_unref (src); + gst_object_unref (sink); +} + +GST_END_TEST; + +static Suite * +cleanup_suite (void) +{ + Suite *s = suite_create ("Pipeline cleanup"); + TCase *tc_chain = tcase_create ("linear"); + + /* time out after 20s, not the default 3 */ + tcase_set_timeout (tc_chain, 20); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_pipeline_unref); + return s; +} + +GST_CHECK_MAIN (cleanup); diff --git a/tests/check/pipelines/parse-disabled.c b/tests/check/pipelines/parse-disabled.c new file mode 100644 index 0000000..b70a5f6 --- /dev/null +++ b/tests/check/pipelines/parse-disabled.c @@ -0,0 +1,72 @@ +/* GStreamer unit test for disabled gst-parse + * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net> + * * + * 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/check/gstcheck.h> + +#include <gst/gstconfig.h> + +GST_START_TEST (test_parse_launch_errors) +{ + GstElement *pipe; + GError *err; + const gchar *arr[] = { "fakesrc", "fakesink", NULL }; + + err = NULL; + pipe = gst_parse_launch ("fakesrc ! fakesink", &err); + fail_unless (err != NULL, "expected an error, but did not get one"); + fail_unless (pipe == NULL, "got pipeline, but expected NULL"); + fail_unless (err->domain == GST_CORE_ERROR); + fail_unless (err->code == GST_CORE_ERROR_DISABLED); + g_error_free (err); + + err = NULL; + pipe = gst_parse_bin_from_description ("fakesrc ! fakesink", TRUE, &err); + fail_unless (err != NULL, "expected an error, but did not get one"); + fail_unless (pipe == NULL, "got pipeline, but expected NULL"); + fail_unless (err->domain == GST_CORE_ERROR); + fail_unless (err->code == GST_CORE_ERROR_DISABLED); + g_error_free (err); + + err = NULL; + pipe = gst_parse_launchv (arr, &err); + fail_unless (err != NULL, "expected an error, but did not get one"); + fail_unless (pipe == NULL, "got pipeline, but expected NULL"); + fail_unless (err->domain == GST_CORE_ERROR); + fail_unless (err->code == GST_CORE_ERROR_DISABLED); + g_error_free (err); +} + +GST_END_TEST; + +static Suite * +parsedisabled_suite (void) +{ + Suite *s = suite_create ("Parse Launch (Disabled Mode)"); + TCase *tc_chain = tcase_create ("parselaunchdisabled"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_parse_launch_errors); + return s; +} + +GST_CHECK_MAIN (parsedisabled); diff --git a/tests/check/pipelines/parse-launch.c b/tests/check/pipelines/parse-launch.c new file mode 100644 index 0000000..6c894f9 --- /dev/null +++ b/tests/check/pipelines/parse-launch.c @@ -0,0 +1,688 @@ +/* GStreamer gst_parse_launch unit tests + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * Copyright (C) <2008> Tim-Philipp Müller <tim centricular net> + * + * 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 + +#ifdef HAVE_VALGRIND_H +# include <valgrind/valgrind.h> +# include <valgrind/memcheck.h> +#endif + +#include <gst/check/gstcheck.h> + +#define GST_TYPE_PARSE_TEST_ELEMENT (gst_parse_test_element_get_type()) +static GType gst_parse_test_element_get_type (void); + +static GstElement * +setup_pipeline (const gchar * pipe_descr) +{ + GstElement *pipeline; + GError *error = NULL; + + pipeline = gst_parse_launch (pipe_descr, &error); + + GST_DEBUG ("created %s", pipe_descr); + + if (error != NULL) { + fail_if (error != NULL, "Error parsing pipeline %s: %s", pipe_descr, + error->message); + g_error_free (error); + } + fail_unless (pipeline != NULL, "Failed to create pipeline %s", pipe_descr); + return pipeline; +} + +static void +expected_fail_pipe (const gchar * pipe_descr) +{ + GstElement *pipeline; + GError *error = NULL; + +#ifndef GST_DISABLE_GST_DEBUG + gst_debug_set_default_threshold (GST_LEVEL_NONE); +#endif + + pipeline = gst_parse_launch (pipe_descr, &error); + fail_unless (pipeline == NULL || error != NULL, + "Expected failure pipeline %s: succeeded!", pipe_descr); + g_error_free (error); + + /* We get a pipeline back even when parsing has failed, sometimes! */ + if (pipeline) + gst_object_unref (pipeline); +} + +static void +check_pipeline_runs (GstElement * p) +{ + GstStateChangeReturn ret; + + /* Check that the pipeline changes state to PAUSED and back to NULL */ + ret = gst_element_set_state (p, GST_STATE_PAUSED); + if (ret == GST_STATE_CHANGE_ASYNC) + ret = gst_element_get_state (p, NULL, NULL, GST_CLOCK_TIME_NONE); + fail_unless (ret != GST_STATE_CHANGE_FAILURE, + "Could not set pipeline to paused"); + + ret = gst_element_set_state (p, GST_STATE_NULL); + if (ret == GST_STATE_CHANGE_ASYNC) + ret = gst_element_get_state (p, NULL, NULL, GST_CLOCK_TIME_NONE); + fail_unless (ret != GST_STATE_CHANGE_FAILURE, + "Could not set pipeline to null"); +} + +static const gchar *test_lines[] = { + "filesrc location=music.mp3 ! identity silent=true ! fakesink silent=true", + "filesrc location=music.ogg ! tee ! identity silent=true ! identity silent=true ! fakesink silent=true", + "filesrc location=http://domain.com/music.mp3 ! identity silent=true ! fakesink silent=true", + "filesrc location=movie.avi ! tee name=demuxer ! ( queue ! identity silent=true ! fakesink silent=true ) ( demuxer. ! queue ! identity silent=true ! fakesink silent=true )", + "fakesrc ! video/x-raw-yuv ! fakesink silent=true", + "fakesrc ! video/raw, format=(string)YUY2; video/raw, format=(string)YV12 ! fakesink silent=true", + "fakesrc ! audio/x-raw-int, width=[16, 32], depth={16, 24, 32}, signed=TRUE ! fakesink silent=true", + "fakesrc ! identity silent=true ! identity silent=true ! identity silent=true ! fakesink silent=true", + "fakesrc name=100 fakesink name=101 silent=true 100. ! 101.", + "fakesrc ! 1dentity ! fakesink silent=true", + NULL +}; + +GST_START_TEST (test_launch_lines) +{ + GstElement *pipeline; + const gchar **s; + GType type; + GstElementFactory *efac; + + efac = gst_element_factory_find ("identity"); + fail_unless (efac != NULL); + efac = + GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE (efac))); + fail_unless (efac != NULL); + type = gst_element_factory_get_element_type (efac); + fail_unless (type != 0); + g_object_unref (efac); + fail_unless (gst_element_register (NULL, "1dentity", GST_RANK_NONE, type)); + + for (s = test_lines; *s != NULL; s++) { + pipeline = setup_pipeline (*s); + gst_object_unref (pipeline); + } +} + +GST_END_TEST; + +#define PIPELINE1 "fakesrc" +#define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 data= Subbuffer\\ data" +#define PIPELINE3 "fakesrc identity silent=true fakesink silent=true" +#define PIPELINE4 "fakesrc num-buffers=4 .src ! identity silent=true !.sink identity silent=true .src ! .sink fakesink silent=true" +#define PIPELINE5 "fakesrc num-buffers=4 name=src identity silent=true name=id1 identity silent=true name = id2 fakesink silent=true name =sink src. ! id1. id1.! id2.sink id2.src!sink.sink" +#define PIPELINE6 "pipeline.(name=\"john\" fakesrc num-buffers=4 ( bin. ( ! queue ! identity silent=true !( queue ! fakesink silent=true )) ))" +#define PIPELINE7 "fakesrc num-buffers=4 ! tee name=tee .src%d! queue ! fakesink silent=true tee.src%d ! queue ! fakesink silent=true queue name =\"foo\" ! fakesink silent=true tee.src%d ! foo." +/* aggregator is borked + * #define PIPELINE8 "fakesrc num-buffers=4 ! tee name=tee1 .src0,src1 ! .sink0, sink1 aggregator ! fakesink silent=true" + * */ +#define PIPELINE8 "fakesrc num-buffers=4 ! fakesink silent=true" +#define PIPELINE9 "fakesrc num-buffers=4 ! test. fakesink silent=true name=test" +#define PIPELINE10 "( fakesrc num-buffers=\"4\" ! ) identity silent=true ! fakesink silent=true" +#define PIPELINE11 "fakesink silent=true name = sink identity silent=true name=id ( fakesrc num-buffers=\"4\" ! id. ) id. ! sink." +#define PIPELINE12 "file:///tmp/test.file ! fakesink silent=true" +#define PIPELINE13 "fakesrc ! file:///tmp/test.file" +#define PIPELINE14 "capsfilter caps=application/x-rtp,sprop-parameter-sets=(string)\"x\\,x\"" +#define PIPELINE15 "capsfilter caps=application/x-rtp,sprop-parameter-sets=(string)\"x\\\"x\\,x\"" + +GST_START_TEST (test_launch_lines2) +{ + GstElement *cur; + gint i; + gboolean b; + gchar *s = NULL; + + /** + * checks: + * - specifying an element works :) + * - if only 1 element is requested, no bin is returned, but the element + */ + cur = setup_pipeline (PIPELINE1); + fail_unless (G_OBJECT_TYPE (cur) == g_type_from_name ("GstFakeSrc"), + "parse_launch did not produce a fakesrc"); + gst_object_unref (cur); + + /** + * checks: + * - properties works + * - string, int, boolean and enums can be properly set + * - first test of escaping strings + */ + cur = setup_pipeline (PIPELINE2); + g_object_get (G_OBJECT (cur), "name", &s, "num-buffers", &i, + "silent", &b, NULL); + fail_if (s == NULL, "name was NULL"); + fail_unless (strcmp (s, "donald") == 0, "fakesrc name was not 'donald'"); + fail_unless (i == 27, "num-buffers was not 27"); + fail_unless (b == TRUE, "silent was not TRUE"); + g_free (s); + + g_object_get (G_OBJECT (cur), "sizetype", &i, NULL); + fail_unless (i == 3, "sizetype != 3"); + + g_object_get (G_OBJECT (cur), "data", &i, NULL); + fail_unless (i == 2, "data != 2"); + gst_object_unref (cur); + + /** + * checks: + * - specifying multiple elements without links works + * - if multiple toplevel elements exist, a pipeline is returned + */ + cur = setup_pipeline (PIPELINE3); + fail_unless (GST_BIN_NUMCHILDREN (cur) == 3, + "Pipeline does not contain 3 children"); + gst_object_unref (cur); + + /** + * checks: + * - test default link "!" + * - test if specifying pads on links works + */ + cur = setup_pipeline (PIPELINE4); + check_pipeline_runs (cur); + gst_object_unref (cur); + + /** + * checks: + * - test if appending the links works, too + * - check if the pipeline constructed works the same as the one before (how?) + */ + cur = setup_pipeline (PIPELINE5); + check_pipeline_runs (cur); + gst_object_unref (cur); + + /** + * checks: + * - test various types of bins + * - test if linking across bins works + * - test if escaping strings works + */ + cur = setup_pipeline (PIPELINE6); + fail_unless (GST_IS_PIPELINE (cur), "Parse did not produce a pipeline"); + g_object_get (G_OBJECT (cur), "name", &s, NULL); + fail_if (s == NULL, "name was NULL"); + fail_unless (strcmp (s, "john") == 0, "Name was not 'john'"); + g_free (s); + check_pipeline_runs (cur); + gst_object_unref (cur); + + /** + * checks: + * - test request pads + */ + cur = setup_pipeline (PIPELINE7); + check_pipeline_runs (cur); + gst_object_unref (cur); + + /** + * checks: + * - multiple pads on 1 link + */ + cur = setup_pipeline (PIPELINE8); + check_pipeline_runs (cur); + gst_object_unref (cur); + + /** + * checks: + * - failed in grammar.y cvs version 1.17 + */ + cur = setup_pipeline (PIPELINE9); + check_pipeline_runs (cur); + gst_object_unref (cur); + + /** + * checks: + * - failed in grammar.y cvs version 1.17 + */ + cur = setup_pipeline (PIPELINE10); + check_pipeline_runs (cur); + gst_object_unref (cur); + + /** + * checks: + * - failed in grammar.y cvs version 1.18 + */ + cur = setup_pipeline (PIPELINE11); + check_pipeline_runs (cur); + gst_object_unref (cur); + + /** + * checks: + * - URI detection works + */ + cur = setup_pipeline (PIPELINE12); + gst_object_unref (cur); + + /** * checks: + * - URI sink detection works + */ + cur = setup_pipeline (PIPELINE13); + gst_object_unref (cur); + + /* Checks handling of a assignment followed by error inside a bin. + * This should warn, but ignore the error and carry on */ + cur = setup_pipeline ("( filesrc blocksize=4 location=/dev/null @ )"); + gst_object_unref (cur); + + /** + * Checks if characters inside quotes are not escaped. + */ + cur = setup_pipeline (PIPELINE14); + gst_object_unref (cur); + + /** + * Checks if escaped quotes inside quotes are not treated as end string quotes. + * This would make the rest of characters to be escaped incorrectly. + */ + cur = setup_pipeline (PIPELINE15); + gst_object_unref (cur); +} + +GST_END_TEST; + +static const gchar *expected_failures[] = { + /* checks: fails because a=b. is not a valid element reference in parse.l */ + "fakesrc num-buffers=4 name=\"a=b\" a=b. ! fakesink silent=true", + /* checks: Error branch for a non-deserialisable property value */ + "filesrc blocksize=absdff", + /* checks: That broken caps which don't parse can't create a pipeline */ + "fakesrc ! video/raw,format=(antwerp)monkeys ! fakesink silent=true", + /* checks: Empty pipeline is invalid */ + "", + /* checks: Link without sink element failes */ + "fakesrc ! ", + /* checks: Link without src element failes */ + " ! fakesink silent=true", + /* checks: Source URI for which no element exists is a failure */ + "borky://fdaffd ! fakesink silent=true", + /* checks: Sink URI for which no element exists is a failure */ + "fakesrc ! borky://fdaffd", + /* checks: Referencing non-existent source element by name can't link */ + "fakesrc name=src fakesink silent=true name=sink noexiste. ! sink.", + /* checks: Referencing non-existent sink element by name can't link */ + "fakesrc name=src fakesink silent=true name=sink src. ! noexiste.", + /* checks: Can't link 2 elements that only have sink pads */ + "fakesink silent=true ! fakesink silent=true", + /* checks multi-chain link without src element fails. */ + "! identity silent=true ! identity silent=true ! fakesink silent=true", + /* Empty bin not allowed */ + "bin.( )", + /* bin with non-existent element counts as empty, and not allowed */ + "bin.( non_existent_element )", + /* END: */ + NULL +}; + +GST_START_TEST (expected_to_fail_pipes) +{ + const gchar **s; + + for (s = expected_failures; *s != NULL; s++) { + expected_fail_pipe (*s); + } +} + +GST_END_TEST; + +static const gchar *leaking_failures[] = { + /* checks: Invalid pipeline syntax fails */ + "fakesrc ! identity silent=true ! sgsdfagfd @ gfdgfdsgfsgSF", + /* checks: Attempting to link to a non-existent pad on an element + * created via URI handler should fail */ + "fakesrc ! .foo file:///dev/null", + /* checks: That requesting an element which doesn't exist doesn't work */ + "error-does-not-exist-src", + NULL +}; + +GST_START_TEST (leaking_fail_pipes) +{ + const gchar **s; + + for (s = leaking_failures; *s != NULL; s++) { + /* Uncomment if you want to try fixing the leaks */ +#if 0 + g_print ("Trying pipe: %s\n", *s); + expected_fail_pipe (*s); +#endif +#ifdef HAVE_VALGRIND_H + VALGRIND_DO_LEAK_CHECK; +#endif + } +} + +GST_END_TEST; + +/* Helper function to test delayed linking support in parse_launch by creating + * a test element based on bin, which contains a fakesrc and a sometimes + * pad-template, and trying to link to a fakesink. When the bin transitions + * to paused it adds a pad, which should get linked to the fakesink */ +static void +run_delayed_test (const gchar * pipe_str, const gchar * peer, + gboolean expect_link) +{ + GstElement *pipe, *src, *sink; + GstPad *srcpad, *sinkpad, *peerpad = NULL; + + pipe = setup_pipeline (pipe_str); + + src = gst_bin_get_by_name (GST_BIN (pipe), "src"); + fail_if (src == NULL, "Test source element was not created"); + + sink = gst_bin_get_by_name (GST_BIN (pipe), "sink"); + fail_if (sink == NULL, "Test sink element was not created"); + + /* The src should not yet have a src pad */ + srcpad = gst_element_get_static_pad (src, "src"); + fail_unless (srcpad == NULL, "Source element already has a source pad"); + + /* Set the state to PAUSED and wait until the src at least reaches that + * state */ + fail_if (gst_element_set_state (pipe, GST_STATE_PAUSED) == + GST_STATE_CHANGE_FAILURE); + + fail_if (gst_element_get_state (src, NULL, NULL, GST_CLOCK_TIME_NONE) == + GST_STATE_CHANGE_FAILURE); + + /* Now, the source element should have a src pad, and if "peer" was passed, + * then the src pad should have gotten linked to the 'sink' pad of that + * peer */ + srcpad = gst_element_get_static_pad (src, "src"); + fail_if (srcpad == NULL, "Source element did not create source pad"); + + peerpad = gst_pad_get_peer (srcpad); + + if (expect_link == TRUE) { + fail_if (peerpad == NULL, "Source element pad did not get linked"); + } else { + fail_if (peerpad != NULL, + "Source element pad got linked but should not have"); + } + if (peerpad != NULL) + gst_object_unref (peerpad); + + if (peer != NULL) { + GstElement *peer_elem = gst_bin_get_by_name (GST_BIN (pipe), peer); + + fail_if (peer_elem == NULL, "Could not retrieve peer %s", peer); + + sinkpad = gst_element_get_static_pad (peer_elem, "sink"); + fail_if (sinkpad == NULL, "Peer element did not have a 'sink' pad"); + + fail_unless (peerpad == sinkpad, + "Source src pad got connected to the wrong peer"); + gst_object_unref (sinkpad); + } + + gst_object_unref (srcpad); + + gst_object_unref (src); + gst_object_unref (sink); + + gst_element_set_state (pipe, GST_STATE_NULL); + gst_object_unref (pipe); +} + +GST_START_TEST (delayed_link) +{ + fail_unless (gst_element_register (NULL, "parsetestelement", + GST_RANK_NONE, GST_TYPE_PARSE_TEST_ELEMENT)); + + /* This tests the delayed linking support in parse_launch by creating + * a test element based on bin, which contains a fakesrc and a sometimes + * pad-template, and trying to link to a fakesink. When the bin transitions + * to paused it adds a pad, which should get linked to the fakesink */ + run_delayed_test + ("parsetestelement name=src ! fakesink silent=true name=sink", "sink", + TRUE); + + /* Test, but this time specifying both pad names */ + run_delayed_test ("parsetestelement name=src .src ! " + ".sink fakesink silent=true name=sink", "sink", TRUE); + + /* Now try with a caps filter, but not testing that + * the peerpad == sinkpad, because the peer will actually + * be a capsfilter */ + run_delayed_test ("parsetestelement name=src ! application/x-test-caps ! " + "fakesink silent=true name=sink", NULL, TRUE); + + /* Now try with mutually exclusive caps filters that + * will prevent linking, but only once gets around to happening - + * ie, the pipeline should create ok but fail to change state */ + run_delayed_test ("parsetestelement name=src ! application/x-test-caps ! " + "identity silent=true ! application/x-other-caps ! " + "fakesink silent=true name=sink silent=true", NULL, FALSE); +} + +GST_END_TEST; + +typedef struct _GstParseTestElement +{ + GstBin parent; + + GstElement *fakesrc; +} GstParseTestElement; + +typedef struct _GstParseTestElementClass +{ + GstBinClass parent; +} GstParseTestElementClass; + +static GstStaticPadTemplate test_element_pad_template = +GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, + GST_PAD_SOMETIMES, GST_STATIC_CAPS ("application/x-test-caps")); +#define gst_parse_test_element_parent_class parent_class +G_DEFINE_TYPE (GstParseTestElement, gst_parse_test_element, GST_TYPE_BIN); + +static GstStateChangeReturn +gst_parse_test_element_change_state (GstElement * element, + GstStateChange transition); + +static void +gst_parse_test_element_class_init (GstParseTestElementClass * klass) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&test_element_pad_template)); + + gst_element_class_set_details_simple (gstelement_class, + "Test element for parse launch tests", "Source", + "Test element for parse launch tests in core", + "GStreamer Devel <gstreamer-devel@lists.sf.net>"); + + gstelement_class->change_state = gst_parse_test_element_change_state; +} + +static void +gst_parse_test_element_init (GstParseTestElement * src) +{ + /* Create a fakesrc and add it to ourselves */ + src->fakesrc = gst_element_factory_make ("fakesrc", NULL); + if (src->fakesrc) + gst_bin_add (GST_BIN (src), src->fakesrc); +} + +static GstStateChangeReturn +gst_parse_test_element_change_state (GstElement * element, + GstStateChange transition) +{ + GstParseTestElement *src = (GstParseTestElement *) element; + + if (transition == GST_STATE_CHANGE_READY_TO_PAUSED) { + /* Add our pad */ + GstPad *pad; + GstPad *ghost; + + if (src->fakesrc == NULL) + return GST_STATE_CHANGE_FAILURE; + + pad = gst_element_get_static_pad (src->fakesrc, "src"); + if (pad == NULL) + return GST_STATE_CHANGE_FAILURE; + + ghost = gst_ghost_pad_new ("src", pad); + fail_if (ghost == NULL, "Failed to create ghost pad"); + /* activate and add */ + gst_pad_set_active (ghost, TRUE); + gst_element_add_pad (GST_ELEMENT (src), ghost); + gst_object_unref (pad); + } + + return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); +} + +GST_START_TEST (test_missing_elements) +{ + GstParseContext *ctx; + GstElement *element; + GError *err = NULL; + gchar **arr; + + /* avoid misleading 'no such element' error debug messages when using cvs */ + if (!g_getenv ("GST_DEBUG")) + gst_debug_set_default_threshold (GST_LEVEL_NONE); + + /* one missing element */ + ctx = gst_parse_context_new (); + element = gst_parse_launch_full ("fakesrc ! coffeesink", ctx, + GST_PARSE_FLAG_FATAL_ERRORS, &err); + fail_unless (err != NULL, "expected error"); + fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT); + fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS"); + arr = gst_parse_context_get_missing_elements (ctx); + fail_unless (arr != NULL, "expected missing elements"); + fail_unless_equals_string (arr[0], "coffeesink"); + fail_unless (arr[1] == NULL); + g_strfreev (arr); + gst_parse_context_free (ctx); + g_error_free (err); + err = NULL; + + /* multiple missing elements */ + ctx = gst_parse_context_new (); + element = gst_parse_launch_full ("fakesrc ! bogusenc ! identity ! goomux ! " + "fakesink", ctx, GST_PARSE_FLAG_FATAL_ERRORS, &err); + fail_unless (err != NULL, "expected error"); + fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT); + fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS"); + arr = gst_parse_context_get_missing_elements (ctx); + fail_unless (arr != NULL, "expected missing elements"); + fail_unless_equals_string (arr[0], "bogusenc"); + fail_unless_equals_string (arr[1], "goomux"); + fail_unless (arr[2] == NULL); + g_strfreev (arr); + gst_parse_context_free (ctx); + g_error_free (err); + err = NULL; + + /* multiple missing elements, different link pattern */ + ctx = gst_parse_context_new (); + element = gst_parse_launch_full ("fakesrc ! bogusenc ! mux.sink " + "blahsrc ! goomux name=mux ! fakesink fakesrc ! goosink", ctx, + GST_PARSE_FLAG_FATAL_ERRORS, &err); + fail_unless (err != NULL, "expected error"); + fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT); + fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS"); + arr = gst_parse_context_get_missing_elements (ctx); + fail_unless (arr != NULL, "expected missing elements"); + fail_unless_equals_string (arr[0], "bogusenc"); + fail_unless_equals_string (arr[1], "blahsrc"); + fail_unless_equals_string (arr[2], "goomux"); + fail_unless_equals_string (arr[3], "goosink"); + fail_unless (arr[4] == NULL); + g_strfreev (arr); + gst_parse_context_free (ctx); + g_error_free (err); + err = NULL; +} + +GST_END_TEST; + +GST_START_TEST (test_flags) +{ + GstElement *element; + GError *err = NULL; + + /* avoid misleading 'no such element' error debug messages when using cvs */ + if (!g_getenv ("GST_DEBUG")) + gst_debug_set_default_threshold (GST_LEVEL_NONE); + + /* default behaviour is to return any already constructed bins/elements */ + element = gst_parse_launch_full ("fakesrc ! coffeesink", NULL, 0, &err); + fail_unless (err != NULL, "expected error"); + fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT); + fail_unless (element != NULL, "expected partial pipeline/element"); + g_error_free (err); + err = NULL; + gst_object_unref (element); + + /* test GST_PARSE_FLAG_FATAL_ERRORS */ + element = gst_parse_launch_full ("fakesrc ! coffeesink", NULL, + GST_PARSE_FLAG_FATAL_ERRORS, &err); + fail_unless (err != NULL, "expected error"); + fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT); + fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS"); + g_error_free (err); + err = NULL; +} + +GST_END_TEST; + +GST_START_TEST (test_parsing) +{ + GstElement *pipeline; + + /* make sure we don't read beyond the end of the string */ + pipeline = gst_parse_launch_full ("filesrc location=x\\", NULL, 0, NULL); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +parse_suite (void) +{ + Suite *s = suite_create ("Parse Launch syntax"); + TCase *tc_chain = tcase_create ("parselaunch"); + + /* time out after 20s, not the default 3 */ + tcase_set_timeout (tc_chain, 20); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_launch_lines); + tcase_add_test (tc_chain, test_launch_lines2); + tcase_add_test (tc_chain, expected_to_fail_pipes); + tcase_add_test (tc_chain, leaking_fail_pipes); + tcase_add_test (tc_chain, delayed_link); + tcase_add_test (tc_chain, test_flags); + tcase_add_test (tc_chain, test_missing_elements); + tcase_add_test (tc_chain, test_parsing); + return s; +} + +GST_CHECK_MAIN (parse); diff --git a/tests/check/pipelines/queue-error.c b/tests/check/pipelines/queue-error.c new file mode 100644 index 0000000..3ac43a9 --- /dev/null +++ b/tests/check/pipelines/queue-error.c @@ -0,0 +1,112 @@ +/* GStreamer unit test for queue + * + * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net> + * Copyright (C) 2009 Mark Nauwelaerts <mnauw users sourceforge net> + * + * 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 <gst/check/gstcheck.h> + +#include <gst/gst.h> + +static GstProbeReturn +modify_caps (GstObject * pad, GstProbeType type, GstEvent * event, + gpointer data) +{ + GstElement *filter = GST_ELEMENT (data); + GstCaps *caps; + + fail_unless (event != NULL); + fail_unless (GST_IS_EVENT (event)); + + if (GST_EVENT_TYPE (event) != GST_EVENT_EOS) + return GST_PROBE_OK; + + /* trigger caps negotiation error */ + caps = gst_caps_new_simple ("video/x-raw-rgb", NULL); + g_object_set (filter, "caps", caps, NULL); + gst_caps_unref (caps); + + return GST_PROBE_OK; +} + +GST_START_TEST (test_queue) +{ + GstStateChangeReturn state_ret; + GstMessage *msg; + GstElement *pipeline, *filter, *queue; + GstBus *bus; + GstPad *pad; + guint probe; + gchar *pipe_desc = + g_strdup_printf ("fakesrc num-buffers=1 ! video/x-raw-yuv ! " + "queue min-threshold-buffers=2 name=queue ! " + "capsfilter name=nasty ! fakesink"); + + pipeline = gst_parse_launch (pipe_desc, NULL); + fail_unless (pipeline != NULL); + g_free (pipe_desc); + + filter = gst_bin_get_by_name (GST_BIN (pipeline), "nasty"); + fail_unless (filter != NULL); + + /* queue waits for all data and EOS to arrive */ + /* then probe forces downstream element to return negotiation error */ + queue = gst_bin_get_by_name (GST_BIN (pipeline), "queue"); + fail_unless (queue != NULL); + pad = gst_element_get_static_pad (queue, "sink"); + fail_unless (pad != NULL); + probe = + gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, + (GstPadProbeCallback) modify_caps, filter, NULL); + + bus = gst_element_get_bus (pipeline); + + state_ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (state_ret != GST_STATE_CHANGE_FAILURE); + + msg = gst_bus_poll (bus, GST_MESSAGE_ERROR | GST_MESSAGE_EOS, 5 * GST_SECOND); + fail_unless (msg != NULL, "timeout waiting for error or eos message");; + + gst_message_unref (msg); + gst_object_unref (bus); + + fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL), + GST_STATE_CHANGE_SUCCESS); + + gst_pad_remove_probe (pad, probe); + gst_object_unref (queue); + gst_object_unref (pad); + gst_object_unref (filter); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +queue_suite (void) +{ + Suite *s = suite_create ("queue"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_queue); + + return s; +} + +GST_CHECK_MAIN (queue) diff --git a/tests/check/pipelines/simple-launch-lines.c b/tests/check/pipelines/simple-launch-lines.c new file mode 100644 index 0000000..dd85b7a --- /dev/null +++ b/tests/check/pipelines/simple-launch-lines.c @@ -0,0 +1,342 @@ +/* GStreamer + * Copyright (C) 2005 Andy Wingo <wingo@pobox.com> + * + * simple_launch_lines.c: Unit test for simple pipelines + * + * 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 <gst/check/gstcheck.h> + + +static GstElement * +setup_pipeline (const gchar * pipe_descr) +{ + GstElement *pipeline; + + pipeline = gst_parse_launch (pipe_descr, NULL); + fail_unless (GST_IS_PIPELINE (pipeline)); + return pipeline; +} + +/* + * run_pipeline: + * @pipe: the pipeline to run + * @desc: the description for use in messages + * @message_types: is a mask of expected message_types + * @tmessage: is the expected terminal message + * + * the poll call will time out after half a second. + */ +static void +run_pipeline (GstElement * pipeline, const gchar * descr, + GstMessageType message_types, GstMessageType tmessage) +{ + GstBus *bus; + GstMessageType rmessage; + GstStateChangeReturn ret; + + fail_if (pipeline == NULL); + bus = gst_element_get_bus (pipeline); + fail_if (bus == NULL); + + GST_DEBUG ("running pipeline %s", descr); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + + if (ret != GST_STATE_CHANGE_SUCCESS) { + GST_WARNING ("have failed state change %d", ret); + g_critical ("Couldn't set pipeline to PLAYING"); + goto done; + } + + while (1) { + GstMessage *message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2); + + if (message) { + rmessage = GST_MESSAGE_TYPE (message); + gst_message_unref (message); + } else { + rmessage = GST_MESSAGE_UNKNOWN; + } + + if (rmessage == tmessage) { + break; + } else if (rmessage == GST_MESSAGE_UNKNOWN) { + g_critical ("Unexpected timeout in gst_bus_poll, looking for %d: %s", + tmessage, descr); + break; + } else if (rmessage & message_types) { + continue; + } + g_critical + ("Unexpected message received of type %d, '%s', looking for %d: %s", + rmessage, gst_message_type_get_name (rmessage), tmessage, descr); + } + +done: + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); + gst_object_unref (bus); +} + +GST_START_TEST (test_2_elements) +{ + const gchar *s; + + s = "fakesrc can-activate-push=false ! fakesink can-activate-pull=true"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED | + GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_UNKNOWN); + + s = "fakesrc can-activate-push=true ! fakesink can-activate-pull=false"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED | + GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_UNKNOWN); + + s = "fakesrc can-activate-push=false num-buffers=10 ! fakesink can-activate-pull=true"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED | + GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_EOS); + + s = "fakesrc can-activate-push=true num-buffers=10 ! fakesink can-activate-pull=false"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED | + GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_EOS); + + s = "fakesrc can-activate-push=false ! fakesink can-activate-pull=false"; + ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED | + GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, + GST_MESSAGE_UNKNOWN)); +} + +GST_END_TEST; + +static void +check_state_change_return (GstElement * pipeline, GstState state, + GstStateChangeReturn immediate, GstStateChangeReturn final) +{ + GstStateChangeReturn ret; + + ret = gst_element_set_state (pipeline, state); + if (ret != immediate) + g_critical ("Unexpected set_state return ->%s: %d != %d", + gst_element_state_get_name (state), ret, immediate); + ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + if (ret != final) + g_critical ("Unexpected get_state return ->%s: %d != %d", + gst_element_state_get_name (state), ret, final); +} + + +GST_START_TEST (test_state_change_returns) +{ + const gchar *s; + GstElement *pipeline; + + s = "fakesrc can-activate-pull=false ! fakesink"; + pipeline = gst_parse_launch (s, NULL); + fail_unless (GST_IS_PIPELINE (pipeline)); + check_state_change_return (pipeline, GST_STATE_READY, + GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS); + check_state_change_return (pipeline, GST_STATE_PAUSED, GST_STATE_CHANGE_ASYNC, + GST_STATE_CHANGE_SUCCESS); + check_state_change_return (pipeline, GST_STATE_PLAYING, + GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS); + /* can't check PAUSED, it's not deterministic */ + check_state_change_return (pipeline, GST_STATE_READY, + GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS); + check_state_change_return (pipeline, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS, + GST_STATE_CHANGE_SUCCESS); + gst_object_unref (pipeline); + + s = "fakesrc can-activate-push=false ! fakesink can-activate-pull=true"; + pipeline = gst_parse_launch (s, NULL); + fail_unless (GST_IS_PIPELINE (pipeline)); + check_state_change_return (pipeline, GST_STATE_READY, + GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS); + check_state_change_return (pipeline, GST_STATE_PAUSED, + GST_STATE_CHANGE_ASYNC, GST_STATE_CHANGE_SUCCESS); + check_state_change_return (pipeline, GST_STATE_PLAYING, + GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS); + /* can't check PAUSED, it's not deterministic */ + check_state_change_return (pipeline, GST_STATE_READY, + GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS); + check_state_change_return (pipeline, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS, + GST_STATE_CHANGE_SUCCESS); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +G_GNUC_UNUSED +GST_START_TEST (test_tee) +{ + const gchar *s; + + s = "fakesrc can-activate-push=true ! tee ! fakesink can-activate-push=true"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN); + + s = "fakesrc can-activate-push=true num-buffers=10 ! tee ! fakesink can-activate-push=true"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_EOS); + + s = "fakesrc can-activate-push=false can-activate-pull=true ! tee ! fakesink can-activate-pull=true"; + ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, + GST_MESSAGE_UNKNOWN)); + + s = "fakesrc can-activate-push=false can-activate-pull=true " + "! tee pull-mode=single ! fakesink can-activate-pull=true"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN); + + s = "fakesrc can-activate-push=false can-activate-pull=true num-buffers=10 " + "! tee pull-mode=single ! fakesink can-activate-pull=true"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_EOS); + + s = "fakesrc can-activate-push=false can-activate-pull=true " + "! tee name=t pull-mode=single ! fakesink can-activate-pull=true " + "t. ! queue ! fakesink can-activate-pull=true can-activate-push=false"; + ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, + GST_MESSAGE_UNKNOWN)); + + s = "fakesrc can-activate-push=false can-activate-pull=true " + "! tee name=t pull-mode=single ! fakesink can-activate-pull=true " + "t. ! queue ! fakesink"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN); + + s = "fakesrc can-activate-push=false can-activate-pull=true num-buffers=10 " + "! tee name=t pull-mode=single ! fakesink can-activate-pull=true " + "t. ! queue ! fakesink"; + run_pipeline (setup_pipeline (s), s, + GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_EOS); +} + +GST_END_TEST; + +static void +got_handoff (GstElement * sink, GstBuffer * buf, GstPad * pad, gpointer unused) +{ + gst_element_post_message + (sink, gst_message_new_application (NULL, gst_structure_new ("foo", + NULL))); +} + +static void +assert_live_count (GType type, gint live) +{ + GstAllocTrace *trace; + const gchar *name; + + if (gst_alloc_trace_available ()) { + name = g_type_name (type); + fail_if (name == NULL); + trace = gst_alloc_trace_get (name); + if (trace) { + g_return_if_fail (trace->live == live); + } + } else { + g_print ("\nSkipping live count tests; recompile with traces to enable\n"); + } +} + +GST_START_TEST (test_stop_from_app) +{ + GstElement *fakesrc, *fakesink, *pipeline; + GstBus *bus; + GstStateChangeReturn ret; + GstMessageType rmessage; + GstMessage *message; + + assert_live_count (GST_TYPE_BUFFER, 0); + + fakesrc = gst_element_factory_make ("fakesrc", NULL); + fakesink = gst_element_factory_make ("fakesink", NULL); + pipeline = gst_element_factory_make ("pipeline", NULL); + + fail_unless (fakesrc && fakesink && pipeline); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); + fail_unless (gst_element_link (fakesrc, fakesink) != FALSE); + + g_object_set (fakesink, "signal-handoffs", (gboolean) TRUE, NULL); + g_signal_connect (fakesink, "handoff", G_CALLBACK (got_handoff), NULL); + + gst_element_set_state (pipeline, GST_STATE_PAUSED); + ret = gst_element_get_state (pipeline, NULL, NULL, 5 * GST_SECOND); + switch (ret) { + case GST_STATE_CHANGE_FAILURE: + g_error ("Failed to change state to PAUSED"); + break; + case GST_STATE_CHANGE_ASYNC: + g_error ("Failed to change state to PAUSED within 5 seconds"); + break; + default: + break; + } + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + bus = gst_element_get_bus (pipeline); + fail_if (bus == NULL); + + /* will time out after half a second */ + message = gst_bus_poll (bus, GST_MESSAGE_APPLICATION, GST_SECOND / 2); + if (message) { + rmessage = GST_MESSAGE_TYPE (message); + gst_message_unref (message); + } else { + rmessage = GST_MESSAGE_UNKNOWN; + } + fail_unless (rmessage == GST_MESSAGE_APPLICATION, + "polled message is not APPLICATION but %s", + gst_message_type_get_name (rmessage)); + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); + gst_object_unref (bus); + + assert_live_count (GST_TYPE_BUFFER, 0); +} + +GST_END_TEST; + +static Suite * +simple_launch_lines_suite (void) +{ + Suite *s = suite_create ("Pipelines"); + TCase *tc_chain = tcase_create ("linear"); + + /* time out after 20s, not the default 3 */ + tcase_set_timeout (tc_chain, 0); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_2_elements); + tcase_add_test (tc_chain, test_state_change_returns); + /* tcase_add_test (tc_chain, test_tee); FIXME */ + tcase_add_test (tc_chain, test_stop_from_app); + return s; +} + +GST_CHECK_MAIN (simple_launch_lines); diff --git a/tests/check/pipelines/stress.c b/tests/check/pipelines/stress.c new file mode 100644 index 0000000..f776633 --- /dev/null +++ b/tests/check/pipelines/stress.c @@ -0,0 +1,132 @@ +/* GStreamer + * Copyright (C) 2005 Andy Wingo <wingo@pobox.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. + */ + + +#include <gst/check/gstcheck.h> + +static int playing = 1; +static int quit = 0; + +static gboolean +change_state_timeout (gpointer data) +{ + GstElement *pipeline = (GstElement *) data; + + if (quit) + return FALSE; + + if (playing) { + playing = 0; + gst_element_set_state (pipeline, GST_STATE_NULL); + } else { + playing = 1; + gst_element_set_state (pipeline, GST_STATE_PLAYING); + } + + return TRUE; +} + +static gboolean +quit_timeout (gpointer data) +{ + quit = 1; + return FALSE; +} + +GST_START_TEST (test_stress_preroll) +{ + GstElement *fakesrc, *fakesink; + GstElement *pipeline; + + fakesrc = gst_element_factory_make ("fakesrc", NULL); + fakesink = gst_element_factory_make ("fakesink", NULL); + pipeline = gst_element_factory_make ("pipeline", NULL); + + g_return_if_fail (fakesrc && fakesink && pipeline); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); + gst_element_link (fakesrc, fakesink); + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + g_timeout_add (500, &change_state_timeout, pipeline); + g_timeout_add (10000, &quit_timeout, NULL); + + while (!quit) { + g_main_context_iteration (NULL, TRUE); + } + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); +} + +GST_END_TEST; + +GST_START_TEST (test_stress) +{ + GstElement *fakesrc, *fakesink, *pipeline; + gint i; + + fakesrc = gst_element_factory_make ("fakesrc", NULL); + fakesink = gst_element_factory_make ("fakesink", NULL); + pipeline = gst_element_factory_make ("pipeline", NULL); + + g_return_if_fail (fakesrc && fakesink && pipeline); + + gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); + gst_element_link (fakesrc, fakesink); + + i = 100; + while (i--) { + gst_element_set_state (pipeline, GST_STATE_PAUSED); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + gst_element_set_state (pipeline, GST_STATE_PAUSED); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + gst_element_set_state (pipeline, GST_STATE_PAUSED); + gst_element_set_state (pipeline, GST_STATE_READY); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + gst_element_set_state (pipeline, GST_STATE_PAUSED); + gst_element_set_state (pipeline, GST_STATE_READY); + gst_element_set_state (pipeline, GST_STATE_PAUSED); + gst_element_set_state (pipeline, GST_STATE_NULL); + } + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +stress_suite (void) +{ + Suite *s = suite_create ("stress"); + TCase *tc_chain = tcase_create ("linear"); + + /* Completely disable timeout for this test */ + tcase_set_timeout (tc_chain, 0); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_stress); + tcase_add_test (tc_chain, test_stress_preroll); + + return s; +} + +GST_CHECK_MAIN (stress); diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am new file mode 100644 index 0000000..f4e059b --- /dev/null +++ b/tests/examples/Makefile.am @@ -0,0 +1,47 @@ +if GST_DISABLE_PARSE +GST_PARSE_DIRS = +else +GST_PARSE_DIRS = launch +endif + +# adapter test needs sys/times.h and unistd.h +if HAVE_SYS_TIMES_H_AND_UNISTD_H + ADAPTER_TEST_DIR = adapter +else + ADAPTER_TEST_DIR = +endif + +always_dirs = \ + controller \ + helloworld \ + manual \ + metadata \ + queue \ + stepping \ + streams \ + typefind + +#appreader +#cutter +#events +#helloworld2 +#launch +#manual +#mixer +#pingpong +#plugins +#pwg +#queue2 +#queue3 +#queue4 +#retag +#thread + +SUBDIRS = \ + $(always_dirs) \ + $(ADAPTER_TEST_DIR) \ + $(GST_PARSE_DIRS) + +DIST_SUBDIRS = $(always_dirs) adapter launch + +include $(top_srcdir)/common/parallel-subdirs.mak diff --git a/tests/examples/Makefile.in b/tests/examples/Makefile.in new file mode 100644 index 0000000..c68857a --- /dev/null +++ b/tests/examples/Makefile.in @@ -0,0 +1,790 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ + +# include this at the end of $MODULE/ext/Makefile.am to force make to +# build subdirectories in parallel when make -jN is used. We will end up +# descending into all subdirectories a second time, but only after the first +# (parallel) run has finished, so it should go right through the second time. +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@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/common/parallel-subdirs.mak +subdir = tests/examples +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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +@GST_DISABLE_PARSE_FALSE@GST_PARSE_DIRS = launch +@GST_DISABLE_PARSE_TRUE@GST_PARSE_DIRS = +@HAVE_SYS_TIMES_H_AND_UNISTD_H_FALSE@ADAPTER_TEST_DIR = + +# adapter test needs sys/times.h and unistd.h +@HAVE_SYS_TIMES_H_AND_UNISTD_H_TRUE@ADAPTER_TEST_DIR = adapter +always_dirs = \ + controller \ + helloworld \ + manual \ + metadata \ + queue \ + stepping \ + streams \ + typefind + + +#appreader +#cutter +#events +#helloworld2 +#launch +#manual +#mixer +#pingpong +#plugins +#pwg +#queue2 +#queue3 +#queue4 +#retag +#thread +SUBDIRS = \ + $(always_dirs) \ + $(ADAPTER_TEST_DIR) \ + $(GST_PARSE_DIRS) + +DIST_SUBDIRS = $(always_dirs) adapter launch +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/common/parallel-subdirs.mak $(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 tests/examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/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): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean 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-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +.PHONY: independent-subdirs $(SUBDIRS) + +independent-subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ + +all-recursive: independent-subdirs + +# 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/tests/examples/adapter/Makefile.am b/tests/examples/adapter/Makefile.am new file mode 100644 index 0000000..6e4a4f4 --- /dev/null +++ b/tests/examples/adapter/Makefile.am @@ -0,0 +1,4 @@ +noinst_PROGRAMS = adapter_test + +adapter_test_LDADD = $(GST_OBJ_LIBS) $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la +adapter_test_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/examples/adapter/Makefile.in b/tests/examples/adapter/Makefile.in new file mode 100644 index 0000000..e20aa6b --- /dev/null +++ b/tests/examples/adapter/Makefile.in @@ -0,0 +1,688 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = adapter_test$(EXEEXT) +subdir = tests/examples/adapter +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +adapter_test_SOURCES = adapter_test.c +adapter_test_OBJECTS = adapter_test-adapter_test.$(OBJEXT) +am__DEPENDENCIES_1 = +adapter_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +adapter_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(adapter_test_CFLAGS) \ + $(CFLAGS) $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = adapter_test.c +DIST_SOURCES = adapter_test.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +adapter_test_LDADD = $(GST_OBJ_LIBS) $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la +adapter_test_CFLAGS = $(GST_OBJ_CFLAGS) +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 tests/examples/adapter/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/adapter/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +adapter_test$(EXEEXT): $(adapter_test_OBJECTS) $(adapter_test_DEPENDENCIES) + @rm -f adapter_test$(EXEEXT) + $(AM_V_CCLD)$(adapter_test_LINK) $(adapter_test_OBJECTS) $(adapter_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adapter_test-adapter_test.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +adapter_test-adapter_test.o: adapter_test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(adapter_test_CFLAGS) $(CFLAGS) -MT adapter_test-adapter_test.o -MD -MP -MF $(DEPDIR)/adapter_test-adapter_test.Tpo -c -o adapter_test-adapter_test.o `test -f 'adapter_test.c' || echo '$(srcdir)/'`adapter_test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adapter_test-adapter_test.Tpo $(DEPDIR)/adapter_test-adapter_test.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='adapter_test.c' object='adapter_test-adapter_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(adapter_test_CFLAGS) $(CFLAGS) -c -o adapter_test-adapter_test.o `test -f 'adapter_test.c' || echo '$(srcdir)/'`adapter_test.c + +adapter_test-adapter_test.obj: adapter_test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(adapter_test_CFLAGS) $(CFLAGS) -MT adapter_test-adapter_test.obj -MD -MP -MF $(DEPDIR)/adapter_test-adapter_test.Tpo -c -o adapter_test-adapter_test.obj `if test -f 'adapter_test.c'; then $(CYGPATH_W) 'adapter_test.c'; else $(CYGPATH_W) '$(srcdir)/adapter_test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adapter_test-adapter_test.Tpo $(DEPDIR)/adapter_test-adapter_test.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='adapter_test.c' object='adapter_test-adapter_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(adapter_test_CFLAGS) $(CFLAGS) -c -o adapter_test-adapter_test.obj `if test -f 'adapter_test.c'; then $(CYGPATH_W) 'adapter_test.c'; else $(CYGPATH_W) '$(srcdir)/adapter_test.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/examples/adapter/adapter_test.c b/tests/examples/adapter/adapter_test.c new file mode 100644 index 0000000..3bb5b4b --- /dev/null +++ b/tests/examples/adapter/adapter_test.c @@ -0,0 +1,139 @@ +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/times.h> + +#include <gst/gst.h> +#include <gst/base/gstadapter.h> + +struct TestParams +{ + gint tot_size; + gint read_size; + gint write_size; +}; + +/* This test pushes 'n' buffers of 'write size' into an adapter, then reads + * them out in 'read size' sized pieces, using take and then take_buffer, + * and prints the timings */ + +static struct TestParams param_sets[] = { +/* These values put ~256MB in 1MB chunks in an adapter, then reads them out + * in 250kb blocks */ + {256000000, 250000, 1000000}, +/* These values put ~256MB in 1000 byte chunks in an adapter, then reads them + * out in 200 byte blocks */ + {25600000, 200, 1000}, +/* These values put ~256MB in 200 chunks in an adapter, then reads them out + * in 1000 byte blocks */ + {25600000, 1000, 200} +}; + +static const gint n_tests = sizeof (param_sets) / sizeof (struct TestParams); + +static gint ticks_per_sec; + +static void +run_test_take (struct TestParams *params) +{ + /* Create an adapter and feed it data of fixed size, then retrieve it in + * a different size */ + GstAdapter *adapter = gst_adapter_new (); + guint8 *data; + GstBuffer *buf; + int i; + gint ntimes = params->tot_size / params->write_size; + + for (i = 0; i < ntimes; i++) { + buf = gst_buffer_new_and_alloc (params->write_size); + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + memset (data, 0, params->write_size); + gst_buffer_unmap (buf, data, params->write_size); + + gst_adapter_push (adapter, buf); + } + + do { + data = gst_adapter_take (adapter, params->read_size); + if (data == NULL) + break; + g_free (data); + } while (TRUE); + + g_object_unref (adapter); +} + +static void +run_test_take_buffer (struct TestParams *params) +{ + /* Create an adapter and feed it data of fixed size, then retrieve it in + * a different size + */ + GstAdapter *adapter = gst_adapter_new (); + GstBuffer *buf; + int i; + gint ntimes = params->tot_size / params->write_size; + guint8 *data; + + for (i = 0; i < ntimes; i++) { + buf = gst_buffer_new_and_alloc (params->write_size); + + data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE); + memset (data, 0, params->write_size); + gst_buffer_unmap (buf, data, params->write_size); + + gst_adapter_push (adapter, buf); + } + + do { + buf = gst_adapter_take_buffer (adapter, params->read_size); + if (buf == NULL) + break; + gst_buffer_unref (buf); + } while (TRUE); + + g_object_unref (adapter); +} + +static void +run_tests (struct TestParams *params) +{ + struct tms time_data; + gdouble start; + gdouble dur; + + g_print ("Running on %d bytes, writing %d bytes/buf, reading %d bytes/buf\n", + params->tot_size, params->write_size, params->read_size); + + start = 0.0; + run_test_take (params); + + times (&time_data); + dur = (gdouble) (time_data.tms_utime + time_data.tms_stime) / ticks_per_sec; + g_print ("Time for take test: %g secs\n", dur - start); + + start = dur; + run_test_take_buffer (params); + + times (&time_data); + dur = (gdouble) (time_data.tms_utime + time_data.tms_stime) / ticks_per_sec; + g_print ("Time for TakeBuffer test: %g secs\n", dur - start); + + g_print ("\n"); +} + +int +main (int argc, char **argv) +{ + gint i; + + ticks_per_sec = sysconf (_SC_CLK_TCK); + + gst_init (&argc, &argv); + + for (i = 0; i < n_tests; i++) + run_tests (param_sets + i); + + return 0; +} diff --git a/tests/examples/controller/Makefile.am b/tests/examples/controller/Makefile.am new file mode 100644 index 0000000..0255ea7 --- /dev/null +++ b/tests/examples/controller/Makefile.am @@ -0,0 +1,6 @@ +noinst_PROGRAMS = audio-example + +audio_example_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)/libs +audio_example_LDADD = \ + $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ + $(GST_OBJ_LIBS) diff --git a/tests/examples/controller/Makefile.in b/tests/examples/controller/Makefile.in new file mode 100644 index 0000000..ea3fae3 --- /dev/null +++ b/tests/examples/controller/Makefile.in @@ -0,0 +1,691 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = audio-example$(EXEEXT) +subdir = tests/examples/controller +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +audio_example_SOURCES = audio-example.c +audio_example_OBJECTS = audio_example-audio-example.$(OBJEXT) +am__DEPENDENCIES_1 = +audio_example_DEPENDENCIES = $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +audio_example_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(audio_example_CFLAGS) \ + $(CFLAGS) $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = audio-example.c +DIST_SOURCES = audio-example.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +audio_example_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)/libs +audio_example_LDADD = \ + $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ + $(GST_OBJ_LIBS) + +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 tests/examples/controller/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/controller/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +audio-example$(EXEEXT): $(audio_example_OBJECTS) $(audio_example_DEPENDENCIES) + @rm -f audio-example$(EXEEXT) + $(AM_V_CCLD)$(audio_example_LINK) $(audio_example_OBJECTS) $(audio_example_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio_example-audio-example.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +audio_example-audio-example.o: audio-example.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(audio_example_CFLAGS) $(CFLAGS) -MT audio_example-audio-example.o -MD -MP -MF $(DEPDIR)/audio_example-audio-example.Tpo -c -o audio_example-audio-example.o `test -f 'audio-example.c' || echo '$(srcdir)/'`audio-example.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audio_example-audio-example.Tpo $(DEPDIR)/audio_example-audio-example.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='audio-example.c' object='audio_example-audio-example.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(audio_example_CFLAGS) $(CFLAGS) -c -o audio_example-audio-example.o `test -f 'audio-example.c' || echo '$(srcdir)/'`audio-example.c + +audio_example-audio-example.obj: audio-example.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(audio_example_CFLAGS) $(CFLAGS) -MT audio_example-audio-example.obj -MD -MP -MF $(DEPDIR)/audio_example-audio-example.Tpo -c -o audio_example-audio-example.obj `if test -f 'audio-example.c'; then $(CYGPATH_W) 'audio-example.c'; else $(CYGPATH_W) '$(srcdir)/audio-example.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audio_example-audio-example.Tpo $(DEPDIR)/audio_example-audio-example.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='audio-example.c' object='audio_example-audio-example.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(audio_example_CFLAGS) $(CFLAGS) -c -o audio_example-audio-example.obj `if test -f 'audio-example.c'; then $(CYGPATH_W) 'audio-example.c'; else $(CYGPATH_W) '$(srcdir)/audio-example.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/examples/controller/audio-example.c b/tests/examples/controller/audio-example.c new file mode 100644 index 0000000..f5b2774 --- /dev/null +++ b/tests/examples/controller/audio-example.c @@ -0,0 +1,113 @@ +/* + * audio-example.c + * + * Builds a pipeline with audiotestsource->alsasink and sweeps frequency and + * volume. + * + * Needs gst-plugin-base installed. + */ + +#include <gst/gst.h> +#include <gst/controller/gstcontroller.h> +#include <gst/controller/gstinterpolationcontrolsource.h> + +gint +main (gint argc, gchar ** argv) +{ + gint res = 1; + GstElement *src, *sink; + GstElement *bin; + GstController *ctrl; + GstInterpolationControlSource *csource1, *csource2; + GstClock *clock; + GstClockID clock_id; + GstClockReturn wait_ret; + GValue vol = { 0, }; + + gst_init (&argc, &argv); + gst_controller_init (&argc, &argv); + + /* build pipeline */ + bin = gst_pipeline_new ("pipeline"); + clock = gst_pipeline_get_clock (GST_PIPELINE (bin)); + src = gst_element_factory_make ("audiotestsrc", "gen_audio"); + if (!src) { + GST_WARNING ("need audiotestsrc from gst-plugins-base"); + goto Error; + } + sink = gst_element_factory_make ("autoaudiosink", "play_audio"); + if (!sink) { + GST_WARNING ("need autoaudiosink from gst-plugins-base"); + goto Error; + } + + gst_bin_add_many (GST_BIN (bin), src, sink, NULL); + if (!gst_element_link (src, sink)) { + GST_WARNING ("can't link elements"); + goto Error; + } + + /* square wave + g_object_set (G_OBJECT(src), "wave", 1, NULL); + */ + + /* add a controller to the source */ + if (!(ctrl = gst_controller_new (G_OBJECT (src), "freq", "volume", NULL))) { + GST_WARNING ("can't control source element"); + goto Error; + } + + csource1 = gst_interpolation_control_source_new (); + csource2 = gst_interpolation_control_source_new (); + + gst_controller_set_control_source (ctrl, "volume", + GST_CONTROL_SOURCE (csource1)); + gst_controller_set_control_source (ctrl, "freq", + GST_CONTROL_SOURCE (csource2)); + + /* Set interpolation mode */ + + gst_interpolation_control_source_set_interpolation_mode (csource1, + GST_INTERPOLATE_LINEAR); + gst_interpolation_control_source_set_interpolation_mode (csource2, + GST_INTERPOLATE_LINEAR); + + /* set control values */ + g_value_init (&vol, G_TYPE_DOUBLE); + g_value_set_double (&vol, 0.0); + gst_interpolation_control_source_set (csource1, 0 * GST_SECOND, &vol); + g_value_set_double (&vol, 1.0); + gst_interpolation_control_source_set (csource1, 5 * GST_SECOND, &vol); + + g_object_unref (csource1); + + g_value_set_double (&vol, 220.0); + gst_interpolation_control_source_set (csource2, 0 * GST_SECOND, &vol); + g_value_set_double (&vol, 3520.0); + gst_interpolation_control_source_set (csource2, 3 * GST_SECOND, &vol); + g_value_set_double (&vol, 440.0); + gst_interpolation_control_source_set (csource2, 6 * GST_SECOND, &vol); + + g_object_unref (csource2); + + clock_id = + gst_clock_new_single_shot_id (clock, + gst_clock_get_time (clock) + (7 * GST_SECOND)); + + /* run for 7 seconds */ + if (gst_element_set_state (bin, GST_STATE_PLAYING)) { + if ((wait_ret = gst_clock_id_wait (clock_id, NULL)) != GST_CLOCK_OK) { + GST_WARNING ("clock_id_wait returned: %d", wait_ret); + } + gst_element_set_state (bin, GST_STATE_NULL); + } + + /* cleanup */ + g_object_unref (G_OBJECT (ctrl)); + gst_clock_id_unref (clock_id); + gst_object_unref (G_OBJECT (clock)); + gst_object_unref (G_OBJECT (bin)); + res = 0; +Error: + return (res); +} diff --git a/tests/examples/helloworld/Makefile.am b/tests/examples/helloworld/Makefile.am new file mode 100644 index 0000000..a7d1bd9 --- /dev/null +++ b/tests/examples/helloworld/Makefile.am @@ -0,0 +1,4 @@ +noinst_PROGRAMS = helloworld + +helloworld_LDADD = $(GST_OBJ_LIBS) +helloworld_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/examples/helloworld/Makefile.in b/tests/examples/helloworld/Makefile.in new file mode 100644 index 0000000..c86a9d1 --- /dev/null +++ b/tests/examples/helloworld/Makefile.in @@ -0,0 +1,687 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = helloworld$(EXEEXT) +subdir = tests/examples/helloworld +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +helloworld_SOURCES = helloworld.c +helloworld_OBJECTS = helloworld-helloworld.$(OBJEXT) +am__DEPENDENCIES_1 = +helloworld_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +helloworld_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(helloworld_CFLAGS) \ + $(CFLAGS) $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = helloworld.c +DIST_SOURCES = helloworld.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +helloworld_LDADD = $(GST_OBJ_LIBS) +helloworld_CFLAGS = $(GST_OBJ_CFLAGS) +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 tests/examples/helloworld/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/helloworld/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +helloworld$(EXEEXT): $(helloworld_OBJECTS) $(helloworld_DEPENDENCIES) + @rm -f helloworld$(EXEEXT) + $(AM_V_CCLD)$(helloworld_LINK) $(helloworld_OBJECTS) $(helloworld_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helloworld-helloworld.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +helloworld-helloworld.o: helloworld.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(helloworld_CFLAGS) $(CFLAGS) -MT helloworld-helloworld.o -MD -MP -MF $(DEPDIR)/helloworld-helloworld.Tpo -c -o helloworld-helloworld.o `test -f 'helloworld.c' || echo '$(srcdir)/'`helloworld.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/helloworld-helloworld.Tpo $(DEPDIR)/helloworld-helloworld.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='helloworld.c' object='helloworld-helloworld.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(helloworld_CFLAGS) $(CFLAGS) -c -o helloworld-helloworld.o `test -f 'helloworld.c' || echo '$(srcdir)/'`helloworld.c + +helloworld-helloworld.obj: helloworld.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(helloworld_CFLAGS) $(CFLAGS) -MT helloworld-helloworld.obj -MD -MP -MF $(DEPDIR)/helloworld-helloworld.Tpo -c -o helloworld-helloworld.obj `if test -f 'helloworld.c'; then $(CYGPATH_W) 'helloworld.c'; else $(CYGPATH_W) '$(srcdir)/helloworld.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/helloworld-helloworld.Tpo $(DEPDIR)/helloworld-helloworld.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='helloworld.c' object='helloworld-helloworld.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(helloworld_CFLAGS) $(CFLAGS) -c -o helloworld-helloworld.obj `if test -f 'helloworld.c'; then $(CYGPATH_W) 'helloworld.c'; else $(CYGPATH_W) '$(srcdir)/helloworld.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/examples/helloworld/helloworld.c b/tests/examples/helloworld/helloworld.c new file mode 100644 index 0000000..a659f5b --- /dev/null +++ b/tests/examples/helloworld/helloworld.c @@ -0,0 +1,80 @@ +#include <gst/gst.h> + +static gboolean +bus_call (GstBus * bus, GstMessage * msg, gpointer data) +{ + GMainLoop *loop = (GMainLoop *) data; + + switch (GST_MESSAGE_TYPE (msg)) { + case GST_MESSAGE_EOS:{ + g_print ("End-of-stream\n"); + g_main_loop_quit (loop); + break; + } + case GST_MESSAGE_ERROR:{ + gchar *debug; + GError *err; + + gst_message_parse_error (msg, &err, &debug); + g_free (debug); + + g_print ("Error: %s\n", err->message); + g_error_free (err); + + g_main_loop_quit (loop); + + break; + } + default: + break; + } + return TRUE; +} + +gint +main (gint argc, gchar * argv[]) +{ + GstElement *playbin; + GMainLoop *loop; + GstBus *bus; + gchar *uri; + + gst_init (&argc, &argv); + + if (argc < 2) { + g_print ("usage: %s <media file or uri>\n", argv[0]); + return 1; + } + + playbin = gst_element_factory_make ("playbin2", NULL); + if (!playbin) { + g_print ("'playbin2' gstreamer plugin missing\n"); + return 1; + } + + /* take the commandline argument and ensure that it is a uri */ + if (gst_uri_is_valid (argv[1])) + uri = g_strdup (argv[1]); + else + uri = gst_filename_to_uri (argv[1], NULL); + g_object_set (playbin, "uri", uri, NULL); + g_free (uri); + + /* create and event loop and feed gstreamer bus mesages to it */ + loop = g_main_loop_new (NULL, FALSE); + + bus = gst_element_get_bus (playbin); + gst_bus_add_watch (bus, bus_call, loop); + g_object_unref (bus); + + /* start play back and listed to events */ + gst_element_set_state (playbin, GST_STATE_PLAYING); + g_main_loop_run (loop); + + /* cleanup */ + gst_element_set_state (playbin, GST_STATE_NULL); + g_object_unref (playbin); + g_main_loop_unref (loop); + + return 0; +} diff --git a/tests/examples/launch/Makefile.am b/tests/examples/launch/Makefile.am new file mode 100644 index 0000000..bee5789 --- /dev/null +++ b/tests/examples/launch/Makefile.am @@ -0,0 +1,7 @@ +noinst_PROGRAMS = mp3parselaunch + +mp3parselaunch_LDADD = $(GST_OBJ_LIBS) +mp3parselaunch_CFLAGS = $(GST_OBJ_CFLAGS) + +#noinst_SCRIPTS = mp3play +#EXTRA_DIST = mp3play diff --git a/tests/examples/launch/Makefile.in b/tests/examples/launch/Makefile.in new file mode 100644 index 0000000..8c68194 --- /dev/null +++ b/tests/examples/launch/Makefile.in @@ -0,0 +1,691 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = mp3parselaunch$(EXEEXT) +subdir = tests/examples/launch +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +mp3parselaunch_SOURCES = mp3parselaunch.c +mp3parselaunch_OBJECTS = mp3parselaunch-mp3parselaunch.$(OBJEXT) +am__DEPENDENCIES_1 = +mp3parselaunch_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +mp3parselaunch_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(mp3parselaunch_CFLAGS) $(CFLAGS) $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = mp3parselaunch.c +DIST_SOURCES = mp3parselaunch.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +mp3parselaunch_LDADD = $(GST_OBJ_LIBS) +mp3parselaunch_CFLAGS = $(GST_OBJ_CFLAGS) +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 tests/examples/launch/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/launch/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +mp3parselaunch$(EXEEXT): $(mp3parselaunch_OBJECTS) $(mp3parselaunch_DEPENDENCIES) + @rm -f mp3parselaunch$(EXEEXT) + $(AM_V_CCLD)$(mp3parselaunch_LINK) $(mp3parselaunch_OBJECTS) $(mp3parselaunch_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp3parselaunch-mp3parselaunch.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mp3parselaunch-mp3parselaunch.o: mp3parselaunch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mp3parselaunch_CFLAGS) $(CFLAGS) -MT mp3parselaunch-mp3parselaunch.o -MD -MP -MF $(DEPDIR)/mp3parselaunch-mp3parselaunch.Tpo -c -o mp3parselaunch-mp3parselaunch.o `test -f 'mp3parselaunch.c' || echo '$(srcdir)/'`mp3parselaunch.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mp3parselaunch-mp3parselaunch.Tpo $(DEPDIR)/mp3parselaunch-mp3parselaunch.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mp3parselaunch.c' object='mp3parselaunch-mp3parselaunch.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mp3parselaunch_CFLAGS) $(CFLAGS) -c -o mp3parselaunch-mp3parselaunch.o `test -f 'mp3parselaunch.c' || echo '$(srcdir)/'`mp3parselaunch.c + +mp3parselaunch-mp3parselaunch.obj: mp3parselaunch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mp3parselaunch_CFLAGS) $(CFLAGS) -MT mp3parselaunch-mp3parselaunch.obj -MD -MP -MF $(DEPDIR)/mp3parselaunch-mp3parselaunch.Tpo -c -o mp3parselaunch-mp3parselaunch.obj `if test -f 'mp3parselaunch.c'; then $(CYGPATH_W) 'mp3parselaunch.c'; else $(CYGPATH_W) '$(srcdir)/mp3parselaunch.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mp3parselaunch-mp3parselaunch.Tpo $(DEPDIR)/mp3parselaunch-mp3parselaunch.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mp3parselaunch.c' object='mp3parselaunch-mp3parselaunch.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mp3parselaunch_CFLAGS) $(CFLAGS) -c -o mp3parselaunch-mp3parselaunch.obj `if test -f 'mp3parselaunch.c'; then $(CYGPATH_W) 'mp3parselaunch.c'; else $(CYGPATH_W) '$(srcdir)/mp3parselaunch.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +#noinst_SCRIPTS = mp3play +#EXTRA_DIST = mp3play + +# 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/tests/examples/launch/mp3parselaunch.c b/tests/examples/launch/mp3parselaunch.c new file mode 100644 index 0000000..cc00a07 --- /dev/null +++ b/tests/examples/launch/mp3parselaunch.c @@ -0,0 +1,86 @@ +#include <stdio.h> +#include <stdlib.h> +#include <gst/gst.h> + +static void +event_loop (GstElement * pipe) +{ + GstBus *bus; + GstMessage *message = NULL; + gboolean running = TRUE; + + bus = gst_element_get_bus (GST_ELEMENT (pipe)); + + while (running) { + message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); + + g_assert (message != NULL); + + switch (message->type) { + case GST_MESSAGE_EOS: + running = FALSE; + break; + case GST_MESSAGE_WARNING:{ + GError *gerror; + gchar *debug; + + gst_message_parse_warning (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + break; + } + case GST_MESSAGE_ERROR:{ + GError *gerror; + gchar *debug; + + gst_message_parse_error (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + running = FALSE; + break; + } + default: + break; + } + gst_message_unref (message); + } + gst_object_unref (bus); +} + +int +main (int argc, char *argv[]) +{ + GstElement *bin; + GstElement *filesrc; + GError *error = NULL; + + gst_init (&argc, &argv); + + if (argc != 2) { + g_print ("usage: %s <mp3 file>\n", argv[0]); + exit (-1); + } + + bin = (GstElement *) + gst_parse_launch ("filesrc name=my_filesrc ! mad ! osssink", &error); + if (!bin) { + fprintf (stderr, "Parse error: %s", error->message); + exit (-1); + } + + filesrc = gst_bin_get_by_name (GST_BIN (bin), "my_filesrc"); + g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); + + /* start playing */ + gst_element_set_state (bin, GST_STATE_PLAYING); + + /* Run event loop listening for bus messages until EOS or ERROR */ + event_loop (bin); + + /* stop the bin */ + gst_element_set_state (bin, GST_STATE_NULL); + + exit (0); +} diff --git a/tests/examples/manual/Makefile.am b/tests/examples/manual/Makefile.am new file mode 100644 index 0000000..d180a94 --- /dev/null +++ b/tests/examples/manual/Makefile.am @@ -0,0 +1,94 @@ +# if HAVE_LIBGNOMEUI +# GNOME = gnome +# else +GNOME = +# endif + +# gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS) +# gnome_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS) + +CHECK_REGISTRY = $(top_builddir)/tests/examples/manual/test-registry.reg + +REGISTRY_ENVIRONMENT = \ + GST_REGISTRY=$(CHECK_REGISTRY) + +TESTS_ENVIRONMENT = \ + $(REGISTRY_ENVIRONMENT) \ + GST_PLUGIN_SCANNER=$(top_builddir)/libs/gst/helpers/gst-plugin-scanner \ + GST_PLUGIN_SYSTEM_PATH= \ + GST_PLUGIN_PATH=$(top_builddir)/plugins + +EXTRA_DIST = extract.pl + +EXAMPLES = \ + dynamic \ + $(GNOME) \ + elementcreate \ + elementmake \ + elementfactory \ + elementget \ + elementlink \ + bin \ + pad \ + ghostpad \ + helloworld \ + init \ + query \ + typefind \ + fakesrc \ + playbin \ + decodebin + +BUILT_SOURCES = \ + elementmake.c elementcreate.c elementget.c elementlink.c elementfactory.c \ + bin.c \ + pad.c ghostpad.c \ + gnome.c \ + helloworld.c \ + init.c \ + query.c \ + typefind.c dynamic.c \ + fakesrc.c \ + playbin.c decodebin.c + +CLEANFILES = core core.* test-registry.* *.gcno *.gcda $(BUILT_SOURCES) + +AM_CFLAGS = $(GST_OBJ_CFLAGS) +LDADD = $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(GST_OBJ_LIBS) + +elementmake.c elementcreate.c elementget.c elementlink.c elementfactory.c: $(top_srcdir)/docs/manual/basics-elements.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +bin.c : $(top_srcdir)/docs/manual/basics-bins.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +pad.c ghostpad.c: $(top_srcdir)/docs/manual/basics-pads.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +gnome.c: $(top_srcdir)/docs/manual/appendix-integration.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +helloworld.c: $(top_srcdir)/docs/manual/basics-helloworld.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +init.c: $(top_srcdir)/docs/manual/basics-init.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +query.c: $(top_srcdir)/docs/manual/advanced-position.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +typefind.c dynamic.c: $(top_srcdir)/docs/manual/advanced-autoplugging.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +fakesrc.c: $(top_srcdir)/docs/manual/advanced-dataaccess.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +playbin.c decodebin.c: $(top_srcdir)/docs/manual/highlevel-components.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +TESTS = bin \ + elementcreate elementfactory elementget elementlink elementmake \ + ghostpad init + +noinst_PROGRAMS = $(EXAMPLES) diff --git a/tests/examples/manual/Makefile.in b/tests/examples/manual/Makefile.in new file mode 100644 index 0000000..4b323f5 --- /dev/null +++ b/tests/examples/manual/Makefile.in @@ -0,0 +1,1021 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +TESTS = bin$(EXEEXT) elementcreate$(EXEEXT) elementfactory$(EXEEXT) \ + elementget$(EXEEXT) elementlink$(EXEEXT) elementmake$(EXEEXT) \ + ghostpad$(EXEEXT) init$(EXEEXT) +noinst_PROGRAMS = $(am__EXEEXT_2) +subdir = tests/examples/manual +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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__EXEEXT_1 = +am__EXEEXT_2 = dynamic$(EXEEXT) $(am__EXEEXT_1) elementcreate$(EXEEXT) \ + elementmake$(EXEEXT) elementfactory$(EXEEXT) \ + elementget$(EXEEXT) elementlink$(EXEEXT) bin$(EXEEXT) \ + pad$(EXEEXT) ghostpad$(EXEEXT) helloworld$(EXEEXT) \ + init$(EXEEXT) query$(EXEEXT) typefind$(EXEEXT) \ + fakesrc$(EXEEXT) playbin$(EXEEXT) decodebin$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +bin_SOURCES = bin.c +bin_OBJECTS = bin.$(OBJEXT) +bin_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +bin_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +decodebin_SOURCES = decodebin.c +decodebin_OBJECTS = decodebin.$(OBJEXT) +decodebin_LDADD = $(LDADD) +decodebin_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +dynamic_SOURCES = dynamic.c +dynamic_OBJECTS = dynamic.$(OBJEXT) +dynamic_LDADD = $(LDADD) +dynamic_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elementcreate_SOURCES = elementcreate.c +elementcreate_OBJECTS = elementcreate.$(OBJEXT) +elementcreate_LDADD = $(LDADD) +elementcreate_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elementfactory_SOURCES = elementfactory.c +elementfactory_OBJECTS = elementfactory.$(OBJEXT) +elementfactory_LDADD = $(LDADD) +elementfactory_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elementget_SOURCES = elementget.c +elementget_OBJECTS = elementget.$(OBJEXT) +elementget_LDADD = $(LDADD) +elementget_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elementlink_SOURCES = elementlink.c +elementlink_OBJECTS = elementlink.$(OBJEXT) +elementlink_LDADD = $(LDADD) +elementlink_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +elementmake_SOURCES = elementmake.c +elementmake_OBJECTS = elementmake.$(OBJEXT) +elementmake_LDADD = $(LDADD) +elementmake_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +fakesrc_SOURCES = fakesrc.c +fakesrc_OBJECTS = fakesrc.$(OBJEXT) +fakesrc_LDADD = $(LDADD) +fakesrc_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +ghostpad_SOURCES = ghostpad.c +ghostpad_OBJECTS = ghostpad.$(OBJEXT) +ghostpad_LDADD = $(LDADD) +ghostpad_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +helloworld_SOURCES = helloworld.c +helloworld_OBJECTS = helloworld.$(OBJEXT) +helloworld_LDADD = $(LDADD) +helloworld_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +init_SOURCES = init.c +init_OBJECTS = init.$(OBJEXT) +init_LDADD = $(LDADD) +init_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +pad_SOURCES = pad.c +pad_OBJECTS = pad.$(OBJEXT) +pad_LDADD = $(LDADD) +pad_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +playbin_SOURCES = playbin.c +playbin_OBJECTS = playbin.$(OBJEXT) +playbin_LDADD = $(LDADD) +playbin_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +query_SOURCES = query.c +query_OBJECTS = query.$(OBJEXT) +query_LDADD = $(LDADD) +query_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +typefind_SOURCES = typefind.c +typefind_OBJECTS = typefind.$(OBJEXT) +typefind_LDADD = $(LDADD) +typefind_DEPENDENCIES = \ + $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(am__DEPENDENCIES_1) +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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = bin.c decodebin.c dynamic.c elementcreate.c elementfactory.c \ + elementget.c elementlink.c elementmake.c fakesrc.c ghostpad.c \ + helloworld.c init.c pad.c playbin.c query.c typefind.c +DIST_SOURCES = bin.c decodebin.c dynamic.c elementcreate.c \ + elementfactory.c elementget.c elementlink.c elementmake.c \ + fakesrc.c ghostpad.c helloworld.c init.c pad.c playbin.c \ + query.c typefind.c +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ + +# if HAVE_LIBGNOMEUI +# GNOME = gnome +# else +GNOME = +# endif + +# gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS) +# gnome_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS) +CHECK_REGISTRY = $(top_builddir)/tests/examples/manual/test-registry.reg +REGISTRY_ENVIRONMENT = \ + GST_REGISTRY=$(CHECK_REGISTRY) + +TESTS_ENVIRONMENT = \ + $(REGISTRY_ENVIRONMENT) \ + GST_PLUGIN_SCANNER=$(top_builddir)/libs/gst/helpers/gst-plugin-scanner \ + GST_PLUGIN_SYSTEM_PATH= \ + GST_PLUGIN_PATH=$(top_builddir)/plugins + +EXTRA_DIST = extract.pl +EXAMPLES = \ + dynamic \ + $(GNOME) \ + elementcreate \ + elementmake \ + elementfactory \ + elementget \ + elementlink \ + bin \ + pad \ + ghostpad \ + helloworld \ + init \ + query \ + typefind \ + fakesrc \ + playbin \ + decodebin + +BUILT_SOURCES = \ + elementmake.c elementcreate.c elementget.c elementlink.c elementfactory.c \ + bin.c \ + pad.c ghostpad.c \ + gnome.c \ + helloworld.c \ + init.c \ + query.c \ + typefind.c dynamic.c \ + fakesrc.c \ + playbin.c decodebin.c + +CLEANFILES = core core.* test-registry.* *.gcno *.gcda $(BUILT_SOURCES) +AM_CFLAGS = $(GST_OBJ_CFLAGS) +LDADD = $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \ + $(GST_OBJ_LIBS) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) 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 tests/examples/manual/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/manual/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +bin$(EXEEXT): $(bin_OBJECTS) $(bin_DEPENDENCIES) + @rm -f bin$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(bin_OBJECTS) $(bin_LDADD) $(LIBS) +decodebin$(EXEEXT): $(decodebin_OBJECTS) $(decodebin_DEPENDENCIES) + @rm -f decodebin$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(decodebin_OBJECTS) $(decodebin_LDADD) $(LIBS) +dynamic$(EXEEXT): $(dynamic_OBJECTS) $(dynamic_DEPENDENCIES) + @rm -f dynamic$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(dynamic_OBJECTS) $(dynamic_LDADD) $(LIBS) +elementcreate$(EXEEXT): $(elementcreate_OBJECTS) $(elementcreate_DEPENDENCIES) + @rm -f elementcreate$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elementcreate_OBJECTS) $(elementcreate_LDADD) $(LIBS) +elementfactory$(EXEEXT): $(elementfactory_OBJECTS) $(elementfactory_DEPENDENCIES) + @rm -f elementfactory$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elementfactory_OBJECTS) $(elementfactory_LDADD) $(LIBS) +elementget$(EXEEXT): $(elementget_OBJECTS) $(elementget_DEPENDENCIES) + @rm -f elementget$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elementget_OBJECTS) $(elementget_LDADD) $(LIBS) +elementlink$(EXEEXT): $(elementlink_OBJECTS) $(elementlink_DEPENDENCIES) + @rm -f elementlink$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elementlink_OBJECTS) $(elementlink_LDADD) $(LIBS) +elementmake$(EXEEXT): $(elementmake_OBJECTS) $(elementmake_DEPENDENCIES) + @rm -f elementmake$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(elementmake_OBJECTS) $(elementmake_LDADD) $(LIBS) +fakesrc$(EXEEXT): $(fakesrc_OBJECTS) $(fakesrc_DEPENDENCIES) + @rm -f fakesrc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fakesrc_OBJECTS) $(fakesrc_LDADD) $(LIBS) +ghostpad$(EXEEXT): $(ghostpad_OBJECTS) $(ghostpad_DEPENDENCIES) + @rm -f ghostpad$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ghostpad_OBJECTS) $(ghostpad_LDADD) $(LIBS) +helloworld$(EXEEXT): $(helloworld_OBJECTS) $(helloworld_DEPENDENCIES) + @rm -f helloworld$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(helloworld_OBJECTS) $(helloworld_LDADD) $(LIBS) +init$(EXEEXT): $(init_OBJECTS) $(init_DEPENDENCIES) + @rm -f init$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(init_OBJECTS) $(init_LDADD) $(LIBS) +pad$(EXEEXT): $(pad_OBJECTS) $(pad_DEPENDENCIES) + @rm -f pad$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pad_OBJECTS) $(pad_LDADD) $(LIBS) +playbin$(EXEEXT): $(playbin_OBJECTS) $(playbin_DEPENDENCIES) + @rm -f playbin$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(playbin_OBJECTS) $(playbin_LDADD) $(LIBS) +query$(EXEEXT): $(query_OBJECTS) $(query_DEPENDENCIES) + @rm -f query$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(query_OBJECTS) $(query_LDADD) $(LIBS) +typefind$(EXEEXT): $(typefind_OBJECTS) $(typefind_DEPENDENCIES) + @rm -f typefind$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(typefind_OBJECTS) $(typefind_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decodebin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynamic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementcreate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementfactory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementlink.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elementmake.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fakesrc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ghostpad.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helloworld.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pad.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/playbin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/typefind.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +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 + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +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 + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + 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-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: + +.MAKE: all check check-am install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS 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-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 + + +elementmake.c elementcreate.c elementget.c elementlink.c elementfactory.c: $(top_srcdir)/docs/manual/basics-elements.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +bin.c : $(top_srcdir)/docs/manual/basics-bins.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +pad.c ghostpad.c: $(top_srcdir)/docs/manual/basics-pads.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +gnome.c: $(top_srcdir)/docs/manual/appendix-integration.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +helloworld.c: $(top_srcdir)/docs/manual/basics-helloworld.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +init.c: $(top_srcdir)/docs/manual/basics-init.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +query.c: $(top_srcdir)/docs/manual/advanced-position.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +typefind.c dynamic.c: $(top_srcdir)/docs/manual/advanced-autoplugging.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +fakesrc.c: $(top_srcdir)/docs/manual/advanced-dataaccess.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +playbin.c decodebin.c: $(top_srcdir)/docs/manual/highlevel-components.xml + $(PERL_PATH) $(srcdir)/extract.pl $@ $< + +# 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/tests/examples/manual/bin.c b/tests/examples/manual/bin.c new file mode 100644 index 0000000..edcdbaa --- /dev/null +++ b/tests/examples/manual/bin.c @@ -0,0 +1,32 @@ + +/*** block a from ../../../docs/manual/basics-bins.xml ***/ +#include <gst/gst.h> + +int +main (int argc, + char *argv[]) +{ + GstElement *bin, *pipeline, *source, *sink; + + /* init */ + gst_init (&argc, &argv); + + /* create */ + pipeline = gst_pipeline_new ("my_pipeline"); + bin = gst_bin_new ("my_bin"); + source = gst_element_factory_make ("fakesrc", "source"); + sink = gst_element_factory_make ("fakesink", "sink"); + + /* First add the elements to the bin */ + gst_bin_add_many (GST_BIN (bin), source, sink, NULL); + /* add the bin to the pipeline */ + gst_bin_add (GST_BIN (pipeline), bin); + + /* link the elements */ + gst_element_link (source, sink); + +/*** block b from ../../../docs/manual/basics-bins.xml ***/ + return 0; + +/*** block c from ../../../docs/manual/basics-bins.xml ***/ +} diff --git a/tests/examples/manual/decodebin.c b/tests/examples/manual/decodebin.c new file mode 100644 index 0000000..cfbbb5f --- /dev/null +++ b/tests/examples/manual/decodebin.c @@ -0,0 +1,129 @@ + +/*** block a from ../../../docs/manual/highlevel-components.xml ***/ +#include <gst/gst.h> + +/*** block b from ../../../docs/manual/highlevel-components.xml ***/ +static gboolean +my_bus_callback (GstBus *bus, + GstMessage *message, + gpointer data) +{ + GMainLoop *loop = data; + + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR: { + GError *err; + gchar *debug; + + gst_message_parse_error (message, &err, &debug); + g_print ("Error: %s\n", err->message); + g_error_free (err); + g_free (debug); + + g_main_loop_quit (loop); + break; + } + case GST_MESSAGE_EOS: + /* end-of-stream */ + g_main_loop_quit (loop); + break; + default: + /* unhandled message */ + break; + } + + /* remove message from the queue */ + return TRUE; +} + +/*** block c from ../../../docs/manual/highlevel-components.xml ***/ +GstElement *pipeline, *audio; + +static void +cb_newpad (GstElement *decodebin, + GstPad *pad, + gboolean last, + gpointer data) +{ + GstCaps *caps; + GstStructure *str; + GstPad *audiopad; + + /* only link once */ + audiopad = gst_element_get_static_pad (audio, "sink"); + if (GST_PAD_IS_LINKED (audiopad)) { + g_object_unref (audiopad); + return; + } + + /* check media type */ + caps = gst_pad_get_caps (pad, NULL); + str = gst_caps_get_structure (caps, 0); + if (!g_strrstr (gst_structure_get_name (str), "audio")) { + gst_caps_unref (caps); + gst_object_unref (audiopad); + return; + } + gst_caps_unref (caps); + + /* link'n'play */ + gst_pad_link (pad, audiopad); + + g_object_unref (audiopad); +} + +gint +main (gint argc, + gchar *argv[]) +{ + GMainLoop *loop; + GstElement *src, *dec, *conv, *sink; + GstPad *audiopad; + GstBus *bus; + + /* init GStreamer */ + gst_init (&argc, &argv); + loop = g_main_loop_new (NULL, FALSE); + + /* make sure we have input */ + if (argc != 2) { + g_print ("Usage: %s <filename>\n", argv[0]); + return -1; + } + + /* setup */ + pipeline = gst_pipeline_new ("pipeline"); + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + gst_bus_add_watch (bus, my_bus_callback, loop); + gst_object_unref (bus); + + src = gst_element_factory_make ("filesrc", "source"); + g_object_set (G_OBJECT (src), "location", argv[1], NULL); + dec = gst_element_factory_make ("decodebin", "decoder"); + g_signal_connect (dec, "new-decoded-pad", G_CALLBACK (cb_newpad), NULL); + gst_bin_add_many (GST_BIN (pipeline), src, dec, NULL); + gst_element_link (src, dec); + + /* create audio output */ + audio = gst_bin_new ("audiobin"); + conv = gst_element_factory_make ("audioconvert", "aconv"); + audiopad = gst_element_get_static_pad (conv, "sink"); + sink = gst_element_factory_make ("alsasink", "sink"); + gst_bin_add_many (GST_BIN (audio), conv, sink, NULL); + gst_element_link (conv, sink); + gst_element_add_pad (audio, + gst_ghost_pad_new ("sink", audiopad)); + gst_object_unref (audiopad); + gst_bin_add (GST_BIN (pipeline), audio); + + /* run */ + gst_element_set_state (pipeline, GST_STATE_PLAYING); + g_main_loop_run (loop); + + /* cleanup */ + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + return 0; +} diff --git a/tests/examples/manual/dynamic.c b/tests/examples/manual/dynamic.c new file mode 100644 index 0000000..e133ef6 --- /dev/null +++ b/tests/examples/manual/dynamic.c @@ -0,0 +1,330 @@ + +/*** block a from ../../../docs/manual/advanced-autoplugging.xml ***/ +#include <gst/gst.h> + +GstElement *pipeline; + +/*** block b from ../../../docs/manual/advanced-autoplugging.xml ***/ +static GList *factories; + +/* + * This function is called by the registry loader. Its return value + * (TRUE or FALSE) decides whether the given feature will be included + * in the list that we're generating further down. + */ + +static gboolean +cb_feature_filter (GstPluginFeature *feature, + gpointer data) +{ + const gchar *klass; + guint rank; + + /* we only care about element factories */ + if (!GST_IS_ELEMENT_FACTORY (feature)) + return FALSE; + + /* only parsers, demuxers and decoders */ + klass = gst_element_factory_get_klass (GST_ELEMENT_FACTORY (feature)); + if (g_strrstr (klass, "Demux") == NULL && + g_strrstr (klass, "Decoder") == NULL && + g_strrstr (klass, "Parse") == NULL) + return FALSE; + + /* only select elements with autoplugging rank */ + rank = gst_plugin_feature_get_rank (feature); + if (rank < GST_RANK_MARGINAL) + return FALSE; + + return TRUE; +} + +/* + * This function is called to sort features by rank. + */ + +static gint +cb_compare_ranks (GstPluginFeature *f1, + GstPluginFeature *f2) +{ + return gst_plugin_feature_get_rank (f2) - gst_plugin_feature_get_rank (f1); +} + +static void +init_factories (void) +{ + /* first filter out the interesting element factories */ + factories = gst_registry_feature_filter ( + gst_registry_get_default (), + (GstPluginFeatureFilter) cb_feature_filter, FALSE, NULL); + + /* sort them according to their ranks */ + factories = g_list_sort (factories, (GCompareFunc) cb_compare_ranks); +} + +/*** block c from ../../../docs/manual/advanced-autoplugging.xml ***/ +static void try_to_plug (GstPad *pad, const GstCaps *caps); + +static GstElement *audiosink; + +static void +cb_newpad (GstElement *element, + GstPad *pad, + gpointer data) +{ + GstCaps *caps; + + caps = gst_pad_get_caps (pad, NULL); + try_to_plug (pad, caps); + gst_caps_unref (caps); +} + +static void +close_link (GstPad *srcpad, + GstElement *sinkelement, + const gchar *padname, + const GList *templlist) +{ + GstPad *pad; + gboolean has_dynamic_pads = FALSE; + + g_print ("Plugging pad %s:%s to newly created %s:%s\n", + gst_object_get_name (GST_OBJECT (gst_pad_get_parent (srcpad))), + gst_pad_get_name (srcpad), + gst_object_get_name (GST_OBJECT (sinkelement)), padname); + + /* add the element to the pipeline and set correct state */ + if (sinkelement != audiosink) { + gst_bin_add (GST_BIN (pipeline), sinkelement); + gst_element_set_state (sinkelement, GST_STATE_READY); + } + pad = gst_element_get_static_pad (sinkelement, padname); + gst_pad_link (srcpad, pad); + if (sinkelement != audiosink) { + gst_element_set_state (sinkelement, GST_STATE_PAUSED); + } + gst_object_unref (GST_OBJECT (pad)); + + /* if we have static source pads, link those. If we have dynamic + * source pads, listen for pad-added signals on the element */ + for ( ; templlist != NULL; templlist = templlist->next) { + GstStaticPadTemplate *templ = templlist->data; + + /* only sourcepads, no request pads */ + if (templ->direction != GST_PAD_SRC || + templ->presence == GST_PAD_REQUEST) { + continue; + } + + switch (templ->presence) { + case GST_PAD_ALWAYS: { + GstPad *pad = gst_element_get_static_pad (sinkelement, templ->name_template); + GstCaps *caps = gst_pad_get_caps (pad, NULL); + + /* link */ + try_to_plug (pad, caps); + gst_object_unref (GST_OBJECT (pad)); + gst_caps_unref (caps); + break; + } + case GST_PAD_SOMETIMES: + has_dynamic_pads = TRUE; + break; + default: + break; + } + } + + /* listen for newly created pads if this element supports that */ + if (has_dynamic_pads) { + g_signal_connect (sinkelement, "pad-added", G_CALLBACK (cb_newpad), NULL); + } +} + +static void +try_to_plug (GstPad *pad, + const GstCaps *caps) +{ + GstObject *parent = GST_OBJECT (GST_OBJECT_PARENT (pad)); + const gchar *mime; + const GList *item; + GstCaps *res, *audiocaps; + + /* don't plug if we're already plugged - FIXME: memleak for pad */ + if (GST_PAD_IS_LINKED (gst_element_get_static_pad (audiosink, "sink"))) { + g_print ("Omitting link for pad %s:%s because we're already linked\n", + GST_OBJECT_NAME (parent), GST_OBJECT_NAME (pad)); + return; + } + + /* as said above, we only try to plug audio... Omit video */ + mime = gst_structure_get_name (gst_caps_get_structure (caps, 0)); + if (g_strrstr (mime, "video")) { + g_print ("Omitting link for pad %s:%s because mimetype %s is non-audio\n", + GST_OBJECT_NAME (parent), GST_OBJECT_NAME (pad), mime); + return; + } + + /* can it link to the audiopad? */ + audiocaps = gst_pad_get_caps (gst_element_get_static_pad (audiosink, "sink"), + NULL); + res = gst_caps_intersect (caps, audiocaps); + if (res && !gst_caps_is_empty (res)) { + g_print ("Found pad to link to audiosink - plugging is now done\n"); + close_link (pad, audiosink, "sink", NULL); + gst_caps_unref (audiocaps); + gst_caps_unref (res); + return; + } + gst_caps_unref (audiocaps); + gst_caps_unref (res); + + /* try to plug from our list */ + for (item = factories; item != NULL; item = item->next) { + GstElementFactory *factory = GST_ELEMENT_FACTORY (item->data); + const GList *pads; + + for (pads = gst_element_factory_get_static_pad_templates (factory); + pads != NULL; pads = pads->next) { + GstStaticPadTemplate *templ = pads->data; + + /* find the sink template - need an always pad*/ + if (templ->direction != GST_PAD_SINK || + templ->presence != GST_PAD_ALWAYS) { + continue; + } + + /* can it link? */ + res = gst_caps_intersect (caps, + gst_static_caps_get (&templ->static_caps)); + if (res && !gst_caps_is_empty (res)) { + GstElement *element; + gchar *name_template = g_strdup (templ->name_template); + + /* close link and return */ + gst_caps_unref (res); + element = gst_element_factory_create (factory, NULL); + close_link (pad, element, name_template, + gst_element_factory_get_static_pad_templates (factory)); + g_free (name_template); + return; + } + gst_caps_unref (res); + + /* we only check one sink template per factory, so move on to the + * next factory now */ + break; + } + } + + /* if we get here, no item was found */ + g_print ("No compatible pad found to decode %s on %s:%s\n", + mime, GST_OBJECT_NAME (parent), GST_OBJECT_NAME (pad)); +} + +static void +cb_typefound (GstElement *typefind, + guint probability, + GstCaps *caps, + gpointer data) +{ + gchar *s; + GstPad *pad; + + s = gst_caps_to_string (caps); + g_print ("Detected media type %s\n", s); + g_free (s); + + /* actually plug now */ + pad = gst_element_get_static_pad (typefind, "src"); + try_to_plug (pad, caps); + gst_object_unref (GST_OBJECT (pad)); +} + +/*** block d from ../../../docs/manual/advanced-autoplugging.xml ***/ +static gboolean +my_bus_callback (GstBus *bus, + GstMessage *message, + gpointer data) +{ + GMainLoop *loop = data; + + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR: { + GError *err; + gchar *debug; + + gst_message_parse_error (message, &err, &debug); + g_print ("Error: %s\n", err->message); + g_error_free (err); + g_free (debug); + + g_main_loop_quit (loop); + break; + } + case GST_MESSAGE_EOS: + /* end-of-stream */ + g_main_loop_quit (loop); + break; + default: + break; + } + + /* remove from queue */ + return TRUE; +} + +gint +main (gint argc, + gchar *argv[]) +{ + GMainLoop *loop; + GstElement *typefind, *realsink; + GstBus *bus; + GError *err = NULL; + gchar *p; + + /* init GStreamer and ourselves */ + gst_init (&argc, &argv); + loop = g_main_loop_new (NULL, FALSE); + init_factories (); + + /* args */ + if (argc != 2) { + g_print ("Usage: %s <filename>\n", argv[0]); + return -1; + } + + /* pipeline */ + p = g_strdup_printf ("filesrc location=\"%s\" ! typefind name=tf", argv[1]); + pipeline = gst_parse_launch (p, &err); + g_free (p); + + if (err) { + g_error ("Could not construct pipeline: %s", err->message); + g_error_free (err); + return -1; + } + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + gst_bus_add_watch (bus, my_bus_callback, NULL); + gst_object_unref (bus); + + typefind = gst_bin_get_by_name (GST_BIN (pipeline), "tf"); + g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), NULL); + gst_object_unref (GST_OBJECT (typefind)); + audiosink = gst_element_factory_make ("audioconvert", "aconv"); + realsink = gst_element_factory_make ("alsasink", "audiosink"); + gst_bin_add_many (GST_BIN (pipeline), audiosink, realsink, NULL); + gst_element_link (audiosink, realsink); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + /* run */ + g_main_loop_run (loop); + + /* exit */ + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + return 0; +} diff --git a/tests/examples/manual/elementcreate.c b/tests/examples/manual/elementcreate.c new file mode 100644 index 0000000..18d9043 --- /dev/null +++ b/tests/examples/manual/elementcreate.c @@ -0,0 +1,30 @@ + +/*** block from ../../../docs/manual/basics-elements.xml ***/ +#include <gst/gst.h> + +int +main (int argc, + char *argv[]) +{ + GstElementFactory *factory; + GstElement * element; + + /* init GStreamer */ + gst_init (&argc, &argv); + + /* create element, method #2 */ + factory = gst_element_factory_find ("fakesrc"); + if (!factory) { + g_print ("Failed to find factory of type 'fakesrc'\n"); + return -1; + } + element = gst_element_factory_create (factory, "source"); + if (!element) { + g_print ("Failed to create element, even though its factory exists!\n"); + return -1; + } + + gst_object_unref (GST_OBJECT (element)); + + return 0; +} diff --git a/tests/examples/manual/elementfactory.c b/tests/examples/manual/elementfactory.c new file mode 100644 index 0000000..610df61 --- /dev/null +++ b/tests/examples/manual/elementfactory.c @@ -0,0 +1,29 @@ + +/*** block from ../../../docs/manual/basics-elements.xml ***/ +#include <gst/gst.h> + +int +main (int argc, + char *argv[]) +{ + GstElementFactory *factory; + + /* init GStreamer */ + gst_init (&argc, &argv); + + /* get factory */ + factory = gst_element_factory_find ("fakesrc"); + if (!factory) { + g_print ("You don't have the 'fakesrc' element installed!\n"); + return -1; + } + + /* display information */ + g_print ("The '%s' element is a member of the category %s.\n" + "Description: %s\n", + gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)), + gst_element_factory_get_klass (factory), + gst_element_factory_get_description (factory)); + + return 0; +} diff --git a/tests/examples/manual/elementget.c b/tests/examples/manual/elementget.c new file mode 100644 index 0000000..720e6e8 --- /dev/null +++ b/tests/examples/manual/elementget.c @@ -0,0 +1,26 @@ + +/*** block from ../../../docs/manual/basics-elements.xml ***/ +#include <gst/gst.h> + +int +main (int argc, + char *argv[]) +{ + GstElement *element; + gchar *name; + + /* init GStreamer */ + gst_init (&argc, &argv); + + /* create element */ + element = gst_element_factory_make ("fakesrc", "source"); + + /* get name */ + g_object_get (G_OBJECT (element), "name", &name, NULL); + g_print ("The name of the element is '%s'.\n", name); + g_free (name); + + gst_object_unref (GST_OBJECT (element)); + + return 0; +} diff --git a/tests/examples/manual/elementlink.c b/tests/examples/manual/elementlink.c new file mode 100644 index 0000000..405c6be --- /dev/null +++ b/tests/examples/manual/elementlink.c @@ -0,0 +1,35 @@ + +/*** block a from ../../../docs/manual/basics-elements.xml ***/ +#include <gst/gst.h> + +int +main (int argc, + char *argv[]) +{ + GstElement *pipeline; + GstElement *source, *filter, *sink; + + /* init */ + gst_init (&argc, &argv); + + /* create pipeline */ + pipeline = gst_pipeline_new ("my-pipeline"); + + /* create elements */ + source = gst_element_factory_make ("fakesrc", "source"); + filter = gst_element_factory_make ("identity", "filter"); + sink = gst_element_factory_make ("fakesink", "sink"); + + /* must add elements to pipeline before linking them */ + gst_bin_add_many (GST_BIN (pipeline), source, filter, sink, NULL); + + /* link */ + if (!gst_element_link_many (source, filter, sink, NULL)) { + g_warning ("Failed to link elements!"); + } + +/*** block b from ../../../docs/manual/basics-elements.xml ***/ + return 0; + +/*** block c from ../../../docs/manual/basics-elements.xml ***/ +} diff --git a/tests/examples/manual/elementmake.c b/tests/examples/manual/elementmake.c new file mode 100644 index 0000000..aae2e04 --- /dev/null +++ b/tests/examples/manual/elementmake.c @@ -0,0 +1,24 @@ + +/*** block from ../../../docs/manual/basics-elements.xml ***/ +#include <gst/gst.h> + +int +main (int argc, + char *argv[]) +{ + GstElement *element; + + /* init GStreamer */ + gst_init (&argc, &argv); + + /* create element */ + element = gst_element_factory_make ("fakesrc", "source"); + if (!element) { + g_print ("Failed to create element of type 'fakesrc'\n"); + return -1; + } + + gst_object_unref (GST_OBJECT (element)); + + return 0; +} diff --git a/tests/examples/manual/extract.pl b/tests/examples/manual/extract.pl new file mode 100755 index 0000000..a4b7c1c --- /dev/null +++ b/tests/examples/manual/extract.pl @@ -0,0 +1,89 @@ +#!/usr/bin/perl + +# extract code fragments from xml program listings +# first argument: source code file to find +# second argument: xml files to extract code from + +# main + +# decodes xml by translating & < > back to what they should be +# and also ignore +# <![CDATA[ and ]]> and <!-- and --> +sub +xml_decode ($) +{ + my $input = shift; + + $input =~ s/\&/&/g; + $input =~ s/</</g; + $input =~ s/>/>/g; + + if ($input =~ /<!\[CDATA\[/) { $input = ""; } + if ($input =~ /]]>/) { $input = ""; } + if ($input =~ /<!--/) { $input = ""; } + if ($input =~ /-->/) { $input = ""; } + + #print "Returning line $input"; + return $input; +} + +# main +my $output = shift @ARGV; +my $outputname; + +# strip path parts +if ($output =~ m/.*\/(.*)$/) +{ + $outputname = $1; +} +else +{ + $outputname = $output; +} + +$found = 0; +%blocks = (); + +foreach $file (@ARGV) +{ + open FILE, $file or die "Cannot open file $file"; + + while ($line = <FILE>) + { + if ($line =~ /<!-- example-begin $outputname (.*?)-->/) + { + $found = 1; + $block_id = $1; + $block = "\n/*** block $block_id from $file ***/\n"; + + print "Extracting $outputname block $block_id from $file\n"; + + while ($line = <FILE>) + { + if ($line =~ /<!-- example-end $outputname (.*?)-->/) + { + last; + } + $block .= xml_decode ($line); + } + $blocks{$block_id} = $block; + } + } +} + + +if (!$found) +{ + print "Could not find $outputname example !\n"; + exit(1); +} + +# now output all the blocks in the right order +open OUTPUT, ">$output"; +@block_ids = keys %blocks; +foreach $block_id (sort @block_ids) +{ + print "Writing $output block $block_id\n"; + print OUTPUT $blocks{$block_id}; +} +close OUTPUT; diff --git a/tests/examples/manual/fakesrc.c b/tests/examples/manual/fakesrc.c new file mode 100644 index 0000000..eedbe04 --- /dev/null +++ b/tests/examples/manual/fakesrc.c @@ -0,0 +1,72 @@ + +/*** block from ../../../docs/manual/advanced-dataaccess.xml ***/ +#include <string.h> /* for memset () */ +#include <gst/gst.h> + +static void +cb_handoff (GstElement *fakesrc, + GstBuffer *buffer, + GstPad *pad, + gpointer user_data) +{ + static gboolean white = FALSE; + gpointer data; + gsize size; + + data = gst_buffer_map (buffer, &size, NULL, GST_MAP_WRITE); + + /* this makes the image black/white */ + memset (data, white ? 0xff : 0x0, size); + white = !white; + + gst_buffer_unmap (buffer, data, size); +} + +gint +main (gint argc, + gchar *argv[]) +{ + GstElement *pipeline, *fakesrc, *flt, *conv, *videosink; + GMainLoop *loop; + + /* init GStreamer */ + gst_init (&argc, &argv); + loop = g_main_loop_new (NULL, FALSE); + + /* setup pipeline */ + pipeline = gst_pipeline_new ("pipeline"); + fakesrc = gst_element_factory_make ("fakesrc", "source"); + flt = gst_element_factory_make ("capsfilter", "flt"); + conv = gst_element_factory_make ("ffmpegcolorspace", "conv"); + videosink = gst_element_factory_make ("xvimagesink", "videosink"); + + /* setup */ + g_object_set (G_OBJECT (flt), "caps", + gst_caps_new_simple ("video/x-raw-rgb", + "width", G_TYPE_INT, 384, + "height", G_TYPE_INT, 288, + "framerate", GST_TYPE_FRACTION, 1, 1, + "bpp", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + NULL), NULL); + gst_bin_add_many (GST_BIN (pipeline), fakesrc, flt, conv, videosink, NULL); + gst_element_link_many (fakesrc, flt, conv, videosink, NULL); + + /* setup fake source */ + g_object_set (G_OBJECT (fakesrc), + "signal-handoffs", TRUE, + "sizemax", 384 * 288 * 2, + "sizetype", 2, NULL); + g_signal_connect (fakesrc, "handoff", G_CALLBACK (cb_handoff), NULL); + + /* play */ + gst_element_set_state (pipeline, GST_STATE_PLAYING); + g_main_loop_run (loop); + + /* clean up */ + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + return 0; +} diff --git a/tests/examples/manual/ghostpad.c b/tests/examples/manual/ghostpad.c new file mode 100644 index 0000000..3dcc4a5 --- /dev/null +++ b/tests/examples/manual/ghostpad.c @@ -0,0 +1,29 @@ + +/*** block a from ../../../docs/manual/basics-pads.xml ***/ +#include <gst/gst.h> + +int +main (int argc, + char *argv[]) +{ + GstElement *bin, *sink; + GstPad *pad; + + /* init */ + gst_init (&argc, &argv); + + /* create element, add to bin */ + sink = gst_element_factory_make ("fakesink", "sink"); + bin = gst_bin_new ("mybin"); + gst_bin_add (GST_BIN (bin), sink); + + /* add ghostpad */ + pad = gst_element_get_static_pad (sink, "sink"); + gst_element_add_pad (bin, gst_ghost_pad_new ("sink", pad)); + gst_object_unref (GST_OBJECT (pad)); + +/*** block b from ../../../docs/manual/basics-pads.xml ***/ + return 0; + +/*** block c from ../../../docs/manual/basics-pads.xml ***/ +} diff --git a/tests/examples/manual/helloworld.c b/tests/examples/manual/helloworld.c new file mode 100644 index 0000000..506f339 --- /dev/null +++ b/tests/examples/manual/helloworld.c @@ -0,0 +1,144 @@ + +/*** block from ../../../docs/manual/basics-helloworld.xml ***/ +#include <gst/gst.h> +#include <glib.h> + + +static gboolean +bus_call (GstBus *bus, + GstMessage *msg, + gpointer data) +{ + GMainLoop *loop = (GMainLoop *) data; + + switch (GST_MESSAGE_TYPE (msg)) { + + case GST_MESSAGE_EOS: + g_print ("End of stream\n"); + g_main_loop_quit (loop); + break; + + case GST_MESSAGE_ERROR: { + gchar *debug; + GError *error; + + gst_message_parse_error (msg, &error, &debug); + g_free (debug); + + g_printerr ("Error: %s\n", error->message); + g_error_free (error); + + g_main_loop_quit (loop); + break; + } + default: + break; + } + + return TRUE; +} + + +static void +on_pad_added (GstElement *element, + GstPad *pad, + gpointer data) +{ + GstPad *sinkpad; + GstElement *decoder = (GstElement *) data; + + /* We can now link this pad with the vorbis-decoder sink pad */ + g_print ("Dynamic pad created, linking demuxer/decoder\n"); + + sinkpad = gst_element_get_static_pad (decoder, "sink"); + + gst_pad_link (pad, sinkpad); + + gst_object_unref (sinkpad); +} + + + +int +main (int argc, + char *argv[]) +{ + GMainLoop *loop; + + GstElement *pipeline, *source, *demuxer, *decoder, *conv, *sink; + GstBus *bus; + + /* Initialisation */ + gst_init (&argc, &argv); + + loop = g_main_loop_new (NULL, FALSE); + + + /* Check input arguments */ + if (argc != 2) { + g_printerr ("Usage: %s <Ogg/Vorbis filename>\n", argv[0]); + return -1; + } + + + /* Create gstreamer elements */ + pipeline = gst_pipeline_new ("audio-player"); + source = gst_element_factory_make ("filesrc", "file-source"); + demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer"); + decoder = gst_element_factory_make ("vorbisdec", "vorbis-decoder"); + conv = gst_element_factory_make ("audioconvert", "converter"); + sink = gst_element_factory_make ("autoaudiosink", "audio-output"); + + if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) { + g_printerr ("One element could not be created. Exiting.\n"); + return -1; + } + + /* Set up the pipeline */ + + /* we set the input filename to the source element */ + g_object_set (G_OBJECT (source), "location", argv[1], NULL); + + /* we add a message handler */ + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + gst_bus_add_watch (bus, bus_call, loop); + gst_object_unref (bus); + + /* we add all elements into the pipeline */ + /* file-source | ogg-demuxer | vorbis-decoder | converter | alsa-output */ + gst_bin_add_many (GST_BIN (pipeline), + source, demuxer, decoder, conv, sink, NULL); + + /* we link the elements together */ + /* file-source -> ogg-demuxer ~> vorbis-decoder -> converter -> alsa-output */ + gst_element_link (source, demuxer); + gst_element_link_many (decoder, conv, sink, NULL); + g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decoder); + + /* note that the demuxer will be linked to the decoder dynamically. + The reason is that Ogg may contain various streams (for example + audio and video). The source pad(s) will be created at run time, + by the demuxer when it detects the amount and nature of streams. + Therefore we connect a callback function which will be executed + when the "pad-added" is emitted.*/ + + + /* Set the pipeline to "playing" state*/ + g_print ("Now playing: %s\n", argv[1]); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + + /* Iterate */ + g_print ("Running...\n"); + g_main_loop_run (loop); + + + /* Out of the main loop, clean up nicely */ + g_print ("Returned, stopping playback\n"); + gst_element_set_state (pipeline, GST_STATE_NULL); + + g_print ("Deleting pipeline\n"); + gst_object_unref (GST_OBJECT (pipeline)); + + return 0; +} diff --git a/tests/examples/manual/init.c b/tests/examples/manual/init.c new file mode 100644 index 0000000..dd53042 --- /dev/null +++ b/tests/examples/manual/init.c @@ -0,0 +1,28 @@ + +/*** block from ../../../docs/manual/basics-init.xml ***/ +#include <stdio.h> +#include <gst/gst.h> + +int +main (int argc, + char *argv[]) +{ + const gchar *nano_str; + guint major, minor, micro, nano; + + gst_init (&argc, &argv); + + gst_version (&major, &minor, µ, &nano); + + if (nano == 1) + nano_str = "(CVS)"; + else if (nano == 2) + nano_str = "(Prerelease)"; + else + nano_str = ""; + + printf ("This program is linked against GStreamer %d.%d.%d %s\n", + major, minor, micro, nano_str); + + return 0; +} diff --git a/tests/examples/manual/pad.c b/tests/examples/manual/pad.c new file mode 100644 index 0000000..b6c5caa --- /dev/null +++ b/tests/examples/manual/pad.c @@ -0,0 +1,53 @@ + +/*** block a from ../../../docs/manual/basics-pads.xml ***/ +#include <gst/gst.h> + +static void +cb_new_pad (GstElement *element, + GstPad *pad, + gpointer data) +{ + gchar *name; + + name = gst_pad_get_name (pad); + g_print ("A new pad %s was created\n", name); + g_free (name); + + /* here, you would setup a new pad link for the newly created pad */ + +/*** block b from ../../../docs/manual/basics-pads.xml ***/ +} + +int +main (int argc, + char *argv[]) +{ + GstElement *pipeline, *source, *demux; + GMainLoop *loop; + + /* init */ + gst_init (&argc, &argv); + + /* create elements */ + pipeline = gst_pipeline_new ("my_pipeline"); + source = gst_element_factory_make ("filesrc", "source"); + g_object_set (source, "location", argv[1], NULL); + demux = gst_element_factory_make ("oggdemux", "demuxer"); + + /* you would normally check that the elements were created properly */ + + /* put together a pipeline */ + gst_bin_add_many (GST_BIN (pipeline), source, demux, NULL); + gst_element_link_pads (source, "src", demux, "sink"); + + /* listen for newly created pads */ + g_signal_connect (demux, "pad-added", G_CALLBACK (cb_new_pad), NULL); + + /* start the pipeline */ + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + loop = g_main_loop_new (NULL, FALSE); + g_main_loop_run (loop); + return 0; + +/*** block d from ../../../docs/manual/basics-pads.xml ***/ +} diff --git a/tests/examples/manual/playbin.c b/tests/examples/manual/playbin.c new file mode 100644 index 0000000..868b586 --- /dev/null +++ b/tests/examples/manual/playbin.c @@ -0,0 +1,76 @@ + +/*** block a from ../../../docs/manual/highlevel-components.xml ***/ +#include <gst/gst.h> + +/*** block b from ../../../docs/manual/highlevel-components.xml ***/ +static gboolean +my_bus_callback (GstBus *bus, + GstMessage *message, + gpointer data) +{ + GMainLoop *loop = data; + + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR: { + GError *err; + gchar *debug; + + gst_message_parse_error (message, &err, &debug); + g_print ("Error: %s\n", err->message); + g_error_free (err); + g_free (debug); + + g_main_loop_quit (loop); + break; + } + case GST_MESSAGE_EOS: + /* end-of-stream */ + g_main_loop_quit (loop); + break; + default: + /* unhandled message */ + break; + } + + /* remove message from the queue */ + return TRUE; +} + +/*** block c from ../../../docs/manual/highlevel-components.xml ***/ +gint +main (gint argc, + gchar *argv[]) +{ + GMainLoop *loop; + GstElement *play; + GstBus *bus; + + /* init GStreamer */ + gst_init (&argc, &argv); + loop = g_main_loop_new (NULL, FALSE); + + /* make sure we have a URI */ + if (argc != 2) { + g_print ("Usage: %s <URI>\n", argv[0]); + return -1; + } + + /* set up */ + play = gst_element_factory_make ("playbin", "play"); + g_object_set (G_OBJECT (play), "uri", argv[1], NULL); + + bus = gst_pipeline_get_bus (GST_PIPELINE (play)); + gst_bus_add_watch (bus, my_bus_callback, loop); + gst_object_unref (bus); + + gst_element_set_state (play, GST_STATE_PLAYING); + + /* now run */ + g_main_loop_run (loop); + + /* also clean up */ + gst_element_set_state (play, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (play)); + + return 0; +} diff --git a/tests/examples/manual/query.c b/tests/examples/manual/query.c new file mode 100644 index 0000000..c8ef55c --- /dev/null +++ b/tests/examples/manual/query.c @@ -0,0 +1,113 @@ + +/*** block a from ../../../docs/manual/advanced-position.xml ***/ +#include <gst/gst.h> + +/*** block b from ../../../docs/manual/advanced-position.xml ***/ +static void +my_bus_message_cb (GstBus *bus, + GstMessage *message, + gpointer data) +{ + GMainLoop *loop = (GMainLoop *) data; + + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR: { + GError *err; + gchar *debug; + + gst_message_parse_error (message, &err, &debug); + g_print ("Error: %s\n", err->message); + g_error_free (err); + g_free (debug); + + g_main_loop_quit (loop); + break; + } + case GST_MESSAGE_EOS: + /* end-of-stream */ + g_main_loop_quit (loop); + break; + default: + break; + } +} + +/*** block c from ../../../docs/manual/advanced-position.xml ***/ +static gboolean +cb_print_position (GstElement *pipeline) +{ + gint64 pos, len; + + if (gst_element_query_position (pipeline, GST_FORMAT_TIME, &pos) + && gst_element_query_duration (pipeline, GST_FORMAT_TIME, &len)) { + g_print ("Time: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", + GST_TIME_ARGS (pos), GST_TIME_ARGS (len)); + } + + /* call me again */ + return TRUE; +} + +gint +main (gint argc, + gchar *argv[]) +{ + GstElement *pipeline; + +/*** block d from ../../../docs/manual/advanced-position.xml ***/ + GstStateChangeReturn ret; + GMainLoop *loop; + GError *err = NULL; + GstBus *bus; + gchar *l; + + /* init */ + gst_init (&argc, &argv); + + /* args */ + if (argc != 2) { + g_print ("Usage: %s <filename>\n", argv[0]); + return -1; + } + + loop = g_main_loop_new (NULL, FALSE); + + /* build pipeline, the easy way */ + l = g_strdup_printf ("filesrc location=\"%s\" ! oggdemux ! vorbisdec ! " + "audioconvert ! audioresample ! alsasink", + argv[1]); + pipeline = gst_parse_launch (l, &err); + if (pipeline == NULL || err != NULL) { + g_printerr ("Cannot build pipeline: %s\n", err->message); + g_error_free (err); + g_free (l); + if (pipeline) + gst_object_unref (pipeline); + return -1; + } + g_free (l); + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + gst_bus_add_signal_watch (bus); + g_signal_connect (bus, "message", G_CALLBACK (my_bus_message_cb), loop); + gst_object_unref (bus); + + /* play */ + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + if (ret == GST_STATE_CHANGE_FAILURE) + g_error ("Failed to set pipeline to PLAYING.\n"); + +/*** block e from ../../../docs/manual/advanced-position.xml ***/ + /* run pipeline */ + g_timeout_add (200, (GSourceFunc) cb_print_position, pipeline); + g_main_loop_run (loop); + +/*** block f from ../../../docs/manual/advanced-position.xml ***/ + /* clean up */ + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + return 0; + +/*** block g from ../../../docs/manual/advanced-position.xml ***/ +} diff --git a/tests/examples/manual/typefind.c b/tests/examples/manual/typefind.c new file mode 100644 index 0000000..6a6266c --- /dev/null +++ b/tests/examples/manual/typefind.c @@ -0,0 +1,110 @@ + +/*** block a from ../../../docs/manual/advanced-autoplugging.xml ***/ +#include <gst/gst.h> + +/*** block b from ../../../docs/manual/advanced-autoplugging.xml ***/ +static gboolean +my_bus_callback (GstBus *bus, + GstMessage *message, + gpointer data) +{ + GMainLoop *loop = data; + + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR: { + GError *err; + gchar *debug; + + gst_message_parse_error (message, &err, &debug); + g_print ("Error: %s\n", err->message); + g_error_free (err); + g_free (debug); + + g_main_loop_quit (loop); + break; + } + case GST_MESSAGE_EOS: + /* end-of-stream */ + g_main_loop_quit (loop); + break; + default: + break; + } + + /* remove from queue */ + return TRUE; +} + +/*** block c from ../../../docs/manual/advanced-autoplugging.xml ***/ +static gboolean +idle_exit_loop (gpointer data) +{ + g_main_loop_quit ((GMainLoop *) data); + + /* once */ + return FALSE; +} + +static void +cb_typefound (GstElement *typefind, + guint probability, + GstCaps *caps, + gpointer data) +{ + GMainLoop *loop = data; + gchar *type; + + type = gst_caps_to_string (caps); + g_print ("Media type %s found, probability %d%%\n", type, probability); + g_free (type); + + /* since we connect to a signal in the pipeline thread context, we need + * to set an idle handler to exit the main loop in the mainloop context. + * Normally, your app should not need to worry about such things. */ + g_idle_add (idle_exit_loop, loop); +} + +gint +main (gint argc, + gchar *argv[]) +{ + GMainLoop *loop; + GstElement *pipeline, *filesrc, *typefind, *fakesink; + GstBus *bus; + + /* init GStreamer */ + gst_init (&argc, &argv); + loop = g_main_loop_new (NULL, FALSE); + + /* check args */ + if (argc != 2) { + g_print ("Usage: %s <filename>\n", argv[0]); + return -1; + } + + /* create a new pipeline to hold the elements */ + pipeline = gst_pipeline_new ("pipe"); + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + gst_bus_add_watch (bus, my_bus_callback, NULL); + gst_object_unref (bus); + + /* create file source and typefind element */ + filesrc = gst_element_factory_make ("filesrc", "source"); + g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); + typefind = gst_element_factory_make ("typefind", "typefinder"); + g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), loop); + fakesink = gst_element_factory_make ("fakesink", "sink"); + + /* setup */ + gst_bin_add_many (GST_BIN (pipeline), filesrc, typefind, fakesink, NULL); + gst_element_link_many (filesrc, typefind, fakesink, NULL); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + g_main_loop_run (loop); + + /* unset */ + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + return 0; +} diff --git a/tests/examples/metadata/Makefile.am b/tests/examples/metadata/Makefile.am new file mode 100644 index 0000000..61d2eb8 --- /dev/null +++ b/tests/examples/metadata/Makefile.am @@ -0,0 +1,4 @@ +noinst_PROGRAMS = read-metadata + +read_metadata_LDADD = $(GST_OBJ_LIBS) +read_metadata_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/examples/metadata/Makefile.in b/tests/examples/metadata/Makefile.in new file mode 100644 index 0000000..578d95f --- /dev/null +++ b/tests/examples/metadata/Makefile.in @@ -0,0 +1,687 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = read-metadata$(EXEEXT) +subdir = tests/examples/metadata +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +read_metadata_SOURCES = read-metadata.c +read_metadata_OBJECTS = read_metadata-read-metadata.$(OBJEXT) +am__DEPENDENCIES_1 = +read_metadata_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +read_metadata_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(read_metadata_CFLAGS) \ + $(CFLAGS) $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = read-metadata.c +DIST_SOURCES = read-metadata.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +read_metadata_LDADD = $(GST_OBJ_LIBS) +read_metadata_CFLAGS = $(GST_OBJ_CFLAGS) +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 tests/examples/metadata/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/metadata/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +read-metadata$(EXEEXT): $(read_metadata_OBJECTS) $(read_metadata_DEPENDENCIES) + @rm -f read-metadata$(EXEEXT) + $(AM_V_CCLD)$(read_metadata_LINK) $(read_metadata_OBJECTS) $(read_metadata_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_metadata-read-metadata.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +read_metadata-read-metadata.o: read-metadata.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(read_metadata_CFLAGS) $(CFLAGS) -MT read_metadata-read-metadata.o -MD -MP -MF $(DEPDIR)/read_metadata-read-metadata.Tpo -c -o read_metadata-read-metadata.o `test -f 'read-metadata.c' || echo '$(srcdir)/'`read-metadata.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/read_metadata-read-metadata.Tpo $(DEPDIR)/read_metadata-read-metadata.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='read-metadata.c' object='read_metadata-read-metadata.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(read_metadata_CFLAGS) $(CFLAGS) -c -o read_metadata-read-metadata.o `test -f 'read-metadata.c' || echo '$(srcdir)/'`read-metadata.c + +read_metadata-read-metadata.obj: read-metadata.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(read_metadata_CFLAGS) $(CFLAGS) -MT read_metadata-read-metadata.obj -MD -MP -MF $(DEPDIR)/read_metadata-read-metadata.Tpo -c -o read_metadata-read-metadata.obj `if test -f 'read-metadata.c'; then $(CYGPATH_W) 'read-metadata.c'; else $(CYGPATH_W) '$(srcdir)/read-metadata.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/read_metadata-read-metadata.Tpo $(DEPDIR)/read_metadata-read-metadata.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='read-metadata.c' object='read_metadata-read-metadata.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(read_metadata_CFLAGS) $(CFLAGS) -c -o read_metadata-read-metadata.obj `if test -f 'read-metadata.c'; then $(CYGPATH_W) 'read-metadata.c'; else $(CYGPATH_W) '$(srcdir)/read-metadata.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/examples/metadata/read-metadata.c b/tests/examples/metadata/read-metadata.c new file mode 100644 index 0000000..52ebfe4 --- /dev/null +++ b/tests/examples/metadata/read-metadata.c @@ -0,0 +1,217 @@ +/* GStreamer + * Copyright (C) 2003 Thomas Vander Stichele <thomas@apestaart.org> + * 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> + * 2005 Andy Wingo <wingo@pobox.com> + * 2005 Jan Schmidt <thaytan@mad.scientist.com> + * + * gst-metadata.c: Use GStreamer to display metadata within files. + * + * 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 <string.h> +#include <stdlib.h> +#include <locale.h> +#include <gst/gst.h> + +static char *filename = NULL; +static GstElement *pipeline = NULL; +static GstElement *source = NULL; + +#define NEW_PIPE_PER_FILE + +static gboolean +message_loop (GstElement * element, GstTagList ** tags) +{ + GstBus *bus; + gboolean done = FALSE; + + bus = gst_element_get_bus (element); + g_return_val_if_fail (bus != NULL, FALSE); + g_return_val_if_fail (tags != NULL, FALSE); + + while (!done) { + GstMessage *message; + + message = gst_bus_pop (bus); + if (message == NULL) + /* All messages read, we're done */ + break; + + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR: + case GST_MESSAGE_EOS: + gst_message_unref (message); + return TRUE; + case GST_MESSAGE_TAG: + { + GstTagList *new_tags, *old_tags; + + gst_message_parse_tag (message, &new_tags); + if (*tags) { + old_tags = *tags; + *tags = gst_tag_list_merge (old_tags, new_tags, GST_TAG_MERGE_KEEP); + gst_tag_list_free (old_tags); + } else + *tags = new_tags; + break; + } + default: + break; + } + gst_message_unref (message); + } + gst_object_unref (bus); + return TRUE; +} + +static void +make_pipeline (void) +{ + GstElement *decodebin; + + if (pipeline != NULL) + gst_object_unref (pipeline); + + pipeline = gst_pipeline_new (NULL); + + source = gst_element_factory_make ("filesrc", "source"); + g_assert (GST_IS_ELEMENT (source)); + decodebin = gst_element_factory_make ("decodebin", "decodebin"); + g_assert (GST_IS_ELEMENT (decodebin)); + + gst_bin_add_many (GST_BIN (pipeline), source, decodebin, NULL); + gst_element_link (source, decodebin); +} + +static void +print_tag (const GstTagList * list, const gchar * tag, gpointer unused) +{ + gint i, count; + + count = gst_tag_list_get_tag_size (list, tag); + + for (i = 0; i < count; i++) { + gchar *str; + + if (gst_tag_get_type (tag) == G_TYPE_STRING) { + if (!gst_tag_list_get_string_index (list, tag, i, &str)) + g_assert_not_reached (); + } else { + str = + g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i)); + } + + if (i == 0) { + g_print (" %15s: %s\n", gst_tag_get_nick (tag), str); + } else { + g_print (" : %s\n", str); + } + + g_free (str); + } +} + +int +main (int argc, char *argv[]) +{ + guint i = 1; + + setlocale (LC_ALL, ""); + + gst_init (&argc, &argv); + + if (argc < 2) { + g_print ("Please give filenames to read metadata from\n\n"); + return 1; + } + + make_pipeline (); + while (i < argc) { + GstStateChangeReturn sret; + GstState state; + GstTagList *tags = NULL; + + filename = argv[i]; + g_object_set (source, "location", filename, NULL); + + GST_DEBUG ("Starting reading for %s", filename); + + /* Decodebin will only commit to PAUSED if it actually finds a type; + * otherwise the state change fails */ + sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); + + if (GST_STATE_CHANGE_ASYNC == sret) { + if (GST_STATE_CHANGE_SUCCESS != + gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, + 5 * GST_SECOND)) { + g_print ("State change failed for %s. Aborting\n", filename); + break; + } + } else if (sret != GST_STATE_CHANGE_SUCCESS) { + g_print ("%s - Could not read file\n", filename); + goto next_file; + } + + if (!message_loop (GST_ELEMENT (pipeline), &tags)) { + g_print ("Failed in message reading for %s\n", argv[i]); + } + + if (tags) { + g_print ("Metadata for %s:\n", argv[i]); + gst_tag_list_foreach (tags, print_tag, NULL); + gst_tag_list_free (tags); + tags = NULL; + } else + g_print ("No metadata found for %s\n", argv[i]); + + sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); +#ifdef NEW_PIPE_PER_FILE + if (sret != GST_STATE_CHANGE_SUCCESS) { + g_print ("State change failed. Aborting\n"); + break; + } +#else + if (GST_STATE_CHANGE_ASYNC == sret) { + if (GST_STATE_CHANGE_FAILURE == + gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, + GST_CLOCK_TIME_NONE)) { + g_print ("State change failed. Aborting"); + break; + } + } else if (sret != GST_STATE_CHANGE_SUCCESS) { + g_print ("State change failed. Aborting\n"); + break; + } +#endif + + next_file: + i++; + +#ifdef NEW_PIPE_PER_FILE + make_pipeline (); +#endif + } + + if (pipeline) + gst_object_unref (pipeline); + return 0; +} diff --git a/tests/examples/queue/Makefile.am b/tests/examples/queue/Makefile.am new file mode 100644 index 0000000..9d66839 --- /dev/null +++ b/tests/examples/queue/Makefile.am @@ -0,0 +1,5 @@ +noinst_PROGRAMS = queue + +queue_LDADD = $(GST_OBJ_LIBS) +queue_CFLAGS = $(GST_OBJ_CFLAGS) + diff --git a/tests/examples/queue/Makefile.in b/tests/examples/queue/Makefile.in new file mode 100644 index 0000000..1558ce7 --- /dev/null +++ b/tests/examples/queue/Makefile.in @@ -0,0 +1,687 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = queue$(EXEEXT) +subdir = tests/examples/queue +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +queue_SOURCES = queue.c +queue_OBJECTS = queue-queue.$(OBJEXT) +am__DEPENDENCIES_1 = +queue_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +queue_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(queue_CFLAGS) $(CFLAGS) \ + $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = queue.c +DIST_SOURCES = queue.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +queue_LDADD = $(GST_OBJ_LIBS) +queue_CFLAGS = $(GST_OBJ_CFLAGS) +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 tests/examples/queue/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/queue/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +queue$(EXEEXT): $(queue_OBJECTS) $(queue_DEPENDENCIES) + @rm -f queue$(EXEEXT) + $(AM_V_CCLD)$(queue_LINK) $(queue_OBJECTS) $(queue_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue-queue.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +queue-queue.o: queue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(queue_CFLAGS) $(CFLAGS) -MT queue-queue.o -MD -MP -MF $(DEPDIR)/queue-queue.Tpo -c -o queue-queue.o `test -f 'queue.c' || echo '$(srcdir)/'`queue.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/queue-queue.Tpo $(DEPDIR)/queue-queue.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='queue.c' object='queue-queue.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(queue_CFLAGS) $(CFLAGS) -c -o queue-queue.o `test -f 'queue.c' || echo '$(srcdir)/'`queue.c + +queue-queue.obj: queue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(queue_CFLAGS) $(CFLAGS) -MT queue-queue.obj -MD -MP -MF $(DEPDIR)/queue-queue.Tpo -c -o queue-queue.obj `if test -f 'queue.c'; then $(CYGPATH_W) 'queue.c'; else $(CYGPATH_W) '$(srcdir)/queue.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/queue-queue.Tpo $(DEPDIR)/queue-queue.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='queue.c' object='queue-queue.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(queue_CFLAGS) $(CFLAGS) -c -o queue-queue.obj `if test -f 'queue.c'; then $(CYGPATH_W) 'queue.c'; else $(CYGPATH_W) '$(srcdir)/queue.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/examples/queue/queue.c b/tests/examples/queue/queue.c new file mode 100644 index 0000000..27ca94e --- /dev/null +++ b/tests/examples/queue/queue.c @@ -0,0 +1,106 @@ +#include <stdlib.h> +#include <gst/gst.h> + +/* This example uses the queue element to create a buffer between 2 elements. + * The scheduler automatically uses 2 threads, 1 to feed and another to consume + * data from the queue buffer + */ + +/* Event loop to listen to events posted on the GstBus from the pipeline. Exits + * on EOS or ERROR events + */ +static void +event_loop (GstElement * pipe) +{ + GstBus *bus; + GstMessage *message = NULL; + gboolean running = TRUE; + + bus = gst_element_get_bus (GST_ELEMENT (pipe)); + + while (running) { + message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); + + g_assert (message != NULL); + + switch (message->type) { + case GST_MESSAGE_EOS: + running = FALSE; + break; + case GST_MESSAGE_WARNING:{ + GError *gerror; + gchar *debug; + + gst_message_parse_warning (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + break; + } + case GST_MESSAGE_ERROR:{ + GError *gerror; + gchar *debug; + + gst_message_parse_error (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + running = FALSE; + break; + } + default: + break; + } + gst_message_unref (message); + } + gst_object_unref (bus); +} + +int +main (int argc, char *argv[]) +{ + GstElement *filesrc, *audiosink, *decode, *queue; + GstElement *pipeline; + + gst_init (&argc, &argv); + + if (argc != 2) { + g_print ("usage: %s <filename>\n", argv[0]); + exit (-1); + } + + /* create a new pipeline to hold the elements */ + pipeline = gst_pipeline_new ("pipeline"); + g_assert (pipeline != NULL); + + /* create a disk reader */ + filesrc = gst_element_factory_make ("filesrc", "disk_source"); + g_assert (filesrc != NULL); + g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); + + decode = gst_element_factory_make ("mad", "decode"); + g_assert (decode != NULL); + + queue = gst_element_factory_make ("queue", "queue"); + g_assert (queue != NULL); + + /* and an audio sink */ + audiosink = gst_element_factory_make ("alsasink", "play_audio"); + g_assert (audiosink != NULL); + + /* add objects to the main pipeline */ + gst_bin_add_many (GST_BIN (pipeline), filesrc, decode, queue, audiosink, + NULL); + + gst_element_link_many (filesrc, decode, queue, audiosink, NULL); + + /* start playing */ + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + + /* Listen for EOS */ + event_loop (pipeline); + + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + + exit (0); +} diff --git a/tests/examples/stepping/Makefile.am b/tests/examples/stepping/Makefile.am new file mode 100644 index 0000000..2a6fbc1 --- /dev/null +++ b/tests/examples/stepping/Makefile.am @@ -0,0 +1,4 @@ +noinst_PROGRAMS = framestep1 + +framestep1_LDADD = $(GST_OBJ_LIBS) +framestep1_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/examples/stepping/Makefile.in b/tests/examples/stepping/Makefile.in new file mode 100644 index 0000000..0ab3d3e --- /dev/null +++ b/tests/examples/stepping/Makefile.in @@ -0,0 +1,687 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = framestep1$(EXEEXT) +subdir = tests/examples/stepping +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +framestep1_SOURCES = framestep1.c +framestep1_OBJECTS = framestep1-framestep1.$(OBJEXT) +am__DEPENDENCIES_1 = +framestep1_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +framestep1_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(framestep1_CFLAGS) \ + $(CFLAGS) $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = framestep1.c +DIST_SOURCES = framestep1.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +framestep1_LDADD = $(GST_OBJ_LIBS) +framestep1_CFLAGS = $(GST_OBJ_CFLAGS) +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 tests/examples/stepping/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/stepping/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +framestep1$(EXEEXT): $(framestep1_OBJECTS) $(framestep1_DEPENDENCIES) + @rm -f framestep1$(EXEEXT) + $(AM_V_CCLD)$(framestep1_LINK) $(framestep1_OBJECTS) $(framestep1_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framestep1-framestep1.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +framestep1-framestep1.o: framestep1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(framestep1_CFLAGS) $(CFLAGS) -MT framestep1-framestep1.o -MD -MP -MF $(DEPDIR)/framestep1-framestep1.Tpo -c -o framestep1-framestep1.o `test -f 'framestep1.c' || echo '$(srcdir)/'`framestep1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/framestep1-framestep1.Tpo $(DEPDIR)/framestep1-framestep1.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='framestep1.c' object='framestep1-framestep1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(framestep1_CFLAGS) $(CFLAGS) -c -o framestep1-framestep1.o `test -f 'framestep1.c' || echo '$(srcdir)/'`framestep1.c + +framestep1-framestep1.obj: framestep1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(framestep1_CFLAGS) $(CFLAGS) -MT framestep1-framestep1.obj -MD -MP -MF $(DEPDIR)/framestep1-framestep1.Tpo -c -o framestep1-framestep1.obj `if test -f 'framestep1.c'; then $(CYGPATH_W) 'framestep1.c'; else $(CYGPATH_W) '$(srcdir)/framestep1.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/framestep1-framestep1.Tpo $(DEPDIR)/framestep1-framestep1.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='framestep1.c' object='framestep1-framestep1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(framestep1_CFLAGS) $(CFLAGS) -c -o framestep1-framestep1.obj `if test -f 'framestep1.c'; then $(CYGPATH_W) 'framestep1.c'; else $(CYGPATH_W) '$(srcdir)/framestep1.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/examples/stepping/framestep1.c b/tests/examples/stepping/framestep1.c new file mode 100644 index 0000000..6eb1881 --- /dev/null +++ b/tests/examples/stepping/framestep1.c @@ -0,0 +1,165 @@ +#include <stdlib.h> +#include <gst/gst.h> + +static void +event_loop (GstElement * pipe) +{ + GstBus *bus; + GstMessage *message = NULL; + gboolean running = TRUE; + + bus = gst_element_get_bus (GST_ELEMENT (pipe)); + + while (running) { + message = gst_bus_timed_pop_filtered (bus, -1, GST_MESSAGE_ANY); + + g_assert (message != NULL); + + switch (message->type) { + case GST_MESSAGE_EOS: + g_message ("got EOS"); + running = FALSE; + break; + case GST_MESSAGE_WARNING:{ + GError *gerror; + gchar *debug; + + gst_message_parse_warning (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + break; + } + case GST_MESSAGE_ERROR: + { + GError *gerror; + gchar *debug; + + gst_message_parse_error (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + running = FALSE; + break; + } + case GST_MESSAGE_STEP_DONE: + { + GstFormat format; + guint64 amount; + gdouble rate; + gboolean flush, intermediate; + guint64 duration; + gboolean eos; + + gst_message_parse_step_done (message, &format, &amount, &rate, + &flush, &intermediate, &duration, &eos); + + if (format == GST_FORMAT_DEFAULT) { + g_message ("step done: %" GST_TIME_FORMAT " skipped in %" + G_GUINT64_FORMAT " frames", GST_TIME_ARGS (duration), amount); + } else { + g_message ("step done: %" GST_TIME_FORMAT " skipped", + GST_TIME_ARGS (duration)); + } + break; + } + default: + break; + } + gst_message_unref (message); + } + gst_object_unref (bus); +} + +/* signalled when a new preroll buffer is available */ +static void +new_preroll (GstElement * appsink, gpointer user_data) +{ + GstBuffer *buffer; + + g_signal_emit_by_name (appsink, "pull-preroll", &buffer); + + g_message ("have new-preroll buffer %p, timestamp %" GST_TIME_FORMAT, buffer, + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); + + gst_buffer_unref (buffer); +} + +int +main (int argc, char *argv[]) +{ + GstElement *bin, *videotestsrc, *appsink; + gint64 pos; + + gst_init (&argc, &argv); + + /* create a new bin to hold the elements */ + bin = gst_pipeline_new ("pipeline"); + g_assert (bin); + + /* create a fake source */ + videotestsrc = gst_element_factory_make ("videotestsrc", "videotestsrc"); + g_assert (videotestsrc); + g_object_set (videotestsrc, "num-buffers", 10, NULL); + + /* and a fake sink */ + appsink = gst_element_factory_make ("appsink", "appsink"); + g_assert (appsink); + g_object_set (appsink, "emit-signals", TRUE, NULL); + g_object_set (appsink, "sync", TRUE, NULL); + g_signal_connect (appsink, "new-preroll", (GCallback) new_preroll, NULL); + + /* add objects to the main pipeline */ + gst_bin_add (GST_BIN (bin), videotestsrc); + gst_bin_add (GST_BIN (bin), appsink); + + /* link the elements */ + gst_element_link_many (videotestsrc, appsink, NULL); + + /* go to the PAUSED state and wait for preroll */ + g_message ("prerolling first frame"); + gst_element_set_state (bin, GST_STATE_PAUSED); + gst_element_get_state (bin, NULL, NULL, -1); + + /* step two frames, flush so that new preroll is queued */ + g_message ("stepping three frames"); + g_assert (gst_element_send_event (bin, + gst_event_new_step (GST_FORMAT_BUFFERS, 2, 1.0, TRUE, FALSE))); + + /* blocks and returns when we received the step done message */ + event_loop (bin); + + /* wait for step to really complete */ + gst_element_get_state (bin, NULL, NULL, -1); + + gst_element_query_position (bin, GST_FORMAT_TIME, &pos); + g_message ("stepped two frames, now at %" GST_TIME_FORMAT, + GST_TIME_ARGS (pos)); + + /* step 3 frames, flush so that new preroll is queued */ + g_message ("stepping 120 milliseconds "); + g_assert (gst_element_send_event (bin, + gst_event_new_step (GST_FORMAT_TIME, 120 * GST_MSECOND, 1.0, TRUE, + FALSE))); + + /* blocks and returns when we received the step done message */ + event_loop (bin); + + /* wait for step to really complete */ + gst_element_get_state (bin, NULL, NULL, -1); + + gst_element_query_position (bin, GST_FORMAT_TIME, &pos); + g_message ("stepped 120ms frames, now at %" GST_TIME_FORMAT, + GST_TIME_ARGS (pos)); + + g_message ("playing until EOS"); + gst_element_set_state (bin, GST_STATE_PLAYING); + /* Run event loop listening for bus messages until EOS or ERROR */ + event_loop (bin); + g_message ("finished"); + + /* stop the bin */ + gst_element_set_state (bin, GST_STATE_NULL); + + exit (0); +} diff --git a/tests/examples/streams/Makefile.am b/tests/examples/streams/Makefile.am new file mode 100644 index 0000000..910df0a --- /dev/null +++ b/tests/examples/streams/Makefile.am @@ -0,0 +1,14 @@ +noinst_PROGRAMS = stream-status +if HAVE_PTHREAD_H +noinst_PROGRAMS += rtpool-test +endif + +stream_status_SOURCES = stream-status.c +stream_status_LDADD = $(GST_OBJ_LIBS) +stream_status_CFLAGS = $(GST_OBJ_CFLAGS) + +rtpool_test_SOURCES = rtpool-test.c testrtpool.h testrtpool.c +rtpool_test_LDADD = $(GST_OBJ_LIBS) -lpthread +rtpool_test_CFLAGS = $(GST_OBJ_CFLAGS) + +EXTRA_DIST = rtpool-test.c testrtpool.h testrtpool.c diff --git a/tests/examples/streams/Makefile.in b/tests/examples/streams/Makefile.in new file mode 100644 index 0000000..5a57a73 --- /dev/null +++ b/tests/examples/streams/Makefile.in @@ -0,0 +1,738 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = stream-status$(EXEEXT) $(am__EXEEXT_1) +@HAVE_PTHREAD_H_TRUE@am__append_1 = rtpool-test +subdir = tests/examples/streams +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +@HAVE_PTHREAD_H_TRUE@am__EXEEXT_1 = rtpool-test$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am_rtpool_test_OBJECTS = rtpool_test-rtpool-test.$(OBJEXT) \ + rtpool_test-testrtpool.$(OBJEXT) +rtpool_test_OBJECTS = $(am_rtpool_test_OBJECTS) +am__DEPENDENCIES_1 = +rtpool_test_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +rtpool_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(rtpool_test_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_stream_status_OBJECTS = stream_status-stream-status.$(OBJEXT) +stream_status_OBJECTS = $(am_stream_status_OBJECTS) +stream_status_DEPENDENCIES = $(am__DEPENDENCIES_1) +stream_status_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(stream_status_CFLAGS) \ + $(CFLAGS) $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(rtpool_test_SOURCES) $(stream_status_SOURCES) +DIST_SOURCES = $(rtpool_test_SOURCES) $(stream_status_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +stream_status_SOURCES = stream-status.c +stream_status_LDADD = $(GST_OBJ_LIBS) +stream_status_CFLAGS = $(GST_OBJ_CFLAGS) +rtpool_test_SOURCES = rtpool-test.c testrtpool.h testrtpool.c +rtpool_test_LDADD = $(GST_OBJ_LIBS) -lpthread +rtpool_test_CFLAGS = $(GST_OBJ_CFLAGS) +EXTRA_DIST = rtpool-test.c testrtpool.h testrtpool.c +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 tests/examples/streams/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/streams/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +rtpool-test$(EXEEXT): $(rtpool_test_OBJECTS) $(rtpool_test_DEPENDENCIES) + @rm -f rtpool-test$(EXEEXT) + $(AM_V_CCLD)$(rtpool_test_LINK) $(rtpool_test_OBJECTS) $(rtpool_test_LDADD) $(LIBS) +stream-status$(EXEEXT): $(stream_status_OBJECTS) $(stream_status_DEPENDENCIES) + @rm -f stream-status$(EXEEXT) + $(AM_V_CCLD)$(stream_status_LINK) $(stream_status_OBJECTS) $(stream_status_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpool_test-rtpool-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpool_test-testrtpool.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_status-stream-status.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +rtpool_test-rtpool-test.o: rtpool-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rtpool_test_CFLAGS) $(CFLAGS) -MT rtpool_test-rtpool-test.o -MD -MP -MF $(DEPDIR)/rtpool_test-rtpool-test.Tpo -c -o rtpool_test-rtpool-test.o `test -f 'rtpool-test.c' || echo '$(srcdir)/'`rtpool-test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rtpool_test-rtpool-test.Tpo $(DEPDIR)/rtpool_test-rtpool-test.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rtpool-test.c' object='rtpool_test-rtpool-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rtpool_test_CFLAGS) $(CFLAGS) -c -o rtpool_test-rtpool-test.o `test -f 'rtpool-test.c' || echo '$(srcdir)/'`rtpool-test.c + +rtpool_test-rtpool-test.obj: rtpool-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rtpool_test_CFLAGS) $(CFLAGS) -MT rtpool_test-rtpool-test.obj -MD -MP -MF $(DEPDIR)/rtpool_test-rtpool-test.Tpo -c -o rtpool_test-rtpool-test.obj `if test -f 'rtpool-test.c'; then $(CYGPATH_W) 'rtpool-test.c'; else $(CYGPATH_W) '$(srcdir)/rtpool-test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rtpool_test-rtpool-test.Tpo $(DEPDIR)/rtpool_test-rtpool-test.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rtpool-test.c' object='rtpool_test-rtpool-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rtpool_test_CFLAGS) $(CFLAGS) -c -o rtpool_test-rtpool-test.obj `if test -f 'rtpool-test.c'; then $(CYGPATH_W) 'rtpool-test.c'; else $(CYGPATH_W) '$(srcdir)/rtpool-test.c'; fi` + +rtpool_test-testrtpool.o: testrtpool.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rtpool_test_CFLAGS) $(CFLAGS) -MT rtpool_test-testrtpool.o -MD -MP -MF $(DEPDIR)/rtpool_test-testrtpool.Tpo -c -o rtpool_test-testrtpool.o `test -f 'testrtpool.c' || echo '$(srcdir)/'`testrtpool.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rtpool_test-testrtpool.Tpo $(DEPDIR)/rtpool_test-testrtpool.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testrtpool.c' object='rtpool_test-testrtpool.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rtpool_test_CFLAGS) $(CFLAGS) -c -o rtpool_test-testrtpool.o `test -f 'testrtpool.c' || echo '$(srcdir)/'`testrtpool.c + +rtpool_test-testrtpool.obj: testrtpool.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rtpool_test_CFLAGS) $(CFLAGS) -MT rtpool_test-testrtpool.obj -MD -MP -MF $(DEPDIR)/rtpool_test-testrtpool.Tpo -c -o rtpool_test-testrtpool.obj `if test -f 'testrtpool.c'; then $(CYGPATH_W) 'testrtpool.c'; else $(CYGPATH_W) '$(srcdir)/testrtpool.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rtpool_test-testrtpool.Tpo $(DEPDIR)/rtpool_test-testrtpool.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testrtpool.c' object='rtpool_test-testrtpool.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rtpool_test_CFLAGS) $(CFLAGS) -c -o rtpool_test-testrtpool.obj `if test -f 'testrtpool.c'; then $(CYGPATH_W) 'testrtpool.c'; else $(CYGPATH_W) '$(srcdir)/testrtpool.c'; fi` + +stream_status-stream-status.o: stream-status.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stream_status_CFLAGS) $(CFLAGS) -MT stream_status-stream-status.o -MD -MP -MF $(DEPDIR)/stream_status-stream-status.Tpo -c -o stream_status-stream-status.o `test -f 'stream-status.c' || echo '$(srcdir)/'`stream-status.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stream_status-stream-status.Tpo $(DEPDIR)/stream_status-stream-status.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stream-status.c' object='stream_status-stream-status.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stream_status_CFLAGS) $(CFLAGS) -c -o stream_status-stream-status.o `test -f 'stream-status.c' || echo '$(srcdir)/'`stream-status.c + +stream_status-stream-status.obj: stream-status.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stream_status_CFLAGS) $(CFLAGS) -MT stream_status-stream-status.obj -MD -MP -MF $(DEPDIR)/stream_status-stream-status.Tpo -c -o stream_status-stream-status.obj `if test -f 'stream-status.c'; then $(CYGPATH_W) 'stream-status.c'; else $(CYGPATH_W) '$(srcdir)/stream-status.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stream_status-stream-status.Tpo $(DEPDIR)/stream_status-stream-status.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stream-status.c' object='stream_status-stream-status.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stream_status_CFLAGS) $(CFLAGS) -c -o stream_status-stream-status.obj `if test -f 'stream-status.c'; then $(CYGPATH_W) 'stream-status.c'; else $(CYGPATH_W) '$(srcdir)/stream-status.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/examples/streams/rtpool-test.c b/tests/examples/streams/rtpool-test.c new file mode 100644 index 0000000..960b6ea --- /dev/null +++ b/tests/examples/streams/rtpool-test.c @@ -0,0 +1,172 @@ +#include <stdlib.h> +#include <gst/gst.h> + +#include "testrtpool.h" + +static GstTaskPool *pool; + +static void +event_loop (GstBus * bus, GstElement * pipe) +{ + GstMessage *message = NULL; + + while (TRUE) { + message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); + + g_assert (message != NULL); + + switch (message->type) { + case GST_MESSAGE_EOS: + g_message ("received EOS"); + gst_message_unref (message); + return; + case GST_MESSAGE_WARNING: + { + GError *gerror; + gchar *debug; + + gst_message_parse_warning (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + gst_message_unref (message); + g_error_free (gerror); + g_free (debug); + return; + } + case GST_MESSAGE_ERROR:{ + GError *gerror; + gchar *debug; + + gst_message_parse_error (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + gst_message_unref (message); + g_error_free (gerror); + g_free (debug); + return; + } + default: + gst_message_unref (message); + break; + } + } +} + +static GstBusSyncReply +sync_bus_handler (GstBus * bus, GstMessage * message, GstElement * bin) +{ + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_STREAM_STATUS: + { + GstStreamStatusType type; + GstElement *owner; + const GValue *val; + gchar *path; + GstTask *task = NULL; + + g_message ("received STREAM_STATUS"); + gst_message_parse_stream_status (message, &type, &owner); + + val = gst_message_get_stream_status_object (message); + + g_message ("type: %d", type); + path = gst_object_get_path_string (GST_MESSAGE_SRC (message)); + g_message ("source: %s", path); + g_free (path); + path = gst_object_get_path_string (GST_OBJECT (owner)); + g_message ("owner: %s", path); + g_free (path); + + if (G_VALUE_HOLDS_OBJECT (val)) { + g_message ("object: type %s, value %p", G_VALUE_TYPE_NAME (val), + g_value_get_object (val)); + } else if (G_VALUE_HOLDS_POINTER (val)) { + g_message ("object: type %s, value %p", G_VALUE_TYPE_NAME (val), + g_value_get_pointer (val)); + } else if (G_IS_VALUE (val)) { + g_message ("object: type %s", G_VALUE_TYPE_NAME (val)); + } else { + g_message ("object: (null)"); + break; + } + + /* see if we know how to deal with this object */ + if (G_VALUE_TYPE (val) == GST_TYPE_TASK) { + task = g_value_get_object (val); + } + + switch (type) { + case GST_STREAM_STATUS_TYPE_CREATE: + if (task) { + g_message ("created task %p, setting pool", task); + gst_task_set_pool (task, pool); + } + break; + case GST_STREAM_STATUS_TYPE_ENTER: + break; + case GST_STREAM_STATUS_TYPE_LEAVE: + break; + default: + break; + } + break; + } + default: + break; + } + /* pass all messages on the async queue */ + return GST_BUS_PASS; +} + +int +main (int argc, char *argv[]) +{ + GstElement *bin, *alsasrc, *alsasink; + GstBus *bus; + GstStateChangeReturn ret; + + gst_init (&argc, &argv); + + /* create a custom thread pool */ + pool = test_rt_pool_new (); + + /* create a new bin to hold the elements */ + bin = gst_pipeline_new ("pipeline"); + g_assert (bin); + + /* create a source */ + alsasrc = gst_element_factory_make ("alsasrc", "alsasrc"); + g_assert (alsasrc); + g_object_set (alsasrc, "device", "hw:0", NULL); + g_object_set (alsasrc, "latency-time", (gint64) 2000, NULL); + g_object_set (alsasrc, "slave-method", 2, NULL); + + /* and a sink */ + alsasink = gst_element_factory_make ("alsasink", "alsasink"); + g_assert (alsasink); + g_object_set (alsasink, "device", "hw:0", NULL); + g_object_set (alsasink, "latency-time", (gint64) 2000, NULL); + g_object_set (alsasink, "buffer-time", (gint64) 10000, NULL); + + /* add objects to the main pipeline */ + gst_bin_add_many (GST_BIN (bin), alsasrc, alsasink, NULL); + + /* link the elements */ + gst_element_link (alsasrc, alsasink); + + /* get the bus, we need to install a sync handler */ + bus = gst_pipeline_get_bus (GST_PIPELINE (bin)); + gst_bus_set_sync_handler (bus, (GstBusSyncHandler) sync_bus_handler, bin); + + /* start playing */ + ret = gst_element_set_state (bin, GST_STATE_PLAYING); + if (ret == GST_STATE_CHANGE_FAILURE) + return 0; + + /* Run event loop listening for bus messages until EOS or ERROR */ + event_loop (bus, bin); + + /* stop the bin */ + gst_element_set_state (bin, GST_STATE_NULL); + gst_object_unref (bus); + + exit (0); +} diff --git a/tests/examples/streams/stream-status.c b/tests/examples/streams/stream-status.c new file mode 100644 index 0000000..f667468 --- /dev/null +++ b/tests/examples/streams/stream-status.c @@ -0,0 +1,146 @@ +#include <stdlib.h> +#include <gst/gst.h> + +static void +event_loop (GstBus * bus, GstElement * pipe) +{ + GstMessage *message = NULL; + + while (TRUE) { + message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); + + g_assert (message != NULL); + + switch (message->type) { + case GST_MESSAGE_EOS: + g_message ("received EOS"); + gst_message_unref (message); + return; + case GST_MESSAGE_WARNING:{ + GError *gerror; + gchar *debug; + + gst_message_parse_warning (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + gst_message_unref (message); + g_error_free (gerror); + g_free (debug); + break; + } + case GST_MESSAGE_ERROR:{ + GError *gerror; + gchar *debug; + + gst_message_parse_error (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + gst_message_unref (message); + g_error_free (gerror); + g_free (debug); + return; + } + default: + gst_message_unref (message); + break; + } + } +} + +static GstBusSyncReply +sync_bus_handler (GstBus * bus, GstMessage * message, GstElement * bin) +{ + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_STREAM_STATUS: + { + GstStreamStatusType type; + GstElement *owner; + const GValue *val; + gchar *path; + GstTask *task = NULL; + + g_message ("received STREAM_STATUS"); + gst_message_parse_stream_status (message, &type, &owner); + + val = gst_message_get_stream_status_object (message); + + g_message ("type: %d", type); + path = gst_object_get_path_string (GST_MESSAGE_SRC (message)); + g_message ("source: %s", path); + g_free (path); + path = gst_object_get_path_string (GST_OBJECT (owner)); + g_message ("owner: %s", path); + g_free (path); + g_message ("object: type %s, value %p", G_VALUE_TYPE_NAME (val), + g_value_get_object (val)); + + /* see if we know how to deal with this object */ + if (G_VALUE_TYPE (val) == GST_TYPE_TASK) { + task = g_value_get_object (val); + } + + switch (type) { + case GST_STREAM_STATUS_TYPE_CREATE: + g_message ("created task %p", task); + break; + case GST_STREAM_STATUS_TYPE_ENTER: + if (task) { + g_message ("raising task priority for %p", task); + gst_task_set_priority (task, G_THREAD_PRIORITY_HIGH); + } + break; + case GST_STREAM_STATUS_TYPE_LEAVE: + break; + default: + break; + } + break; + } + default: + break; + } + /* pass all messages on the async queue */ + return GST_BUS_PASS; +} + +int +main (int argc, char *argv[]) +{ + GstElement *bin, *fakesrc, *fakesink; + GstBus *bus; + + gst_init (&argc, &argv); + + /* create a new bin to hold the elements */ + bin = gst_pipeline_new ("pipeline"); + g_assert (bin); + + /* create a source */ + fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); + g_assert (fakesrc); + g_object_set (fakesrc, "num-buffers", 50, NULL); + + /* and a sink */ + fakesink = gst_element_factory_make ("fakesink", "fakesink"); + g_assert (fakesink); + + /* add objects to the main pipeline */ + gst_bin_add_many (GST_BIN (bin), fakesrc, fakesink, NULL); + + /* link the elements */ + gst_element_link (fakesrc, fakesink); + + /* get the bus, we need to install a sync handler */ + bus = gst_pipeline_get_bus (GST_PIPELINE (bin)); + gst_bus_set_sync_handler (bus, (GstBusSyncHandler) sync_bus_handler, bin); + + /* start playing */ + gst_element_set_state (bin, GST_STATE_PLAYING); + + /* Run event loop listening for bus messages until EOS or ERROR */ + event_loop (bus, bin); + + /* stop the bin */ + gst_element_set_state (bin, GST_STATE_NULL); + gst_object_unref (bus); + + exit (0); +} diff --git a/tests/examples/streams/testrtpool.c b/tests/examples/streams/testrtpool.c new file mode 100644 index 0000000..f2e6fa5 --- /dev/null +++ b/tests/examples/streams/testrtpool.c @@ -0,0 +1,135 @@ +/* GStreamer + * Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.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. + */ + +#include <pthread.h> + +#include "testrtpool.h" + +static void test_rt_pool_finalize (GObject * object); + +typedef struct +{ + pthread_t thread; +} TestRTId; + +G_DEFINE_TYPE (TestRTPool, test_rt_pool, GST_TYPE_TASK_POOL); + +static void +default_prepare (GstTaskPool * pool, GError ** error) +{ + /* we don't do anything here. We could construct a pool of threads here that + * we could reuse later but we don't */ + g_message ("prepare Realtime pool %p", pool); +} + +static void +default_cleanup (GstTaskPool * pool) +{ + g_message ("cleanup Realtime pool %p", pool); +} + +static gpointer +default_push (GstTaskPool * pool, GstTaskPoolFunction func, gpointer data, + GError ** error) +{ + TestRTId *tid; + gint res; + pthread_attr_t attr; + struct sched_param param; + + g_message ("pushing Realtime pool %p, %p", pool, func); + + tid = g_slice_new0 (TestRTId); + + g_message ("set policy"); + pthread_attr_init (&attr); + if ((res = pthread_attr_setschedpolicy (&attr, SCHED_RR)) != 0) + g_warning ("setschedpolicy: failure: %p", g_strerror (res)); + + g_message ("set prio"); + param.sched_priority = 50; + if ((res = pthread_attr_setschedparam (&attr, ¶m)) != 0) + g_warning ("setschedparam: failure: %p", g_strerror (res)); + + g_message ("set inherit"); + if ((res = pthread_attr_setinheritsched (&attr, PTHREAD_EXPLICIT_SCHED)) != 0) + g_warning ("setinheritsched: failure: %p", g_strerror (res)); + + g_message ("create thread"); + res = pthread_create (&tid->thread, &attr, (void *(*)(void *)) func, data); + + if (res != 0) { + g_set_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN, + "Error creating thread: %s", g_strerror (res)); + g_slice_free (TestRTId, tid); + tid = NULL; + } + + return tid; +} + +static void +default_join (GstTaskPool * pool, gpointer id) +{ + TestRTId *tid = (TestRTId *) id; + + g_message ("joining Realtime pool %p", pool); + + pthread_join (tid->thread, NULL); + + g_slice_free (TestRTId, tid); +} + +static void +test_rt_pool_class_init (TestRTPoolClass * klass) +{ + GObjectClass *gobject_class; + GstTaskPoolClass *gsttaskpool_class; + + gobject_class = (GObjectClass *) klass; + gsttaskpool_class = (GstTaskPoolClass *) klass; + + gobject_class->finalize = GST_DEBUG_FUNCPTR (test_rt_pool_finalize); + + gsttaskpool_class->prepare = default_prepare; + gsttaskpool_class->cleanup = default_cleanup; + gsttaskpool_class->push = default_push; + gsttaskpool_class->join = default_join; +} + +static void +test_rt_pool_init (TestRTPool * pool) +{ +} + +static void +test_rt_pool_finalize (GObject * object) +{ + G_OBJECT_CLASS (test_rt_pool_parent_class)->finalize (object); +} + +GstTaskPool * +test_rt_pool_new (void) +{ + GstTaskPool *pool; + + pool = g_object_new (TEST_TYPE_RT_POOL, NULL); + + return pool; +} diff --git a/tests/examples/streams/testrtpool.h b/tests/examples/streams/testrtpool.h new file mode 100644 index 0000000..580cffa --- /dev/null +++ b/tests/examples/streams/testrtpool.h @@ -0,0 +1,53 @@ +/* GStreamer + * Copyright (C) <2009> Wim Taymans <wim.taymans@gmail.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 __TEST_RT_POOL_H__ +#define __TEST_RT_POOL_H__ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +/* --- standard type macros --- */ +#define TEST_TYPE_RT_POOL (test_rt_pool_get_type ()) +#define TEST_RT_POOL(pool) (G_TYPE_CHECK_INSTANCE_CAST ((pool), TEST_TYPE_RT_POOL, TestRTPool)) +#define TEST_IS_RT_POOL(pool) (G_TYPE_CHECK_INSTANCE_TYPE ((pool), TEST_TYPE_RT_POOL)) +#define TEST_RT_POOL_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), TEST_TYPE_RT_POOL, TestRTPoolClass)) +#define TEST_IS_RT_POOL_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), TEST_TYPE_RT_POOL)) +#define TEST_RT_POOL_GET_CLASS(pool) (G_TYPE_INSTANCE_GET_CLASS ((pool), TEST_TYPE_RT_POOL, TestRTPoolClass)) +#define TEST_RT_POOL_CAST(pool) ((TestRTPool*)(pool)) + +typedef struct _TestRTPool TestRTPool; +typedef struct _TestRTPoolClass TestRTPoolClass; + +struct _TestRTPool { + GstTaskPool object; +}; + +struct _TestRTPoolClass { + GstTaskPoolClass parent_class; +}; + +GType test_rt_pool_get_type (void); + +GstTaskPool * test_rt_pool_new (void); + +G_END_DECLS + +#endif /* __TEST_RT_POOL_H__ */ diff --git a/tests/examples/typefind/Makefile.am b/tests/examples/typefind/Makefile.am new file mode 100644 index 0000000..cc99802 --- /dev/null +++ b/tests/examples/typefind/Makefile.am @@ -0,0 +1,5 @@ +noinst_PROGRAMS = typefind + +typefind_LDADD = $(GST_OBJ_LIBS) +typefind_CFLAGS = $(GST_OBJ_CFLAGS) + diff --git a/tests/examples/typefind/Makefile.in b/tests/examples/typefind/Makefile.in new file mode 100644 index 0000000..f1dad62 --- /dev/null +++ b/tests/examples/typefind/Makefile.in @@ -0,0 +1,687 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +noinst_PROGRAMS = typefind$(EXEEXT) +subdir = tests/examples/typefind +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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 = +PROGRAMS = $(noinst_PROGRAMS) +typefind_SOURCES = typefind.c +typefind_OBJECTS = typefind-typefind.$(OBJEXT) +am__DEPENDENCIES_1 = +typefind_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +typefind_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(typefind_CFLAGS) \ + $(CFLAGS) $(AM_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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = typefind.c +DIST_SOURCES = typefind.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +typefind_LDADD = $(GST_OBJ_LIBS) +typefind_CFLAGS = $(GST_OBJ_CFLAGS) +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 tests/examples/typefind/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/examples/typefind/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): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +typefind$(EXEEXT): $(typefind_OBJECTS) $(typefind_DEPENDENCIES) + @rm -f typefind$(EXEEXT) + $(AM_V_CCLD)$(typefind_LINK) $(typefind_OBJECTS) $(typefind_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/typefind-typefind.Po@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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +typefind-typefind.o: typefind.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(typefind_CFLAGS) $(CFLAGS) -MT typefind-typefind.o -MD -MP -MF $(DEPDIR)/typefind-typefind.Tpo -c -o typefind-typefind.o `test -f 'typefind.c' || echo '$(srcdir)/'`typefind.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/typefind-typefind.Tpo $(DEPDIR)/typefind-typefind.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='typefind.c' object='typefind-typefind.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(typefind_CFLAGS) $(CFLAGS) -c -o typefind-typefind.o `test -f 'typefind.c' || echo '$(srcdir)/'`typefind.c + +typefind-typefind.obj: typefind.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(typefind_CFLAGS) $(CFLAGS) -MT typefind-typefind.obj -MD -MP -MF $(DEPDIR)/typefind-typefind.Tpo -c -o typefind-typefind.obj `if test -f 'typefind.c'; then $(CYGPATH_W) 'typefind.c'; else $(CYGPATH_W) '$(srcdir)/typefind.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/typefind-typefind.Tpo $(DEPDIR)/typefind-typefind.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='typefind.c' object='typefind-typefind.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(typefind_CFLAGS) $(CFLAGS) -c -o typefind-typefind.obj `if test -f 'typefind.c'; then $(CYGPATH_W) 'typefind.c'; else $(CYGPATH_W) '$(srcdir)/typefind.c'; fi` + +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 $(PROGRAMS) +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstPROGRAMS \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS 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-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 + + +# 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/tests/examples/typefind/typefind.c b/tests/examples/typefind/typefind.c new file mode 100644 index 0000000..58f11db --- /dev/null +++ b/tests/examples/typefind/typefind.c @@ -0,0 +1,135 @@ +/* GStreamer typefind element example + * Copyright (C) <2005> Stefan Kost + * Copyright (C) <2006> Tim-Philipp Müller + * + * 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 <gst/gst.h> + +#include <stdlib.h> + +static void +type_found (GstElement * typefind, guint probability, const GstCaps * caps, + gpointer user_data) +{ + gchar *xml, *caps_str; + + caps_str = gst_caps_to_string (caps); + xml = g_markup_printf_escaped ("<?xml version=\"1.0\"?>\n<Capabilities>\n" + " <Caps1>%s</Caps1>\n</Capabilities>", caps_str); + g_free (caps_str); + + g_print ("%s\n", xml); + g_free (xml); +} + +static void +event_loop (GstElement * pipe) +{ + GstBus *bus; + GstMessage *message = NULL; + gboolean running = TRUE; + + bus = gst_element_get_bus (GST_ELEMENT (pipe)); + + while (running) { + message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); + + g_assert (message != NULL); + + switch (message->type) { + case GST_MESSAGE_EOS: + running = FALSE; + break; + case GST_MESSAGE_WARNING:{ + GError *gerror; + gchar *debug; + + gst_message_parse_warning (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + break; + } + case GST_MESSAGE_ERROR:{ + GError *gerror; + gchar *debug; + + gst_message_parse_error (message, &gerror, &debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); + g_error_free (gerror); + g_free (debug); + running = FALSE; + break; + } + default: + break; + } + gst_message_unref (message); + } + gst_object_unref (bus); +} + +int +main (int argc, char *argv[]) +{ + GstElement *pipeline, *filesrc, *typefind, *sink; + + gst_init (&argc, &argv); + + if (argc != 2) { + g_print ("usage: %s <filename>\n", argv[0]); + exit (-1); + } + + /* create a new pipeline to hold the elements */ + pipeline = gst_pipeline_new ("pipeline"); + g_assert (pipeline != NULL); + + /* create a file reader */ + filesrc = gst_element_factory_make ("filesrc", "file_source"); + g_assert (filesrc != NULL); + g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); + + typefind = gst_element_factory_make ("typefind", "typefind"); + g_assert (typefind != NULL); + + sink = gst_element_factory_make ("fakesink", "sink"); + g_assert (sink != NULL); + + /* add objects to the main pipeline */ + gst_bin_add (GST_BIN (pipeline), filesrc); + gst_bin_add (GST_BIN (pipeline), typefind); + gst_bin_add (GST_BIN (pipeline), sink); + + g_signal_connect (G_OBJECT (typefind), "have-type", + G_CALLBACK (type_found), NULL); + + gst_element_link_many (filesrc, typefind, sink, NULL); + + /* start playing */ + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + /* Run event loop listening for bus messages until EOS or ERROR */ + event_loop (pipeline); + + /* stop the bin */ + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); + + exit (0); +} diff --git a/tests/misc/Makefile.am b/tests/misc/Makefile.am new file mode 100644 index 0000000..7ba8572 --- /dev/null +++ b/tests/misc/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = \ + network-clock.scm \ + network-clock-utils.scm \ + plot-data diff --git a/tests/misc/Makefile.in b/tests/misc/Makefile.in new file mode 100644 index 0000000..ca89e33 --- /dev/null +++ b/tests/misc/Makefile.in @@ -0,0 +1,541 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 = tests/misc +DIST_COMMON = $(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-docbook.m4 \ + $(top_srcdir)/common/m4/as-libtool.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-doc.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-parser.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.m4 \ + $(top_srcdir)/common/m4/gtk-doc.m4 \ + $(top_srcdir)/common/m4/introspection.m4 \ + $(top_srcdir)/common/m4/pkg.m4 \ + $(top_srcdir)/m4/check-checks.m4 $(top_srcdir)/m4/gettext.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_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON_PATH = @BISON_PATH@ +CAT_ENTRY_END = @CAT_ENTRY_END@ +CAT_ENTRY_START = @CAT_ENTRY_START@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_MAJOR_VERSION = @CHECK_MAJOR_VERSION@ +CHECK_MICRO_VERSION = @CHECK_MICRO_VERSION@ +CHECK_MINOR_VERSION = @CHECK_MINOR_VERSION@ +CHECK_VERSION = @CHECK_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SUBUNIT = @ENABLE_SUBUNIT@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLEX_PATH = @FLEX_PATH@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_ONLY_CFLAGS = @GLIB_ONLY_CFLAGS@ +GLIB_ONLY_LIBS = @GLIB_ONLY_LIBS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMP_LIBS = @GMP_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSL_LIBS = @GSL_LIBS@ +GST_AGE = @GST_AGE@ +GST_ALL_CFLAGS = @GST_ALL_CFLAGS@ +GST_ALL_CXXFLAGS = @GST_ALL_CXXFLAGS@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_ALL_LIBS = @GST_ALL_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_DISABLE_ALLOC_TRACE_DEFINE = @GST_DISABLE_ALLOC_TRACE_DEFINE@ +GST_DISABLE_GST_DEBUG_DEFINE = @GST_DISABLE_GST_DEBUG_DEFINE@ +GST_DISABLE_NET_DEFINE = @GST_DISABLE_NET_DEFINE@ +GST_DISABLE_OPTION_PARSING_DEFINE = @GST_DISABLE_OPTION_PARSING_DEFINE@ +GST_DISABLE_PARSE_DEFINE = @GST_DISABLE_PARSE_DEFINE@ +GST_DISABLE_PLUGIN_DEFINE = @GST_DISABLE_PLUGIN_DEFINE@ +GST_DISABLE_REGISTRY_DEFINE = @GST_DISABLE_REGISTRY_DEFINE@ +GST_DISABLE_TRACE_DEFINE = @GST_DISABLE_TRACE_DEFINE@ +GST_HAVE_MONOTONIC_CLOCK_DEFINE = @GST_HAVE_MONOTONIC_CLOCK_DEFINE@ +GST_HAVE_POSIX_TIMERS_DEFINE = @GST_HAVE_POSIX_TIMERS_DEFINE@ +GST_HAVE_UNALIGNED_ACCESS_DEFINE = @GST_HAVE_UNALIGNED_ACCESS_DEFINE@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OBJ_CFLAGS = @GST_OBJ_CFLAGS@ +GST_OBJ_CXXFLAGS = @GST_OBJ_CXXFLAGS@ +GST_OBJ_LIBS = @GST_OBJ_LIBS@ +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_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@ +GST_PKG_DEPS = @GST_PKG_DEPS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_SCANNER_INSTALLED = @GST_PLUGIN_SCANNER_INSTALLED@ +GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE@ +GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE = @GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE@ +GST_REGISTRY_DOC_TYPES = @GST_REGISTRY_DOC_TYPES@ +GST_REVISION = @GST_REVISION@ +GST_USING_PRINTF_EXTENSION_DEFINE = @GST_USING_PRINTF_EXTENSION_DEFINE@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@ +HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@ +HAVE_DVIPS = @HAVE_DVIPS@ +HAVE_EPSTOPDF = @HAVE_EPSTOPDF@ +HAVE_FIG2DEV = @HAVE_FIG2DEV@ +HAVE_GMP = @HAVE_GMP@ +HAVE_GSL = @HAVE_GSL@ +HAVE_JADETEX = @HAVE_JADETEX@ +HAVE_PNGTOPNM = @HAVE_PNGTOPNM@ +HAVE_PNMTOPS = @HAVE_PNMTOPS@ +HAVE_PS2PDF = @HAVE_PS2PDF@ +HAVE_XMLLINT = @HAVE_XMLLINT@ +HOST_CPU = @HOST_CPU@ +HTML_DIR = @HTML_DIR@ +INET_ATON_LIBS = @INET_ATON_LIBS@ +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@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +PERL_PATH = @PERL_PATH@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGINDIR = @PLUGINDIR@ +POSUB = @POSUB@ +PROFILE_CFLAGS = @PROFILE_CFLAGS@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VALGRIND_PATH = @VALGRIND_PATH@ +VERSION = @VERSION@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CATALOG = @XML_CATALOG@ +XSLTPROC = @XSLTPROC@ +XSLTPROC_FLAGS = @XSLTPROC_FLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +EXTRA_DIST = \ + network-clock.scm \ + network-clock-utils.scm \ + plot-data + +all: all-am + +.SUFFIXES: +$(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 tests/misc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/misc/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): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +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 +installdirs: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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 mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +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 -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool 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-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am + + +# 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/tests/misc/network-clock-utils.scm b/tests/misc/network-clock-utils.scm new file mode 100644 index 0000000..174b5f7 --- /dev/null +++ b/tests/misc/network-clock-utils.scm @@ -0,0 +1,229 @@ +;; GStreamer +;; Copyright (C) 2005 Andy Wingo <wingo at pobox.com> + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2 of +;; the License, or (at your option) any later version. +;; +;; This program 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 General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, contact: +;; +;; Free Software Foundation Voice: +1-617-542-5942 +;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652 +;; Boston, MA 02111-1307, USA gnu@gnu.org + + +;;; Commentary: +;; +;; Utilities for the network clock simulator. +;; +;;; Code: + + +;; Init the rng. + +(use-modules ((srfi srfi-1) (fold unfold))) + +(define (read-bytes-from-file-as-integer f n) + (with-input-from-file f + (lambda () + (fold (lambda (x seed) (+ x (ash seed 8))) + 0 + (unfold zero? (lambda (n) (char->integer (read-char))) 1- n))))) + +(set! *random-state* (seed->random-state + (read-bytes-from-file-as-integer "/dev/random" 4))) + +;; General utilities. + +(define (iround x) + (if (inexact? x) + (inexact->exact (round x)) + x)) + +(define (filter proc l) + (cond + ((null? l) '()) + ((proc (car l)) (cons (car l) (filter proc (cdr l)))) + (else (filter proc (cdr l))))) + +(define (sum l) + (apply + l)) + +(define (avg . nums) + (/ (sum nums) (length nums))) + +(define (sq x) + (* x x)) + +(define (debug str . args) + (if *debug* + (apply format (current-error-port) str args))) + +(define (print-event kind x y) + (format #t "~a ~a ~a\n" kind x y)) + +;; Linear least squares. +;; +;; See http://mathworld.wolfram.com/LeastSquaresFitting.html +;; returns (values slope intercept r-squared) + +(define (least-squares x y) + (let ((n (length x))) + (let ((xbar (apply avg x)) + (ybar (apply avg y))) + (let ((sxx (- (sum (map sq x)) (* n (sq xbar)))) + (syy (- (sum (map sq y)) (* n (sq ybar)))) + (sxy (- (sum (map * x y)) (* n xbar ybar)))) + (let ((slope (/ sxy sxx))) + (values + slope + (- ybar (* slope xbar)) + (/ (sq sxy) (* sxx syy)))))))) + +;; Streams: lists with lazy cdrs. + +(define-macro (stream-cons kar kdr) + `(cons ,kar (delay ,kdr))) + +(define (stream-cdr stream) + (force (cdr stream))) + +(define (stream-car stream) + (car stream)) + +(define (stream-null? stream) + (null? stream)) + +(define (stream-ref stream n) + (if (zero? n) + (stream-car stream) + (stream-ref (stream-cdr stream) (1- n)))) + +(define (stream->list stream n) + (let lp ((in stream) (out '()) (n n)) + (if (zero? n) + (reverse! out) + (lp (stream-cdr in) (cons (stream-car in) out) (1- n))))) + +(define (stream-skip stream n) + (if (zero? n) + stream + (stream-skip (stream-cdr stream) (1- n)))) + +(define (stream-sample stream n) + (stream-cons (stream-car stream) + (stream-sample (stream-skip stream n) n))) + +(define (stream-map proc . streams) + (stream-cons (apply proc (map stream-car streams)) + (apply stream-map proc (map stream-cdr streams)))) + +(define (arithmetic-series start step) + (stream-cons start (arithmetic-series (+ start step) step))) + +(define (scale-stream stream factor) + (stream-map (lambda (t) (* t factor)) stream)) + +(define (stream-while pred proc . streams) + (if (apply pred (map stream-car streams)) + (begin + (apply proc (map stream-car streams)) + (apply stream-while pred proc (map stream-cdr streams))))) + +(define (stream-of val) + (stream-cons val (stream-of val))) + +(define (periodic-stream val period) + (let ((period (iround (max 1 (* *sample-frequency* period))))) + (let lp ((n 0)) + (if (zero? n) + (stream-cons val (lp period)) + (stream-cons #f (lp (1- n))))))) + + +;; Queues with a maximum length. + +(define (make-q l) + (cons l (last-pair l))) + +(define (q-head q) + (car q)) + +(define (q-tail q) + (car q)) + +(define (q-push q val) + (let ((tail (cons val '()))) + (if (null? (q-tail q)) + (make-q tail) + (let ((l (append! (q-head q) tail))) + (if (> (length (q-head q)) *window-size*) + (make-q (cdr (q-head q))) + q))))) + + +;; Parameters, settable via command line arguments. + +(define %parameters '()) +(define-macro (define-parameter name val) + (let ((str (symbol->string name))) + (or (and (eqv? (string-ref str 0) #\*) + (eqv? (string-ref str (1- (string-length str))) #\*)) + (error "Invalid parameter name" name)) + (let ((param (string->symbol + (substring str 1 (1- (string-length str))))) + (val-sym (gensym))) + `(begin + (define ,name #f) + (let ((,val-sym ,val)) + (set! ,name ,val-sym) + (set! %parameters (cons (cons ',param ,val-sym) + %parameters))))))) +(define (set-parameter! name val) + (define (symbol-append . args) + (string->symbol (apply string-append (map symbol->string args)))) + (or (assq name %parameters) + (error "Unknown parameter" name)) + (module-set! (current-module) (symbol-append '* name '*) val)) + +(define (parse-parameter-arguments args) + (define (usage) + (format #t "Usage: ~a ARG1...\n\n" "network-clock.scm") + (for-each + (lambda (pair) + (format #t "\t--~a=VAL \t(default: ~a)\n" (car pair) (cdr pair))) + %parameters)) + (define (unknown-arg arg) + (with-output-to-port (current-error-port) + (lambda () + (format #t "\nUnknown argument: ~a\n\n" arg) + (usage) + (quit)))) + (define (parse-arguments args) + (let lp ((in args) (out '())) + (cond + ((null? in) + (reverse! out)) + ((not (string=? (substring (car in) 0 2) "--")) + (unknown-arg (car in))) + (else + (let ((divider (or (string-index (car in) #\=) + (unknown-arg (car in))))) + (or (> divider 2) (unknown-arg (car in))) + (let ((param (string->symbol (substring (car in) 2 divider))) + (val (with-input-from-string (substring (car in) (1+ divider)) + read))) + (lp (cdr in) (acons param val out)))))))) + (for-each + (lambda (pair) + (or (false-if-exception + (set-parameter! (car pair) (cdr pair))) + (unknown-arg (format #f "--~a=~a" (car pair) (cdr pair))))) + (parse-arguments args))) diff --git a/tests/misc/network-clock.scm b/tests/misc/network-clock.scm new file mode 100755 index 0000000..10878c6 --- /dev/null +++ b/tests/misc/network-clock.scm @@ -0,0 +1,205 @@ +#!/bin/bash +# -*- scheme -*- +exec guile --debug -l $0 -e main -- "$@" +!# + +;; GStreamer +;; Copyright (C) 2005 Andy Wingo <wingo at pobox.com> + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2 of +;; the License, or (at your option) any later version. +;; +;; This program 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 General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, contact: +;; +;; Free Software Foundation Voice: +1-617-542-5942 +;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652 +;; Boston, MA 02111-1307, USA gnu@gnu.org + + +;;; Commentary: +;; +;; Network clock simulator. +;; +;; Simulates the attempts of one clock to synchronize with another over +;; the network. Packets are sent out with a local timestamp, and come +;; back with the remote time added on to the packet. The remote time is +;; assumed to have been observed at the local time in between sending +;; the query and receiving the reply. +;; +;; The local clock will attempt to adjust its rate and offset by fitting +;; a line to the last N datapoints on hand, by default 32. A better fit, +;; as measured by the correlation coefficient, will result in a longer +;; time before the next query. Bad fits or a not-yet-full set of data +;; will result in many queries in quick succession. +;; +;; The rate and offset are set directly to the slope and intercept from +;; the linear regression. This results in discontinuities in the local +;; time. As clock times must be monotonically increasing, a jump down in +;; time will result instead in time standing still for a while. Smoothly +;; varying the rate such that no discontinuities are present has not +;; been investigated. +;; +;; Implementation-wise, this simulator processes events and calculates +;; times discretely. Times are represented as streams, also known as +;; lazy lists. This is an almost-pure functional simulator. The thing to +;; remember while reading is that stream-cons does not evaluate its +;; second argument, rather deferring that calculation until stream-cdr +;; is called. In that way all times are actually infinite series. +;; +;; Usage: See network-clock.scm --help. +;; +;;; Code: + + +(use-modules (ice-9 popen)) + + +(load "network-clock-utils.scm") + + +(define (time->samples t) + (iround (* t *sample-frequency*))) + + +(define (schedule-event events e time) + (let lp ((response-time (time->samples time)) + (stream events)) + (if (zero? response-time) + (if (not (stream-car stream)) + (stream-cons e (stream-cdr stream)) + (stream-cons (stream-car stream) (lp 0 (stream-cdr stream)))) + (stream-cons (stream-car stream) (lp (1- response-time) (stream-cdr stream)))))) + +(define (schedule-send-time-query events time) + (schedule-event events (list 'send-time-query) time)) + +(define (schedule-time-query events l) + (schedule-event events (list 'time-query l) + (+ *send-delay* (random *send-jitter*)))) + +(define (schedule-time-response events l r) + (schedule-event events (list 'time-response l r) + (+ *recv-delay* (random *recv-jitter*)))) + +(define (network-time remote-time local-time events m b x y t) + (let ((r (stream-car remote-time)) + (l (stream-car local-time)) + (event (stream-car events)) + (events (stream-cdr events))) + + (define (next events m b x y t) + (stream-cons + (+ (* m l) b) + (network-time + (stream-cdr remote-time) (stream-cdr local-time) events m b x y t))) + + (case (and=> event car) + ((send-time-query) + (cond + ((< (random 1.0) *packet-loss*) + (debug "; dropped time query: ~a\n" l) + (print-event 'packet-lost l (+ (* m l) b)) + (next events m b x y (time->samples *timeout*))) + (else + (debug "; sending time query: ~a\n" l) + (print-event 'packet-sent l (+ (* m l) b)) + (next (schedule-time-query events l) m b x y (time->samples *timeout*))))) + + ((time-query) + (debug "; time query received, replying with ~a\n" r) + (next (schedule-time-response events (cadr event) r) m b x y (and t (1- t)))) + + ((time-response) + (let ((x (q-push x (avg (cadr event) l))) + (y (q-push y (caddr event)))) + (call-with-values + (lambda () (least-squares (q-head x) (q-head y))) + (lambda (m b r-squared) + (define (next-time) + (max + (if (< (length (q-head x)) *window-size*) + 0 + (/ 1 (- 1 (min r-squared 0.99999)) 1000)) + 0.10)) + (debug "; new slope and offset: ~a ~a (~a)\n" m b r-squared) + (print-event 'packet-observed (avg (cadr event) l) (caddr event)) + (print-event 'packet-received l (+ (* m l) b)) + (next (schedule-send-time-query events (next-time)) m b x y #f))))) + + (else + (cond + ((not t) + ;; not waiting for a response + (next events m b x y t)) + ((<= t 0) + ;; we timed out + (next (schedule-send-time-query events 0.0) m b x y 0)) + (else + (next events m b x y (1- t)))))))) + +(define (run-simulation remote-speed local-speed) + (let ((absolute-time (arithmetic-series 0.0 (/ 1.0 *sample-frequency*))) + (event-stream (stream-of #f))) + (let ((remote-time (scale-stream absolute-time remote-speed)) + (local-time (scale-stream absolute-time local-speed))) + (values + absolute-time + remote-time + local-time + (network-time + remote-time + local-time + (schedule-send-time-query event-stream 0.0) + 1.0 + (stream-car local-time) + (make-q (list (stream-car local-time))) + (make-q (list (stream-car remote-time))) + #f))))) + +(define (print-simulation) + (display "Absolute time; Remote time; Local time; Network time\n") + (call-with-values + (lambda () (run-simulation *remote-rate* *local-rate*)) + (lambda streams + (apply + stream-while + (lambda (a r l n) (<= a *total-time*)) + (lambda (a r l n) (format #t "~a ~a ~a ~a\n" a r l n)) + streams)))) + +(define (plot-simulation) + (let ((port (open-output-pipe "./plot-data Network Clock Simulation"))) + (with-output-to-port port + print-simulation) + (close-pipe port))) + + +(define-parameter *sample-frequency* 40) +(define-parameter *send-delay* 0.1) +(define-parameter *recv-delay* 0.1) +(define-parameter *packet-loss* 0.01) +(define-parameter *send-jitter* 0.1) +(define-parameter *recv-jitter* 0.1) +(define-parameter *window-size* 32) +(define-parameter *local-rate* 1.0) +(define-parameter *remote-rate* 1.1) +(define-parameter *total-time* 5.0) +(define-parameter *timeout* 1.0) +(define-parameter *debug* #f) +(define-parameter *with-graph* #t) + + +(define (main args) + (parse-parameter-arguments (cdr args)) + (if *with-graph* + (plot-simulation) + (print-simulation)) + (quit)) diff --git a/tests/misc/plot-data b/tests/misc/plot-data new file mode 100755 index 0000000..6627a66 --- /dev/null +++ b/tests/misc/plot-data @@ -0,0 +1,81 @@ +#!/usr/bin/env python + +from __future__ import division + +import pylab +import optparse +import sys + +def parse_data(l, state): + state['data'].append([float(x) for x in filter(None, l.split(' '))]) + return state + +def parse_event(l, state): + components = filter(None, l.split(' ')) + vals = [float(x) for x in components[1:]] + if not components[0] in state: + state[components[0]] = [vals] + else: + state[components[0]].append(vals) + return state + +def read_line(fd, state): + l = fd.readline() + if not l: + return None + l = l.strip() + if l[0].isdigit(): + return parse_data(l, state) + else: + return parse_event(l, state) + +def read_data(fd): + state = {'data':[], + 'packet-sent':[], + 'packet-lost':[], + 'packet-received':[], + 'packet-observed':[]} + newstate = state + while newstate: + state = newstate + newstate = read_line(fd, state) + return state + +def make_xticks(start, end, numticks): + return range(int(start), int(end), int((start-end)/numticks)) + +def make_plot(title): + l = sys.stdin.readline() + labels = l.strip().split(';') + state = read_data(sys.stdin) + data = state['data'] + lost_packets = state['packet-lost'] + obsv_packets = state['packet-observed'] + sent_packets = state['packet-sent'] + recd_packets = state['packet-received'] + + domain = [x[0] for x in data] + for i in range(1,len(labels)): + pylab.plot(domain, [x[i] for x in data], label=labels[i]) + pylab.plot([x[0] for x in lost_packets], [x[1] for x in lost_packets], + label='Client sent packet, but dropped', marker='x', linestyle=None, ms=8) + pylab.plot([x[0] for x in sent_packets], [x[1] for x in sent_packets], + label='Client sent packet', marker='^', linestyle=None, ms=8) + pylab.plot([x[0] for x in obsv_packets], [x[1] for x in obsv_packets], + label='Remote time observation', marker='D', linestyle=None, ms=8) + pylab.plot([x[0] for x in recd_packets], [x[1] for x in recd_packets], + label='Client received packet', marker='v', linestyle=None, ms=8) + pylab.legend() + pylab.ylabel(r'Clock time (s)') + pylab.xlabel(r'Real time (s)') + pylab.title(title) + pylab.grid(True) + pylab.show() + +def main(args): + parser = optparse.OptionParser() + + title = ' '.join(args[1:]) + make_plot(title) + +main(sys.argv) |