diff -Nur gst-plugins-bad/ext/jack/gstjackaudioclient.h gst-plugins-badder/ext/jack/gstjackaudioclient.h
--- gst-plugins-bad/ext/jack/gstjackaudioclient.h	2007-03-08 10:24:52.000000000 -0500
+++ gst-plugins-badder/ext/jack/gstjackaudioclient.h	2008-07-29 11:30:24.000000000 -0400
@@ -28,30 +28,33 @@
 
 G_BEGIN_DECLS
 
-typedef enum 
+typedef enum
 {
-  GST_JACK_CLIENT_SOURCE,
-  GST_JACK_CLIENT_SINK
+    GST_JACK_CLIENT_SOURCE
+    ,GST_JACK_CLIENT_SINK
 } GstJackClientType;
 
 typedef struct _GstJackAudioClient GstJackAudioClient;
 
-void                  gst_jack_audio_client_init           (void);
+void gst_jack_audio_client_init(void);
 
 
-GstJackAudioClient *  gst_jack_audio_client_new            (const gchar *id, const gchar *server,
-                                                            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);
+GstJackAudioClient *  gst_jack_audio_client_new (const gchar *id, const gchar *
+                                                 server
+                                                 ,GstJackClientType type
+                                                 ,void (*shutdown) (
+                                                     void *arg)
+                                                 ,JackProcessCallback process
+                                                 ,JackBufferSizeCallback buffer_size
+                                                 ,JackSampleRateCallback sample_rate
+                                                 ,gpointer user_data
+                                                 ,jack_status_t *status);
 
-jack_client_t *       gst_jack_audio_client_get_client     (GstJackAudioClient *client);
+void gst_jack_audio_client_free(GstJackAudioClient *client);
 
-gboolean              gst_jack_audio_client_set_active     (GstJackAudioClient *client, gboolean active);
+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
 
diff -Nur gst-plugins-bad/ext/jack/gstjackaudiosink.c gst-plugins-badder/ext/jack/gstjackaudiosink.c
--- gst-plugins-bad/ext/jack/gstjackaudiosink.c	2008-06-13 07:59:19.000000000 -0400
+++ gst-plugins-badder/ext/jack/gstjackaudiosink.c	2008-07-29 11:30:24.000000000 -0400
@@ -59,390 +59,346 @@
 #include <string.h>
 
 #include "gstjackaudiosink.h"
+#include "gstjackringbuffer.h"
 
-GST_DEBUG_CATEGORY_STATIC (gst_jack_audio_sink_debug);
+GST_DEBUG_CATEGORY_STATIC(gst_jack_audio_sink_debug);
 #define GST_CAT_DEFAULT gst_jack_audio_sink_debug
 
-typedef jack_default_audio_sample_t sample_t;
-
-#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 void gst_jack_ring_buffer_dispose (GObject * object);
-static void gst_jack_ring_buffer_finalize (GObject * object);
-
-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);
-
 static gboolean
-gst_jack_audio_sink_allocate_channels (GstJackAudioSink * sink, gint channels)
+gst_jack_audio_sink_allocate_channels(GstJackAudioSink * sink, gint channels)
 {
-  jack_client_t *client;
+    jack_client_t *client;
 
-  client = gst_jack_audio_client_get_client (sink->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);
+    /* remove ports we don't need */
+    while (sink->port_count > channels) 
+    {
+        jack_port_unregister(client, sink->ports[--sink->port_count]);
+    }
 
-  /* create an output port for each channel */
-  while (sink->port_count < channels) {
-    gchar *name;
+    /* alloc enough output ports */
+    sink->ports = g_realloc(sink->ports, sizeof(jack_port_t *) * channels);
 
-    /* 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;
+    /* 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++;
+        sink->port_count++;
 
-    g_free (name);
-  }
-  return TRUE;
+        g_free(name);
+    }
+    return TRUE;
 }
 
 static void
-gst_jack_audio_sink_free_channels (GstJackAudioSink * sink)
+gst_jack_audio_sink_free_channels(GstJackAudioSink * sink)
 {
-  gint res, i = 0;
-  jack_client_t *client;
+    gint res, i = 0;
+    jack_client_t *client;
 
-  client = gst_jack_audio_client_get_client (sink->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);
+    /* 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--;
     }
-    sink->port_count--;
-  }
-  g_free (sink->ports);
-  sink->ports = NULL;
+    g_free(sink->ports);
+    sink->ports = NULL;
 }
 
 /* ringbuffer abstract base class */
 static GType
-gst_jack_ring_buffer_get_type (void)
+gst_jack_ring_buffer_get_type()
 {
-  static GType ringbuffer_type = 0;
+    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;
+    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);
-
-  gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_dispose);
-  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_finalize);
-
-  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);
+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->delay = GST_DEBUG_FUNCPTR (gst_jack_ring_buffer_delay);
+    gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_jack_ring_buffer_dispose);
+    gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_jack_ring_buffer_finalize);
+
+    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)
+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 ("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 {
-    /* 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));
+    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("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 {
+        /* 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;
+    return 0;
 
-  /* ERRORS */
+    /* ERRORS */
 wrong_size:
-  {
-    GST_ERROR_OBJECT (sink, "nbytes (%d) != flen (%d)",
-        nframes * sizeof (sample_t), flen);
-    return 1;
-  }
+    {
+        GST_ERROR_OBJECT(sink, "nbytes (%d) != flen (%d)",
+                nframes * sizeof(sample_t), flen);
+        return 1;
+    }
 }
 
 /* we error out */
 static int
