summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-03-16 11:21:02 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2009-03-23 17:07:16 +0100
commit13bc8b8c03d3a8291ef75c0c89b16079e084c174 (patch)
tree641ddfbcc15e1a18dea72a3a9195bdea34b2aa96
parent276228da806728723fecde73b539c0c33863d761 (diff)
jack: Add new connection mode
Add a new connection mode to jacksrc and jacksink. In this new auto-force connection mode jack will create as many ports as requested/needed in the pipeline and will then connect as many physical ports as possible, possibly leaving some ports unconnected. Also get rid of some leftover g_print. Fixes #575284.
-rw-r--r--ext/jack/gstjack.c3
-rw-r--r--ext/jack/gstjack.h6
-rw-r--r--ext/jack/gstjackaudiosink.c3
-rw-r--r--ext/jack/gstjackaudiosrc.c7
4 files changed, 13 insertions, 6 deletions
diff --git a/ext/jack/gstjack.c b/ext/jack/gstjack.c
index 96afd06e6..083025016 100644
--- a/ext/jack/gstjack.c
+++ b/ext/jack/gstjack.c
@@ -33,6 +33,9 @@ gst_jack_connect_get_type (void)
"Don't automatically connect ports to physical ports", "none"},
{GST_JACK_CONNECT_AUTO,
"Automatically connect ports to physical ports", "auto"},
+ {GST_JACK_CONNECT_AUTO_FORCED,
+ "Automatically connect ports to as many physical ports as possible",
+ "auto-forced"},
{0, NULL, NULL},
};
diff --git a/ext/jack/gstjack.h b/ext/jack/gstjack.h
index 585b72ea8..fc26b7138 100644
--- a/ext/jack/gstjack.h
+++ b/ext/jack/gstjack.h
@@ -31,13 +31,17 @@
* @GST_JACK_CONNECT_AUTO: In this mode, the element will try to connect each
* output port to a random physical jack input pin. The sink will
* expose the number of physical channels on its pad caps.
+ * @GST_JACK_CONNECT_AUTO_FORCED: In this mode, the element will try to connect each
+ * output port to a random physical jack input pin. The element will accept any number
+ * of input channels.
*
* Specify how the output ports will be connected.
*/
typedef enum {
GST_JACK_CONNECT_NONE,
- GST_JACK_CONNECT_AUTO
+ GST_JACK_CONNECT_AUTO,
+ GST_JACK_CONNECT_AUTO_FORCED
} GstJackConnect;
typedef jack_default_audio_sample_t sample_t;
diff --git a/ext/jack/gstjackaudiosink.c b/ext/jack/gstjackaudiosink.c
index 228a22976..01383cbbf 100644
--- a/ext/jack/gstjackaudiosink.c
+++ b/ext/jack/gstjackaudiosink.c
@@ -454,7 +454,8 @@ gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
/* 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) {
+ if (sink->connect == GST_JACK_CONNECT_AUTO
+ || sink->connect == GST_JACK_CONNECT_AUTO_FORCED) {
/* find all the physical input ports. A physical input port is a port
* associated with a hardware device. Someone needs connect to a physical
* port in order to hear something. */
diff --git a/ext/jack/gstjackaudiosrc.c b/ext/jack/gstjackaudiosrc.c
index 682a684af..ca4bf73ff 100644
--- a/ext/jack/gstjackaudiosrc.c
+++ b/ext/jack/gstjackaudiosrc.c
@@ -233,7 +233,6 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
/* 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];
@@ -458,7 +457,8 @@ gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
/* 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) {
+ if (src->connect == GST_JACK_CONNECT_AUTO
+ || src->connect == GST_JACK_CONNECT_AUTO_FORCED) {
/* find all the physical output ports. A physical output port is a port
* associated with a hardware device. Someone needs connect to a physical
* port in order to capture something. */
@@ -483,10 +483,9 @@ gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
}
GST_DEBUG_OBJECT (src, "try connecting to %s",
jack_port_name (src->ports[i]));
- /* connect the physical port to a port */
+ /* 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;
}