summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/jack/gstjackaudiosink.c36
-rw-r--r--ext/jack/gstjackaudiosink.h1
-rw-r--r--ext/jack/gstjackaudiosrc.c39
-rw-r--r--ext/jack/gstjackaudiosrc.h1
4 files changed, 70 insertions, 7 deletions
diff --git a/ext/jack/gstjackaudiosink.c b/ext/jack/gstjackaudiosink.c
index 3a8356784..dd8b73f88 100644
--- a/ext/jack/gstjackaudiosink.c
+++ b/ext/jack/gstjackaudiosink.c
@@ -458,8 +458,13 @@ gst_jack_ring_buffer_acquire (GstAudioRingBuffer * buf,
/* 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 (sink->port_pattern == NULL) {
+ ports = jack_get_ports (client, NULL, NULL,
+ JackPortIsPhysical | JackPortIsInput);
+ } else {
+ ports = jack_get_ports (client, sink->port_pattern, NULL,
+ JackPortIsInput);
+ }
if (ports == NULL) {
/* no ports? fine then we don't do anything except for posting a warning
* message. */
@@ -675,6 +680,7 @@ enum
#define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO
#define DEFAULT_PROP_SERVER NULL
#define DEFAULT_PROP_CLIENT_NAME NULL
+#define DEFAULT_PROP_PORT_PATTERN NULL
#define DEFAULT_PROP_TRANSPORT GST_JACK_TRANSPORT_AUTONOMOUS
enum
@@ -684,6 +690,7 @@ enum
PROP_SERVER,
PROP_CLIENT,
PROP_CLIENT_NAME,
+ PROP_PORT_PATTERN,
PROP_TRANSPORT,
PROP_LAST
};
@@ -750,6 +757,19 @@ gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * GstJackAudioSink:port-pattern
+ *
+ * autoconnect to ports matching pattern, when NULL connect to physical ports
+ *
+ * Since: 1.6
+ */
+ g_object_class_install_property (gobject_class, PROP_PORT_PATTERN,
+ g_param_spec_string ("port-pattern", "port pattern",
+ "A pattern to select which ports to connect to (NULL = first physical ports)",
+ DEFAULT_PROP_PORT_PATTERN,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/**
* GstJackAudioSink:transport:
*
@@ -805,6 +825,11 @@ gst_jack_audio_sink_dispose (GObject * object)
sink->client_name = NULL;
}
+ if (sink->port_pattern != NULL) {
+ g_free (sink->port_pattern);
+ sink->port_pattern = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -821,6 +846,10 @@ gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
g_free (sink->client_name);
sink->client_name = g_value_dup_string (value);
break;
+ case PROP_PORT_PATTERN:
+ g_free (sink->port_pattern);
+ sink->port_pattern = g_value_dup_string (value);
+ break;
case PROP_CONNECT:
sink->connect = g_value_get_enum (value);
break;
@@ -855,6 +884,9 @@ gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
case PROP_CLIENT_NAME:
g_value_set_string (value, sink->client_name);
break;
+ case PROP_PORT_PATTERN:
+ g_value_set_string (value, sink->port_pattern);
+ break;
case PROP_CONNECT:
g_value_set_enum (value, sink->connect);
break;
diff --git a/ext/jack/gstjackaudiosink.h b/ext/jack/gstjackaudiosink.h
index b2377c43f..7fccc8a48 100644
--- a/ext/jack/gstjackaudiosink.h
+++ b/ext/jack/gstjackaudiosink.h
@@ -59,6 +59,7 @@ struct _GstJackAudioSink {
gchar *server;
jack_client_t *jclient;
gchar *client_name;
+ gchar *port_pattern;
guint transport;
/* our client */
diff --git a/ext/jack/gstjackaudiosrc.c b/ext/jack/gstjackaudiosrc.c
index 5a3bfb5fd..78090a2ea 100644
--- a/ext/jack/gstjackaudiosrc.c
+++ b/ext/jack/gstjackaudiosrc.c
@@ -469,9 +469,15 @@ gst_jack_ring_buffer_acquire (GstAudioRingBuffer * buf,
/* 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 (src->port_pattern == NULL) {
+ ports = jack_get_ports (client, NULL, NULL,
+ JackPortIsPhysical | JackPortIsOutput);
+ } else {
+ ports = jack_get_ports (client, src->port_pattern, NULL,
+ JackPortIsOutput);
+ }
+
if (ports == NULL) {
/* no ports? fine then we don't do anything except for posting a warning
* message. */
@@ -680,7 +686,7 @@ enum
#define DEFAULT_PROP_SERVER NULL
#define DEFAULT_PROP_CLIENT_NAME NULL
#define DEFAULT_PROP_TRANSPORT GST_JACK_TRANSPORT_AUTONOMOUS
-
+#define DEFAULT_PROP_PORT_PATTERN NULL
enum
{
PROP_0,
@@ -688,11 +694,11 @@ enum
PROP_SERVER,
PROP_CLIENT,
PROP_CLIENT_NAME,
+ PROP_PORT_PATTERN,
PROP_TRANSPORT,
PROP_LAST
};
-
/* the capabilities of the inputs and outputs.
*
* describe the real formats here.
@@ -771,6 +777,18 @@ gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
GST_TYPE_JACK_CLIENT,
GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * GstJackAudioSrc:port-pattern
+ *
+ * autoconnect to ports matching pattern, when NULL connect to physical ports
+ *
+ * Since: 1.6
+ */
+ g_object_class_install_property (gobject_class, PROP_PORT_PATTERN,
+ g_param_spec_string ("port-pattern", "port pattern",
+ "A pattern to select which ports to connect to (NULL = first physical ports)",
+ DEFAULT_PROP_PORT_PATTERN,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstJackAudioSink:transport:
@@ -828,6 +846,11 @@ gst_jack_audio_src_dispose (GObject * object)
src->client_name = NULL;
}
+ if (src->port_pattern != NULL) {
+ g_free (src->port_pattern);
+ src->port_pattern = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -842,6 +865,10 @@ gst_jack_audio_src_set_property (GObject * object, guint prop_id,
g_free (src->client_name);
src->client_name = g_value_dup_string (value);
break;
+ case PROP_PORT_PATTERN:
+ g_free (src->port_pattern);
+ src->port_pattern = g_value_dup_string (value);
+ break;
case PROP_CONNECT:
src->connect = g_value_get_enum (value);
break;
@@ -874,6 +901,8 @@ gst_jack_audio_src_get_property (GObject * object, guint prop_id,
case PROP_CLIENT_NAME:
g_value_set_string (value, src->client_name);
break;
+ case PROP_PORT_PATTERN:
+ g_value_set_string (value, src->port_pattern);
case PROP_CONNECT:
g_value_set_enum (value, src->connect);
break;
diff --git a/ext/jack/gstjackaudiosrc.h b/ext/jack/gstjackaudiosrc.h
index 97c289145..63ffe3f75 100644
--- a/ext/jack/gstjackaudiosrc.h
+++ b/ext/jack/gstjackaudiosrc.h
@@ -76,6 +76,7 @@ struct _GstJackAudioSrc
gchar *server;
jack_client_t *jclient;
gchar *client_name;
+ gchar *port_pattern;
guint transport;
/* our client */