-jack_sample_rate_cb (jack_nframes_t nframes, void *arg)
+jack_sample_rate_cb(jack_nframes_t nframes, void *arg)
 {
-  GstJackAudioSink *sink;
-  GstJackRingBuffer *abuf;
+    GstJackAudioSink *sink;
+    GstJackRingBuffer *abuf;
 
-  abuf = GST_JACK_RING_BUFFER_CAST (arg);
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
+    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;
+    if (abuf->sample_rate != -1 && abuf->sample_rate != nframes)
+        goto not_supported;
 
-  return 0;
+    return 0;
 
-  /* ERRORS */
+    /* ERRORS */
 not_supported:
-  {
-    GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
-        (NULL), ("Jack changed the sample rate, which is not supported"));
-    return 1;
-  }
+    {
+        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)
+jack_buffer_size_cb(jack_nframes_t nframes, void *arg)
 {
-  GstJackAudioSink *sink;
-  GstJackRingBuffer *abuf;
+    GstJackAudioSink *sink;
+    GstJackRingBuffer *abuf;
 
-  abuf = GST_JACK_RING_BUFFER_CAST (arg);
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
+    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;
+    if (abuf->buffer_size != -1 && abuf->buffer_size != nframes)
+        goto not_supported;
 
-  return 0;
+    return 0;
 
-  /* ERRORS */
+    /* ERRORS */
 not_supported:
-  {
-    GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
-        (NULL), ("Jack changed the buffer size, which is not supported"));
-    return 1;
-  }
+    {
+        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)
+jack_shutdown_cb(void *arg)
 {
-  GstJackAudioSink *sink;
+    GstJackAudioSink *sink;
 
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (arg));
+    sink = GST_JACK_AUDIO_SINK(GST_OBJECT_PARENT(arg));
 
-  GST_DEBUG_OBJECT (sink, "shutdown");
+    GST_DEBUG_OBJECT(sink, "shutdown");
 
-  GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
-      (NULL), ("Jack server shutdown"));
+    GST_ELEMENT_ERROR(sink, RESOURCE, NOT_FOUND,
+            (NULL), ("Jack server shutdown"));
 }
 
 static void
-gst_jack_ring_buffer_init (GstJackRingBuffer * buf,
-    GstJackRingBufferClass * g_class)
+gst_jack_ring_buffer_init(GstJackRingBuffer * buf,
+        GstJackRingBufferClass * g_class)
 {
-  buf->channels = -1;
-  buf->buffer_size = -1;
-  buf->sample_rate = -1;
+    buf->channels = -1;
+    buf->buffer_size = -1;
+    buf->sample_rate = -1;
 }
 
 static void
-gst_jack_ring_buffer_dispose (GObject * object)
+gst_jack_ring_buffer_dispose(GObject * object)
 {
-  G_OBJECT_CLASS (ring_parent_class)->dispose (object);
+    G_OBJECT_CLASS(ring_parent_class)->dispose(object);
 }
 
 static void
