summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2011-01-02 15:11:52 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-01-02 15:11:52 +0000
commita197901b82c22db9d8441eadba8063151c994b22 (patch)
treea345a2ce2253630668b247f51151b50cbc20a497
parent992c05f840381dd251d76eda4f3cc05fb5312c68 (diff)
downloadgstreamer-plugins-bad-a197901b82c22db9d8441eadba8063151c994b22.tar.gz
jack: move plugin to gst-plugins-good
https://bugzilla.gnome.org/show_bug.cgi?id=621929
-rw-r--r--LICENSE_readme2
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac11
-rw-r--r--docs/plugins/Makefile.am2
-rw-r--r--docs/plugins/gst-plugins-bad-plugins-docs.sgml3
-rw-r--r--docs/plugins/gst-plugins-bad-plugins-sections.txt30
-rw-r--r--docs/plugins/gst-plugins-bad-plugins.args86
-rw-r--r--docs/plugins/gst-plugins-bad-plugins.hierarchy5
-rw-r--r--docs/plugins/inspect/plugin-jack.xml43
-rw-r--r--ext/Makefile.am8
-rw-r--r--ext/jack/.gitignore1
-rw-r--r--ext/jack/Makefile.am12
-rw-r--r--ext/jack/README4
-rw-r--r--ext/jack/gstjack.c95
-rw-r--r--ext/jack/gstjack.h55
-rw-r--r--ext/jack/gstjackaudioclient.c525
-rw-r--r--ext/jack/gstjackaudioclient.h59
-rw-r--r--ext/jack/gstjackaudiosink.c852
-rw-r--r--ext/jack/gstjackaudiosink.h78
-rw-r--r--ext/jack/gstjackaudiosrc.c874
-rw-r--r--ext/jack/gstjackaudiosrc.h97
-rw-r--r--ext/jack/gstjackringbuffer.h88
-rw-r--r--ext/jack/gstjackutil.c114
-rw-r--r--ext/jack/gstjackutil.h30
-rw-r--r--gst-plugins-bad.spec.in1
-rw-r--r--tests/examples/Makefile.am9
-rw-r--r--tests/examples/jack/Makefile.am6
-rw-r--r--tests/examples/jack/jack_client.c79
28 files changed, 19 insertions, 3154 deletions
diff --git a/LICENSE_readme b/LICENSE_readme
index 718d6d23b..3afe96ebc 100644
--- a/LICENSE_readme
+++ b/LICENSE_readme
@@ -37,8 +37,6 @@ xvid libxvidcore (http://www.xvid.org/)
Plugins derived from GPL code are as follows:
dvdreadsrc libdvdread (http://www.dtek.chalmers.se/groups/dvd/)
-jack libjack (http://jackit.sourceforge.net/)
- Note libjack is LGPL, but plugin is GPL.
monoscope None (Algorithm by Ralph Loader, Joerg Walter,
Richard Boulton, and Andy Lo A Foe)
rtjpeg None (Erik Walthinsen's algorithm)
diff --git a/Makefile.am b/Makefile.am
index 402b8b957..a8ac17d49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,6 +46,7 @@ CRUFT_FILES = \
$(top_builddir)/common/shave-libtool \
$(top_builddir)/ext/alsaspdif/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/ext/ivorbis/.libs/*.{so,dll,DLL,dylib} \
+ $(top_builddir)/ext/jack/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/aacparse/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/amrparse/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/flacparse/.libs/*.{so,dll,DLL,dylib} \
@@ -60,6 +61,7 @@ CRUFT_FILES = \
$(top_builddir)/tests/check/elements/selector \
$(top_builddir)/tests/check/elements/valve \
$(top_builddir)/tests/check/pipelines/metadata \
+ $(top_builddir)/tests/examples/jack/jack_client \
$(top_builddir)/tests/examples/switch/switcher \
$(top_builddir)/tests/icles/output-selector-test \
$(top_builddir)/tests/icles/test-oss4
@@ -74,8 +76,10 @@ CRUFT_DIRS = \
$(top_srcdir)/gst/valve \
$(top_srcdir)/tests/examples/shapewipe \
$(top_srcdir)/tests/examples/switch \
+ $(top_srcdir)/tests/examples/jack \
$(top_srcdir)/ext/alsaspdif \
$(top_srcdir)/ext/ivorbis \
+ $(top_srcdir)/ext/jack \
$(top_srcdir)/ext/metadata
include $(top_srcdir)/common/cruft.mak
diff --git a/configure.ac b/configure.ac
index 50f03565e..31b09ed66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -888,14 +888,6 @@ AG_GST_CHECK_FEATURE(GSM, [GSM library], gsmenc gsmdec, [
AC_SUBST(GSM_LIBS)
])
-dnl *** Jack ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
-AG_GST_CHECK_FEATURE(JACK, Jack, jack, [
- PKG_CHECK_MODULES(JACK, jack >= 0.99.10, HAVE_JACK="yes", HAVE_JACK="no")
- AC_SUBST(JACK_CFLAGS)
- AC_SUBST(JACK_LIBS)
-])
-
dnl *** jp2k ***
translit(dnm, m, l) AM_CONDITIONAL(USE_JP2K, true)
AG_GST_CHECK_FEATURE(JP2K, [jp2k], jp2kdec jp2kenc, [
@@ -1607,7 +1599,6 @@ AM_CONDITIONAL(USE_FAAD, false)
AM_CONDITIONAL(USE_FBDEV, false)
AM_CONDITIONAL(USE_FLITE, false)
AM_CONDITIONAL(USE_GSM, false)
-AM_CONDITIONAL(USE_JACK, false)
AM_CONDITIONAL(USE_JP2K, false)
AM_CONDITIONAL(USE_KATE, false)
AM_CONDITIONAL(USE_TIGER, false)
@@ -1812,7 +1803,6 @@ tests/examples/camerabin2/Makefile
tests/examples/directfb/Makefile
tests/examples/mxf/Makefile
tests/examples/scaletempo/Makefile
-tests/examples/jack/Makefile
tests/icles/Makefile
ext/amrwbenc/Makefile
ext/assrender/Makefile
@@ -1830,7 +1820,6 @@ ext/faac/Makefile
ext/faad/Makefile
ext/flite/Makefile
ext/gsm/Makefile
-ext/jack/Makefile
ext/jp2k/Makefile
ext/kate/Makefile
ext/ladspa/Makefile
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index 6a151ffea..63719918f 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -99,8 +99,6 @@ EXTRA_HFILES = \
$(top_srcdir)/ext/dts/gstdtsdec.h \
$(top_srcdir)/ext/faac/gstfaac.h \
$(top_srcdir)/ext/faad/gstfaad.h \
- $(top_srcdir)/ext/jack/gstjackaudiosrc.h \
- $(top_srcdir)/ext/jack/gstjackaudiosink.h \
$(top_srcdir)/ext/kate/gstkateenc.h \
$(top_srcdir)/ext/kate/gstkatedec.h \
$(top_srcdir)/ext/kate/gstkateparse.h \
diff --git a/docs/plugins/gst-plugins-bad-plugins-docs.sgml b/docs/plugins/gst-plugins-bad-plugins-docs.sgml
index f4b545504..d102a0691 100644
--- a/docs/plugins/gst-plugins-bad-plugins-docs.sgml
+++ b/docs/plugins/gst-plugins-bad-plugins-docs.sgml
@@ -69,8 +69,6 @@
<xi:include href="xml/element-freeze.xml" />
<xi:include href="xml/element-gaussianblur.xml" />
<xi:include href="xml/element-ivfparse.xml" />
- <xi:include href="xml/element-jackaudiosrc.xml" />
- <xi:include href="xml/element-jackaudiosink.xml" />
<xi:include href="xml/element-jpegparse.xml" />
<xi:include href="xml/element-kaleidoscope.xml" />
<xi:include href="xml/element-kateenc.xml" />
@@ -169,7 +167,6 @@
<xi:include href="xml/plugin-gsm.xml" />
<xi:include href="xml/plugin-h264parse.xml" />
<xi:include href="xml/plugin-ivfparse.xml" />
- <xi:include href="xml/plugin-jack.xml" />
<xi:include href="xml/plugin-jpegformat.xml" />
<xi:include href="xml/plugin-kate.xml" />
<xi:include href="xml/plugin-ladspa.xml" />
diff --git a/docs/plugins/gst-plugins-bad-plugins-sections.txt b/docs/plugins/gst-plugins-bad-plugins-sections.txt
index 764f641af..fe5104ad5 100644
--- a/docs/plugins/gst-plugins-bad-plugins-sections.txt
+++ b/docs/plugins/gst-plugins-bad-plugins-sections.txt
@@ -807,36 +807,6 @@ gst_ivf_parse_get_type
</SECTION>
<SECTION>
-<FILE>element-jackaudiosrc</FILE>
-<TITLE>jackaudiosrc</TITLE>
-GstJackAudioSrc
-<SUBSECTION Standard>
-GstJackAudioSrcClass
-GST_JACK_AUDIO_SRC
-GST_JACK_AUDIO_SRC_CLASS
-GST_JACK_AUDIO_SRC_GET_CLASS
-GST_IS_JACK_AUDIO_SRC
-GST_IS_JACK_AUDIO_SRC_CLASS
-GST_TYPE_JACK_AUDIO_SRC
-gst_jack_audio_src_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-jackaudiosink</FILE>
-<TITLE>jackaudiosink</TITLE>
-GstJackAudioSink
-<SUBSECTION Standard>
-GstJackAudioSinkClass
-GST_JACK_AUDIO_SINK
-GST_JACK_AUDIO_SINK_CLASS
-GST_JACK_AUDIO_SINK_GET_CLASS
-GST_IS_JACK_AUDIO_SINK
-GST_IS_JACK_AUDIO_SINK_CLASS
-GST_TYPE_JACK_AUDIO_SINK
-gst_jack_audio_sink_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-jpegparse</FILE>
<TITLE>jpegparse</TITLE>
GstJpegParse
diff --git a/docs/plugins/gst-plugins-bad-plugins.args b/docs/plugins/gst-plugins-bad-plugins.args
index 9d4bdf5ca..8ca527f24 100644
--- a/docs/plugins/gst-plugins-bad-plugins.args
+++ b/docs/plugins/gst-plugins-bad-plugins.args
@@ -1539,36 +1539,6 @@
</ARG>
<ARG>
-<NAME>GstJackAudioSink::connect</NAME>
-<TYPE>GstJackConnect</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Connect</NICK>
-<BLURB>Specify how the output ports will be connected.</BLURB>
-<DEFAULT>Automatically connect ports to physical ports</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstJackAudioSink::server</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Server</NICK>
-<BLURB>The Jack server to connect to (NULL = default).</BLURB>
-<DEFAULT>NULL</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstJackAudioSink::client</NAME>
-<TYPE>JackClient*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>JackClient</NICK>
-<BLURB>Handle for jack client.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
<NAME>GstDvbSrc::bandwidth</NAME>
<TYPE>GstDvbSrcBandwidth</TYPE>
<RANGE></RANGE>
@@ -21954,36 +21924,6 @@
</ARG>
<ARG>
-<NAME>GstJackAudioSrc::connect</NAME>
-<TYPE>GstJackConnect</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Connect</NICK>
-<BLURB>Specify how the input ports will be connected.</BLURB>
-<DEFAULT>Automatically connect ports to physical ports</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstJackAudioSrc::server</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Server</NICK>
-<BLURB>The Jack server to connect to (NULL = default).</BLURB>
-<DEFAULT>NULL</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstJackAudioSrc::client</NAME>
-<TYPE>JackClient*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>JackClient</NICK>
-<BLURB>Handle for jack client.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
<NAME>GstDCCPClientSrc::caps</NAME>
<TYPE>GstCaps*</TYPE>
<RANGE></RANGE>
@@ -26530,7 +26470,7 @@
<FLAGS>rw</FLAGS>
<NICK>physics</NICK>
<BLURB>water density: from 1 to 4.</BLURB>
-<DEFAULT>7.75038e-304</DEFAULT>
+<DEFAULT>8.09774e-321</DEFAULT>
</ARG>
<ARG>
@@ -26570,7 +26510,7 @@
<FLAGS>rw</FLAGS>
<NICK>splash</NICK>
<BLURB>make a big splash in the center.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>2.34994e-310</DEFAULT>
</ARG>
<ARG>
@@ -26580,7 +26520,7 @@
<FLAGS>rw</FLAGS>
<NICK>splash</NICK>
<BLURB>make a big splash in the center.</BLURB>
-<DEFAULT>4.77773e-299</DEFAULT>
+<DEFAULT>1.82574e-315</DEFAULT>
</ARG>
<ARG>
@@ -26610,7 +26550,7 @@
<FLAGS>rw</FLAGS>
<NICK>ratiox</NICK>
<BLURB>x-ratio.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>1.47273e-316</DEFAULT>
</ARG>
<ARG>
@@ -26620,7 +26560,7 @@
<FLAGS>rw</FLAGS>
<NICK>ratioy</NICK>
<BLURB>y-ratio.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>1.85891e-316</DEFAULT>
</ARG>
<ARG>
@@ -26630,7 +26570,7 @@
<FLAGS>rw</FLAGS>
<NICK>DelayTime</NICK>
<BLURB>the delay time.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>2.18476e-316</DEFAULT>
</ARG>
<ARG>
@@ -26660,7 +26600,7 @@
<FLAGS>rw</FLAGS>
<NICK>Color</NICK>
<BLURB>the color of the image.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>1.39669e-37</DEFAULT>
</ARG>
<ARG>
@@ -26680,7 +26620,7 @@
<FLAGS>rw</FLAGS>
<NICK>Color-R</NICK>
<BLURB>the color of the image.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>7.30424e-38</DEFAULT>
</ARG>
<ARG>
@@ -27010,7 +26950,7 @@
<FLAGS>rw</FLAGS>
<NICK>lredscale</NICK>
<BLURB>multiplier for downscaling non-edge brightness.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>3.40216e-111</DEFAULT>
</ARG>
<ARG>
@@ -27020,7 +26960,7 @@
<FLAGS>rw</FLAGS>
<NICK>lthresh</NICK>
<BLURB>threshold for edge lightening.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>6.9235e+228</DEFAULT>
</ARG>
<ARG>
@@ -27030,7 +26970,7 @@
<FLAGS>rw</FLAGS>
<NICK>lupscale</NICK>
<BLURB>multiplier for upscaling edge brightness.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>7.54985e-96</DEFAULT>
</ARG>
<ARG>
@@ -27200,7 +27140,7 @@
<FLAGS>rw</FLAGS>
<NICK>blend</NICK>
<BLURB>blend factor.</BLURB>
-<DEFAULT>4.74303e-322</DEFAULT>
+<DEFAULT>4.77773e-299</DEFAULT>
</ARG>
<ARG>
@@ -27390,7 +27330,7 @@
<FLAGS>rw</FLAGS>
<NICK>HSync</NICK>
<BLURB>the hsync offset.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>1.86264e-09</DEFAULT>
</ARG>
<ARG>
diff --git a/docs/plugins/gst-plugins-bad-plugins.hierarchy b/docs/plugins/gst-plugins-bad-plugins.hierarchy
index 511a79e54..84322e7d5 100644
--- a/docs/plugins/gst-plugins-bad-plugins.hierarchy
+++ b/docs/plugins/gst-plugins-bad-plugins.hierarchy
@@ -31,7 +31,6 @@ GObject
GstApExSink
GstNasSink
GstSDLAudioSink
- GstJackAudioSink
GstChecksumSink
GstDCCPClientSink
GstDCCPServerSink
@@ -46,8 +45,6 @@ GObject
GstDTMFSrc
GstDataURISrc
GstPushSrc
- GstBaseAudioSrc
- GstJackAudioSrc
GstDCCPClientSrc
GstDCCPServerSrc
GstDc1394
@@ -490,8 +487,6 @@ GObject
GstRegistry
GstRingBuffer
GstAudioSinkRingBuffer
- GstJackAudioSinkRingBuffer
- GstJackAudioSrcRingBuffer
GstTask
GstTaskPool
GstSignalObject
diff --git a/docs/plugins/inspect/plugin-jack.xml b/docs/plugins/inspect/plugin-jack.xml
deleted file mode 100644
index baa370192..000000000
--- a/docs/plugins/inspect/plugin-jack.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<plugin>
- <name>jack</name>
- <description>Jack elements</description>
- <filename>../../ext/jack/.libs/libgstjack.so</filename>
- <basename>libgstjack.so</basename>
- <version>0.10.20.1</version>
- <license>LGPL</license>
- <source>gst-plugins-bad</source>
- <package>GStreamer Bad Plug-ins git</package>
- <origin>Unknown package origin</origin>
- <elements>
- <element>
- <name>jackaudiosink</name>
- <longname>Audio Sink (Jack)</longname>
- <class>Sink/Audio</class>
- <description>Output to Jack</description>
- <author>Wim Taymans &lt;wim@fluendo.com&gt;</author>
- <pads>
- <caps>
- <name>sink</name>
- <direction>sink</direction>
- <presence>always</presence>
- <details>audio/x-raw-float, endianness=(int){ 1234 }, width=(int)32, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
- </caps>
- </pads>
- </element>
- <element>
- <name>jackaudiosrc</name>
- <longname>Audio Source (Jack)</longname>
- <class>Source/Audio</class>
- <description>Input from Jack</description>
- <author>Tristan Matthews &lt;tristan@sat.qc.ca&gt;</author>
- <pads>
- <caps>
- <name>src</name>
- <direction>source</direction>
- <presence>always</presence>
- <details>audio/x-raw-float, endianness=(int){ 1234 }, width=(int)32, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
- </caps>
- </pads>
- </element>
- </elements>
-</plugin> \ No newline at end of file
diff --git a/ext/Makefile.am b/ext/Makefile.am
index a9a7c8b5f..9b670d4db 100644
--- a/ext/Makefile.am
+++ b/ext/Makefile.am
@@ -136,12 +136,6 @@ endif
HERMES_DIR=
# endif
-if USE_JACK
-JACK_DIR=jack
-else
-JACK_DIR=
-endif
-
if USE_JP2K
JP2K_DIR = jp2k
else
@@ -398,7 +392,6 @@ SUBDIRS=\
$(GSM_DIR) \
$(G729_DIR) \
$(HERMES_DIR) \
- $(JACK_DIR) \
$(JP2K_DIR) \
$(KATE_DIR) \
$(LADSPA_DIR) \
@@ -453,7 +446,6 @@ DIST_SUBDIRS = \
gsettings \
gsm \
ladspa \
- jack \
jp2k \
kate \
libmms \
diff --git a/ext/jack/.gitignore b/ext/jack/.gitignore
deleted file mode 100644
index 916f265c7..000000000
--- a/ext/jack/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.loT
diff --git a/ext/jack/Makefile.am b/ext/jack/Makefile.am
deleted file mode 100644
index ede70594b..000000000
--- a/ext/jack/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-
-plugin_LTLIBRARIES = libgstjack.la
-
-libgstjack_la_SOURCES = gstjackutil.c gstjack.c gstjackaudiosrc.c gstjackaudiosink.c gstjackaudioclient.c
-libgstjack_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(JACK_CFLAGS)
-libgstjack_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(JACK_LIBS)
-libgstjack_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstjack_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstjackutil.h gstjackaudiosrc.h gstjackaudiosink.h gstjackaudioclient.h gstjack.h gstjackringbuffer.h
-
-EXTRA_DIST = README
diff --git a/ext/jack/README b/ext/jack/README
deleted file mode 100644
index 2bb97beba..000000000
--- a/ext/jack/README
+++ /dev/null
@@ -1,4 +0,0 @@
-to be written, la dee da
-
-jackit.sf.net
-
diff --git a/ext/jack/gstjack.c b/ext/jack/gstjack.c
deleted file mode 100644
index 371a9e934..000000000
--- a/ext/jack/gstjack.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* GStreamer Jack plugins
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstjackaudiosrc.h"
-#include "gstjackaudiosink.h"
-
-GType
-gst_jack_connect_get_type (void)
-{
- static GType jack_connect_type = 0;
- static const GEnumValue jack_connect[] = {
- {GST_JACK_CONNECT_NONE,
- "Don't automatically connect ports to physical ports", "none"},
- {GST_JACK_CONNECT_AUTO,
- "Automatically connect ports to physical ports", "auto"},
- {GST_JACK_CONNECT_AUTO_FORCED,
- "Automatically connect ports to as many physical ports as possible",
- "auto-forced"},
- {0, NULL, NULL},
- };
-
- if (!jack_connect_type) {
- jack_connect_type = g_enum_register_static ("GstJackConnect", jack_connect);
- }
- return jack_connect_type;
-}
-
-
-static gpointer
-gst_jack_client_copy (gpointer jclient)
-{
- return jclient;
-}
-
-
-static void
-gst_jack_client_free (gpointer jclient)
-{
- return;
-}
-
-
-GType
-gst_jack_client_get_type (void)
-{
- static GType type; /* 0 */
-
- if (type == 0) {
- /* hackish, but makes it show up nicely in gst-inspect */
- type = g_boxed_type_register_static ("JackClient",
- (GBoxedCopyFunc) gst_jack_client_copy,
- (GBoxedFreeFunc) gst_jack_client_free);
- }
-
- return type;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "jackaudiosrc", GST_RANK_PRIMARY,
- GST_TYPE_JACK_AUDIO_SRC))
- return FALSE;
- if (!gst_element_register (plugin, "jackaudiosink", GST_RANK_PRIMARY,
- GST_TYPE_JACK_AUDIO_SINK))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "jack",
- "Jack elements",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/jack/gstjack.h b/ext/jack/gstjack.h
deleted file mode 100644
index d923866df..000000000
--- a/ext/jack/gstjack.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjack.h:
- *
- * 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_JACK_H_
-#define _GST_JACK_H_
-
-
-/**
- * GstJackConnect:
- * @GST_JACK_CONNECT_NONE: Don't automatically connect to physical ports.
- * In this mode, the element will accept any number of input channels and will
- * create (but not connect) an output port for each channel.
- * @GST_JACK_CONNECT_AUTO: In this mode, the element will try to connect each
- * output port to a random physical jack input pin. The sink will
- * expose the number of physical channels on its pad caps.
- * @GST_JACK_CONNECT_AUTO_FORCED: In this mode, the element will try to connect each
- * output port to a random physical jack input pin. The element will accept any number
- * of input channels.
- *
- * Specify how the output ports will be connected.
- */
-
-typedef enum {
- GST_JACK_CONNECT_NONE,
- GST_JACK_CONNECT_AUTO,
- GST_JACK_CONNECT_AUTO_FORCED
-} GstJackConnect;
-
-typedef jack_default_audio_sample_t sample_t;
-
-#define GST_TYPE_JACK_CONNECT (gst_jack_connect_get_type())
-#define GST_TYPE_JACK_CLIENT (gst_jack_client_get_type ())
-
-GType gst_jack_client_get_type(void);
-GType gst_jack_connect_get_type(void);
-
-#endif // _GST_JACK_H_
diff --git a/ext/jack/gstjackaudioclient.c b/ext/jack/gstjackaudioclient.c
deleted file mode 100644
index 1789edb60..000000000
--- a/ext/jack/gstjackaudioclient.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjackaudioclient.c: jack audio client implementation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-
-#include "gstjackaudioclient.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_jack_audio_client_debug);
-#define GST_CAT_DEFAULT gst_jack_audio_client_debug
-
-void
-gst_jack_audio_client_init (void)
-{
- GST_DEBUG_CATEGORY_INIT (gst_jack_audio_client_debug, "jackclient", 0,
- "jackclient helpers");
-}
-
-/* a list of global connections indexed by id and server. */
-G_LOCK_DEFINE_STATIC (connections_lock);
-static GList *connections;
-
-/* the connection to a server */
-typedef struct
-{
- gint refcount;
- GMutex *lock;
- GCond *flush_cond;
-
- /* id/server pair and the connection */
- gchar *id;
- gchar *server;
- jack_client_t *client;
-
- /* lists of GstJackAudioClients */
- gint n_clients;
- GList *src_clients;
- GList *sink_clients;
-} GstJackAudioConnection;
-
-/* an object sharing a jack_client_t connection. */
-struct _GstJackAudioClient
-{
- GstJackAudioConnection *conn;
-
- GstJackClientType type;
- gboolean active;
- gboolean deactivate;
-
- void (*shutdown) (void *arg);
- JackProcessCallback process;
- JackBufferSizeCallback buffer_size;
- JackSampleRateCallback sample_rate;
- gpointer user_data;
-};
-
-typedef jack_default_audio_sample_t sample_t;
-
-typedef struct
-{
- jack_nframes_t nframes;
- gpointer user_data;
-} JackCB;
-
-static int
-jack_process_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioConnection *conn = (GstJackAudioConnection *) arg;
- GList *walk;
- int res = 0;
-
- g_mutex_lock (conn->lock);
- /* call sources first, then sinks. Sources will either push data into the
- * ringbuffer of the sinks, which will then pull the data out of it, or
- * sinks will pull the data from the sources. */
- for (walk = conn->src_clients; walk; walk = g_list_next (walk)) {
- GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
-
- /* only call active clients */
- if ((client->active || client->deactivate) && client->process) {
- res = client->process (nframes, client->user_data);
- if (client->deactivate) {
- client->deactivate = FALSE;
- g_cond_signal (conn->flush_cond);
- }
- }
- }
- for (walk = conn->sink_clients; walk; walk = g_list_next (walk)) {
- GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
-
- /* only call active clients */
- if ((client->active || client->deactivate) && client->process) {
- res = client->process (nframes, client->user_data);
- if (client->deactivate) {
- client->deactivate = FALSE;
- g_cond_signal (conn->flush_cond);
- }
- }
- }
- g_mutex_unlock (conn->lock);
-
- return res;
-}
-
-/* we error out */
-static int
-jack_sample_rate_cb (jack_nframes_t nframes, void *arg)
-{
- return 0;
-}
-
-/* we error out */
-static int
-jack_buffer_size_cb (jack_nframes_t nframes, void *arg)
-{
- return 0;
-}
-
-static void
-jack_shutdown_cb (void *arg)
-{
- GstJackAudioConnection *conn = (GstJackAudioConnection *) arg;
- GList *walk;
-
- GST_DEBUG ("disconnect client %s from server %s", conn->id,
- GST_STR_NULL (conn->server));
-
- g_mutex_lock (conn->lock);
- for (walk = conn->src_clients; walk; walk = g_list_next (walk)) {
- GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
-
- if (client->shutdown)
- client->shutdown (client->user_data);
- }
- for (walk = conn->sink_clients; walk; walk = g_list_next (walk)) {
- GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
-
- if (client->shutdown)
- client->shutdown (client->user_data);
- }
- g_mutex_unlock (conn->lock);
-}
-
-typedef struct
-{
- const gchar *id;
- const gchar *server;
-} FindData;
-
-static gint
-connection_find (GstJackAudioConnection * conn, FindData * data)
-{
- /* id's must match */
- if (strcmp (conn->id, data->id))
- return 1;
-
- /* both the same or NULL */
- if (conn->server == data->server)
- return 0;
-
- /* we cannot compare NULL */
- if (conn->server == NULL || data->server == NULL)
- return 1;
-
- if (strcmp (conn->server, data->server))
- return 1;
-
- return 0;
-}
-
-/* make a connection with @id and @server. Returns NULL on failure with the
- * status set. */
-static GstJackAudioConnection *
-gst_jack_audio_make_connection (const gchar * id, const gchar * server,
- jack_client_t * jclient, jack_status_t * status)
-{
- GstJackAudioConnection *conn;
- jack_options_t options;
- gint res;
-
- *status = 0;
-
- GST_DEBUG ("new client %s, connecting to server %s", id,
- GST_STR_NULL (server));
-
- /* never start a server */
- options = JackNoStartServer;
- /* if we have a servername, use it */
- if (server != NULL)
- options |= JackServerName;
- /* open the client */
- if (jclient == NULL)
- jclient = jack_client_open (id, options, status, server);
- if (jclient == NULL)
- goto could_not_open;
-
- /* now create object */
- conn = g_new (GstJackAudioConnection, 1);
- conn->refcount = 1;
- conn->lock = g_mutex_new ();
- conn->flush_cond = g_cond_new ();
- conn->id = g_strdup (id);
- conn->server = g_strdup (server);
- conn->client = jclient;
- conn->n_clients = 0;
- conn->src_clients = NULL;
- conn->sink_clients = NULL;
-
- /* set our callbacks */
- jack_set_process_callback (jclient, jack_process_cb, conn);
- /* these callbacks cause us to error */
- jack_set_buffer_size_callback (jclient, jack_buffer_size_cb, conn);
- jack_set_sample_rate_callback (jclient, jack_sample_rate_cb, conn);
- jack_on_shutdown (jclient, jack_shutdown_cb, conn);
-
- /* all callbacks are set, activate the client */
- if ((res = jack_activate (jclient)))
- goto could_not_activate;
-
- GST_DEBUG ("opened connection %p", conn);
-
- return conn;
-
- /* ERRORS */
-could_not_open:
- {
- GST_DEBUG ("failed to open jack client, %d", *status);
- return NULL;
- }
-could_not_activate:
- {
- GST_ERROR ("Could not activate client (%d)", res);
- *status = JackFailure;
- g_mutex_free (conn->lock);
- g_free (conn->id);
- g_free (conn->server);
- g_free (conn);
- return NULL;
- }
-}
-
-static GstJackAudioConnection *
-gst_jack_audio_get_connection (const gchar * id, const gchar * server,
- jack_client_t * jclient, jack_status_t * status)
-{
- GstJackAudioConnection *conn;
- GList *found;
- FindData data;
-
- GST_DEBUG ("getting connection for id %s, server %s", id,
- GST_STR_NULL (server));
-
- data.id = id;
- data.server = server;
-
- G_LOCK (connections_lock);
- found =
- g_list_find_custom (connections, &data, (GCompareFunc) connection_find);
- if (found != NULL && jclient != NULL) {
- /* we found it, increase refcount and return it */
- conn = (GstJackAudioConnection *) found->data;
- conn->refcount++;
-
- GST_DEBUG ("found connection %p", conn);
- } else {
- /* make new connection */
- conn = gst_jack_audio_make_connection (id, server, jclient, status);
- if (conn != NULL) {
- GST_DEBUG ("created connection %p", conn);
- /* add to list on success */
- connections = g_list_prepend (connections, conn);
- } else {
- GST_WARNING ("could not create connection");
- }
- }
- G_UNLOCK (connections_lock);
-
- return conn;
-}
-
-static void
-gst_jack_audio_unref_connection (GstJackAudioConnection * conn)
-{
- gint res;
- gboolean zero;
-
- GST_DEBUG ("unref connection %p refcnt %d", conn, conn->refcount);
-
- G_LOCK (connections_lock);
- conn->refcount--;
- if ((zero = (conn->refcount == 0))) {
- GST_DEBUG ("closing connection %p", conn);
- /* remove from list, we can release the mutex after removing the connection
- * from the list because after that, nobody can access the connection anymore. */
- connections = g_list_remove (connections, conn);
- }
- G_UNLOCK (connections_lock);
-
- /* if we are zero, close and cleanup the connection */
- if (zero) {
- /* don't use conn->lock here. two reasons:
- *
- * 1) its not necessary: jack_deactivate() will not return until the JACK thread
- * associated with this connection is cleaned up by a thread join, hence
- * no more callbacks can occur or be in progress.
- *
- * 2) it would deadlock anyway, because jack_deactivate() will sleep
- * waiting for the JACK thread, and can thus cause deadlock in
- * jack_process_cb()
- */
- if ((res = jack_deactivate (conn->client))) {
- /* we only warn, this means the server is probably shut down and the client
- * is gone anyway. */
- GST_WARNING ("Could not deactivate Jack client (%d)", res);
- }
- /* close connection */
- if ((res = jack_client_close (conn->client))) {
- /* we assume the client is gone. */
- GST_WARNING ("close failed (%d)", res);
- }
-
- /* free resources */
- g_mutex_free (conn->lock);
- g_cond_free (conn->flush_cond);
- g_free (conn->id);
- g_free (conn->server);
- g_free (conn);
- }
-}
-
-static void
-gst_jack_audio_connection_add_client (GstJackAudioConnection * conn,
- GstJackAudioClient * client)
-{
- g_mutex_lock (conn->lock);
- switch (client->type) {
- case GST_JACK_CLIENT_SOURCE:
- conn->src_clients = g_list_append (conn->src_clients, client);
- conn->n_clients++;
- break;
- case GST_JACK_CLIENT_SINK:
- conn->sink_clients = g_list_append (conn->sink_clients, client);
- conn->n_clients++;
- break;
- default:
- g_warning ("trying to add unknown client type");
- break;
- }
- g_mutex_unlock (conn->lock);
-}
-
-static void
-gst_jack_audio_connection_remove_client (GstJackAudioConnection * conn,
- GstJackAudioClient * client)
-{
- g_mutex_lock (conn->lock);
- switch (client->type) {
- case GST_JACK_CLIENT_SOURCE:
- conn->src_clients = g_list_remove (conn->src_clients, client);
- conn->n_clients--;
- break;
- case GST_JACK_CLIENT_SINK:
- conn->sink_clients = g_list_remove (conn->sink_clients, client);
- conn->n_clients--;
- break;
- default:
- g_warning ("trying to remove unknown client type");
- break;
- }
- g_mutex_unlock (conn->lock);
-}
-
-/**
- * gst_jack_audio_client_get:
- * @id: the client id
- * @server: the server to connect to or NULL for the default server
- * @type: the client type
- * @shutdown: a callback when the jack server shuts down
- * @process: a callback when samples are available
- * @buffer_size: a callback when the buffer_size changes
- * @sample_rate: a callback when the sample_rate changes
- * @user_data: user data passed to the callbacks
- * @status: pointer to hold the jack status code in case of errors
- *
- * Get the jack client connection for @id and @server. Connections to the same
- * @id and @server will receive the same physical Jack client connection and
- * will therefore be scheduled in the same process callback.
- *
- * Returns: a #GstJackAudioClient.
- */
-GstJackAudioClient *
-gst_jack_audio_client_new (const gchar * id, const gchar * server,
- jack_client_t * jclient, GstJackClientType type,
- void (*shutdown) (void *arg), JackProcessCallback process,
- JackBufferSizeCallback buffer_size, JackSampleRateCallback sample_rate,
- gpointer user_data, jack_status_t * status)
-{
- GstJackAudioClient *client;
- GstJackAudioConnection *conn;
-
- g_return_val_if_fail (id != NULL, NULL);
- g_return_val_if_fail (status != NULL, NULL);
-
- /* first get a connection for the id/server pair */
- conn = gst_jack_audio_get_connection (id, server, jclient, status);
- if (conn == NULL)
- goto no_connection;
-
- GST_INFO ("new client %s", id);
-
- /* make new client using the connection */
- client = g_new (GstJackAudioClient, 1);
- client->active = client->deactivate = FALSE;
- client->conn = conn;
- client->type = type;
- client->shutdown = shutdown;
- client->process = process;
- client->buffer_size = buffer_size;
- client->sample_rate = sample_rate;
- client->user_data = user_data;
-
- /* add the client to the connection */
- gst_jack_audio_connection_add_client (conn, client);
-
- return client;
-
- /* ERRORS */
-no_connection:
- {
- GST_DEBUG ("Could not get server connection (%d)", *status);
- return NULL;
- }
-}
-
-/**
- * gst_jack_audio_client_free:
- * @client: a #GstJackAudioClient
- *
- * Free the resources used by @client.
- */
-void
-gst_jack_audio_client_free (GstJackAudioClient * client)
-{
- GstJackAudioConnection *conn;
-
- g_return_if_fail (client != NULL);
-
- GST_INFO ("free client");
-
- conn = client->conn;
-
- /* remove from connection first so that it's not scheduled anymore after this
- * call */
- gst_jack_audio_connection_remove_client (conn, client);
- gst_jack_audio_unref_connection (conn);
-
- g_free (client);
-}
-
-/**
- * gst_jack_audio_client_get_client:
- * @client: a #GstJackAudioClient
- *
- * Get the jack audio client for @client. This function is used to perform
- * operations on the jack server from this client.
- *
- * Returns: The jack audio client.
- */
-jack_client_t *
-gst_jack_audio_client_get_client (GstJackAudioClient * client)
-{
- g_return_val_if_fail (client != NULL, NULL);
-
- /* no lock needed, the connection and the client does not change
- * once the client is created. */
- return client->conn->client;
-}
-
-/**
- * gst_jack_audio_client_set_active:
- * @client: a #GstJackAudioClient
- * @active: new mode for the client
- *
- * Activate or deactive @client. When a client is activated it will receive
- * callbacks when data should be processed.
- *
- * Returns: 0 if all ok.
- */
-gint
-gst_jack_audio_client_set_active (GstJackAudioClient * client, gboolean active)
-{
- g_return_val_if_fail (client != NULL, -1);
-
- /* make sure that we are not dispatching the client */
- g_mutex_lock (client->conn->lock);
- if (client->active && !active) {
- /* we need to process once more to flush the port */
- client->deactivate = TRUE;
-
- /* need to wait for process_cb run once more */
- while (client->deactivate)
- g_cond_wait (client->conn->flush_cond, client->conn->lock);
- }
- client->active = active;
- g_mutex_unlock (client->conn->lock);
-
- return 0;
-}
diff --git a/ext/jack/gstjackaudioclient.h b/ext/jack/gstjackaudioclient.h
deleted file mode 100644
index 5fb7e3544..000000000
--- a/ext/jack/gstjackaudioclient.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjackaudioclient.h:
- *
- * 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_JACK_AUDIO_CLIENT_H__
-#define __GST_JACK_AUDIO_CLIENT_H__
-
-#include <jack/jack.h>
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-typedef enum
-{
- GST_JACK_CLIENT_SOURCE,
- GST_JACK_CLIENT_SINK
-} GstJackClientType;
-
-typedef struct _GstJackAudioClient GstJackAudioClient;
-
-void gst_jack_audio_client_init (void);
-
-
-GstJackAudioClient * gst_jack_audio_client_new (const gchar *id, const gchar *server,
- jack_client_t *jclient,
- GstJackClientType type,
- void (*shutdown) (void *arg),
- JackProcessCallback process,
- JackBufferSizeCallback buffer_size,
- JackSampleRateCallback sample_rate,
- gpointer user_data,
- jack_status_t *status);
-void gst_jack_audio_client_free (GstJackAudioClient *client);
-
-jack_client_t * gst_jack_audio_client_get_client (GstJackAudioClient *client);
-
-gboolean gst_jack_audio_client_set_active (GstJackAudioClient *client, gboolean active);
-
-G_END_DECLS
-
-#endif /* __GST_JACK_AUDIO_CLIENT_H__ */
diff --git a/ext/jack/gstjackaudiosink.c b/ext/jack/gstjackaudiosink.c
deleted file mode 100644
index 32bf1af3e..000000000
--- a/ext/jack/gstjackaudiosink.c
+++ /dev/null
@@ -1,852 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjackaudiosink.c: jack audio sink implementation
- *
- * 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-jackaudiosink
- * @see_also: #GstBaseAudioSink, #GstRingBuffer
- *
- * A Sink that outputs data to Jack ports.
- *
- * It will create N Jack ports named out_&lt;name&gt;_&lt;num&gt; where
- * &lt;name&gt; is the element name and &lt;num&gt; is starting from 1.
- * Each port corresponds to a gstreamer channel.
- *
- * The samplerate as exposed on the caps is always the same as the samplerate of
- * the jack server.
- *
- * When the #GstJackAudioSink:connect property is set to auto, this element
- * will try to connect each output port to a random physical jack input pin. In
- * this mode, the sink will expose the number of physical channels on its pad
- * caps.
- *
- * When the #GstJackAudioSink:connect property is set to none, the element will
- * accept any number of input channels and will create (but not connect) an
- * output port for each channel.
- *
- * The element will generate an error when the Jack server is shut down when it
- * was PAUSED or PLAYING. This element does not support dynamic rate and buffer
- * size changes at runtime.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch audiotestsrc ! jackaudiosink
- * ]| Play a sine wave to using jack.
- * </refsect2>
- *
- * Last reviewed on 2006-11-30 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gstjackaudiosink.h"
-#include "gstjackringbuffer.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_jack_audio_sink_debug);
-#define GST_CAT_DEFAULT gst_jack_audio_sink_debug
-
-static gboolean
-gst_jack_audio_sink_allocate_channels (GstJackAudioSink * sink, gint channels)
-{
- jack_client_t *client;
-
- client = gst_jack_audio_client_get_client (sink->client);
-
- /* remove ports we don't need */
- while (sink->port_count > channels) {
- jack_port_unregister (client, sink->ports[--sink->port_count]);
- }
-
- /* alloc enough output ports */
- sink->ports = g_realloc (sink->ports, sizeof (jack_port_t *) * channels);
-
- /* create an output port for each channel */
- while (sink->port_count < channels) {
- gchar *name;
-
- /* port names start from 1 and are local to the element */
- name =
- g_strdup_printf ("out_%s_%d", GST_ELEMENT_NAME (sink),
- sink->port_count + 1);
- sink->ports[sink->port_count] =
- jack_port_register (client, name, JACK_DEFAULT_AUDIO_TYPE,
- JackPortIsOutput, 0);
- if (sink->ports[sink->port_count] == NULL)
- return FALSE;
-
- sink->port_count++;
-
- g_free (name);
- }
- return TRUE;
-}
-
-static void
-gst_jack_audio_sink_free_channels (GstJackAudioSink * sink)
-{
- gint res, i = 0;
- jack_client_t *client;
-
- client = gst_jack_audio_client_get_client (sink->client);
-
- /* get rid of all ports */
- while (sink->port_count) {
- GST_LOG_OBJECT (sink, "unregister port %d", i);
- if ((res = jack_port_unregister (client, sink->ports[i++]))) {
- GST_DEBUG_OBJECT (sink, "unregister of port failed (%d)", res);
- }
- sink->port_count--;
- }
- g_free (sink->ports);
- sink->ports = NULL;
-}
-
-/* ringbuffer abstract base class */
-static GType
-gst_jack_ring_buffer_get_type (void)
-{
- static GType ringbuffer_type = 0;
-
- if (!ringbuffer_type) {
- static const GTypeInfo ringbuffer_info = {
- sizeof (GstJackRingBufferClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_jack_ring_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstJackRingBuffer),
- 0,
- (GInstanceInitFunc) gst_jack_ring_buffer_init,
- NULL
- };
-
- ringbuffer_type =
- g_type_register_static (GST_TYPE_RING_BUFFER,
- "GstJackAudioSinkRingBuffer", &ringbuffer_info, 0);
- }
- return ringbuffer_type;
-}
-
-static void
-gst_jack_ring_buffer_class_init (GstJackRingBufferClass * klass)
-{
- GObjectClass *gobject_class;
- GstObjectClass *gstobject_class;
- GstRingBufferClass *gstringbuffer_class;
-
- gobject_class = (GObjectClass *) klass;
- gstobject_class = (GstObjectClass *) klass;
- gstringbuffer_class = (GstRingBufferClass *) klass;
-
- ring_parent_class = g_type_class_peek_parent (klass);
-
- gstringbuffer_class->open_device =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_open_device);
- gstringbuffer_class->close_device =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_close_device);
- gstringbuffer_class->acquire =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_acquire);
- gstringbuffer_class->release =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_release);
- gstringbuffer_class->start = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_start);
- gstringbuffer_class->pause = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_pause);
- gstringbuffer_class->resume = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_start);
- gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_stop);
-
- gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_delay);
-}
-
-/* this is the callback of jack. This should RT-safe.
- */
-static int
-jack_process_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSink *sink;
- GstRingBuffer *buf;
- GstJackRingBuffer *abuf;
- gint readseg, len;
- guint8 *readptr;
- gint i, j, flen, channels;
- sample_t **buffers, *data;
-
- buf = GST_RING_BUFFER_CAST (arg);
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- channels = buf->spec.channels;
-
- /* alloc pointers to samples */
- buffers = g_alloca (sizeof (sample_t *) * channels);
-
- /* get target buffers */
- for (i = 0; i < channels; i++) {
- buffers[i] = (sample_t *) jack_port_get_buffer (sink->ports[i], nframes);
- }
-
- if (gst_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) {
- flen = len / channels;
-
- /* the number of samples must be exactly the segment size */
- if (nframes * sizeof (sample_t) != flen)
- goto wrong_size;
-
- GST_DEBUG_OBJECT (sink, "copy %d frames: %p, %d bytes, %d channels",
- nframes, readptr, flen, channels);
- data = (sample_t *) readptr;
-
- /* the samples in the ringbuffer have the channels interleaved, we need to
- * deinterleave into the jack target buffers */
- for (i = 0; i < nframes; i++) {
- for (j = 0; j < channels; j++) {
- buffers[j][i] = *data++;
- }
- }
-
- /* clear written samples in the ringbuffer */
- gst_ring_buffer_clear (buf, readseg);
-
- /* we wrote one segment */
- gst_ring_buffer_advance (buf, 1);
- } else {
- GST_DEBUG_OBJECT (sink, "write %d frames silence", nframes);
- /* We are not allowed to read from the ringbuffer, write silence to all
- * jack output buffers */
- for (i = 0; i < channels; i++) {
- memset (buffers[i], 0, nframes * sizeof (sample_t));
- }
- }
- return 0;
-
- /* ERRORS */
-wrong_size:
- {
- GST_ERROR_OBJECT (sink, "nbytes (%d) != flen (%d)",
- (gint) (nframes * sizeof (sample_t)), flen);
- return 1;
- }
-}
-
-/* we error out */
-static int
-jack_sample_rate_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSink *sink;
- GstJackRingBuffer *abuf;
-
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
-
- if (abuf->sample_rate != -1 && abuf->sample_rate != nframes)
- goto not_supported;
-
- return 0;
-
- /* ERRORS */
-not_supported:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (NULL), ("Jack changed the sample rate, which is not supported"));
- return 1;
- }
-}
-
-/* we error out */
-static int
-jack_buffer_size_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSink *sink;
- GstJackRingBuffer *abuf;
-
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
-
- if (abuf->buffer_size != -1 && abuf->buffer_size != nframes)
- goto not_supported;
-
- return 0;
-
- /* ERRORS */
-not_supported:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (NULL), ("Jack changed the buffer size, which is not supported"));
- return 1;
- }
-}
-
-static void
-jack_shutdown_cb (void *arg)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
-
- GST_DEBUG_OBJECT (sink, "shutdown");
-
- GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
- (NULL), ("Jack server shutdown"));
-}
-
-static void
-gst_jack_ring_buffer_init (GstJackRingBuffer * buf,
- GstJackRingBufferClass * g_class)
-{
- buf->channels = -1;
- buf->buffer_size = -1;
- buf->sample_rate = -1;
-}
-
-/* the _open_device method should make a connection with the server
- */
-static gboolean
-gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
- jack_status_t status = 0;
- const gchar *name;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "open");
-
- name = g_get_application_name ();
- if (!name)
- name = "GStreamer";
-
- sink->client = gst_jack_audio_client_new (name, sink->server,
- sink->jclient,
- GST_JACK_CLIENT_SINK,
- jack_shutdown_cb,
- jack_process_cb, jack_buffer_size_cb, jack_sample_rate_cb, buf, &status);
- if (sink->client == NULL)
- goto could_not_open;
-
- GST_DEBUG_OBJECT (sink, "opened");
-
- return TRUE;
-
- /* ERRORS */
-could_not_open:
- {
- if (status & JackServerFailed) {
- GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
- (_("Jack server not found")),
- ("Cannot connect to the Jack server (status %d)", status));
- } else {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (NULL), ("Jack client open error (status %d)", status));
- }
- return FALSE;
- }
-}
-
-/* close the connection with the server
- */
-static gboolean
-gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "close");
-
- gst_jack_audio_sink_free_channels (sink);
- gst_jack_audio_client_free (sink->client);
- sink->client = NULL;
-
- return TRUE;
-}
-
-/* allocate a buffer and setup resources to process the audio samples of
- * the format as specified in @spec.
- *
- * We allocate N jack ports, one for each channel. If we are asked to
- * automatically make a connection with physical ports, we connect as many
- * ports as there are physical ports, leaving leftover ports unconnected.
- *
- * It is assumed that samplerate and number of channels are acceptable since our
- * getcaps method will always provide correct values. If unacceptable caps are
- * received for some reason, we fail here.
- */
-static gboolean
-gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
-{
- GstJackAudioSink *sink;
- GstJackRingBuffer *abuf;
- const char **ports;
- gint sample_rate, buffer_size;
- gint i, channels, res;
- jack_client_t *client;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- abuf = GST_JACK_RING_BUFFER_CAST (buf);
-
- GST_DEBUG_OBJECT (sink, "acquire");
-
- client = gst_jack_audio_client_get_client (sink->client);
-
- /* sample rate must be that of the server */
- sample_rate = jack_get_sample_rate (client);
- if (sample_rate != spec->rate)
- goto wrong_samplerate;
-
- channels = spec->channels;
-
- if (!gst_jack_audio_sink_allocate_channels (sink, channels))
- goto out_of_ports;
-
- buffer_size = jack_get_buffer_size (client);
-
- /* the segment size in bytes, this is large enough to hold a buffer of 32bit floats
- * for all channels */
- spec->segsize = buffer_size * sizeof (gfloat) * channels;
- spec->latency_time = gst_util_uint64_scale (spec->segsize,
- (GST_SECOND / GST_USECOND), spec->rate * spec->bytes_per_sample);
- /* segtotal based on buffer-time latency */
- spec->segtotal = spec->buffer_time / spec->latency_time;
- if (spec->segtotal < 2) {
- spec->segtotal = 2;
- spec->buffer_time = spec->latency_time * spec->segtotal;
- }
-
- GST_DEBUG_OBJECT (sink, "buffer time: %" G_GINT64_FORMAT " usec",
- spec->buffer_time);
- GST_DEBUG_OBJECT (sink, "latency time: %" G_GINT64_FORMAT " usec",
- spec->latency_time);
- GST_DEBUG_OBJECT (sink, "buffer_size %d, segsize %d, segtotal %d",
- buffer_size, spec->segsize, spec->segtotal);
-
- /* allocate the ringbuffer memory now */
- buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
- memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
-
- if ((res = gst_jack_audio_client_set_active (sink->client, TRUE)))
- goto could_not_activate;
-
- /* if we need to automatically connect the ports, do so now. We must do this
- * after activating the client. */
- if (sink->connect == GST_JACK_CONNECT_AUTO
- || sink->connect == GST_JACK_CONNECT_AUTO_FORCED) {
- /* find all the physical input ports. A physical input port is a port
- * associated with a hardware device. Someone needs connect to a physical
- * port in order to hear something. */
- ports = jack_get_ports (client, NULL, NULL,
- JackPortIsPhysical | JackPortIsInput);
- if (ports == NULL) {
- /* no ports? fine then we don't do anything except for posting a warning
- * message. */
- GST_ELEMENT_WARNING (sink, RESOURCE, NOT_FOUND, (NULL),
- ("No physical input ports found, leaving ports unconnected"));
- goto done;
- }
-
- for (i = 0; i < channels; i++) {
- /* stop when all input ports are exhausted */
- if (ports[i] == NULL) {
- /* post a warning that we could not connect all ports */
- GST_ELEMENT_WARNING (sink, RESOURCE, NOT_FOUND, (NULL),
- ("No more physical ports, leaving some ports unconnected"));
- break;
- }
- GST_DEBUG_OBJECT (sink, "try connecting to %s",
- jack_port_name (sink->ports[i]));
- /* connect the port to a physical port */
- res = jack_connect (client, jack_port_name (sink->ports[i]), ports[i]);
- if (res != 0 && res != EEXIST)
- goto cannot_connect;
- }
- free (ports);
- }
-done:
-
- abuf->sample_rate = sample_rate;
- abuf->buffer_size = buffer_size;
- abuf->channels = spec->channels;
-
- return TRUE;
-
- /* ERRORS */
-wrong_samplerate:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Wrong samplerate, server is running at %d and we received %d",
- sample_rate, spec->rate));
- return FALSE;
- }
-out_of_ports:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Cannot allocate more Jack ports"));
- return FALSE;
- }
-could_not_activate:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Could not activate client (%d:%s)", res, g_strerror (res)));
- return FALSE;
- }
-cannot_connect:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Could not connect output ports to physical ports (%d:%s)",
- res, g_strerror (res)));
- free (ports);
- return FALSE;
- }
-}
-
-/* function is called with LOCK */
-static gboolean
-gst_jack_ring_buffer_release (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
- GstJackRingBuffer *abuf;
- gint res;
-
- abuf = GST_JACK_RING_BUFFER_CAST (buf);
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "release");
-
- if ((res = gst_jack_audio_client_set_active (sink->client, FALSE))) {
- /* we only warn, this means the server is probably shut down and the client
- * is gone anyway. */
- GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
- ("Could not deactivate Jack client (%d)", res));
- }
-
- abuf->channels = -1;
- abuf->buffer_size = -1;
- abuf->sample_rate = -1;
-
- /* free the buffer */
- gst_buffer_unref (buf->data);
- buf->data = NULL;
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_start (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "start");
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_pause (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "pause");
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_stop (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "stop");
-
- return TRUE;
-}
-
-static guint
-gst_jack_ring_buffer_delay (GstRingBuffer * buf)
-{
- GstJackAudioSink *sink;
- guint i, res = 0, latency;
- jack_client_t *client;
-
- sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- client = gst_jack_audio_client_get_client (sink->client);
-
- for (i = 0; i < sink->port_count; i++) {
- latency = jack_port_get_total_latency (client, sink->ports[i]);
- if (latency > res)
- res = latency;
- }
-
- GST_LOG_OBJECT (sink, "delay %u", res);
-
- return res;
-}
-
-static GstStaticPadTemplate jackaudiosink_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, "
- "width = (int) 32, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
- );
-
-/* AudioSink signals and args */
-enum
-{
- /* FILL ME */
- SIGNAL_LAST
-};
-
-#define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO
-#define DEFAULT_PROP_SERVER NULL
-
-enum
-{
- PROP_0,
- PROP_CONNECT,
- PROP_SERVER,
- PROP_CLIENT,
- PROP_LAST
-};
-
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_jack_audio_sink_debug, "jacksink", 0, "jacksink element");
-
-GST_BOILERPLATE_FULL (GstJackAudioSink, gst_jack_audio_sink, GstBaseAudioSink,
- GST_TYPE_BASE_AUDIO_SINK, _do_init);
-
-static void gst_jack_audio_sink_dispose (GObject * object);
-static void gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_jack_audio_sink_getcaps (GstBaseSink * bsink);
-static GstRingBuffer *gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink *
- sink);
-
-static void
-gst_jack_audio_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class, "Audio Sink (Jack)",
- "Sink/Audio", "Output to Jack", "Wim Taymans <wim@fluendo.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&jackaudiosink_sink_factory));
-}
-
-static void
-gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
- GstBaseAudioSinkClass *gstbaseaudiosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
-
- gobject_class->dispose = gst_jack_audio_sink_dispose;
- gobject_class->get_property = gst_jack_audio_sink_get_property;
- gobject_class->set_property = gst_jack_audio_sink_set_property;
-
- g_object_class_install_property (gobject_class, PROP_CONNECT,
- g_param_spec_enum ("connect", "Connect",
- "Specify how the output ports will be connected",
- GST_TYPE_JACK_CONNECT, DEFAULT_PROP_CONNECT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SERVER,
- g_param_spec_string ("server", "Server",
- "The Jack server to connect to (NULL = default)",
- DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLIENT,
- g_param_spec_boxed ("client", "JackClient", "Handle for jack client",
- GST_TYPE_JACK_CLIENT,
- GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_sink_getcaps);
-
- gstbaseaudiosink_class->create_ringbuffer =
- GST_DEBUG_FUNCPTR (gst_jack_audio_sink_create_ringbuffer);
-
- /* ref class from a thread-safe context to work around missing bit of
- * thread-safety in GObject */
- g_type_class_ref (GST_TYPE_JACK_RING_BUFFER);
-
- gst_jack_audio_client_init ();
-}
-
-static void
-gst_jack_audio_sink_init (GstJackAudioSink * sink,
- GstJackAudioSinkClass * g_class)
-{
- sink->connect = DEFAULT_PROP_CONNECT;
- sink->server = g_strdup (DEFAULT_PROP_SERVER);
- sink->jclient = NULL;
- sink->ports = NULL;
- sink->port_count = 0;
-}
-
-static void
-gst_jack_audio_sink_dispose (GObject * object)
-{
- GstJackAudioSink *sink = GST_JACK_AUDIO_SINK (object);
-
- gst_caps_replace (&sink->caps, NULL);
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (object);
-
- switch (prop_id) {
- case PROP_CONNECT:
- sink->connect = g_value_get_enum (value);
- break;
- case PROP_SERVER:
- g_free (sink->server);
- sink->server = g_value_dup_string (value);
- break;
- case PROP_CLIENT:
- if (GST_STATE (sink) == GST_STATE_NULL ||
- GST_STATE (sink) == GST_STATE_READY) {
- sink->jclient = g_value_get_boxed (value);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstJackAudioSink *sink;
-
- sink = GST_JACK_AUDIO_SINK (object);
-
- switch (prop_id) {
- case PROP_CONNECT:
- g_value_set_enum (value, sink->connect);
- break;
- case PROP_SERVER:
- g_value_set_string (value, sink->server);
- break;
- case PROP_CLIENT:
- g_value_set_boxed (value, sink->jclient);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstCaps *
-gst_jack_audio_sink_getcaps (GstBaseSink * bsink)
-{
- GstJackAudioSink *sink = GST_JACK_AUDIO_SINK (bsink);
- const char **ports;
- gint min, max;
- gint rate;
- jack_client_t *client;
-
- if (sink->client == NULL)
- goto no_client;
-
- client = gst_jack_audio_client_get_client (sink->client);
-
- if (sink->connect == GST_JACK_CONNECT_AUTO) {
- /* get a port count, this is the number of channels we can automatically
- * connect. */
- ports = jack_get_ports (client, NULL, NULL,
- JackPortIsPhysical | JackPortIsInput);
- max = 0;
- if (ports != NULL) {
- for (; ports[max]; max++);
- free (ports);
- } else
- max = 0;
- } else {
- /* we allow any number of pads, something else is going to connect the
- * pads. */
- max = G_MAXINT;
- }
- min = MIN (1, max);
-
- rate = jack_get_sample_rate (client);
-
- GST_DEBUG_OBJECT (sink, "got %d-%d ports, samplerate: %d", min, max, rate);
-
- if (!sink->caps) {
- sink->caps = gst_caps_new_simple ("audio/x-raw-float",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, 32,
- "rate", G_TYPE_INT, rate,
- "channels", GST_TYPE_INT_RANGE, min, max, NULL);
- }
- GST_INFO_OBJECT (sink, "returning caps %" GST_PTR_FORMAT, sink->caps);
-
- return gst_caps_ref (sink->caps);
-
- /* ERRORS */
-no_client:
- {
- GST_DEBUG_OBJECT (sink, "device not open, using template caps");
- /* base class will get template caps for us when we return NULL */
- return NULL;
- }
-}
-
-static GstRingBuffer *
-gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
-{
- GstRingBuffer *buffer;
-
- buffer = g_object_new (GST_TYPE_JACK_RING_BUFFER, NULL);
- GST_DEBUG_OBJECT (sink, "created ringbuffer @%p", buffer);
-
- return buffer;
-}
diff --git a/ext/jack/gstjackaudiosink.h b/ext/jack/gstjackaudiosink.h
deleted file mode 100644
index def423329..000000000
--- a/ext/jack/gstjackaudiosink.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstjacksink.h:
- *
- * 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_JACK_AUDIO_SINK_H__
-#define __GST_JACK_AUDIO_SINK_H__
-
-#include <jack/jack.h>
-
-#include <gst/gst.h>
-#include <gst/audio/gstbaseaudiosink.h>
-
-#include "gstjack.h"
-#include "gstjackaudioclient.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_JACK_AUDIO_SINK (gst_jack_audio_sink_get_type())
-#define GST_JACK_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JACK_AUDIO_SINK,GstJackAudioSink))
-#define GST_JACK_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JACK_AUDIO_SINK,GstJackAudioSinkClass))
-#define GST_JACK_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_JACK_AUDIO_SINK,GstJackAudioSinkClass))
-#define GST_IS_JACK_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JACK_AUDIO_SINK))
-#define GST_IS_JACK_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JACK_AUDIO_SINK))
-
-typedef struct _GstJackAudioSink GstJackAudioSink;
-typedef struct _GstJackAudioSinkClass GstJackAudioSinkClass;
-
-/**
- * GstJackAudioSink:
- *
- * Opaque #GstJackAudioSink.
- */
-struct _GstJackAudioSink {
- GstBaseAudioSink element;
-
- /*< private >*/
- /* cached caps */
- GstCaps *caps;
-
- /* properties */
- GstJackConnect connect;
- gchar *server;
- jack_client_t *jclient;
-
- /* our client */
- GstJackAudioClient *client;
-
- /* our ports */
- jack_port_t **ports;
- int port_count;
-};
-
-struct _GstJackAudioSinkClass {
- GstBaseAudioSinkClass parent_class;
-};
-
-GType gst_jack_audio_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_JACK_AUDIO_SINK_H__ */
diff --git a/ext/jack/gstjackaudiosrc.c b/ext/jack/gstjackaudiosrc.c
deleted file mode 100644
index 0ffdb2398..000000000
--- a/ext/jack/gstjackaudiosrc.c
+++ /dev/null
@@ -1,874 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 Tristan Matthews <tristan@sat.qc.ca>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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-jackaudiosrc
- * @see_also: #GstBaseAudioSrc, #GstRingBuffer
- *
- * A Src that inputs data from Jack ports.
- *
- * It will create N Jack ports named in_&lt;name&gt;_&lt;num&gt; where
- * &lt;name&gt; is the element name and &lt;num&gt; is starting from 1.
- * Each port corresponds to a gstreamer channel.
- *
- * The samplerate as exposed on the caps is always the same as the samplerate of
- * the jack server.
- *
- * When the #GstJackAudioSrc:connect property is set to auto, this element
- * will try to connect each input port to a random physical jack output pin.
- *
- * When the #GstJackAudioSrc:connect property is set to none, the element will
- * accept any number of output channels and will create (but not connect) an
- * input port for each channel.
- *
- * The element will generate an error when the Jack server is shut down when it
- * was PAUSED or PLAYING. This element does not support dynamic rate and buffer
- * size changes at runtime.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch jackaudiosrc connect=0 ! jackaudiosink connect=0
- * ]| Get audio input into gstreamer from jack.
- * </refsect2>
- *
- * Last reviewed on 2008-07-22 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gstjackaudiosrc.h"
-#include "gstjackringbuffer.h"
-#include "gstjackutil.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_jack_audio_src_debug);
-#define GST_CAT_DEFAULT gst_jack_audio_src_debug
-
-static gboolean
-gst_jack_audio_src_allocate_channels (GstJackAudioSrc * src, gint channels)
-{
- jack_client_t *client;
-
- client = gst_jack_audio_client_get_client (src->client);
-
- /* remove ports we don't need */
- while (src->port_count > channels)
- jack_port_unregister (client, src->ports[--src->port_count]);
-
- /* alloc enough input ports */
- src->ports = g_realloc (src->ports, sizeof (jack_port_t *) * channels);
- src->buffers = g_realloc (src->buffers, sizeof (sample_t *) * channels);
-
- /* create an input port for each channel */
- while (src->port_count < channels) {
- gchar *name;
-
- /* port names start from 1 and are local to the element */
- name =
- g_strdup_printf ("in_%s_%d", GST_ELEMENT_NAME (src),
- src->port_count + 1);
- src->ports[src->port_count] =
- jack_port_register (client, name, JACK_DEFAULT_AUDIO_TYPE,
- JackPortIsInput, 0);
- if (src->ports[src->port_count] == NULL)
- return FALSE;
-
- src->port_count++;
-
- g_free (name);
- }
- return TRUE;
-}
-
-static void
-gst_jack_audio_src_free_channels (GstJackAudioSrc * src)
-{
- gint res, i = 0;
- jack_client_t *client;
-
- client = gst_jack_audio_client_get_client (src->client);
-
- /* get rid of all ports */
- while (src->port_count) {
- GST_LOG_OBJECT (src, "unregister port %d", i);
- if ((res = jack_port_unregister (client, src->ports[i++])))
- GST_DEBUG_OBJECT (src, "unregister of port failed (%d)", res);
-
- src->port_count--;
- }
- g_free (src->ports);
- src->ports = NULL;
- g_free (src->buffers);
- src->buffers = NULL;
-}
-
-/* ringbuffer abstract base class */
-static GType
-gst_jack_ring_buffer_get_type (void)
-{
- static GType ringbuffer_type = 0;
-
- if (!ringbuffer_type) {
- static const GTypeInfo ringbuffer_info = { sizeof (GstJackRingBufferClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_jack_ring_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstJackRingBuffer),
- 0,
- (GInstanceInitFunc) gst_jack_ring_buffer_init,
- NULL
- };
-
- ringbuffer_type =
- g_type_register_static (GST_TYPE_RING_BUFFER,
- "GstJackAudioSrcRingBuffer", &ringbuffer_info, 0);
- }
- return ringbuffer_type;
-}
-
-static void
-gst_jack_ring_buffer_class_init (GstJackRingBufferClass * klass)
-{
- GObjectClass *gobject_class;
- GstObjectClass *gstobject_class;
- GstRingBufferClass *gstringbuffer_class;
-
- gobject_class = (GObjectClass *) klass;
- gstobject_class = (GstObjectClass *) klass;
- gstringbuffer_class = (GstRingBufferClass *) klass;
-
- ring_parent_class = g_type_class_peek_parent (klass);
-
- gstringbuffer_class->open_device =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_open_device);
- gstringbuffer_class->close_device =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_close_device);
- gstringbuffer_class->acquire =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_acquire);
- gstringbuffer_class->release =
- GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_release);
- gstringbuffer_class->start = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_start);
- gstringbuffer_class->pause = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_pause);
- gstringbuffer_class->resume = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_start);
- gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_stop);
-
- gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_delay);
-}
-
-/* this is the callback of jack. This should be RT-safe.
- * Writes samples from the jack input port's buffer to the gst ring buffer.
- */
-static int
-jack_process_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSrc *src;
- GstRingBuffer *buf;
- gint len;
- guint8 *writeptr;
- gint writeseg;
- gint channels, i, j, flen;
- sample_t *data;
-
- buf = GST_RING_BUFFER_CAST (arg);
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- channels = buf->spec.channels;
-
- /* get input buffers */
- for (i = 0; i < channels; i++)
- src->buffers[i] =
- (sample_t *) jack_port_get_buffer (src->ports[i], nframes);
-
- if (gst_ring_buffer_prepare_read (buf, &writeseg, &writeptr, &len)) {
- flen = len / channels;
-
- /* the number of samples must be exactly the segment size */
- if (nframes * sizeof (sample_t) != flen)
- goto wrong_size;
-
- /* the samples in the jack input buffers have to be interleaved into the
- * ringbuffer */
- data = (sample_t *) writeptr;
- for (i = 0; i < nframes; ++i)
- for (j = 0; j < channels; ++j)
- *data++ = src->buffers[j][i];
-
- GST_DEBUG ("copy %d frames: %p, %d bytes, %d channels", nframes, writeptr,
- len / channels, channels);
-
- /* we wrote one segment */
- gst_ring_buffer_advance (buf, 1);
- }
- return 0;
-
- /* ERRORS */
-wrong_size:
- {
- GST_ERROR_OBJECT (src, "nbytes (%d) != flen (%d)",
- (gint) (nframes * sizeof (sample_t)), flen);
- return 1;
- }
-}
-
-/* we error out */
-static int
-jack_sample_rate_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSrc *src;
- GstJackRingBuffer *abuf;
-
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (arg));
-
- if (abuf->sample_rate != -1 && abuf->sample_rate != nframes)
- goto not_supported;
-
- return 0;
-
- /* ERRORS */
-not_supported:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS,
- (NULL), ("Jack changed the sample rate, which is not supported"));
- return 1;
- }
-}
-
-/* we error out */
-static int
-jack_buffer_size_cb (jack_nframes_t nframes, void *arg)
-{
- GstJackAudioSrc *src;
- GstJackRingBuffer *abuf;
-
- abuf = GST_JACK_RING_BUFFER_CAST (arg);
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (arg));
-
- if (abuf->buffer_size != -1 && abuf->buffer_size != nframes)
- goto not_supported;
-
- return 0;
-
- /* ERRORS */
-not_supported:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS,
- (NULL), ("Jack changed the buffer size, which is not supported"));
- return 1;
- }
-}
-
-static void
-jack_shutdown_cb (void *arg)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (arg));
-
- GST_DEBUG_OBJECT (src, "shutdown");
-
- GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
- (NULL), ("Jack server shutdown"));
-}
-
-static void
-gst_jack_ring_buffer_init (GstJackRingBuffer * buf,
- GstJackRingBufferClass * g_class)
-{
- buf->channels = -1;
- buf->buffer_size = -1;
- buf->sample_rate = -1;
-}
-
-/* the _open_device method should make a connection with the server
-*/
-static gboolean
-gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
- jack_status_t status = 0;
- const gchar *name;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "open");
-
- name = g_get_application_name ();
- if (!name)
- name = "GStreamer";
-
- src->client = gst_jack_audio_client_new (name, src->server,
- src->jclient,
- GST_JACK_CLIENT_SOURCE,
- jack_shutdown_cb,
- jack_process_cb, jack_buffer_size_cb, jack_sample_rate_cb, buf, &status);
- if (src->client == NULL)
- goto could_not_open;
-
- GST_DEBUG_OBJECT (src, "opened");
-
- return TRUE;
-
- /* ERRORS */
-could_not_open:
- {
- if (status & JackServerFailed) {
- GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
- (_("Jack server not found")),
- ("Cannot connect to the Jack server (status %d)", status));
- } else {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_WRITE,
- (NULL), ("Jack client open error (status %d)", status));
- }
- return FALSE;
- }
-}
-
-/* close the connection with the server
-*/
-static gboolean
-gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "close");
-
- gst_jack_audio_src_free_channels (src);
- gst_jack_audio_client_free (src->client);
- src->client = NULL;
-
- return TRUE;
-}
-
-
-/* allocate a buffer and setup resources to process the audio samples of
- * the format as specified in @spec.
- *
- * We allocate N jack ports, one for each channel. If we are asked to
- * automatically make a connection with physical ports, we connect as many
- * ports as there are physical ports, leaving leftover ports unconnected.
- *
- * It is assumed that samplerate and number of channels are acceptable since our
- * getcaps method will always provide correct values. If unacceptable caps are
- * received for some reason, we fail here.
- */
-static gboolean
-gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
-{
- GstJackAudioSrc *src;
- GstJackRingBuffer *abuf;
- const char **ports;
- gint sample_rate, buffer_size;
- gint i, channels, res;
- jack_client_t *client;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- abuf = GST_JACK_RING_BUFFER_CAST (buf);
-
- GST_DEBUG_OBJECT (src, "acquire");
-
- client = gst_jack_audio_client_get_client (src->client);
-
- /* sample rate must be that of the server */
- sample_rate = jack_get_sample_rate (client);
- if (sample_rate != spec->rate)
- goto wrong_samplerate;
-
- channels = spec->channels;
-
- if (!gst_jack_audio_src_allocate_channels (src, channels))
- goto out_of_ports;
-
- gst_jack_set_layout_on_caps (&spec->caps, channels);
-
- buffer_size = jack_get_buffer_size (client);
-
- /* the segment size in bytes, this is large enough to hold a buffer of 32bit floats
- * for all channels */
- spec->segsize = buffer_size * sizeof (gfloat) * channels;
- spec->latency_time = gst_util_uint64_scale (spec->segsize,
- (GST_SECOND / GST_USECOND), spec->rate * spec->bytes_per_sample);
- /* segtotal based on buffer-time latency */
- spec->segtotal = spec->buffer_time / spec->latency_time;
- if (spec->segtotal < 2) {
- spec->segtotal = 2;
- spec->buffer_time = spec->latency_time * spec->segtotal;
- }
-
- GST_DEBUG_OBJECT (src, "buffer time: %" G_GINT64_FORMAT " usec",
- spec->buffer_time);
- GST_DEBUG_OBJECT (src, "latency time: %" G_GINT64_FORMAT " usec",
- spec->latency_time);
- GST_DEBUG_OBJECT (src, "buffer_size %d, segsize %d, segtotal %d",
- buffer_size, spec->segsize, spec->segtotal);
-
- /* allocate the ringbuffer memory now */
- buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
- memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
-
- if ((res = gst_jack_audio_client_set_active (src->client, TRUE)))
- goto could_not_activate;
-
- /* if we need to automatically connect the ports, do so now. We must do this
- * after activating the client. */
- if (src->connect == GST_JACK_CONNECT_AUTO
- || src->connect == GST_JACK_CONNECT_AUTO_FORCED) {
- /* find all the physical output ports. A physical output port is a port
- * associated with a hardware device. Someone needs connect to a physical
- * port in order to capture something. */
- ports =
- jack_get_ports (client, NULL, NULL,
- JackPortIsPhysical | JackPortIsOutput);
- if (ports == NULL) {
- /* no ports? fine then we don't do anything except for posting a warning
- * message. */
- GST_ELEMENT_WARNING (src, RESOURCE, NOT_FOUND, (NULL),
- ("No physical output ports found, leaving ports unconnected"));
- goto done;
- }
-
- for (i = 0; i < channels; i++) {
- /* stop when all output ports are exhausted */
- if (ports[i] == NULL) {
- /* post a warning that we could not connect all ports */
- GST_ELEMENT_WARNING (src, RESOURCE, NOT_FOUND, (NULL),
- ("No more physical ports, leaving some ports unconnected"));
- break;
- }
- GST_DEBUG_OBJECT (src, "try connecting to %s",
- jack_port_name (src->ports[i]));
-
- /* connect the physical port to a port */
- res = jack_connect (client, ports[i], jack_port_name (src->ports[i]));
- if (res != 0 && res != EEXIST)
- goto cannot_connect;
- }
- free (ports);
- }
-done:
-
- abuf->sample_rate = sample_rate;
- abuf->buffer_size = buffer_size;
- abuf->channels = spec->channels;
-
- return TRUE;
-
- /* ERRORS */
-wrong_samplerate:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Wrong samplerate, server is running at %d and we received %d",
- sample_rate, spec->rate));
- return FALSE;
- }
-out_of_ports:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Cannot allocate more Jack ports"));
- return FALSE;
- }
-could_not_activate:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Could not activate client (%d:%s)", res, g_strerror (res)));
- return FALSE;
- }
-cannot_connect:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Could not connect input ports to physical ports (%d:%s)",
- res, g_strerror (res)));
- free (ports);
- return FALSE;
- }
-}
-
-/* function is called with LOCK */
-static gboolean
-gst_jack_ring_buffer_release (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
- GstJackRingBuffer *abuf;
- gint res;
-
- abuf = GST_JACK_RING_BUFFER_CAST (buf);
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "release");
-
- if ((res = gst_jack_audio_client_set_active (src->client, FALSE))) {
- /* we only warn, this means the server is probably shut down and the client
- * is gone anyway. */
- GST_ELEMENT_WARNING (src, RESOURCE, CLOSE, (NULL),
- ("Could not deactivate Jack client (%d)", res));
- }
-
- abuf->channels = -1;
- abuf->buffer_size = -1;
- abuf->sample_rate = -1;
-
- /* free the buffer */
- gst_buffer_unref (buf->data);
- buf->data = NULL;
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_start (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "start");
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_pause (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "pause");
-
- return TRUE;
-}
-
-static gboolean
-gst_jack_ring_buffer_stop (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (src, "stop");
-
- return TRUE;
-}
-
-static guint
-gst_jack_ring_buffer_delay (GstRingBuffer * buf)
-{
- GstJackAudioSrc *src;
- guint i, res = 0, latency;
- jack_client_t *client;
-
- src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- client = gst_jack_audio_client_get_client (src->client);
-
- for (i = 0; i < src->port_count; i++) {
- latency = jack_port_get_total_latency (client, src->ports[i]);
- if (latency > res)
- res = latency;
- }
-
- GST_DEBUG_OBJECT (src, "delay %u", res);
-
- return res;
-}
-
-/* Audiosrc signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-#define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO
-#define DEFAULT_PROP_SERVER NULL
-
-enum
-{
- PROP_0,
- PROP_CONNECT,
- PROP_SERVER,
- PROP_CLIENT,
- PROP_LAST
-};
-
-
-/* the capabilities of the inputs and outputs.
- *
- * describe the real formats here.
- */
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, "
- "width = (int) 32, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
- );
-
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT(gst_jack_audio_src_debug, "jacksrc", 0, "jacksrc element");
-
-GST_BOILERPLATE_FULL (GstJackAudioSrc, gst_jack_audio_src, GstBaseAudioSrc,
- GST_TYPE_BASE_AUDIO_SRC, _do_init);
-
-static void gst_jack_audio_src_dispose (GObject * object);
-static void gst_jack_audio_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_jack_audio_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_jack_audio_src_getcaps (GstBaseSrc * bsrc);
-static GstRingBuffer *gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc *
- src);
-
-/* GObject vmethod implementations */
-
-static void
-gst_jack_audio_src_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
- gst_element_class_set_details_simple (element_class, "Audio Source (Jack)",
- "Source/Audio",
- "Input from Jack", "Tristan Matthews <tristan@sat.qc.ca>");
-}
-
-/* initialize the jack_audio_src's class */
-static void
-gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSrcClass *gstbasesrc_class;
- GstBaseAudioSrcClass *gstbaseaudiosrc_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- gstbasesrc_class = (GstBaseSrcClass *) klass;
- gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
-
- gobject_class->dispose = gst_jack_audio_src_dispose;
- gobject_class->set_property = gst_jack_audio_src_set_property;
- gobject_class->get_property = gst_jack_audio_src_get_property;
-
- g_object_class_install_property (gobject_class, PROP_CONNECT,
- g_param_spec_enum ("connect", "Connect",
- "Specify how the input ports will be connected",
- GST_TYPE_JACK_CONNECT, DEFAULT_PROP_CONNECT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SERVER,
- g_param_spec_string ("server", "Server",
- "The Jack server to connect to (NULL = default)",
- DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLIENT,
- g_param_spec_boxed ("client", "JackClient", "Handle for jack client",
- GST_TYPE_JACK_CLIENT,
- GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_src_getcaps);
- gstbaseaudiosrc_class->create_ringbuffer =
- GST_DEBUG_FUNCPTR (gst_jack_audio_src_create_ringbuffer);
-
- /* ref class from a thread-safe context to work around missing bit of
- * thread-safety in GObject */
- g_type_class_ref (GST_TYPE_JACK_RING_BUFFER);
-
- gst_jack_audio_client_init ();
-}
-
-/* initialize the new element
- * instantiate pads and add them to element
- * set pad calback functions
- * initialize instance structure
- */
-static void
-gst_jack_audio_src_init (GstJackAudioSrc * src, GstJackAudioSrcClass * gclass)
-{
- //gst_base_src_set_live(GST_BASE_SRC (src), TRUE);
- src->connect = DEFAULT_PROP_CONNECT;
- src->server = g_strdup (DEFAULT_PROP_SERVER);
- src->jclient = NULL;
- src->ports = NULL;
- src->port_count = 0;
- src->buffers = NULL;
-}
-
-static void
-gst_jack_audio_src_dispose (GObject * object)
-{
- GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
-
- gst_caps_replace (&src->caps, NULL);
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_jack_audio_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
-
- switch (prop_id) {
- case PROP_CONNECT:
- src->connect = g_value_get_enum (value);
- break;
- case PROP_SERVER:
- g_free (src->server);
- src->server = g_value_dup_string (value);
- break;
- case PROP_CLIENT:
- if (GST_STATE (src) == GST_STATE_NULL ||
- GST_STATE (src) == GST_STATE_READY) {
- src->jclient = g_value_get_boxed (value);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_jack_audio_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
-
- switch (prop_id) {
- case PROP_CONNECT:
- g_value_set_enum (value, src->connect);
- break;
- case PROP_SERVER:
- g_value_set_string (value, src->server);
- break;
- case PROP_CLIENT:
- g_value_set_boxed (value, src->jclient);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstCaps *
-gst_jack_audio_src_getcaps (GstBaseSrc * bsrc)
-{
- GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (bsrc);
- const char **ports;
- gint min, max;
- gint rate;
- jack_client_t *client;
-
- if (src->client == NULL)
- goto no_client;
-
- client = gst_jack_audio_client_get_client (src->client);
-
- if (src->connect == GST_JACK_CONNECT_AUTO) {
- /* get a port count, this is the number of channels we can automatically
- * connect. */
- ports = jack_get_ports (client, NULL, NULL,
- JackPortIsPhysical | JackPortIsOutput);
- max = 0;
- if (ports != NULL) {
- for (; ports[max]; max++);
-
- free (ports);
- } else
- max = 0;
- } else {
- /* we allow any number of pads, something else is going to connect the
- * pads. */
- max = G_MAXINT;
- }
- min = MIN (1, max);
-
- rate = jack_get_sample_rate (client);
-
- GST_DEBUG_OBJECT (src, "got %d-%d ports, samplerate: %d", min, max, rate);
-
- if (!src->caps) {
- src->caps = gst_caps_new_simple ("audio/x-raw-float",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, 32,
- "rate", G_TYPE_INT, rate,
- "channels", GST_TYPE_INT_RANGE, min, max, NULL);
- }
- GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, src->caps);
-
- return gst_caps_ref (src->caps);
-
- /* ERRORS */
-no_client:
- {
- GST_DEBUG_OBJECT (src, "device not open, using template caps");
- /* base class will get template caps for us when we return NULL */
- return NULL;
- }
-}
-
-static GstRingBuffer *
-gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc * src)
-{
- GstRingBuffer *buffer;
-
- buffer = g_object_new (GST_TYPE_JACK_RING_BUFFER, NULL);
- GST_DEBUG_OBJECT (src, "created ringbuffer @%p", buffer);
-
- return buffer;
-}
diff --git a/ext/jack/gstjackaudiosrc.h b/ext/jack/gstjackaudiosrc.h
deleted file mode 100644
index 7e99b69df..000000000
--- a/ext/jack/gstjackaudiosrc.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 Tristan Matthews <tristan@sat.qc.ca>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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_JACK_AUDIO_SRC_H__
-#define __GST_JACK_AUDIO_SRC_H__
-
-#include <jack/jack.h>
-
-#include <gst/gst.h>
-#include <gst/audio/gstaudiosrc.h>
-
-#include "gstjackaudioclient.h"
-#include "gstjack.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_JACK_AUDIO_SRC (gst_jack_audio_src_get_type())
-#define GST_JACK_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JACK_AUDIO_SRC,GstJackAudioSrc))
-#define GST_JACK_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JACK_AUDIO_SRC,GstJackAudioSrcClass))
-#define GST_JACK_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_JACK_AUDIO_SRC,GstJackAudioSrcClass))
-#define GST_IS_JACK_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JACK_AUDIO_SRC))
-#define GST_IS_JACK_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JACK_AUDIO_SRC))
-
-typedef struct _GstJackAudioSrc GstJackAudioSrc;
-typedef struct _GstJackAudioSrcClass GstJackAudioSrcClass;
-
-struct _GstJackAudioSrc
-{
- GstBaseAudioSrc src;
-
- /*< private >*/
- /* cached caps */
- GstCaps *caps;
-
- /* properties */
- GstJackConnect connect;
- gchar *server;
- jack_client_t *jclient;
-
- /* our client */
- GstJackAudioClient *client;
-
- /* our ports */
- jack_port_t **ports;
- int port_count;
- sample_t **buffers;
-};
-
-struct _GstJackAudioSrcClass
-{
- GstBaseAudioSrcClass parent_class;
-};
-
-GType gst_jack_audio_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_JACK_AUDIO_SRC_H__ */
diff --git a/ext/jack/gstjackringbuffer.h b/ext/jack/gstjackringbuffer.h
deleted file mode 100644
index 266fdfa31..000000000
--- a/ext/jack/gstjackringbuffer.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- * Copyright (C) 2008 Tristan Matthews <tristan@sat.qc.ca>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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_JACK_RING_BUFFER_H__
-#define __GST_JACK_RING_BUFFER_H__
-
-#define GST_TYPE_JACK_RING_BUFFER (gst_jack_ring_buffer_get_type())
-#define GST_JACK_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JACK_RING_BUFFER,GstJackRingBuffer))
-#define GST_JACK_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JACK_RING_BUFFER,GstJackRingBufferClass))
-#define GST_JACK_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_JACK_RING_BUFFER,GstJackRingBufferClass))
-#define GST_JACK_RING_BUFFER_CAST(obj) ((GstJackRingBuffer *)obj)
-#define GST_IS_JACK_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JACK_RING_BUFFER))
-#define GST_IS_JACK_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JACK_RING_BUFFER))
-
-typedef struct _GstJackRingBuffer GstJackRingBuffer;
-typedef struct _GstJackRingBufferClass GstJackRingBufferClass;
-
-struct _GstJackRingBuffer
-{
- GstRingBuffer object;
-
- gint sample_rate;
- gint buffer_size;
- gint channels;
-};
-
-struct _GstJackRingBufferClass
-{
- GstRingBufferClass parent_class;
-};
-
-static void gst_jack_ring_buffer_class_init(GstJackRingBufferClass * klass);
-static void gst_jack_ring_buffer_init(GstJackRingBuffer * ringbuffer,
- GstJackRingBufferClass * klass);
-
-static GstRingBufferClass *ring_parent_class = NULL;
-
-static gboolean gst_jack_ring_buffer_open_device(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_close_device(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_acquire(GstRingBuffer * buf,GstRingBufferSpec * spec);
-static gboolean gst_jack_ring_buffer_release(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_start(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_pause(GstRingBuffer * buf);
-static gboolean gst_jack_ring_buffer_stop(GstRingBuffer * buf);
-static guint gst_jack_ring_buffer_delay(GstRingBuffer * buf);
-
-#endif
diff --git a/ext/jack/gstjackutil.c b/ext/jack/gstjackutil.c
deleted file mode 100644
index cde84d8e8..000000000
--- a/ext/jack/gstjackutil.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* GStreamer Jack utility functions
- * Copyright (C) 2010 Tristan Matthews <tristan@sat.qc.ca>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "gstjackutil.h"
-#include <gst/audio/multichannel.h>
-
-static const GstAudioChannelPosition default_positions[8][8] = {
- /* 1 channel */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
- },
- /* 2 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- },
- /* 3 channels (2.1) */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE, /* or FRONT_CENTER for 3.0? */
- },
- /* 4 channels (4.0 or 3.1?) */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- /* 5 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- },
- /* 6 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- },
- /* 7 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- },
- /* 8 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- }
-};
-
-
-/* if channels are less than or equal to 8, we set a default layout,
- * otherwise set layout to an array of GST_AUDIO_CHANNEL_POSITION_NONE */
-void
-gst_jack_set_layout_on_caps (GstCaps ** caps, gint channels)
-{
- int c;
- GValue pos = { 0 };
- GValue chanpos = { 0 };
- gst_caps_unref (*caps);
-
- if (channels <= 8) {
- g_assert (channels >= 1);
- gst_audio_set_channel_positions (gst_caps_get_structure (*caps, 0),
- default_positions[channels - 1]);
- } else {
- g_value_init (&chanpos, GST_TYPE_ARRAY);
- g_value_init (&pos, GST_TYPE_AUDIO_CHANNEL_POSITION);
- for (c = 0; c < channels; c++) {
- g_value_set_enum (&pos, GST_AUDIO_CHANNEL_POSITION_NONE);
- gst_value_array_append_value (&chanpos, &pos);
- }
- g_value_unset (&pos);
- gst_structure_set_value (gst_caps_get_structure (*caps, 0),
- "channel-positions", &chanpos);
- g_value_unset (&chanpos);
- }
- gst_caps_ref (*caps);
-}
diff --git a/ext/jack/gstjackutil.h b/ext/jack/gstjackutil.h
deleted file mode 100644
index e330afd5e..000000000
--- a/ext/jack/gstjackutil.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 Tristan Matthews <tristan@sat.qc.ca>
- *
- * gstjackutil.h:
- *
- * 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_JACK_UTIL_H_
-#define _GST_JACK_UTIL_H_
-
-#include <gst/gst.h>
-
-void
-gst_jack_set_layout_on_caps (GstCaps **caps, gint channels);
-
-#endif // _GST_JACK_UTIL_H_
diff --git a/gst-plugins-bad.spec.in b/gst-plugins-bad.spec.in
index 6ad7d763c..33c8bd887 100644
--- a/gst-plugins-bad.spec.in
+++ b/gst-plugins-bad.spec.in
@@ -165,7 +165,6 @@ rm -rf $RPM_BUILD_ROOT
@USE_DC1394_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstdc1394.so
@USE_TIMIDITY_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgsttimidity.so
@USE_WILDMIDI_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstwildmidi.so
-@USE_JACK_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstjack.so
@USE_SNDFILE_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstsndfile.so
@USE_CELT_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstcelt.so
@USE_MPEG2ENC_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstmpeg2enc.so
diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am
index 4a158d951..f085c8b42 100644
--- a/tests/examples/Makefile.am
+++ b/tests/examples/Makefile.am
@@ -1,9 +1,4 @@
if HAVE_GTK
-if USE_JACK
-JACK_EXAMPLES=jack
-else
-JACK_EXAMPLES=
-endif
GTK_EXAMPLES=camerabin mxf scaletempo camerabin2
else
GTK_EXAMPLES=
@@ -21,7 +16,7 @@ else
CAMERABIN2=
endif
-SUBDIRS= $(DIRECTFB_DIR) $(GTK_EXAMPLES) $(JACK_EXAMPLES)
-DIST_SUBDIRS= camerabin $(CAMERABIN2) directfb jack mxf scaletempo
+SUBDIRS= $(DIRECTFB_DIR) $(GTK_EXAMPLES)
+DIST_SUBDIRS= camerabin $(CAMERABIN2) directfb mxf scaletempo
include $(top_srcdir)/common/parallel-subdirs.mak
diff --git a/tests/examples/jack/Makefile.am b/tests/examples/jack/Makefile.am
deleted file mode 100644
index 4adfd1314..000000000
--- a/tests/examples/jack/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-noinst_PROGRAMS = jack_client
-
-jack_client_SOURCES = jack_client.c
-jack_client_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS) $(JACK_CFLAGS)
-jack_client_LDFLAGS = $(GST_LIBS) $(GTK_LIBS) $(JACK_LIBS)
-
diff --git a/tests/examples/jack/jack_client.c b/tests/examples/jack/jack_client.c
deleted file mode 100644
index 99599ab5c..000000000
--- a/tests/examples/jack/jack_client.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* This app demonstrates the creation and use of a jack client in conjunction
- * with the jack plugins. This way, an application can control the jack client
- * directly.
- */
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-#include <jack/jack.h>
-
-static gboolean
-quit_cb (gpointer data)
-{
- gtk_main_quit ();
- return FALSE;
-}
-
-int
-main (int argc, char **argv)
-{
- jack_client_t *src_client, *sink_client;
- jack_status_t status;
- GstElement *pipeline, *src, *sink;
- GstStateChangeReturn ret;
-
- gst_init (&argc, &argv);
-
- /* create jack clients */
- src_client = jack_client_open ("src_client", JackNoStartServer, &status);
- if (src_client == NULL) {
- if (status & JackServerFailed)
- g_print ("JACK server not running\n");
- else
- g_print ("jack_client_open() failed, status = 0x%2.0x\n", status);
- return 1;
- }
-
- sink_client = jack_client_open ("sink_client", JackNoStartServer, &status);
- if (sink_client == NULL) {
- if (status & JackServerFailed)
- g_print ("JACK server not running\n");
- else
- g_print ("jack_client_open() failed, status = 0x%2.0x\n", status);
- return 1;
- }
-
- /* create gst elements */
- pipeline = gst_pipeline_new ("my_pipeline");
-
- src = gst_element_factory_make ("jackaudiosrc", NULL);
- sink = gst_element_factory_make ("jackaudiosink", NULL);
-
- g_object_set (src, "client", src_client, NULL);
- g_object_set (sink, "client", sink_client, NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
-
- /* link everything together */
- if (!gst_element_link (src, sink)) {
- g_print ("Failed to link elements!\n");
- return 1;
- }
-
- /* run */
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- g_print ("Failed to start up pipeline!\n");
- return 1;
- }
-
- /* quit after 5 seconds */
- g_timeout_add (5000, (GSourceFunc) quit_cb, NULL);
- gtk_main ();
-
- /* clean up */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}