diff --git a/gstlal-calibration/configure.ac b/gstlal-calibration/configure.ac index 9e47cce55f5abf3c7b953b93d45bada7ae534a4a..366d8755dadc1bdb198946f0b2b198f43ccc3378 100644 --- a/gstlal-calibration/configure.ac +++ b/gstlal-calibration/configure.ac @@ -103,14 +103,13 @@ PKG_PROG_PKG_CONFIG() # -AM_PATH_PYTHON([2.6],,) +MIN_PYTHON_VERSION="2.7" +AM_PATH_PYTHON(["$MIN_PYTHON_VERSION"],,) AX_PYTHON_DEVEL() # hack to remove default lib dirs from PYTHON_LDFLAGS. only tested on # Debian and SL6. FIXME: find a way to do this properly PYTHON_LDFLAGS="`echo $PYTHON_LDFLAGS | sed -e 'sX-L/usr/lib\(64\)\?\(/\)\?[[:space:]]*XXg'`" -# hack to add missing options to PYTHON_LDFLAGS. sigh, what's the point of -# AX_PYTHON_DEVEL!? -PYTHON_LDFLAGS="-module -avoid-version $PYTHON_LDFLAGS" +AC_SUBST([MIN_PYTHON_VERSION]) # force python modules into same directory as gstlal AC_SUBST([pkgpythondir], ["\${pythondir}/gstlal"]) AC_SUBST([pkgpyexecdir], ["\${pyexecdir}/gstlal"]) @@ -149,9 +148,9 @@ AC_CHECK_LIB([m], [main], , [AC_MSG_ERROR([Not found!])]) # -AC_SUBST([GSTREAMER_RELEASE], [0.10]) -AC_SUBST([MIN_GSTREAMER_VERSION], [0.10.32]) -PKG_CHECK_MODULES([gstreamer], [gstreamer-${GSTREAMER_RELEASE} >= ${MIN_GSTREAMER_VERSION} gstreamer-base-${GSTREAMER_RELEASE} >= ${MIN_GSTREAMER_VERSION}]) +AC_SUBST([GSTREAMER_RELEASE], [1.0]) +AC_SUBST([MIN_GSTREAMER_VERSION], [1.2.4]) +PKG_CHECK_MODULES([gstreamer], [gstreamer-${GSTREAMER_RELEASE} >= ${MIN_GSTREAMER_VERSION} gstreamer-base-${GSTREAMER_RELEASE} >= ${MIN_GSTREAMER_VERSION} gstreamer-controller-${GSTREAMER_RELEASE} >= ${MIN_GSTREAMER_VERSION}]) AC_SUBST([gstreamer_CFLAGS]) AC_SUBST([gstreamer_LIBS]) AC_SUBST([plugindir], [${libdir}/gstreamer-${GSTREAMER_RELEASE}]) @@ -180,8 +179,8 @@ AM_CONDITIONAL([COND_GSTBASEPARSE], [test "x${HAVE_GSTBASEPARSE}" == "xyes"]) # -AC_SUBST([GSTREAMER_AUDIO_RELEASE], [0.10]) -AC_SUBST([MIN_GSTREAMER_AUDIO_VERSION], [0.10.32]) +AC_SUBST([GSTREAMER_AUDIO_RELEASE], [1.0]) +AC_SUBST([MIN_GSTREAMER_AUDIO_VERSION], [1.2.4]) PKG_CHECK_MODULES([gstreamer_audio], [gstreamer-audio-${GSTREAMER_AUDIO_RELEASE} >= ${MIN_GSTREAMER_AUDIO_VERSION}]) AC_SUBST([gstreamer_audio_CFLAGS]) AC_SUBST([gstreamer_audio_LIBS]) @@ -192,9 +191,18 @@ AC_SUBST([gstreamer_audio_LIBS]) # -PKG_CHECK_MODULES([pygobject], [pygobject-2.0]) -AC_SUBST([pygobject_CFLAGS]) -AC_SUBST([pygobject_LIBS]) +GOBJECT_INTROSPECTION_CHECK([1.30.0]) +AC_SUBST([GIR_VERSION], [${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}]) +AC_SUBST([GIR_VERSION_], [${GIR_VERSION/./_}]) +AS_IF([test "x$found_introspection" = "xyes"], [ + AC_SUBST([girdir], ["\${datadir}/gir-1.0"]) + AC_SUBST([typelibdir], ["\${libdir}/girepository-1.0"]) + AC_MSG_NOTICE([If you have chosen to install the software in a location not included in your gobject introspection typelib search path, you might need to add the directory + + $typelibdir + +to your GI_TYPELIB_PATH environment variable.]) +]) # @@ -218,7 +226,7 @@ CFLAGS="$old_CFLAGS" # -AC_SUBST([MIN_LAL_VERSION], [6.15.0]) +AC_SUBST([MIN_LAL_VERSION], [6.15.2]) AC_SUBST([MIN_LALMETAIO_VERSION], [1.2.6]) PKG_CHECK_MODULES([LAL], [lal >= ${MIN_LAL_VERSION} lalmetaio >= ${MIN_LALMETAIO_VERSION} lalsupport]) AC_SUBST([LAL_CFLAGS]) @@ -231,7 +239,7 @@ AC_SUBST([LAL_LIBS]) AC_SUBST([MIN_GLUE_VERSION], [1.49]) -AC_SUBST([MIN_PYLAL_VERSION], [0.8.0]) +AC_SUBST([MIN_PYLAL_VERSION], [0.9.0]) AX_PYTHON_GLUE() AX_PYTHON_PYLAL() @@ -241,7 +249,7 @@ AX_PYTHON_PYLAL() # -AC_SUBST([MIN_GSTLAL_VERSION], [0.10.3]) +AC_SUBST([MIN_GSTLAL_VERSION], [0.10.4]) AC_SUBST([MIN_GSTLALUGLY_VERSION], [0.9.2]) PKG_CHECK_MODULES([GSTLAL], [gstlal >= ${MIN_GSTLAL_VERSION}]) AC_SUBST([GSTLAL_VERSION], [`$PKG_CONFIG --modversion gstlal`]) diff --git a/gstlal-calibration/debian/control.in b/gstlal-calibration/debian/control.in index 96098986931938bf22f1d7d0859f90a032cbf14d..35f4633b92778a58ac9642ac844fe7dd21400b00 100644 --- a/gstlal-calibration/debian/control.in +++ b/gstlal-calibration/debian/control.in @@ -3,29 +3,34 @@ Maintainer: Madeline Wade <madeline.wade@gravity.phys.uwm.edu> Section: lscsoft Priority: optional Standards-Version: 3.9.2 -X-Python-Version: >= 2.6 +X-Python-Version: >= @MIN_PYTHON_VERSION@ Build-Depends: debhelper (>= 8), - python-all-dev (>= 2.6), - gstlal-dep (>= 2.2) | gstenvironment, - python-gobject-dev, - python-numpy, + fakeroot, + gstlal-dev (>= @MIN_GSTLAL_VERSION@), lal-dev (>= @MIN_LAL_VERSION@), lalmetaio-dev (>= @MIN_LALMETAIO_VERSION@), - python-glue (>= @MIN_GLUE_VERSION@), - fakeroot, + libgstreamer1.0-dev (>= @MIN_GSTREAMER_VERSION@), + libgstreamer-plugins-base1.0-dev (>= @MIN_GSTREAMER_VERSION@), pkg-config, - gstlal-dev (>= @MIN_GSTLAL_VERSION@) + python-all-dev (>= @MIN_PYTHON_VERSION@), + python-glue (>= @MIN_GLUE_VERSION@), + python-numpy Package: gstlal-calibration Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, - python (>= 2.6), + python (>= @MIN_PYTHON_VERSION@), python-glue (>= @MIN_GLUE_VERSION@), python-glue-segments (>= @MIN_GLUE_VERSION@), python-pylal (>= @MIN_PYLAL_VERSION@), - gstlal-dep (>= 2.2) | gstenvironment, - python-gobject, + gstreamer1.0-plugins-base (>= @MIN_GSTREAMER_VERSION@), + gstreamer1.0-plugins-good (>= @MIN_GSTREAMER_VERSION@), + libgstreamer1.0-0 (>= @MIN_GSTREAMER_VERSION@), + libgstreamer-plugins-base1.0-0 (>= @MIN_GSTREAMER_VERSION@), + gstreamer1.0-tools (>= @MIN_GSTREAMER_VERSION@), + gir1.2-gstreamer-1.0 (>= @MIN_GSTREAMER_VERSION@), + gir1.2-gst-plugins-base-1.0 (>= @MIN_GSTREAMER_VERSION@), python-numpy, python-scipy, lal (>= @MIN_LAL_VERSION@), diff --git a/gstlal-calibration/gnuscripts/depcomp b/gstlal-calibration/gnuscripts/depcomp new file mode 100755 index 0000000000000000000000000000000000000000..fc98710e2a1df7159cd72a01ffc011784748c3bc --- /dev/null +++ b/gstlal-calibration/gnuscripts/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2013-05-30.07; # UTC + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. + +# 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, 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, see <http://www.gnu.org/licenses/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/gstlal-calibration/gst/lal/Makefile.am b/gstlal-calibration/gst/lal/Makefile.am index 3d7b2891f5b12f02846f9a1027da8444406a086a..99276df0af581f8f37be073308ffe0cf5c3a4aa7 100644 --- a/gstlal-calibration/gst/lal/Makefile.am +++ b/gstlal-calibration/gst/lal/Makefile.am @@ -1,22 +1,7 @@ -AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib - -plugin_LTLIBRARIES = libgstlalcalibration.la libgstlalinterleave.la libgstlaldeinterleave.la +plugin_LTLIBRARIES = libgstlalcalibration.la libgstlalcalibration_la_SOURCES = \ gstlalcalibration.c \ gstlal_wings.c gstlal_wings.h -libgstlalcalibration_la_CFLAGS = $(AM_CFLAGS) $(LAL_CFLAGS) $(GSTLAL_CFLAGS) $(gstreamer_CFLAGS) -#libgstlalcalibration_la_LIBADD = $(top_builddir)/lib/libgstlalcalibration.la -libgstlalcalibration_la_LDFLAGS = $(AM_LDFLAGS) $(LAL_LIBS) $(GSTLAL_LIBS) $(gstreamer_LIBS) $(GSTLAL_PLUGIN_LDFLAGS) - -libgstlalinterleave_la_SOURCES = \ - gstinterleave.c gstinterleave.h -libgstlalinterleave_la_CFLAGS = $(AM_CFLAGS) $(LAL_CFLAGS) $(GSTLAL_CFLAGS) $(gstreamer_CFLAGS) $(gstreamer_audio_CFLAGS) -DGST_PACKAGE_NAME=\"gstlal\" -DGST_PACKAGE_ORIGIN=\"\" -#libgstlalinterleave_la_LIBADD = $(top_builddir)/lib/gstlal/libgstlaltypes.la -libgstlalinterleave_la_LDFLAGS = $(AM_LDFLAGS) $(LAL_LIBS) $(GSTLAL_LIBS) $(gstreamer_LIBS) $(gstreamer_audio_LIBS) $(GSTLAL_PLUGIN_LDFLAGS) - -libgstlaldeinterleave_la_SOURCES = \ - gstdeinterleave.c gstdeinterleave.h -libgstlaldeinterleave_la_CFLAGS = $(AM_CFLAGS) $(LAL_CFLAGS) $(GSTLAL_CFLAGS) $(gstreamer_CFLAGS) $(gstreamer_audio_CFLAGS) -DGST_PACKAGE_NAME=\"gstlal\" -DGST_PACKAGE_ORIGIN=\"\" -#libgstlalinterleave_la_LIBADD = $(top_builddir)/lib/gstlal/libgstlaltypes.la -libgstlaldeinterleave_la_LDFLAGS = $(AM_LDFLAGS) $(LAL_LIBS) $(GSTLAL_LIBS) $(gstreamer_LIBS) $(gstreamer_audio_LIBS) $(GSTLAL_PLUGIN_LDFLAGS) +libgstlalcalibration_la_CFLAGS = $(AM_CFLAGS) $(LAL_CFLAGS) $(GSTLAL_CFLAGS) $(gstreamer_CFLAGS) $(gstreamer_audio_CFLAGS) +libgstlalcalibration_la_LDFLAGS = $(AM_LDFLAGS) $(LAL_LIBS) $(GSTLAL_LIBS) $(gstreamer_LIBS) $(gstreamer_audio_LIBS) $(GSTLAL_PLUGIN_LDFLAGS) diff --git a/gstlal-calibration/gst/lal/gstdeinterleave.c b/gstlal-calibration/gst/lal/gstdeinterleave.c deleted file mode 100644 index facb87d820d4b370a04d4085255a58f847231b1e..0000000000000000000000000000000000000000 --- a/gstlal-calibration/gst/lal/gstdeinterleave.c +++ /dev/null @@ -1,906 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> - * 2000 Wim Taymans <wtay@chello.be> - * 2005 Wim Taymans <wim@fluendo.com> - * 2007 Andy Wingo <wingo at pobox.com> - * 2008 Sebastian Dröge <slomo@circular-chaos.org> - * - * deinterleave.c: deinterleave samples - * - * 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. - */ - -/* TODO: - * - handle changes in number of channels - * - handle changes in channel positions - * - better capsnego by using a buffer alloc function - * and passing downstream caps changes upstream there - */ - -/** - * SECTION:element-deinterleave - * @see_also: interleave - * - * Splits one interleaved multichannel audio stream into many mono audio streams. - * - * This element handles all raw audio formats and supports changing the input caps as long as - * all downstream elements can handle the new caps and the number of channels and the channel - * positions stay the same. This restriction will be removed in later versions by adding or - * removing some source pads as required. - * - * In most cases a queue and an audioconvert element should be added after each source pad - * before further processing of the audio data. - * - * <refsect2> - * <title>Example launch line</title> - * |[ - * gst-launch filesrc location=/path/to/file.mp3 ! decodebin ! audioconvert ! "audio/x-raw-int,channels=2 ! deinterleave name=d d.src0 ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=channel1.ogg d.src1 ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=channel2.ogg - * ]| Decodes an MP3 file and encodes the left and right channel into separate - * Ogg Vorbis files. - * |[ - * gst-launch filesrc location=file.mp3 ! decodebin ! audioconvert ! "audio/x-raw-int,channels=2" ! deinterleave name=d interleave name=i ! audioconvert ! wavenc ! filesink location=test.wav d.src0 ! queue ! audioconvert ! i.sink1 d.src1 ! queue ! audioconvert ! i.sink0 - * ]| Decodes and deinterleaves a Stereo MP3 file into separate channels and - * then interleaves the channels again to a WAV file with the channel with the - * channels exchanged. - * </refsect2> - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gst/gst.h> -#include <string.h> -#include "gstdeinterleave.h" -#include <gstlal/gstlalcollectpads.h> -#include <gstlal/gstlal_debug.h> - -GST_DEBUG_CATEGORY_STATIC (gst_deinterleave_debug); -#define GST_CAT_DEFAULT gst_deinterleave_debug - -static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src%d", - GST_PAD_SRC, - GST_PAD_SOMETIMES, - GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) [ 1, MAX ], " - "channels = (int) 1, " - "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " - "width = (int) { 8, 16, 24, 32 }, " - "depth = (int) [ 1, 32 ], " - "signed = (boolean) { true, false }; " - "audio/x-raw-float, " - "rate = (int) [ 1, MAX ], " - "channels = (int) 1, " - "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " - "width = (int) { 32, 64 }") - ); - -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_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 }; " - "audio/x-raw-float, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, MAX ], " - "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " - "width = (int) { 32, 64 }") - ); - -#define MAKE_FUNC(type) \ -static void deinterleave_##type (guint##type *out, guint##type *in, \ - guint stride, guint nframes) \ -{ \ - guint i; \ - \ - for (i = 0; i < nframes; i++) { \ - out[i] = *in; \ - in += stride; \ - } \ -} - -MAKE_FUNC (8); -MAKE_FUNC (16); -MAKE_FUNC (32); -MAKE_FUNC (64); - -static void -deinterleave_24 (guint8 * out, guint8 * in, guint stride, guint nframes) -{ - guint i; - - for (i = 0; i < nframes; i++) { - memcpy (out, in, 3); - out += 3; - in += stride * 3; - } -} - -GST_BOILERPLATE (GstLALDeinterleave, gst_deinterleave, GstElement, - GST_TYPE_ELEMENT); - -enum -{ - PROP_0, - PROP_KEEP_POSITIONS -}; - -static GstFlowReturn gst_deinterleave_chain (GstPad * pad, GstBuffer * buffer); - -static gboolean gst_deinterleave_sink_setcaps (GstPad * pad, GstCaps * caps); - -static GstCaps *gst_deinterleave_sink_getcaps (GstPad * pad); - -static gboolean gst_deinterleave_sink_activate_push (GstPad * pad, - gboolean active); -static gboolean gst_deinterleave_sink_event (GstPad * pad, GstEvent * event); - -static gboolean gst_deinterleave_src_query (GstPad * pad, GstQuery * query); - -static void gst_deinterleave_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_deinterleave_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - - -static void -gst_deinterleave_finalize (GObject * obj) -{ - GstLALDeinterleave *self = GST_DEINTERLEAVE (obj); - - if (self->pos) { - g_free (self->pos); - self->pos = NULL; - } - - if (self->pending_events) { - g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref, NULL); - g_list_free (self->pending_events); - self->pending_events = NULL; - } - - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -gst_deinterleave_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = (GstElementClass *) g_class; - - gst_element_class_set_details_simple (gstelement_class, "Audio deinterleaver", - "Filter/Converter/Audio", - "Splits one interleaved multichannel audio stream into many mono audio streams", - "Andy Wingo <wingo at pobox.com>, " - "Iain <iain@prettypeople.org>, " - "Sebastian Dröge <slomo@circular-chaos.org>"); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&src_template)); -} - -static void -gst_deinterleave_class_init (GstLALDeinterleaveClass * klass) -{ - GstElementClass *gstelement_class; - GObjectClass *gobject_class; - - gobject_class = G_OBJECT_CLASS (klass); - gstelement_class = GST_ELEMENT_CLASS (klass); - - gobject_class->finalize = gst_deinterleave_finalize; - gobject_class->set_property = gst_deinterleave_set_property; - gobject_class->get_property = gst_deinterleave_get_property; - - /** - * GstLALDeinterleave:keep-positions - * - * Keep positions: When enable the caps on the output buffers will - * contain the original channel positions. This can be used to correctly - * interleave the output again later but can also lead to unwanted effects - * if the output should be handled as Mono. - * - */ - g_object_class_install_property (gobject_class, PROP_KEEP_POSITIONS, - g_param_spec_boolean ("keep-positions", "Keep positions", - "Keep the original channel positions on the output buffers", - FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -static void -gst_deinterleave_init (GstLALDeinterleave * self, GstLALDeinterleaveClass * klass) -{ - self->channels = 0; - self->pos = NULL; - self->keep_positions = FALSE; - self->width = 0; - self->func = NULL; - - /* Add sink pad */ - self->sink = gst_pad_new_from_static_template (&sink_template, "sink"); - gst_pad_set_chain_function (self->sink, - GST_DEBUG_FUNCPTR (gst_deinterleave_chain)); - gst_pad_set_setcaps_function (self->sink, - GST_DEBUG_FUNCPTR (gst_deinterleave_sink_setcaps)); - gst_pad_set_getcaps_function (self->sink, - GST_DEBUG_FUNCPTR (gst_deinterleave_sink_getcaps)); - gst_pad_set_activatepush_function (self->sink, - GST_DEBUG_FUNCPTR (gst_deinterleave_sink_activate_push)); - gst_pad_set_event_function (self->sink, - GST_DEBUG_FUNCPTR (gst_deinterleave_sink_event)); - gst_element_add_pad (GST_ELEMENT (self), self->sink); -} - -static void -gst_deinterleave_add_new_pads (GstLALDeinterleave * self, GstCaps * caps) -{ - GstPad *pad; - - guint i; - - for (i = 0; i < self->channels; i++) { - gchar *name = g_strdup_printf ("src%d", i); - - GstCaps *srccaps; - - GstStructure *s; - - pad = gst_pad_new_from_static_template (&src_template, name); - g_free (name); - - /* Set channel position if we know it */ - if (self->keep_positions) { - GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE }; - - srccaps = gst_caps_copy (caps); - s = gst_caps_get_structure (srccaps, 0); - if (self->pos) - gst_audio_set_channel_positions (s, &self->pos[i]); - else - gst_audio_set_channel_positions (s, pos); - } else { - srccaps = caps; - } - - gst_pad_set_caps (pad, srccaps); - gst_pad_use_fixed_caps (pad); - gst_pad_set_query_function (pad, - GST_DEBUG_FUNCPTR (gst_deinterleave_src_query)); - gst_pad_set_active (pad, TRUE); - gst_element_add_pad (GST_ELEMENT (self), pad); - self->srcpads = g_list_prepend (self->srcpads, gst_object_ref (pad)); - - if (self->keep_positions) - gst_caps_unref (srccaps); - } - - gst_element_no_more_pads (GST_ELEMENT (self)); - self->srcpads = g_list_reverse (self->srcpads); -} - -static void -gst_deinterleave_set_pads_caps (GstLALDeinterleave * self, GstCaps * caps) -{ - GList *l; - - GstStructure *s; - - gint i; - - for (l = self->srcpads, i = 0; l; l = l->next, i++) { - GstPad *pad = GST_PAD (l->data); - - GstCaps *srccaps; - - /* Set channel position if we know it */ - if (self->keep_positions) { - GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE }; - - srccaps = gst_caps_copy (caps); - s = gst_caps_get_structure (srccaps, 0); - if (self->pos) - gst_audio_set_channel_positions (s, &self->pos[i]); - else - gst_audio_set_channel_positions (s, pos); - } else { - srccaps = caps; - } - - gst_pad_set_caps (pad, srccaps); - - if (self->keep_positions) - gst_caps_unref (srccaps); - } -} - -static void -gst_deinterleave_remove_pads (GstLALDeinterleave * self) -{ - GList *l; - - GST_INFO_OBJECT (self, "removing pads"); - - for (l = self->srcpads; l; l = l->next) { - GstPad *pad = GST_PAD (l->data); - - gst_element_remove_pad (GST_ELEMENT_CAST (self), pad); - gst_object_unref (pad); - } - g_list_free (self->srcpads); - self->srcpads = NULL; - - gst_pad_set_caps (self->sink, NULL); - gst_caps_replace (&self->sinkcaps, NULL); -} - -static gboolean -gst_deinterleave_set_process_function (GstLALDeinterleave * self, GstCaps * caps) -{ - GstStructure *s; - - s = gst_caps_get_structure (caps, 0); - if (!gst_structure_get_int (s, "width", &self->width)) - return FALSE; - - switch (self->width) { - case 8: - self->func = (GstLALDeinterleaveFunc) deinterleave_8; - break; - case 16: - self->func = (GstLALDeinterleaveFunc) deinterleave_16; - break; - case 24: - self->func = (GstLALDeinterleaveFunc) deinterleave_24; - break; - case 32: - self->func = (GstLALDeinterleaveFunc) deinterleave_32; - break; - case 64: - self->func = (GstLALDeinterleaveFunc) deinterleave_64; - break; - default: - return FALSE; - } - return TRUE; -} - -static gboolean -gst_deinterleave_sink_setcaps (GstPad * pad, GstCaps * caps) -{ - GstLALDeinterleave *self; - - GstCaps *srccaps; - - GstStructure *s; - - self = GST_DEINTERLEAVE (gst_pad_get_parent (pad)); - - GST_DEBUG_OBJECT (self, "got caps: %" GST_PTR_FORMAT, caps); - - if (self->sinkcaps && !gst_caps_is_equal (caps, self->sinkcaps)) { - gint new_channels, i; - - GstAudioChannelPosition *pos; - - gboolean same_layout = TRUE; - - s = gst_caps_get_structure (caps, 0); - - /* We allow caps changes as long as the number of channels doesn't change - * and the channel positions stay the same. _getcaps() should've cared - * for this already but better be safe. - */ - if (!gst_structure_get_int (s, "channels", &new_channels) || - new_channels != self->channels || - !gst_deinterleave_set_process_function (self, caps)) - goto cannot_change_caps; - - /* Now check the channel positions. If we had no channel positions - * and get them or the other way around things have changed. - * If we had channel positions and get different ones things have - * changed too of course - */ - pos = gst_audio_get_channel_positions (s); - if ((pos && !self->pos) || (!pos && self->pos)) - goto cannot_change_caps; - - if (pos) { - for (i = 0; i < self->channels; i++) { - if (self->pos[i] != pos[i]) { - same_layout = FALSE; - break; - } - } - g_free (pos); - if (!same_layout) - goto cannot_change_caps; - } - - } else { - s = gst_caps_get_structure (caps, 0); - - if (!gst_structure_get_int (s, "channels", &self->channels)) - goto no_channels; - - if (!gst_deinterleave_set_process_function (self, caps)) - goto unsupported_caps; - - self->pos = gst_audio_get_channel_positions (s); - } - - gst_caps_replace (&self->sinkcaps, caps); - - /* Get srcpad caps */ - srccaps = gst_caps_copy (caps); - s = gst_caps_get_structure (srccaps, 0); - gst_structure_set (s, "channels", G_TYPE_INT, 1, NULL); - gst_structure_remove_field (s, "channel-positions"); - - /* If we already have pads, update the caps otherwise - * add new pads */ - if (self->srcpads) { - gst_deinterleave_set_pads_caps (self, srccaps); - } else { - gst_deinterleave_add_new_pads (self, srccaps); - } - - gst_caps_unref (srccaps); - gst_object_unref (self); - - return TRUE; - -cannot_change_caps: - { - GST_ERROR_OBJECT (self, "can't set new caps: %" GST_PTR_FORMAT, caps); - gst_object_unref (self); - return FALSE; - } -unsupported_caps: - { - GST_ERROR_OBJECT (self, "caps not supported: %" GST_PTR_FORMAT, caps); - gst_object_unref (self); - return FALSE; - } -no_channels: - { - GST_ERROR_OBJECT (self, "invalid caps"); - gst_object_unref (self); - return FALSE; - } -} - -static void -__remove_channels (GstCaps * caps) -{ - GstStructure *s; - - gint i, size; - - size = gst_caps_get_size (caps); - for (i = 0; i < size; i++) { - s = gst_caps_get_structure (caps, i); - gst_structure_remove_field (s, "channel-positions"); - gst_structure_remove_field (s, "channels"); - } -} - -static void -__set_channels (GstCaps * caps, gint channels) -{ - GstStructure *s; - - gint i, size; - - size = gst_caps_get_size (caps); - for (i = 0; i < size; i++) { - s = gst_caps_get_structure (caps, i); - if (channels > 0) - gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL); - else - gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); - } -} - -static GstCaps * -gst_deinterleave_sink_getcaps (GstPad * pad) -{ - GstLALDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad)); - - GstCaps *ret; - - GList *l; - - GST_OBJECT_LOCK (self); - /* Intersect all of our pad template caps with the peer caps of the pad - * to get all formats that are possible up- and downstream. - * - * For the pad for which the caps are requested we don't remove the channel - * informations as they must be in the returned caps and incompatibilities - * will be detected here already - */ - ret = gst_caps_new_any (); - for (l = GST_ELEMENT (self)->pads; l != NULL; l = l->next) { - GstPad *ourpad = GST_PAD (l->data); - - GstCaps *peercaps = NULL, *ourcaps; - - ourcaps = gst_caps_copy (gst_pad_get_pad_template_caps (ourpad)); - - if (pad == ourpad) { - if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) - __set_channels (ourcaps, self->channels); - else - __set_channels (ourcaps, 1); - } else { - __remove_channels (ourcaps); - /* Only ask for peer caps for other pads than pad - * as otherwise gst_pad_peer_get_caps() might call - * back into this function and deadlock - */ - peercaps = gst_pad_peer_get_caps (ourpad); - } - - /* If the peer exists and has caps add them to the intersection, - * otherwise assume that the peer accepts everything */ - if (peercaps) { - GstCaps *intersection; - - GstCaps *oldret = ret; - - __remove_channels (peercaps); - - intersection = gst_caps_intersect (peercaps, ourcaps); - - ret = gst_caps_intersect (ret, intersection); - gst_caps_unref (intersection); - gst_caps_unref (peercaps); - gst_caps_unref (oldret); - } else { - GstCaps *oldret = ret; - - ret = gst_caps_intersect (ret, ourcaps); - gst_caps_unref (oldret); - } - gst_caps_unref (ourcaps); - } - GST_OBJECT_UNLOCK (self); - - gst_object_unref (self); - - GST_DEBUG_OBJECT (pad, "Intersected caps to %" GST_PTR_FORMAT, ret); - - return ret; -} - -static gboolean -gst_deinterleave_sink_event (GstPad * pad, GstEvent * event) -{ - GstLALDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad)); - - gboolean ret; - - GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event), - GST_DEBUG_PAD_NAME (pad)); - - /* Send FLUSH_STOP, FLUSH_START and EOS immediately, no matter if - * we have src pads already or not. Queue all other events and - * push them after we have src pads - */ - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_FLUSH_STOP: - case GST_EVENT_FLUSH_START: - case GST_EVENT_EOS: - ret = gst_pad_event_default (pad, event); - break; - default: - if (self->srcpads) { - ret = gst_pad_event_default (pad, event); - } else { - GST_OBJECT_LOCK (self); - self->pending_events = g_list_append (self->pending_events, event); - GST_OBJECT_UNLOCK (self); - ret = TRUE; - } - break; - } - - gst_object_unref (self); - - return ret; -} - -static gboolean -gst_deinterleave_src_query (GstPad * pad, GstQuery * query) -{ - GstLALDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad)); - - gboolean res; - - res = gst_pad_query_default (pad, query); - - if (res && GST_QUERY_TYPE (query) == GST_QUERY_DURATION) { - GstFormat format; - - gint64 dur; - - gst_query_parse_duration (query, &format, &dur); - - /* Need to divide by the number of channels in byte format - * to get the correct value. All other formats should be fine - */ - if (format == GST_FORMAT_BYTES && dur != -1) - gst_query_set_duration (query, format, dur / self->channels); - } else if (res && GST_QUERY_TYPE (query) == GST_QUERY_POSITION) { - GstFormat format; - - gint64 pos; - - gst_query_parse_position (query, &format, &pos); - - /* Need to divide by the number of channels in byte format - * to get the correct value. All other formats should be fine - */ - if (format == GST_FORMAT_BYTES && pos != -1) - gst_query_set_position (query, format, pos / self->channels); - } - - gst_object_unref (self); - return res; -} - -static void -gst_deinterleave_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstLALDeinterleave *self = GST_DEINTERLEAVE (object); - - switch (prop_id) { - case PROP_KEEP_POSITIONS: - self->keep_positions = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_deinterleave_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstLALDeinterleave *self = GST_DEINTERLEAVE (object); - - switch (prop_id) { - case PROP_KEEP_POSITIONS: - g_value_set_boolean (value, self->keep_positions); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstFlowReturn -gst_deinterleave_process (GstLALDeinterleave * self, GstBuffer * buf) -{ - GstFlowReturn ret = GST_FLOW_OK; - - guint channels = self->channels; - - guint pads_pushed = 0, buffers_allocated = 0; - - guint nframes = GST_BUFFER_SIZE (buf) / channels / (self->width / 8); - - guint bufsize = nframes * (self->width / 8); - - guint i; - - GList *srcs; - - GstBuffer **buffers_out = g_new0 (GstBuffer *, channels); - - guint8 *in, *out; - - /* Send any pending events to all src pads */ - GST_OBJECT_LOCK (self); - if (self->pending_events) { - GList *events; - - GstEvent *event; - - GST_DEBUG_OBJECT (self, "Sending pending events to all src pads"); - - for (events = self->pending_events; events != NULL; events = events->next) { - event = GST_EVENT (events->data); - - for (srcs = self->srcpads; srcs != NULL; srcs = srcs->next) - gst_pad_push_event (GST_PAD (srcs->data), gst_event_ref (event)); - gst_event_unref (event); - } - - g_list_free (self->pending_events); - self->pending_events = NULL; - } - GST_OBJECT_UNLOCK (self); - - /* Allocate buffers */ - for (srcs = self->srcpads, i = 0; srcs; srcs = srcs->next, i++) { - GstPad *pad = (GstPad *) srcs->data; - - buffers_out[i] = NULL; - ret = - gst_pad_alloc_buffer (pad, GST_BUFFER_OFFSET_NONE, bufsize, - GST_PAD_CAPS (pad), &buffers_out[i]); - - /* Make sure we got a correct buffer. The only other case we allow - * here is an unliked pad */ - if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED) - goto alloc_buffer_failed; - else if (buffers_out[i] && GST_BUFFER_SIZE (buffers_out[i]) != bufsize) - goto alloc_buffer_bad_size; - else if (buffers_out[i] && - !gst_caps_is_equal (GST_BUFFER_CAPS (buffers_out[i]), - GST_PAD_CAPS (pad))) - goto invalid_caps; - - if (buffers_out[i]) { - buffers_out[i] = gst_buffer_make_metadata_writable(buffers_out[i]); - gst_buffer_copy_metadata (buffers_out[i], buf, - GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS); - buffers_allocated++; - } - } - - /* Return NOT_LINKED if no pad was linked */ - if (!buffers_allocated) { - GST_WARNING_OBJECT (self, - "Couldn't allocate any buffers because no pad was linked"); - ret = GST_FLOW_NOT_LINKED; - goto done; - } - - /* deinterleave */ - for (srcs = self->srcpads, i = 0; srcs; srcs = srcs->next, i++) { - GstPad *pad = (GstPad *) srcs->data; - - in = (guint8 *) GST_BUFFER_DATA (buf); - in += i * (self->width / 8); - if (buffers_out[i]) { - buffers_out[i] = gst_buffer_make_writable(buffers_out[i]); - out = (guint8 *) GST_BUFFER_DATA (buffers_out[i]); - - self->func (out, in, channels, nframes); - - ret = gst_pad_push (pad, buffers_out[i]); - buffers_out[i] = NULL; - if (ret == GST_FLOW_OK) - pads_pushed++; - else if (ret == GST_FLOW_NOT_LINKED) - ret = GST_FLOW_OK; - else - goto push_failed; - } - } - - /* Return NOT_LINKED if no pad was linked */ - if (!pads_pushed) - ret = GST_FLOW_NOT_LINKED; - -done: - gst_buffer_unref (buf); - g_free (buffers_out); - return ret; - -alloc_buffer_failed: - { - GST_WARNING ("gst_pad_alloc_buffer() returned %s", gst_flow_get_name (ret)); - goto clean_buffers; - - } -alloc_buffer_bad_size: - { - GST_WARNING ("called alloc_buffer(), but didn't get requested bytes"); - ret = GST_FLOW_NOT_NEGOTIATED; - goto clean_buffers; - } -invalid_caps: - { - GST_WARNING ("called alloc_buffer(), but didn't get requested caps"); - ret = GST_FLOW_NOT_NEGOTIATED; - goto clean_buffers; - } -push_failed: - { - GST_DEBUG ("push() failed, flow = %s", gst_flow_get_name (ret)); - goto clean_buffers; - } -clean_buffers: - { - for (i = 0; i < channels; i++) { - if (buffers_out[i]) - gst_buffer_unref (buffers_out[i]); - } - gst_buffer_unref (buf); - g_free (buffers_out); - return ret; - } -} - -static GstFlowReturn -gst_deinterleave_chain (GstPad * pad, GstBuffer * buffer) -{ - GstLALDeinterleave *self = GST_DEINTERLEAVE (GST_PAD_PARENT (pad)); - - GstFlowReturn ret; - - g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED); - g_return_val_if_fail (self->width > 0, GST_FLOW_NOT_NEGOTIATED); - g_return_val_if_fail (self->channels > 0, GST_FLOW_NOT_NEGOTIATED); - - ret = gst_deinterleave_process (self, buffer); - - if (ret != GST_FLOW_OK) - GST_DEBUG_OBJECT (self, "flow return: %s", gst_flow_get_name (ret)); - - return ret; -} - -static gboolean -gst_deinterleave_sink_activate_push (GstPad * pad, gboolean active) -{ - GstLALDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad)); - - /* Reset everything when the pad is deactivated */ - if (!active) { - gst_deinterleave_remove_pads (self); - if (self->pos) { - g_free (self->pos); - self->pos = NULL; - } - self->channels = 0; - self->width = 0; - self->func = NULL; - - if (self->pending_events) { - g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref, - NULL); - g_list_free (self->pending_events); - self->pending_events = NULL; - } - } - - gst_object_unref (self); - - return TRUE; -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "lal_deinterleave", 0, "audio channel deinterleaving element"); - if (!gst_element_register (plugin, "lal_deinterleave", - GST_RANK_NONE, gst_deinterleave_get_type())) - return FALSE; - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, "lal_deinterleave", "Audio deinterleaver", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/gstlal-calibration/gst/lal/gstdeinterleave.h b/gstlal-calibration/gst/lal/gstdeinterleave.h deleted file mode 100644 index cd90aa20a9ed1f9bcbd03863a37619f29afa0910..0000000000000000000000000000000000000000 --- a/gstlal-calibration/gst/lal/gstdeinterleave.h +++ /dev/null @@ -1,75 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> - * 2000 Wim Taymans <wtay@chello.be> - * 2005 Wim Taymans <wim@fluendo.com> - * 2007 Andy Wingo <wingo at pobox.com> - * 2008 Sebastian Dröge <slomo@circular-chaos.org> - * - * deinterleave.c: deinterleave samples - * - * 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 __DEINTERLEAVE_H__ -#define __DEINTERLEAVE_H__ - -G_BEGIN_DECLS - -#include <gst/gst.h> -#include <gst/audio/multichannel.h> - -#define GST_TYPE_DEINTERLEAVE (gst_deinterleave_get_type()) -#define GST_DEINTERLEAVE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEINTERLEAVE,GstLALDeinterleave)) -#define GST_DEINTERLEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEINTERLEAVE,GstLALDeinterleaveClass)) -#define GST_DEINTERLEAVE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_DEINTERLEAVE,GstLALDeinterleaveClass)) -#define GST_IS_DEINTERLEAVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEINTERLEAVE)) -#define GST_IS_DEINTERLEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEINTERLEAVE)) - -typedef struct _GstLALDeinterleave GstLALDeinterleave; -typedef struct _GstLALDeinterleaveClass GstLALDeinterleaveClass; - -typedef void (*GstLALDeinterleaveFunc) (gpointer out, gpointer in, guint stride, guint nframes); - -struct _GstLALDeinterleave -{ - GstElement element; - - /*< private > */ - GList *srcpads; - GstCaps *sinkcaps; - gint channels; - GstAudioChannelPosition *pos; - gboolean keep_positions; - - GstPad *sink; - - gint width; - GstLALDeinterleaveFunc func; - - GList *pending_events; -}; - -struct _GstLALDeinterleaveClass -{ - GstElementClass parent_class; -}; - -GType gst_deinterleave_get_type (void); - -G_END_DECLS - -#endif /* __DEINTERLEAVE_H__ */ diff --git a/gstlal-calibration/gst/lal/gstinterleave.c b/gstlal-calibration/gst/lal/gstinterleave.c deleted file mode 100644 index d4888be432dc2a80d360d295ce0f403c2462bbe4..0000000000000000000000000000000000000000 --- a/gstlal-calibration/gst/lal/gstinterleave.c +++ /dev/null @@ -1,1483 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> - * 2000 Wim Taymans <wtay@chello.be> - * 2005 Wim Taymans <wim@fluendo.com> - * 2007 Andy Wingo <wingo at pobox.com> - * 2008 Sebastian Dröge <slomo@circular-chaos.rg> - * 2015 Madeline Wade <madeline.wade@ligo.org> - * - * lal_interleave.c: interleave samples, mostly based on adder. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-interleave - * @see_also: deinterleave - * - * Merges separate mono inputs into one interleaved stream. - * - * This element handles all raw floating point sample formats and all signed integer sample formats. The first - * caps on one of the sinkpads will set the caps of the output so usually an audioconvert element should be - * placed before every sinkpad of interleave. - * - * It's possible to change the number of channels while the pipeline is running by adding or removing - * some of the request pads but this will change the caps of the output buffers. Changing the input - * caps is _not_ supported yet. - * - * The channel number of every sinkpad in the out can be retrieved from the "channel" property of the pad. - * - * <refsect2> - * <title>Example launch line</title> - * |[ - * gst-launch filesrc location=file.mp3 ! decodebin ! audioconvert ! "audio/x-raw-int,channels=2" ! deinterleave name=d interleave name=i ! audioconvert ! wavenc ! filesink location=test.wav d.src0 ! queue ! audioconvert ! i.sink1 d.src1 ! queue ! audioconvert ! i.sink0 - * ]| Decodes and deinterleaves a Stereo MP3 file into separate channels and - * then interleaves the channels again to a WAV file with the channel with the - * channels exchanged. - * |[ - * gst-launch interleave name=i ! audioconvert ! wavenc ! filesink location=file.wav filesrc location=file1.wav ! decodebin ! audioconvert ! "audio/x-raw-int,channels=1" ! queue ! i.sink0 filesrc location=file2.wav ! decodebin ! audioconvert ! "audio/x-raw-int,channels=1" ! queue ! i.sink1 - * ]| Interleaves two Mono WAV files to a single Stereo WAV file. - * </refsect2> - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gst/gst.h> -#include <string.h> -#include "gstinterleave.h" -#include <gst/audio/audio.h> -#include <gstlal/gstlalcollectpads.h> -#include <gstlal/gstlal_debug.h> -#include <gst/audio/multichannel.h> - -GST_DEBUG_CATEGORY_STATIC (gst_interleave_debug); -#define GST_CAT_DEFAULT gst_interleave_debug - -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink%d", - GST_PAD_SINK, - GST_PAD_REQUEST, - GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) [ 1, MAX ], " - "channels = (int) 1, " - "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " - "width = (int) { 8, 16, 24, 32 }, " - "depth = (int) [ 1, 32 ], " - "signed = (boolean) true; " - "audio/x-raw-float, " - "rate = (int) [ 1, MAX ], " - "channels = (int) 1, " - "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " - "width = (int) { 32, 64 }") - ); - -static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_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; " - "audio/x-raw-float, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, MAX ], " - "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " - "width = (int) { 32, 64 }") - ); - -#define MAKE_FUNC(type) \ -static void interleave_##type (guint##type *out, guint##type *in, \ - guint stride, guint nframes) \ -{ \ - guint i; \ - \ - for (i = 0; i < nframes; i++) { \ - *out = in[i]; \ - out += stride; \ - } \ -} - -MAKE_FUNC (8); -MAKE_FUNC (16); -MAKE_FUNC (32); -MAKE_FUNC (64); - -static void -interleave_24 (guint8 * out, guint8 * in, guint stride, guint nframes) -{ - guint i; - - for (i = 0; i < nframes; i++) { - memcpy (out, in, 3); - out += stride * 3; - in += 3; - } -} - -typedef struct -{ - GstPad parent; - guint channel; -} GstLALInterleavePad; - -enum -{ - PROP_PAD_0, - PROP_PAD_CHANNEL -}; - -static void gst_interleave_pad_class_init (GstPadClass * klass); - -#define GST_TYPE_INTERLEAVE_PAD (gst_interleave_pad_get_type()) -#define GST_INTERLEAVE_PAD(pad) (G_TYPE_CHECK_INSTANCE_CAST((pad),GST_TYPE_INTERLEAVE_PAD,GstLALInterleavePad)) -#define GST_INTERLEAVE_PAD_CAST(pad) ((GstLALInterleavePad *) pad) -#define GST_IS_INTERLEAVE_PAD(pad) (G_TYPE_CHECK_INSTANCE_TYPE((pad),GST_TYPE_INTERLEAVE_PAD)) -static GType -gst_interleave_pad_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - type = g_type_register_static_simple (GST_TYPE_PAD, - g_intern_static_string ("GstLALInterleavePad"), sizeof (GstPadClass), - (GClassInitFunc) gst_interleave_pad_class_init, - sizeof (GstLALInterleavePad), NULL, 0); - } - return type; -} - -static void -gst_interleave_pad_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstLALInterleavePad *self = GST_INTERLEAVE_PAD (object); - - switch (prop_id) { - case PROP_PAD_CHANNEL: - g_value_set_uint (value, self->channel); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_interleave_pad_class_init (GstPadClass * klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - - gobject_class->get_property = gst_interleave_pad_get_property; - - g_object_class_install_property (gobject_class, - PROP_PAD_CHANNEL, - g_param_spec_uint ("channel", - "Channel number", - "Number of the channel of this pad in the output", 0, G_MAXUINT, 0, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); -} - -GST_BOILERPLATE (GstLALInterleave, gst_interleave, GstElement, GST_TYPE_ELEMENT); - -enum -{ - PROP_0, - PROP_CHANNEL_POSITIONS, - PROP_CHANNEL_POSITIONS_FROM_INPUT, - PROP_SYNCHRONOUS -}; - -static void gst_interleave_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_interleave_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static GstPad *gst_interleave_request_new_pad (GstElement * element, - GstPadTemplate * templ, const gchar * name); -static void gst_interleave_release_pad (GstElement * element, GstPad * pad); - -static GstStateChangeReturn gst_interleave_change_state (GstElement * element, - GstStateChange transition); - -static gboolean gst_interleave_src_query (GstPad * pad, GstQuery * query); - -static gboolean gst_interleave_src_event (GstPad * pad, GstEvent * event); - -static gboolean gst_interleave_sink_event (GstPad * pad, GstEvent * event); - -static gboolean gst_interleave_sink_setcaps (GstPad * pad, GstCaps * caps); - -static GstCaps *gst_interleave_sink_getcaps (GstPad * pad); - -static GstFlowReturn gst_interleave_collected (GstCollectPads * pads, - GstLALInterleave * self); - -static void -gst_interleave_finalize (GObject * object) -{ - GstLALInterleave *self = GST_INTERLEAVE (object); - - if (self->collect) { - gst_object_unref (self->collect); - self->collect = NULL; - } - - if (self->channel_positions - && self->channel_positions != self->input_channel_positions) { - g_value_array_free (self->channel_positions); - self->channel_positions = NULL; - } - - if (self->input_channel_positions) { - g_value_array_free (self->input_channel_positions); - self->input_channel_positions = NULL; - } - - gst_caps_replace (&self->sinkcaps, NULL); - - while (self->pending_events) { - GstEvent *ev = GST_EVENT (self->pending_events->data); - gst_event_unref (ev); - self->pending_events = g_list_remove (self->pending_events, ev); - } - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static gboolean -gst_interleave_check_channel_positions (GValueArray * positions) -{ - guint i; - guint channels; - GstAudioChannelPosition *pos; - gboolean ret; - - channels = positions->n_values; - pos = g_new (GstAudioChannelPosition, positions->n_values); - - for (i = 0; i < channels; i++) { - GValue *v = g_value_array_get_nth (positions, i); - - pos[i] = g_value_get_enum (v); - } - - ret = gst_audio_check_channel_positions (pos, channels); - g_free (pos); - - return ret; -} - -static void -gst_interleave_set_channel_positions (GstLALInterleave * self, GstStructure * s) -{ - GValue pos_array = { 0, }; - gint i; - - g_value_init (&pos_array, GST_TYPE_ARRAY); - - if (self->channel_positions - && (gint) self->channels == (gint) self->channel_positions->n_values - && gst_interleave_check_channel_positions (self->channel_positions)) { - GST_DEBUG_OBJECT (self, "Using provided channel positions"); - for (i = 0; i < self->channels; i++) - gst_value_array_append_value (&pos_array, - g_value_array_get_nth (self->channel_positions, i)); - } else { - GValue pos_none = { 0, }; - - GST_WARNING_OBJECT (self, "Using NONE channel positions"); - - g_value_init (&pos_none, GST_TYPE_AUDIO_CHANNEL_POSITION); - g_value_set_enum (&pos_none, GST_AUDIO_CHANNEL_POSITION_NONE); - - for (i = 0; i < self->channels; i++) - gst_value_array_append_value (&pos_array, &pos_none); - - g_value_unset (&pos_none); - } - gst_structure_set_value (s, "channel-positions", &pos_array); - g_value_unset (&pos_array); -} - -static void -gst_interleave_base_init (gpointer g_class) -{ - gst_element_class_set_details_simple (g_class, "Audio interleaver", - "Filter/Converter/Audio", - "Folds many mono channels into one interleaved audio stream", - "Andy Wingo <wingo at pobox.com>, " - "Sebastian Dröge <slomo@circular-chaos.org>"); - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&src_template)); - gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&sink_template)); -} - -static void -gst_interleave_class_init (GstLALInterleaveClass * klass) -{ - GstElementClass *gstelement_class; - GObjectClass *gobject_class; - - gobject_class = G_OBJECT_CLASS (klass); - gstelement_class = GST_ELEMENT_CLASS (klass); - - /* Reference GstLALInterleavePad class to have the type registered from - * a threadsafe context - */ - g_type_class_ref (GST_TYPE_INTERLEAVE_PAD); - - gobject_class->finalize = gst_interleave_finalize; - gobject_class->set_property = gst_interleave_set_property; - gobject_class->get_property = gst_interleave_get_property; - - /** - * GstLALInterleave:channel-positions - * - * Channel positions: This property controls the channel positions - * that are used on the src caps. The number of elements should be - * the same as the number of sink pads and the array should contain - * a valid list of channel positions. The n-th element of the array - * is the position of the n-th sink pad. - * - * These channel positions will only be used if they're valid and the - * number of elements is the same as the number of channels. If this - * is not given a NONE layout will be used. - * - */ - g_object_class_install_property (gobject_class, PROP_CHANNEL_POSITIONS, - g_param_spec_value_array ("channel-positions", "Channel positions", - "Channel positions used on the output", - g_param_spec_enum ("channel-position", "Channel position", - "Channel position of the n-th input", - GST_TYPE_AUDIO_CHANNEL_POSITION, - GST_AUDIO_CHANNEL_POSITION_NONE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS), - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GstLALInterleave:channel-positions-from-input - * - * Channel positions from input: If this property is set to %TRUE the channel - * positions will be taken from the input caps if valid channel positions for - * the output can be constructed from them. If this is set to %TRUE setting the - * channel-positions property overwrites this property again. - * - */ - g_object_class_install_property (gobject_class, - PROP_CHANNEL_POSITIONS_FROM_INPUT, - g_param_spec_boolean ("channel-positions-from-input", - "Channel positions from input", - "Take channel positions from the input", TRUE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /** - * GstLALInterleave:sync - * - * Sync/Synchronous: Channels will be interleaved synchronously by timestampe - * - */ - - g_object_class_install_property (gobject_class, PROP_SYNCHRONOUS, - g_param_spec_boolean ("sync", "Synchronous", - "Align the time stamps of input streams. ", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - gstelement_class->request_new_pad = - GST_DEBUG_FUNCPTR (gst_interleave_request_new_pad); - gstelement_class->release_pad = - GST_DEBUG_FUNCPTR (gst_interleave_release_pad); - gstelement_class->change_state = - GST_DEBUG_FUNCPTR (gst_interleave_change_state); -} - -static void -gst_interleave_init (GstLALInterleave * self, GstLALInterleaveClass * klass) -{ - self->src = gst_pad_new_from_static_template (&src_template, "src"); - - gst_pad_set_query_function (self->src, - GST_DEBUG_FUNCPTR (gst_interleave_src_query)); - gst_pad_set_event_function (self->src, - GST_DEBUG_FUNCPTR (gst_interleave_src_event)); - - gst_element_add_pad (GST_ELEMENT (self), self->src); - - self->collect = gst_collect_pads_new (); - gst_collect_pads_set_function (self->collect, - (GstCollectPadsFunction) gst_interleave_collected, self); - - self->input_channel_positions = g_value_array_new (0); - self->channel_positions_from_input = TRUE; - self->channel_positions = self->input_channel_positions; -} - -static void -gst_interleave_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstLALInterleave *self = GST_INTERLEAVE (object); - - switch (prop_id) { - case PROP_CHANNEL_POSITIONS: - if (self->channel_positions && - self->channel_positions != self->input_channel_positions) - g_value_array_free (self->channel_positions); - - self->channel_positions = g_value_dup_boxed (value); - self->channel_positions_from_input = FALSE; - break; - case PROP_CHANNEL_POSITIONS_FROM_INPUT: - self->channel_positions_from_input = g_value_get_boolean (value); - - if (self->channel_positions_from_input) { - if (self->channel_positions && - self->channel_positions != self->input_channel_positions) - g_value_array_free (self->channel_positions); - self->channel_positions = self->input_channel_positions; - } - break; - case PROP_SYNCHRONOUS: - self->synchronous = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_interleave_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstLALInterleave *self = GST_INTERLEAVE (object); - - switch (prop_id) { - case PROP_CHANNEL_POSITIONS: - g_value_set_boxed (value, self->channel_positions); - break; - case PROP_CHANNEL_POSITIONS_FROM_INPUT: - g_value_set_boolean (value, self->channel_positions_from_input); - break; - case PROP_SYNCHRONOUS: - g_value_set_boolean (value, self->synchronous); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstPad * -gst_interleave_request_new_pad (GstElement * element, GstPadTemplate * templ, - const gchar * req_name) -{ - GstLALInterleave *self = GST_INTERLEAVE (element); - GstPad *new_pad; - gchar *pad_name; - gint channels, padnumber; - GstLALCollectData *data = NULL; - GValue val = { 0, }; - - if (templ->direction != GST_PAD_SINK) - goto not_sink_pad; - -#if GLIB_CHECK_VERSION(2,29,5) - channels = g_atomic_int_add (&self->channels, 1); - padnumber = g_atomic_int_add (&self->padcounter, 1); -#else - channels = g_atomic_int_exchange_and_add (&self->channels, 1); - padnumber = g_atomic_int_exchange_and_add (&self->padcounter, 1); -#endif - - pad_name = g_strdup_printf ("sink%d", padnumber); - new_pad = GST_PAD_CAST (g_object_new (GST_TYPE_INTERLEAVE_PAD, - "name", pad_name, "direction", templ->direction, - "template", templ, NULL)); - GST_INTERLEAVE_PAD_CAST (new_pad)->channel = channels; - GST_DEBUG_OBJECT (self, "requested new pad %s", pad_name); - g_free (pad_name); - - gst_pad_set_setcaps_function (new_pad, - GST_DEBUG_FUNCPTR (gst_interleave_sink_setcaps)); - gst_pad_set_getcaps_function (new_pad, - GST_DEBUG_FUNCPTR (gst_interleave_sink_getcaps)); - GST_OBJECT_LOCK(self->collect); - data = gstlal_collect_pads_add_pad(self->collect, new_pad, sizeof(*data)); - gstlal_collect_pads_set_unit_size(new_pad, self->width / 8); - gstlal_collect_pads_set_rate(new_pad, self->rate); - GST_OBJECT_UNLOCK(self->collect); - - /* FIXME: hacked way to override/extend the event function of - * GstCollectPads; because it sets its own event function giving the - * element no access to events */ - self->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (new_pad); - gst_pad_set_event_function (new_pad, - GST_DEBUG_FUNCPTR (gst_interleave_sink_event)); - - if (!gst_element_add_pad (element, new_pad)) - goto could_not_add; - - g_value_init (&val, GST_TYPE_AUDIO_CHANNEL_POSITION); - g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_NONE); - self->input_channel_positions = - g_value_array_append (self->input_channel_positions, &val); - g_value_unset (&val); - - /* Update the src caps if we already have them */ - if (self->sinkcaps) { - GstCaps *srccaps; - GstStructure *s; - - /* Take lock to make sure processing finishes first */ - GST_OBJECT_LOCK (self->collect); - - srccaps = gst_caps_copy (self->sinkcaps); - s = gst_caps_get_structure (srccaps, 0); - - gst_structure_set (s, "channels", G_TYPE_INT, self->channels, NULL); - gst_interleave_set_channel_positions (self, s); - - gst_pad_set_caps (self->src, srccaps); - gst_caps_unref (srccaps); - - GST_OBJECT_UNLOCK (self->collect); - } - - return new_pad; - - /* errors */ -not_sink_pad: - { - g_warning ("interleave: requested new pad that is not a SINK pad\n"); - return NULL; - } -could_not_add: - { - GST_DEBUG_OBJECT (self, "could not add pad %s", GST_PAD_NAME (new_pad)); - gst_collect_pads_remove_pad (self->collect, new_pad); - gst_object_unref (new_pad); - return NULL; - } -} - -static void -gst_interleave_release_pad (GstElement * element, GstPad * pad) -{ - GstLALInterleave *self = GST_INTERLEAVE (element); - GList *l; - - g_return_if_fail (GST_IS_INTERLEAVE_PAD (pad)); - - /* Take lock to make sure we're not changing this when processing buffers */ - GST_OBJECT_LOCK (self->collect); - - g_atomic_int_add (&self->channels, -1); - - g_value_array_remove (self->input_channel_positions, - GST_INTERLEAVE_PAD_CAST (pad)->channel); - - /* Update channel numbers */ - GST_OBJECT_LOCK (self); - for (l = GST_ELEMENT_CAST (self)->sinkpads; l != NULL; l = l->next) { - GstLALInterleavePad *ipad = GST_INTERLEAVE_PAD (l->data); - - if (GST_INTERLEAVE_PAD_CAST (pad)->channel < ipad->channel) - ipad->channel--; - } - GST_OBJECT_UNLOCK (self); - - /* Update the src caps if we already have them */ - if (self->sinkcaps) { - if (self->channels > 0) { - GstCaps *srccaps; - GstStructure *s; - - srccaps = gst_caps_copy (self->sinkcaps); - s = gst_caps_get_structure (srccaps, 0); - - gst_structure_set (s, "channels", G_TYPE_INT, self->channels, NULL); - gst_interleave_set_channel_positions (self, s); - - gst_pad_set_caps (self->src, srccaps); - gst_caps_unref (srccaps); - } else { - gst_caps_replace (&self->sinkcaps, NULL); - gst_pad_set_caps (self->src, NULL); - } - } - - GST_OBJECT_UNLOCK (self->collect); - - gstlal_collect_pads_remove_pad (self->collect, pad); - gst_element_remove_pad (element, pad); -} - -static GstStateChangeReturn -gst_interleave_change_state (GstElement * element, GstStateChange transition) -{ - GstLALInterleave *self; - GstStateChangeReturn ret; - - self = GST_INTERLEAVE (element); - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - break; - case GST_STATE_CHANGE_READY_TO_PAUSED: - self->timestamp = 0; - self->offset = 0; - self->flush_stop_pending = FALSE; - self->segment_pending = TRUE; - self->segment_position = 0; - self->segment_rate = 1.0; - gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED); - gst_collect_pads_start (self->collect); - break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - break; - default: - break; - } - - /* Stop before calling the parent's state change function as - * GstCollectPads might take locks and we would deadlock in that - * case - */ - if (transition == GST_STATE_CHANGE_PAUSED_TO_READY) - gst_collect_pads_stop (self->collect); - - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - gst_pad_set_caps (self->src, NULL); - gst_caps_replace (&self->sinkcaps, NULL); - break; - case GST_STATE_CHANGE_READY_TO_NULL: - break; - default: - break; - } - - return ret; -} - -static void -__remove_channels (GstCaps * caps) -{ - GstStructure *s; - gint i, size; - - size = gst_caps_get_size (caps); - for (i = 0; i < size; i++) { - s = gst_caps_get_structure (caps, i); - gst_structure_remove_field (s, "channel-positions"); - gst_structure_remove_field (s, "channels"); - } -} - -static void -__set_channels (GstCaps * caps, gint channels) -{ - GstStructure *s; - gint i, size; - - size = gst_caps_get_size (caps); - for (i = 0; i < size; i++) { - s = gst_caps_get_structure (caps, i); - if (channels > 0) - gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL); - else - gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); - } -} - -/* we can only accept caps that we and downstream can handle. */ -static GstCaps * -gst_interleave_sink_getcaps (GstPad * pad) -{ - GstLALInterleave *self = GST_INTERLEAVE (gst_pad_get_parent (pad)); - GstCaps *result, *peercaps, *sinkcaps; - - GST_OBJECT_LOCK (self); - - /* If we already have caps on one of the sink pads return them */ - if (self->sinkcaps) { - result = gst_caps_copy (self->sinkcaps); - } else { - /* get the downstream possible caps */ - peercaps = gst_pad_peer_get_caps (self->src); - /* get the allowed caps on this sinkpad */ - sinkcaps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); - __remove_channels (sinkcaps); - if (peercaps) { - __remove_channels (peercaps); - /* if the peer has caps, intersect */ - GST_DEBUG_OBJECT (pad, "intersecting peer and template caps"); - result = gst_caps_intersect (peercaps, sinkcaps); - gst_caps_unref (peercaps); - gst_caps_unref (sinkcaps); - } else { - /* the peer has no caps (or there is no peer), just use the allowed caps - * of this sinkpad. */ - GST_DEBUG_OBJECT (pad, "no peer caps, using sinkcaps"); - result = sinkcaps; - } - __set_channels (result, 1); - } - - GST_OBJECT_UNLOCK (self); - - gst_object_unref (self); - - GST_DEBUG_OBJECT (pad, "Returning caps %" GST_PTR_FORMAT, result); - - return result; -} - -static void -gst_interleave_set_process_function (GstLALInterleave * self) -{ - switch (self->width) { - case 8: - self->func = (GstLALInterleaveFunc) interleave_8; - break; - case 16: - self->func = (GstLALInterleaveFunc) interleave_16; - break; - case 24: - self->func = (GstLALInterleaveFunc) interleave_24; - break; - case 32: - self->func = (GstLALInterleaveFunc) interleave_32; - break; - case 64: - self->func = (GstLALInterleaveFunc) interleave_64; - break; - default: - g_assert_not_reached (); - break; - } -} - -static gboolean -gst_interleave_sink_setcaps (GstPad * pad, GstCaps * caps) -{ - GstLALInterleave *self; - GList *pads; - - g_return_val_if_fail (GST_IS_INTERLEAVE_PAD (pad), FALSE); - - self = GST_INTERLEAVE (gst_pad_get_parent (pad)); - - /* First caps that are set on a sink pad are used as output caps */ - /* TODO: handle caps changes */ - if (self->sinkcaps && !gst_caps_is_subset (caps, self->sinkcaps)) { - goto cannot_change_caps; - } else { - GstCaps *srccaps; - GstStructure *s; - gboolean res; - - s = gst_caps_get_structure (caps, 0); - - if (!gst_structure_get_int (s, "width", &self->width)) - goto no_width; - - if (!gst_structure_get_int (s, "rate", &self->rate)) - goto no_rate; - - gst_interleave_set_process_function (self); - - if (gst_structure_has_field (s, "channel-positions")) { - const GValue *pos_array; - - pos_array = gst_structure_get_value (s, "channel-positions"); - if (GST_VALUE_HOLDS_ARRAY (pos_array) - && gst_value_array_get_size (pos_array) == 1) { - const GValue *pos = gst_value_array_get_value (pos_array, 0); - - GValue *apos = g_value_array_get_nth (self->input_channel_positions, - GST_INTERLEAVE_PAD_CAST (pad)->channel); - - g_value_set_enum (apos, g_value_get_enum (pos)); - } - } - - srccaps = gst_caps_copy (caps); - s = gst_caps_get_structure (srccaps, 0); - - gst_structure_set (s, "channels", G_TYPE_INT, self->channels, NULL); - gst_interleave_set_channel_positions (self, s); - - res = gst_pad_set_caps (self->src, srccaps); - gst_caps_unref (srccaps); - - if (!res) - goto src_did_not_accept; - } - - /* set unit size on collect pads */ - GST_OBJECT_LOCK(self->collect); - for (pads = GST_ELEMENT (self)->pads; pads; pads = g_list_next (pads)) { - GstPad *pad = GST_PAD(pads->data); - if (gst_pad_get_direction (pad) == GST_PAD_SINK) { - gstlal_collect_pads_set_unit_size (pad, self->width / 8); - gstlal_collect_pads_set_rate (pad, self->rate); - } - } - GST_OBJECT_UNLOCK(self->collect); - - if (!self->sinkcaps) { - GstCaps *sinkcaps = gst_caps_copy (caps); - GstStructure *s = gst_caps_get_structure (sinkcaps, 0); - - gst_structure_remove_field (s, "channel-positions"); - - gst_caps_replace (&self->sinkcaps, sinkcaps); - - gst_caps_unref (sinkcaps); - } - - gst_object_unref (self); - - return TRUE; - -cannot_change_caps: - { - GST_WARNING_OBJECT (self, "caps of %" GST_PTR_FORMAT " already set, can't " - "change", self->sinkcaps); - gst_object_unref (self); - return FALSE; - } -src_did_not_accept: - { - GST_WARNING_OBJECT (self, "src did not accept setcaps()"); - gst_object_unref (self); - return FALSE; - } -no_width: - { - GST_WARNING_OBJECT (self, "caps did not have width: %" GST_PTR_FORMAT, - caps); - gst_object_unref (self); - return FALSE; - } -no_rate: - { - GST_WARNING_OBJECT (self, "caps did not have rate: %" GST_PTR_FORMAT, caps); - gst_object_unref (self); - return FALSE; - } -} - -static gboolean -gst_interleave_sink_event (GstPad * pad, GstEvent * event) -{ - GstLALInterleave *self = GST_INTERLEAVE (gst_pad_get_parent (pad)); - gboolean ret = TRUE; - - GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event), - GST_DEBUG_PAD_NAME (pad)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_FLUSH_STOP: - /* mark a pending new segment. This event is synchronized - * with the streaming thread so we can safely update the - * variable without races. It's somewhat weird because we - * assume the collectpads forwarded the FLUSH_STOP past us - * and downstream (using our source pad, the bastard!). - */ - GST_OBJECT_LOCK (self->collect); - self->segment_pending = TRUE; - self->flush_stop_pending = FALSE; - while (self->pending_events) { - GstEvent *ev = GST_EVENT (self->pending_events->data); - gst_event_unref(ev); - self->pending_events = g_list_remove (self->pending_events, ev); - } - GST_OBJECT_UNLOCK(self->collect); - break; - case GST_EVENT_TAG: - GST_OBJECT_LOCK(self->collect); - self->pending_events = g_list_append (self->pending_events, event); - GST_OBJECT_UNLOCK (self->collect); - goto beach; - default: - break; - } - - /* now GstCollectPads can take care of the rest, e.g. EOS */ - ret = self->collect_event (pad, event); - -beach: - gst_object_unref (self); - return ret; -} - -static gboolean -gst_interleave_src_query_duration (GstLALInterleave * self, GstQuery * query) -{ - gint64 max; - gboolean res; - GstFormat format; - GstIterator *it; - gboolean done; - - /* parse format */ - gst_query_parse_duration (query, &format, NULL); - - max = -1; - res = TRUE; - done = FALSE; - - /* Take maximum of all durations */ - it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (self)); - while (!done) { - GstIteratorResult ires; - - gpointer item; - - ires = gst_iterator_next (it, &item); - switch (ires) { - case GST_ITERATOR_DONE: - done = TRUE; - break; - case GST_ITERATOR_OK: - { - GstPad *pad = GST_PAD_CAST (item); - - gint64 duration; - - /* ask sink peer for duration */ - res &= gst_pad_query_peer_duration (pad, &format, &duration); - /* take max from all valid return values */ - if (res) { - /* valid unknown length, stop searching */ - if (duration == -1) { - max = duration; - done = TRUE; - } - /* else see if bigger than current max */ - else if (duration > max) - max = duration; - } - gst_object_unref (pad); - break; - } - case GST_ITERATOR_RESYNC: - max = -1; - res = TRUE; - gst_iterator_resync (it); - break; - default: - res = FALSE; - done = TRUE; - break; - } - } - gst_iterator_free (it); - - if (res) { - /* If in bytes format we have to multiply with the number of channels - * to get the correct results. All other formats should be fine */ - if (format == GST_FORMAT_BYTES && max != -1) - max *= self->channels; - - /* and store the max */ - GST_DEBUG_OBJECT (self, "Total duration in format %s: %" - GST_TIME_FORMAT, gst_format_get_name (format), GST_TIME_ARGS (max)); - gst_query_set_duration (query, format, max); - } - - return res; -} - -static gboolean -gst_interleave_src_query_latency (GstLALInterleave * self, GstQuery * query) -{ - GstClockTime min, max; - gboolean live; - gboolean res; - GstIterator *it; - gboolean done; - - res = TRUE; - done = FALSE; - - live = FALSE; - min = 0; - max = GST_CLOCK_TIME_NONE; - - /* Take maximum of all latency values */ - it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (self)); - while (!done) { - GstIteratorResult ires; - gpointer item; - - ires = gst_iterator_next (it, &item); - switch (ires) { - case GST_ITERATOR_DONE: - done = TRUE; - break; - case GST_ITERATOR_OK: - { - GstPad *pad = GST_PAD_CAST (item); - GstQuery *peerquery; - GstClockTime min_cur, max_cur; - gboolean live_cur; - - peerquery = gst_query_new_latency (); - - /* Ask peer for latency */ - res &= gst_pad_peer_query (pad, peerquery); - - /* take max from all valid return values */ - if (res) { - gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur); - - if (min_cur > min) - min = min_cur; - - if (max_cur != GST_CLOCK_TIME_NONE && - ((max != GST_CLOCK_TIME_NONE && max_cur > max) || - (max == GST_CLOCK_TIME_NONE))) - max = max_cur; - - live = live || live_cur; - } - - gst_query_unref (peerquery); - gst_object_unref (pad); - break; - } - case GST_ITERATOR_RESYNC: - live = FALSE; - min = 0; - max = GST_CLOCK_TIME_NONE; - res = TRUE; - gst_iterator_resync (it); - break; - default: - res = FALSE; - done = TRUE; - break; - } - } - gst_iterator_free (it); - - if (res) { - /* store the results */ - GST_DEBUG_OBJECT (self, "Calculated total latency: live %s, min %" - GST_TIME_FORMAT ", max %" GST_TIME_FORMAT, - (live ? "yes" : "no"), GST_TIME_ARGS (min), GST_TIME_ARGS (max)); - gst_query_set_latency (query, live, min, max); - } - - return res; -} - -static gboolean -gst_interleave_src_query (GstPad * pad, GstQuery * query) -{ - GstLALInterleave *self = GST_INTERLEAVE (gst_pad_get_parent (pad)); - gboolean res = FALSE; - - switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_POSITION: - { - GstFormat format; - - gst_query_parse_position (query, &format, NULL); - - switch (format) { - case GST_FORMAT_TIME: - /* FIXME, bring to stream time, might be tricky */ - gst_query_set_position (query, format, self->timestamp); - res = TRUE; - break; - case GST_FORMAT_BYTES: - gst_query_set_position (query, format, - self->offset * self->channels * self->width); - res = TRUE; - break; - case GST_FORMAT_DEFAULT: - gst_query_set_position (query, format, self->offset); - res = TRUE; - break; - default: - break; - } - break; - } - case GST_QUERY_DURATION: - res = gst_interleave_src_query_duration (self, query); - break; - case GST_QUERY_LATENCY: - res = gst_interleave_src_query_latency (self, query); - break; - default: - /* FIXME, needs a custom query handler because we have multiple - * sinkpads */ - res = gst_pad_query_default (pad, query); - break; - } - - gst_object_unref (self); - return res; -} - -static gboolean -forward_event_func (GstPad * pad, GValue * ret, GstEvent * event) -{ - gst_event_ref (event); - GST_LOG_OBJECT (pad, "About to send event %s", GST_EVENT_TYPE_NAME (event)); - if (!gst_pad_push_event (pad, event)) { - g_value_set_boolean (ret, FALSE); - GST_WARNING_OBJECT (pad, "Sending event %p (%s) failed.", - event, GST_EVENT_TYPE_NAME (event)); - } else { - GST_LOG_OBJECT (pad, "Sent event %p (%s).", - event, GST_EVENT_TYPE_NAME (event)); - } - gst_object_unref (pad); - return TRUE; -} - -static gboolean -forward_event (GstLALInterleave * self, GstEvent * event) -{ - GstIterator *it; - GValue vret = { 0 }; - - GST_LOG_OBJECT (self, "Forwarding event %p (%s)", event, - GST_EVENT_TYPE_NAME (event)); - - g_value_init (&vret, G_TYPE_BOOLEAN); - g_value_set_boolean (&vret, TRUE); - it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (self)); - gst_iterator_fold (it, (GstIteratorFoldFunction) forward_event_func, &vret, - event); - gst_iterator_free (it); - gst_event_unref (event); - - return g_value_get_boolean (&vret); -} - - -static gboolean -gst_interleave_src_event (GstPad * pad, GstEvent * event) -{ - GstLALInterleave *self = GST_INTERLEAVE (gst_pad_get_parent (pad)); - gboolean result; - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_QOS: - /* QoS might be tricky */ - result = FALSE; - break; - case GST_EVENT_SEEK: - { - GstSeekFlags flags; - GstSeekType curtype; - gint64 cur; - gboolean flush; - - /* parse the seek parameters */ - gst_event_parse_seek (event, &self->segment_rate, NULL, &flags, &curtype, - &cur, NULL, NULL); - - flush = (flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH; - - /* check if we are flushing */ - if (flush) { - /* make sure we accept nothing anymore and return WRONG_STATE */ - gst_collect_pads_set_flushing (self->collect, TRUE); - - /* flushing seek, start flush downstream, the flush will be done - * when all pads received a FLUSH_STOP. */ - gst_pad_push_event (self->src, gst_event_new_flush_start ()); - self->flush_stop_pending = TRUE; - } - - /* now wait for the collected to be finished and mark a new - * segment */ - GST_OBJECT_LOCK (self->collect); - if (curtype == GST_SEEK_TYPE_SET) - self->segment_position = cur; - else - self->segment_position = 0; - self->segment_pending = TRUE; - if (flush) { - gst_collect_pads_set_flushing (self->collect, TRUE); - } - GST_OBJECT_UNLOCK (self->collect); - - result = forward_event (self, event); - if (!result) { - GST_DEBUG_OBJECT (self, "seeking failed"); - } - if (g_atomic_int_compare_and_exchange (&self->flush_stop_pending, TRUE, FALSE)) { - GST_DEBUG_OBJECT (self, "pending flush stop"); - gst_pad_push_event (self->src, gst_event_new_flush_stop ()); - } - break; - } - case GST_EVENT_NAVIGATION: - /* navigation is rather pointless. */ - result = FALSE; - break; - default: - /* just forward the rest for now */ - result = forward_event (self, event); - break; - } - gst_object_unref (self); - - return result; -} - -static GstClockTime -output_timestamp_from_offset (const GstLALInterleave *self, guint64 offset) -{ - return self->segment.start + gst_util_uint64_scale_int_round (offset, GST_SECOND, self->rate); -} - -static GstFlowReturn -gst_interleave_collected (GstCollectPads * pads, GstLALInterleave * self) -{ - GstBuffer *outbuf; - GstFlowReturn ret = GST_FLOW_OK; - GSList *collected; - gint width = self->width / 8; - GstClockTime t_start, t_end; - guint64 earliest_output_offset, earliest_output_offset_end, outlength; - guint ncollected = 0; - gboolean empty = TRUE; - - g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED); - g_return_val_if_fail (self->width > 0, GST_FLOW_NOT_NEGOTIATED); - g_return_val_if_fail (self->channels > 0, GST_FLOW_NOT_NEGOTIATED); - g_return_val_if_fail (self->rate > 0, GST_FLOW_NOT_NEGOTIATED); - - if (g_atomic_int_compare_and_exchange (&self->flush_stop_pending, TRUE, FALSE)){ - GST_DEBUG_OBJECT (self, "pending flush stop"); - gst_pad_push_event (self->src, gst_event_new_flush_stop ()); - } - - if (self->segment_pending) { - GstEvent *event; - GstSegment *segment; - - segment = gstlal_collect_pads_get_segment (self->collect); - if (segment) { - g_assert (segment->format == GST_FORMAT_TIME); - self->segment = *segment; - gst_segment_free (segment); - } else - GST_ELEMENT_ERROR (self, STREAM, FORMAT, (NULL), ("failed to deduce output segment, falling back to undefined default")); - - event = gst_event_new_new_segment_full (FALSE, self->segment.rate, - 1.0, GST_FORMAT_TIME, self->segment.start, self->segment.stop, self->segment.start); - if (self->segment.rate > 0.0) { - self->timestamp = self->segment.start; - self->offset = 0; - } else { - self->timestamp = self->segment.stop; - self->offset = gst_util_uint64_scale_round (self->segment.stop - self->segment.start, self->rate, GST_SECOND); - } - - if (event) { - if (!gst_pad_push_event (self->src, event)) { - GST_WARNING_OBJECT (self->src, "Sending event %p (%s) failed.", event, GST_EVENT_TYPE_NAME (event)); - } - self->segment_pending = FALSE; - self->segment_position = 0; - } else { - GST_WARNING_OBJECT (self->src, "Creating new segment event for " "start:%" G_GINT64_FORMAT, " end:%" G_GINT64_FORMAT " failed", self->segment.start, self->segment.stop); - } - } - - if (self->pending_events) { - while (self->pending_events) { - GstEvent *ev = GST_EVENT (self->pending_events->data); - gst_pad_push_event (self->src, ev); - self->pending_events = g_list_remove (self->pending_events, ev); - } - } - - /* get the range of offsets in the output stream spanend by the available input buffers */ - if (self->synchronous) { - /* when doing synchronous interleaving, determine the offsets for real */ - if (!gstlal_collect_pads_get_earliest_times (self->collect, &t_start, &t_end)) { - GST_ELEMENT_ERROR (self, STREAM, FORMAT, (NULL), ("cannot deduce input timestamp offset information")); - goto bad_timestamps; - } - /* check for EOS */ - if (!GST_CLOCK_TIME_IS_VALID (t_start)) - goto eos; - /* don't let time go backwards */ - earliest_output_offset = gst_util_uint64_scale_int_round (t_start - self->segment.start, self->rate, GST_SECOND); - earliest_output_offset_end = gst_util_uint64_scale_int_round (t_end - self->segment.start, self->rate, GST_SECOND); - - if (earliest_output_offset < self->offset) { - GST_ELEMENT_ERROR (self, STREAM, FORMAT, (NULL), ("detected time reversal in at least one input stream: expected nothing earlier than offset %" G_GUINT64_FORMAT ", found sample at offset %" G_GUINT64_FORMAT, self->offset, earliest_output_offset)); - goto bad_timestamps; - } - } else { - earliest_output_offset = self->offset; - earliest_output_offset_end = earliest_output_offset + gst_collect_pads_available(pads) / width; - } - - /* compute the number of samples for which all sink pads can contribute - * information. 0 does not necessarily mean EOS. */ - outlength = earliest_output_offset_end - earliest_output_offset; - - ret = gst_pad_alloc_buffer (self->src, GST_BUFFER_OFFSET_NONE, outlength * width * self->channels, GST_PAD_CAPS (self->src), &outbuf); - - if (ret != GST_FLOW_OK) { - return ret; - } else if (outbuf == NULL || GST_BUFFER_SIZE (outbuf) < outlength * width * self->channels) { - gst_buffer_unref (outbuf); - return GST_FLOW_NOT_NEGOTIATED; - } else if (!gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), GST_PAD_CAPS (self->src))) { - gst_buffer_unref (outbuf); - return GST_FLOW_NOT_NEGOTIATED; - } - - // Set up buffer of zeros - memset (GST_BUFFER_DATA (outbuf), 0, outlength * width * self->channels); - - for (collected = pads->data; collected; collected = g_slist_next (collected)) { - GstLALCollectData *collect_data = (GstLALCollectData *) collected->data; - GstBuffer *inbuf; - guint8 *outdata; - guint offset; - guint64 inlength; - - /* (try to) get a buffer upto the desired end offset. - * NULL means EOS or an empty buffer so we still need to flush in - * case of an empty buffer. - * determine the buffer's location relative to the desired range of - * offsets. we've checked above that time hasn't gone backwards on any - * input buffer so offset can't be negative. if not doing synchronous - * adding the buffer starts "now". */ - if (self->synchronous) { - inbuf = gstlal_collect_pads_take_buffer_sync (pads, collect_data, t_end); - if (inbuf == NULL) { - GST_LOG_OBJECT (self, "channel %p: no bytes available", collect_data); - goto next; - } - offset = gst_util_uint64_scale_int_round (GST_BUFFER_TIMESTAMP (inbuf) - self->segment.start, self->rate, GST_SECOND) - earliest_output_offset; - inlength = GST_BUFFER_OFFSET_END (inbuf) - GST_BUFFER_OFFSET (inbuf); - g_assert (inlength == GST_BUFFER_SIZE (inbuf) / width || GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)); - } else { - inbuf = gst_collect_pads_take_buffer (pads, (GstCollectData *) collect_data, outlength * width); - if (inbuf == NULL) { - GST_LOG_OBJECT (self, "channel %p: no bytes available", collect_data); - goto next; - } - offset = 0; - inlength = GST_BUFFER_SIZE (inbuf) / width; - } - g_assert (offset + inlength <= outlength || inlength == 0); - GST_LOG_OBJECT (self, "channel %p: retrieved %d sample buffer at %" GST_TIME_FORMAT, collect_data, inlength, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (inbuf))); - - /* this buffer is for the future, we don't need it yet. */ - if (offset > outlength || (offset == outlength && outlength != 0)) { - /* it must be empty or there's a bug in the collect pads class */ - g_assert (inlength == 0); - GST_LOG_OBJECT (self, "channel %p: discarding 0 sample buffer from the future", collect_data); - goto next; - } - - ncollected++; - - if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) - goto next; - - empty = FALSE; - outbuf = gst_buffer_make_writable(outbuf); - outdata = GST_BUFFER_DATA (outbuf) + width * GST_INTERLEAVE_PAD_CAST ( ( (GstCollectData *) collect_data)->pad)->channel + offset * width * self->channels; - self->func (outdata, GST_BUFFER_DATA (inbuf), self->channels, inlength); - - next: - if (inbuf) - gst_buffer_unref (inbuf); - } - - if (ncollected == 0) - goto eos; - - /* FIXME: this logic can't run backwards */ - /* set timestamps on the output buffer */ - outbuf = gst_buffer_make_metadata_writable(outbuf); - GST_BUFFER_OFFSET (outbuf) = earliest_output_offset; - GST_BUFFER_TIMESTAMP (outbuf) = output_timestamp_from_offset (self, GST_BUFFER_OFFSET (outbuf)); - if (GST_BUFFER_OFFSET (outbuf) == 0 || GST_BUFFER_TIMESTAMP (outbuf) != self->timestamp) - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT); - else - GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DISCONT); - GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET (outbuf) + outlength; - self->timestamp = output_timestamp_from_offset (self, GST_BUFFER_OFFSET_END (outbuf)); - self->offset = GST_BUFFER_OFFSET_END(outbuf); - GST_BUFFER_DURATION (outbuf) = self->timestamp - GST_BUFFER_TIMESTAMP (outbuf); - g_assert(GST_BUFFER_SIZE(outbuf) == outlength*width*self->channels); - - if (empty) - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP); - - /* send it out */ - g_assert (GST_BUFFER_CAPS (outbuf) != NULL); - GST_LOG_OBJECT (self, "pushing outbuf %p spanning %" GST_BUFFER_BOUNDARIES_FORMAT, outbuf, GST_BUFFER_BOUNDARIES_ARGS (outbuf)); - ret = gst_pad_push (self->src, outbuf); - GST_LOG_OBJECT (self, "pushed outbuf, result = %s", gst_flow_get_name (ret)); - - - return ret; - - /* ERRORS */ -bad_timestamps: - { - return GST_FLOW_ERROR; - } -eos: - { - GST_DEBUG_OBJECT (self, "no data available, must be EOS"); - gst_pad_push_event (self->src, gst_event_new_eos ()); - return GST_FLOW_UNEXPECTED; - } -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "lal_interleave", 0, "audio channel interleaving element"); - if (!gst_element_register (plugin, "lal_interleave", - GST_RANK_NONE, gst_interleave_get_type())) - return FALSE; - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, "lal_interleave", "Audio interleaver", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/gstlal-calibration/gst/lal/gstinterleave.h b/gstlal-calibration/gst/lal/gstinterleave.h deleted file mode 100644 index 59572909478d6fd25487302a787f952ce743e620..0000000000000000000000000000000000000000 --- a/gstlal-calibration/gst/lal/gstinterleave.h +++ /dev/null @@ -1,94 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> - * 2000 Wim Taymans <wtay@chello.be> - * 2005 Wim Taymans <wim@fluendo.com> - * 2007 Andy Wingo <wingo at pobox.com> - * 2008 Sebastian Dröge <slomo@circular-chaos.org> - * - * interleave.c: interleave samples, mostly based on adder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_INTERLEAVE_H__ -#define __GST_INTERLEAVE_H__ - -#include <gst/gst.h> -#include <gst/base/gstcollectpads.h> - -G_BEGIN_DECLS - -#define GST_TYPE_INTERLEAVE (gst_interleave_get_type()) -#define GST_INTERLEAVE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_INTERLEAVE,GstLALInterleave)) -#define GST_INTERLEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_INTERLEAVE,GstLALInterleaveClass)) -#define GST_INTERLEAVE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_INTERLEAVE,GstLALInterleaveClass)) -#define GST_IS_INTERLEAVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_INTERLEAVE)) -#define GST_IS_INTERLEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_INTERLEAVE)) - -typedef struct _GstLALInterleave GstLALInterleave; -typedef struct _GstLALInterleaveClass GstLALInterleaveClass; - -typedef void (*GstLALInterleaveFunc) (gpointer out, gpointer in, guint stride, guint nframes); - -struct _GstLALInterleave -{ - GstElement element; - - /*< private >*/ - GstCollectPads *collect; - - gint channels; - gint padcounter; - gint rate; - gint width; - - GValueArray *channel_positions; - GValueArray *input_channel_positions; - gboolean channel_positions_from_input; - - GstCaps *sinkcaps; - - GstClockTime timestamp; - guint64 offset; - gboolean synchronous; - - gboolean segment_pending; - guint64 segment_position; - gdouble segment_rate; - GstSegment segment; - - gboolean flush_stop_pending; - - GstPadEventFunction collect_event; - - GstLALInterleaveFunc func; - - GstPad *src; - - GList *pending_events; -}; - -struct _GstLALInterleaveClass -{ - GstElementClass parent_class; -}; - -GType gst_interleave_get_type (void); - -G_END_DECLS - -#endif /* __GST_INTERLEAVE_H__ */ diff --git a/gstlal-calibration/gstlal-calibration.spec.in b/gstlal-calibration/gstlal-calibration.spec.in index 7dd171b8ae9d59576a8fade375ba65d737b814f3..a73980e4203549e7ad0325376af9709f98ecd3b1 100644 --- a/gstlal-calibration/gstlal-calibration.spec.in +++ b/gstlal-calibration/gstlal-calibration.spec.in @@ -1,4 +1,4 @@ -%define gstreamername gstreamer_lscsoft +%define gstreamername gstreamer1 Name: @PACKAGE_NAME@ Version: @PACKAGE_VERSION@ @@ -6,8 +6,8 @@ Release: 1.lscsoft Summary: GSTLAL Calibration License: GPL Group: LSC Software/Data Analysis -Requires: gstlal >= @MIN_GSTLAL_VERSION@ gstlal-ugly >= @MIN_GSTLALUGLY_VERSION@ python >= 2.6 glue >= @MIN_GLUE_VERSION@ glue-segments >= @MIN_GLUE_VERSION@ python-pylal >= @MIN_PYLAL_VERSION@ %{gstreamername} >= @MIN_GSTREAMER_VERSION@ %{gstreamername}-plugins-base >= @MIN_GSTREAMER_VERSION@ %{gstreamername}-plugins-good >= 0.10.27 gstreamer_lscsoft-python >= 0.10.21 pygobject2 numpy scipy lal >= @MIN_LAL_VERSION@ lalmetaio >= @MIN_LALMETAIO_VERSION@ -BuildRequires: gstlal-devel >= @MIN_GSTLAL_VERSION@ python-devel >= 2.6 fftw-devel >= 3 %{gstreamername}-devel >= @MIN_GSTREAMER_VERSION@ %{gstreamername}-plugins-base-devel >= @MIN_GSTREAMER_VERSION@ pygobject2-devel lal-devel >= @MIN_LAL_VERSION@ lalmetaio-devel >= @MIN_LALMETAIO_VERSION@ +Requires: gstlal >= @MIN_GSTLAL_VERSION@ gstlal-ugly >= @MIN_GSTLALUGLY_VERSION@ python >= @MIN_PYTHON_VERSION@ glue >= @MIN_GLUE_VERSION@ glue-segments >= @MIN_GLUE_VERSION@ python-pylal >= @MIN_PYLAL_VERSION@ %{gstreamername} >= @MIN_GSTREAMER_VERSION@ %{gstreamername}-plugins-base >= @MIN_GSTREAMER_VERSION@ %{gstreamername}-plugins-good >= 0.10.27 %{gstreamername}-python >= 0.10.21 numpy scipy lal >= @MIN_LAL_VERSION@ lalmetaio >= @MIN_LALMETAIO_VERSION@ +BuildRequires: gstlal-devel >= @MIN_GSTLAL_VERSION@ python-devel >= @MIN_PYTHON_VERSION@ fftw-devel >= 3 %{gstreamername}-devel >= @MIN_GSTREAMER_VERSION@ %{gstreamername}-plugins-base-devel >= @MIN_GSTREAMER_VERSION@ lal-devel >= @MIN_LAL_VERSION@ lalmetaio-devel >= @MIN_LALMETAIO_VERSION@ Conflicts: gstlal-ugly < 0.6.0 Source: @PACKAGE_NAME@-%{version}.tar.gz URL: https://www.lsc-group.phys.uwm.edu/daswg/projects/gstlal.html