-gst_jack_ring_buffer_finalize (GObject * object)
+gst_jack_ring_buffer_finalize(GObject * object)
 {
-  GstJackRingBuffer *ringbuffer;
+    GstJackRingBuffer *ringbuffer;
 
-  ringbuffer = GST_JACK_RING_BUFFER_CAST (object);
+    ringbuffer = GST_JACK_RING_BUFFER_CAST(object);
 
-  G_OBJECT_CLASS (ring_parent_class)->finalize (object);
+    G_OBJECT_CLASS(ring_parent_class)->finalize(object);
 }
 
 /* the _open_device method should make a connection with the server
- */
-static gboolean
-gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
+*/
+    static gboolean
+gst_jack_ring_buffer_open_device(GstRingBuffer * buf)
 {
-  GstJackAudioSink *sink;
-  jack_status_t status = 0;
-  const gchar *name;
+    GstJackAudioSink *sink;
+    jack_status_t status = 0;
+    const gchar *name;
 
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
+    sink = GST_JACK_AUDIO_SINK(GST_OBJECT_PARENT(buf));
 
-  GST_DEBUG_OBJECT (sink, "open");
+    GST_DEBUG_OBJECT(sink, "open");
 
-  name = g_get_application_name ();
-  if (!name)
-    name = "GStreamer";
+    name = g_get_application_name();
+    if (!name)
+        name = "GStreamer";
 
-  sink->client = gst_jack_audio_client_new (name, sink->server,
-      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;
+    sink->client = gst_jack_audio_client_new(name, sink->server,
+            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");
+    GST_DEBUG_OBJECT(sink, "opened");
 
-  return TRUE;
+    return TRUE;
 
-  /* ERRORS */
+    /* ERRORS */
 could_not_open:
-  {
-    if (status & JackServerFailed) {
-      GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
-          (NULL), ("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));
+    {
+        if (status & JackServerFailed) {
+            GST_ELEMENT_ERROR(sink, RESOURCE, NOT_FOUND,
+                    (NULL), ("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;
     }
-    return FALSE;
-  }
 }
 
 /* close the connection with the server
- */
-static gboolean
-gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
+*/
+    static gboolean
+gst_jack_ring_buffer_close_device(GstRingBuffer * buf)
 {
-  GstJackAudioSink *sink;
+    GstJackAudioSink *sink;
 
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
+    sink = GST_JACK_AUDIO_SINK(GST_OBJECT_PARENT(buf));
 
-  GST_DEBUG_OBJECT (sink, "close");
+    GST_DEBUG_OBJECT(sink, "close");
 
-  gst_jack_audio_sink_free_channels (sink);
-  gst_jack_audio_client_free (sink->client);
-  sink->client = NULL;
+    gst_jack_audio_sink_free_channels(sink);
+    gst_jack_audio_client_free(sink->client);
+    sink->client = NULL;
 
-  return TRUE;
+    return TRUE;
 }
 
 /* allocate a buffer and setup resources to process the audio samples of
@@ -456,226 +412,227 @@
  * 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)
+    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;
-
-  GST_DEBUG_OBJECT (sink, "segsize %d, segtotal %d", 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) {
-    /* 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;
+    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;
+
+    GST_DEBUG_OBJECT(sink, "segsize %d, segtotal %d", 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) {
+        /* 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);
     }
-    free (ports);
-  }
 done:
 
-  abuf->sample_rate = sample_rate;
-  abuf->buffer_size = buffer_size;
-  abuf->channels = spec->channels;
+    abuf->sample_rate = sample_rate;
+    abuf->buffer_size = buffer_size;
+    abuf->channels = spec->channels;
 
-  return TRUE;
+    return TRUE;
 
-  /* ERRORS */
+    /* 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;
-  }
+    {
+        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;
-  }
+    {
+        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;
-  }
+    {
+        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;
-  }
+    {
+        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)
+    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));
-  }
+    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;
+    abuf->channels = -1;
+    abuf->buffer_size = -1;
+    abuf->sample_rate = -1;
 
-  /* free the buffer */
-  gst_buffer_unref (buf->data);
-  buf->data = NULL;
+    /* free the buffer */
+    gst_buffer_unref(buf->data);
+    buf->data = NULL;
 
-  return TRUE;
+    return TRUE;
 }
 
-static gboolean
-gst_jack_ring_buffer_start (GstRingBuffer * buf)
+    static gboolean
+gst_jack_ring_buffer_start(GstRingBuffer * buf)
 {
-  GstJackAudioSink *sink;
+    GstJackAudioSink *sink;
 
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
+    sink = GST_JACK_AUDIO_SINK(GST_OBJECT_PARENT(buf));
 
-  GST_DEBUG_OBJECT (sink, "start");
+    GST_DEBUG_OBJECT(sink, "start");
 
-  return TRUE;
+    return TRUE;
 }
 
-static gboolean
-gst_jack_ring_buffer_pause (GstRingBuffer * buf)
+    static gboolean
+gst_jack_ring_buffer_pause(GstRingBuffer * buf)
 {
-  GstJackAudioSink *sink;
+    GstJackAudioSink *sink;
 
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
+    sink = GST_JACK_AUDIO_SINK(GST_OBJECT_PARENT(buf));
 
-  GST_DEBUG_OBJECT (sink, "pause");
+    GST_DEBUG_OBJECT(sink, "pause");
 
-  return TRUE;
+    return TRUE;
 }
 
-static gboolean
-gst_jack_ring_buffer_stop (GstRingBuffer * buf)
+    static gboolean
+gst_jack_ring_buffer_stop(GstRingBuffer * buf)
 {
-  GstJackAudioSink *sink;
+    GstJackAudioSink *sink;
 
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
+    sink = GST_JACK_AUDIO_SINK(GST_OBJECT_PARENT(buf));
 
-  GST_DEBUG_OBJECT (sink, "stop");
+    GST_DEBUG_OBJECT(sink, "stop");
 
-  return TRUE;
+    return TRUE;
 }
 
-static guint
-gst_jack_ring_buffer_delay (GstRingBuffer * buf)
+    static guint
+gst_jack_ring_buffer_delay(GstRingBuffer * buf)
 {
-  GstJackAudioSink *sink;
-  guint res = 0;
+    GstJackAudioSink *sink;
+    guint res = 0;
 
-  sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
+    sink = GST_JACK_AUDIO_SINK(GST_OBJECT_PARENT(buf));
 
-  GST_DEBUG_OBJECT (sink, "delay %u", res);
+    GST_DEBUG_OBJECT(sink, "delay %u", res);
 
-  return res;
+    return res;
 }
 
 /* elementfactory information */
 static const GstElementDetails gst_jack_audio_sink_details =
-GST_ELEMENT_DETAILS ("Audio Sink (Jack)",
-    "Sink/Audio",
-    "Output to Jack",
-    "Wim Taymans <wim@fluendo.com>");
+GST_ELEMENT_DETAILS("Audio Sink (Jack)",
+        "Sink/Audio",
+        "Output to Jack",
+        "Wim Taymans <wim@fluendo.com>");
 
 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 ]")
-    );
+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
+    /* FILL ME */
+    SIGNAL_LAST
 };
 
 #define DEFAULT_PROP_CONNECT 	GST_JACK_CONNECT_AUTO
@@ -683,213 +640,205 @@
 
 enum
 {
-  PROP_0,
-  PROP_CONNECT,
-  PROP_SERVER,
-  PROP_LAST
+    PROP_0,
+    PROP_CONNECT,
+    PROP_SERVER,
+    PROP_LAST
 };
 
+#if 0
 #define GST_TYPE_JACK_CONNECT (gst_jack_connect_get_type())
-static 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"},
-    {0, NULL, NULL},
-  };
-
-  if (!jack_connect_type) {
-    jack_connect_type = g_enum_register_static ("GstJackConnect", jack_connect);
-  }
-  return jack_connect_type;
-}
+GType
+gst_jack_connect_get_type();
+#endif
 
 #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);
+GST_BOILERPLATE_FULL(GstJackAudioSink, gst_jack_audio_sink, GstBaseAudioSink,
+        GST_TYPE_BASE_AUDIO_SINK, _do_init);
 
-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 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 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)
+gst_jack_audio_sink_base_init(gpointer g_class)
 {
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+    GstElementClass *element_class = GST_ELEMENT_CLASS(g_class);
 
-  gst_element_class_set_details (element_class, &gst_jack_audio_sink_details);
+    gst_element_class_set_details(element_class, &gst_jack_audio_sink_details);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&jackaudiosink_sink_factory));
+    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)
+gst_jack_audio_sink_class_init(GstJackAudioSinkClass * klass)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-  GstBaseSinkClass *gstbasesink_class;
-  GstBaseAudioSinkClass *gstbaseaudiosink_class;
+    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 = (GObjectClass *) klass;
+    gstelement_class = (GstElementClass *) klass;
+    gstbasesink_class = (GstBaseSinkClass *) klass;
+    gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
 
-  gobject_class->get_property =
-      GST_DEBUG_FUNCPTR (gst_jack_audio_sink_get_property);
-  gobject_class->set_property =
-      GST_DEBUG_FUNCPTR (gst_jack_audio_sink_set_property);
+    gobject_class->get_property =
+        GST_DEBUG_FUNCPTR(gst_jack_audio_sink_get_property);
+    gobject_class->set_property =
+        GST_DEBUG_FUNCPTR(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_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_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_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));
 
-  gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_sink_getcaps);
+    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);
+    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);
+    /* 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 ();
+    gst_jack_audio_client_init();
 }
 
 static void
-gst_jack_audio_sink_init (GstJackAudioSink * sink,
-    GstJackAudioSinkClass * g_class)
+gst_jack_audio_sink_init(GstJackAudioSink * sink,
+        GstJackAudioSinkClass * g_class)
 {
-  sink->connect = DEFAULT_PROP_CONNECT;
-  sink->server = g_strdup (DEFAULT_PROP_SERVER);
-  sink->ports = NULL;
-  sink->port_count = 0;
+    sink->connect = DEFAULT_PROP_CONNECT;
+    sink->server = g_strdup(DEFAULT_PROP_SERVER);
+    sink->ports = NULL;
+    sink->port_count = 0;
 }
 
 static void
-gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
+gst_jack_audio_sink_set_property(GObject * object, guint prop_id,
+        const GValue * value, GParamSpec * pspec)
 {
-  GstJackAudioSink *sink;
+    GstJackAudioSink *sink;
 
-  sink = GST_JACK_AUDIO_SINK (object);
+    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;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
+    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;
+        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)
+gst_jack_audio_sink_get_property(GObject * object, guint prop_id,
+        GValue * value, GParamSpec * pspec)
 {
-  GstJackAudioSink *sink;
+    GstJackAudioSink *sink;
 
-  sink = GST_JACK_AUDIO_SINK (object);
+    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;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
+    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;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+            break;
+    }
 }
 
 static GstCaps *
-gst_jack_audio_sink_getcaps (GstBaseSink * bsink)
+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);
+    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);
 
-  return gst_caps_ref (sink->caps);
+    rate = jack_get_sample_rate(client);
 
-  /* ERRORS */
+    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;
-  }
+    {
+        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)
+gst_jack_audio_sink_create_ringbuffer(GstBaseAudioSink * sink)
 {
-  GstRingBuffer *buffer;
+    GstRingBuffer *buffer;
 
-  buffer = g_object_new (GST_TYPE_JACK_RING_BUFFER, NULL);
-  GST_DEBUG_OBJECT (sink, "created ringbuffer @%p", buffer);
+    buffer = g_object_new(GST_TYPE_JACK_RING_BUFFER, NULL);
+    GST_DEBUG_OBJECT(sink, "created ringbuffer @%p", buffer);
 
-  return buffer;
+    return buffer;
 }
diff -Nur gst-plugins-bad/ext/jack/gstjackaudiosink.h gst-plugins-badder/ext/jack/gstjackaudiosink.h
--- gst-plugins-bad/ext/jack/gstjackaudiosink.h	2007-03-08 10:24:52.000000000 -0500
+++ gst-plugins-badder/ext/jack/gstjackaudiosink.h	2008-07-29 11:30:24.000000000 -0400
@@ -27,65 +27,66 @@
 #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))
+#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;
 
 /**
- * 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.
- *
- * Specify how the output ports will be connected.
- */
-typedef enum {
-  GST_JACK_CONNECT_NONE,
-  GST_JACK_CONNECT_AUTO
-} GstJackConnect;
-
-/**
  * GstJackAudioSink:
- * 
+ *
  * Opaque #GstJackAudioSink.
  */
 struct _GstJackAudioSink {
-  GstBaseAudioSink element;
+    GstBaseAudioSink element;
 
-  /*< private >*/
-  /* cached caps */
-  GstCaps         *caps;
-
-  /* properties */
-  GstJackConnect   connect;
-  gchar           *server;
-
-  /* our client */
-  GstJackAudioClient *client;
-
-  /* our ports */
-  jack_port_t    **ports;
-  int              port_count;
+    /*< private >*/
+    /* cached caps */
+    GstCaps         *caps;
+
+    /* properties */
+    GstJackConnect connect;
+    gchar           *server;
+
+    /* our client */
+    GstJackAudioClient *client;
+
+    /* our ports */
+    jack_port_t    **ports;
+    int port_count;
 };
 
 struct _GstJackAudioSinkClass {
-  GstBaseAudioSinkClass parent_class;
+    GstBaseAudioSinkClass parent_class;
 };
 
-GType gst_jack_audio_sink_get_type (void);
+GType gst_jack_audio_sink_get_type ();
 
 G_END_DECLS
 
diff -Nur gst-plugins-bad/ext/jack/gstjackaudiosrc.c gst-plugins-badder/ext/jack/gstjackaudiosrc.c
--- gst-plugins-bad/ext/jack/gstjackaudiosrc.c	1969-12-31 19:00:00.000000000 -0500
+++ gst-plugins-badder/ext/jack/gstjackaudiosrc.c	2008-07-29 11:30:24.000000000 -0400
@@ -0,0 +1,815 @@
+/* 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)
+ */
+
+#include <gst/gst.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "gstjackaudiosrc.h"
+#include "gstjackringbuffer.h"
+
+GST_DEBUG_CATEGORY_STATIC(gst_jackaudiosrc_debug);
+#define GST_CAT_DEFAULT gst_jackaudiosrc_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);
+
+    /* 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;
+}
+
+/* ringbuffer abstract base class */
+static GType gst_jack_ring_buffer_get_type()
+{
+    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);
+
+    gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_jack_ring_buffer_dispose);
+    gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_jack_ring_buffer_finalize);
+
+    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;
+    GstJackRingBuffer *abuf;
+    gint len, givenLen;
+    guint8 *writeptr, *dataStart;
+    gint writeseg;
+    gint channels, i, j;
+    sample_t **buffers, *data;
+
+    buf = GST_RING_BUFFER_CAST(arg);
+    abuf = GST_JACK_RING_BUFFER_CAST(arg);
+    src = GST_JACKAUDIOSRC(GST_OBJECT_PARENT(buf));
+
+    channels = buf->spec.channels;
+    len = sizeof(sample_t) * nframes * channels;
+
+    /* alloc pointers to samples */
+    buffers = g_alloca(sizeof(sample_t *) * channels);
+    data = g_alloca(len);
+
+    /* get input buffers */
+    for (i = 0; i < channels; i++) 
+        buffers[i] = (sample_t *)jack_port_get_buffer(src->ports[i], nframes);
+
+    //writeptr = data; 
+    dataStart = (guint8*) data;
+
+    /* the samples in the jack input buffers have to be interleaved into the 
+     * ringbuffer 
+     */
+
+    for (i = 0; i < nframes; i++) 
+        for (j = 0; j < channels; j++) 
+            *data++ = buffers[j][i]; 
+
+    if (gst_ring_buffer_prepare_read(buf, &writeseg, &writeptr, &givenLen))
+    {
+        memcpy(writeptr, (char *) dataStart, givenLen);
+
+        GST_DEBUG("copy %d frames: %p, %d bytes, %d channels", nframes, writeptr, len / channels, channels);
+
+        /* clear written samples in the ringbuffer */
+        // gst_ring_buffer_clear(buf, 0);
+
+        /* we wrote one segment */
+        gst_ring_buffer_advance(buf, 1);
+    }
+    return 0;
+}
+
+/* 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_JACKAUDIOSRC(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_JACKAUDIOSRC(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_JACKAUDIOSRC(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;
+}
+
+static void gst_jack_ring_buffer_dispose(GObject * object)
+{
+    G_OBJECT_CLASS(ring_parent_class)->dispose(object);
+}
+
+static void gst_jack_ring_buffer_finalize(GObject * object)
+{
+    GstJackRingBuffer *ringbuffer;
+    ringbuffer = GST_JACK_RING_BUFFER_CAST(object);
+    G_OBJECT_CLASS(ring_parent_class)->finalize(object);
+}
+
+/* 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_JACKAUDIOSRC(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,
+            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,
+                    (NULL), ("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_JACKAUDIOSRC(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_JACKAUDIOSRC(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;
+
+    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;
+
+    GST_DEBUG_OBJECT(src, "segsize %d, segtotal %d", 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) {
+        /* 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]));
+            g_print("connecting to %s\n", 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_JACKAUDIOSRC(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_JACKAUDIOSRC(GST_OBJECT_PARENT(buf));
+
+    GST_DEBUG_OBJECT(src, "start");
+
+    return TRUE;
+}
+
+static gboolean gst_jack_ring_buffer_pause(GstRingBuffer * buf)
+{
+    GstJackAudioSrc *src;
+
+    src = GST_JACKAUDIOSRC(GST_OBJECT_PARENT(buf));
+
+    GST_DEBUG_OBJECT(src, "pause");
+
+    return TRUE;
+}
+
+static gboolean gst_jack_ring_buffer_stop(GstRingBuffer * buf)
+{
+    GstJackAudioSrc *src;
+
+    src = GST_JACKAUDIOSRC(GST_OBJECT_PARENT(buf));
+
+    GST_DEBUG_OBJECT(src, "stop");
+
+    return TRUE;
+}
+
+static guint gst_jack_ring_buffer_delay(GstRingBuffer * buf)
+{
+    GstJackAudioSrc *src;
+    guint res = 0;
+
+    src = GST_JACKAUDIOSRC(GST_OBJECT_PARENT(buf));
+
+    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_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_jackaudiosrc_debug, "jacksrc", 0, "jacksrc element");
+
+GST_BOILERPLATE_FULL(GstJackAudioSrc, gst_jackaudiosrc, GstBaseAudioSrc,
+        GST_TYPE_BASE_AUDIO_SRC, _do_init);
+
+static void gst_jackaudiosrc_set_property(GObject * object, guint prop_id,
+        const GValue * value, GParamSpec * pspec);
+static void gst_jackaudiosrc_get_property(GObject * object, guint prop_id,
+        GValue * value, GParamSpec * pspec);
+
+static GstCaps *gst_jackaudiosrc_getcaps(GstBaseSrc * bsrc);
+static GstRingBuffer *gst_jackaudiosrc_create_ringbuffer(GstBaseAudioSrc *src);
+
+/* GObject vmethod implementations */
+
+static void gst_jackaudiosrc_base_init(gpointer gclass)
+{
+    static GstElementDetails gst_jackaudiosrc_details = {
+        "Audio Source (Jack)",
+        "Source/Audio",
+        "Input from Jack",
+        "Tristan Matthews <tristan@sat.qc.ca>"
+    };
+    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(element_class, &gst_jackaudiosrc_details);
+}
+
+/* initialize the jackaudiosrc's class */
+static void gst_jackaudiosrc_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->set_property = GST_DEBUG_FUNCPTR(gst_jackaudiosrc_set_property);
+    gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_jackaudiosrc_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_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));
+
+    gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR(gst_jackaudiosrc_getcaps);
+    gstbaseaudiosrc_class->create_ringbuffer =
+        GST_DEBUG_FUNCPTR(gst_jackaudiosrc_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_jackaudiosrc_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->ports = NULL;
+    src->port_count = 0;
+}
+
+static void gst_jackaudiosrc_set_property(GObject * object, guint prop_id,
+        const GValue * value, GParamSpec * pspec)
+{
+    GstJackAudioSrc *src = GST_JACKAUDIOSRC(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;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+            break;
+    }
+}
+
+static void gst_jackaudiosrc_get_property(GObject * object, guint prop_id, 
+        GValue * value, GParamSpec * pspec)
+{
+    GstJackAudioSrc *src = GST_JACKAUDIOSRC(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;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+            break;
+    }
+}
+
+static GstCaps *gst_jackaudiosrc_getcaps(GstBaseSrc * bsrc)
+{
+    GstJackAudioSrc *src = GST_JACKAUDIOSRC(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_jackaudiosrc_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 -Nur gst-plugins-bad/ext/jack/gstjackaudiosrc.h gst-plugins-badder/ext/jack/gstjackaudiosrc.h
--- gst-plugins-bad/ext/jack/gstjackaudiosrc.h	1969-12-31 19:00:00.000000000 -0500
+++ gst-plugins-badder/ext/jack/gstjackaudiosrc.h	2008-07-29 11:30:24.000000000 -0400
@@ -0,0 +1,103 @@
+/*
+ * GStreamer
+ * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
+ * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) 2008  <<user@hostname.org>>
+ *
+ * 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_JACKAUDIOSRC_H__
+#define __GST_JACKAUDIOSRC_H__
+
+#include <jack/jack.h>
+
+#include <gst/gst.h>
+#include <gst/audio/gstaudiosrc.h>
+
+#include "gstjackaudioclient.h"
+#include "gstjack.h"
+
+G_BEGIN_DECLS
+
+/* #defines don't like whitespacey bits */
+#define GST_TYPE_JACKAUDIOSRC \
+    (gst_jackaudiosrc_get_type())
+#define GST_JACKAUDIOSRC(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JACKAUDIOSRC,GstJackAudioSrc))
+#define GST_JACKAUDIOSRC_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JACKAUDIOSRC,GstJackAudioSrcClass))
+#define GST_IS_JACKAUDIOSRC(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JACKAUDIOSRC))
+#define GST_IS_JACKAUDIOSRC_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JACKAUDIOSRC))
+
+typedef struct _GstJackAudioSrc GstJackAudioSrc;
+typedef struct _GstJackAudioSrcClass GstJackAudioSrcClass;
+
+struct _GstJackAudioSrc
+{
+    GstBaseAudioSrc src;
+
+    /*< private >*/
+    /* cached caps */
+    GstCaps         *caps;
+
+    /* properties */
+    GstJackConnect connect;
+    gchar           *server;
+
+    /* our client */
+    GstJackAudioClient *client;
+
+    /* our ports */
+    jack_port_t    **ports;
+    int port_count;
+};
+
+struct _GstJackAudioSrcClass
+{
+    GstBaseAudioSrcClass parent_class;
+};
+
+GType gst_jackaudiosrc_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_JACKAUDIOSRC_H__ */
diff -Nur gst-plugins-bad/ext/jack/gstjackbin.c gst-plugins-badder/ext/jack/gstjackbin.c
--- gst-plugins-bad/ext/jack/gstjackbin.c	2006-04-08 17:47:57.000000000 -0400
+++ gst-plugins-badder/ext/jack/gstjackbin.c	2008-07-29 11:30:24.000000000 -0400
@@ -24,8 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
-#include "gstjack.h"
-
+//#include "gstjack.h"
 
 static GstBinClass *parent_class = NULL;
 
diff -Nur gst-plugins-bad/ext/jack/gstjack.c gst-plugins-badder/ext/jack/gstjack.c
--- gst-plugins-bad/ext/jack/gstjack.c	2008-03-13 10:25:19.000000000 -0400
+++ gst-plugins-badder/ext/jack/gstjack.c	2008-07-29 11:30:24.000000000 -0400
@@ -21,11 +21,34 @@
 #include "config.h"
 #endif
 
+#include "gstjackaudiosrc.h"
 #include "gstjackaudiosink.h"
 
+GType
+gst_jack_connect_get_type()
+{
+  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"},
+    {0, NULL, NULL},
+  };
+
+  if (!jack_connect_type) {
+    jack_connect_type = g_enum_register_static ("GstJackConnect", jack_connect);
+  }
+  return jack_connect_type;
+}
+
+
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
+  if (!gst_element_register (plugin, "jackaudiosrc", GST_RANK_PRIMARY,
+          GST_TYPE_JACKAUDIOSRC))
+    return FALSE;
   if (!gst_element_register (plugin, "jackaudiosink", GST_RANK_PRIMARY,
           GST_TYPE_JACK_AUDIO_SINK))
     return FALSE;
@@ -33,8 +56,18 @@
   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)
+/* gstreamer looks for this structure to register jackaudiosrcs
+ *
+ * exchange the string 'Template jackaudiosrc' with your jackaudiosrc description
+ */
+GST_PLUGIN_DEFINE (
+        GST_VERSION_MAJOR,
+        GST_VERSION_MINOR,
+        "jack",
+        "Jack elements",
+        plugin_init,
+        VERSION,
+        "LGPL",
+        "GStreamer",
+        "http://gstreamer.net/"
+        )
diff -Nur gst-plugins-bad/ext/jack/gstjack.h gst-plugins-badder/ext/jack/gstjack.h
--- gst-plugins-bad/ext/jack/gstjack.h	1969-12-31 19:00:00.000000000 -0500
+++ gst-plugins-badder/ext/jack/gstjack.h	2008-07-29 11:30:24.000000000 -0400
@@ -0,0 +1,48 @@
+/* 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_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.
+ *
+ * Specify how the output ports will be connected.
+ */
+
+typedef enum {
+    GST_JACK_CONNECT_NONE
+    ,GST_JACK_CONNECT_AUTO
+} GstJackConnect;
+
+typedef jack_default_audio_sample_t sample_t;
+
+#define GST_TYPE_JACK_CONNECT (gst_jack_connect_get_type())
+GType gst_jack_connect_get_type();
+
+#endif  // _GST_JACK_H_
diff -Nur gst-plugins-bad/ext/jack/gstjackringbuffer.h gst-plugins-badder/ext/jack/gstjackringbuffer.h
--- gst-plugins-bad/ext/jack/gstjackringbuffer.h	1969-12-31 19:00:00.000000000 -0500
+++ gst-plugins-badder/ext/jack/gstjackringbuffer.h	2008-07-29 11:30:24.000000000 -0400
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+
+#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 void gst_jack_ring_buffer_dispose(GObject * object);
+static void gst_jack_ring_buffer_finalize(GObject * object);
+
+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);
+
diff -Nur gst-plugins-bad/ext/jack/Makefile.am gst-plugins-badder/ext/jack/Makefile.am
--- gst-plugins-bad/ext/jack/Makefile.am	2007-03-08 10:24:52.000000000 -0500
+++ gst-plugins-badder/ext/jack/Makefile.am	2008-07-29 11:30:24.000000000 -0400
@@ -1,11 +1,28 @@
+# plugindir is set in configure
 
+##############################################################################
+# change libgstplugin.la to something more suitable, e.g. libmysomething.la  #
+##############################################################################
 plugin_LTLIBRARIES = libgstjack.la
 
-libgstjack_la_SOURCES = gstjack.c gstjackaudiosink.c gstjackaudioclient.c
+##############################################################################
+# for the next set of variables, rename the prefix if you renamed the .la,   #
+#  e.g. libgstplugin_la_SOURCES => libmysomething_la_SOURCES                 #
+#       libgstplugin_la_CFLAGS  => libmysomething_la_CFLAGS                  #
+#       libgstplugin_la_LIBADD  => libmysomething_la_LIBADD                  #
+#       libgstplugin_la_LDFLAGS => libmysomething_la_LDFLAGS                 #
+##############################################################################
+
+# sources used to compile this plug-in
+libgstjack_la_SOURCES = gstjack.c gstjackaudiosrc.c gstjackaudiosink.c gstjackaudioclient.c
+
+# flags used to compile this plugin
+# add other _CFLAGS and _LIBS as needed
 libgstjack_la_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)
 
-noinst_HEADERS = gstjackaudiosink.h gstjackaudioclient.h
+# headers we need but don't want installed
+noinst_HEADERS = gstjackaudiosrc.h gstjackaudiosink.h gstjackaudioclient.h gstjack.h gstjackringbuffer.h
+
 
-EXTRA_DIST = README
