Commit 92cfb335 authored by Nicolas Baron's avatar Nicolas Baron Committed by Tim-Philipp Müller

jack: add "client-name" property to jackaudiosink and jackaudiosrc

https://bugzilla.gnome.org/show_bug.cgi?id=665872
parent c363ae82
...@@ -329,7 +329,11 @@ gst_jack_ring_buffer_open_device (GstRingBuffer * buf) ...@@ -329,7 +329,11 @@ gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
GST_DEBUG_OBJECT (sink, "open"); GST_DEBUG_OBJECT (sink, "open");
name = g_get_application_name (); if (sink->client_name) {
name = sink->client_name;
} else {
name = g_get_application_name ();
}
if (!name) if (!name)
name = "GStreamer"; name = "GStreamer";
...@@ -644,8 +648,9 @@ enum ...@@ -644,8 +648,9 @@ enum
SIGNAL_LAST SIGNAL_LAST
}; };
#define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO #define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO
#define DEFAULT_PROP_SERVER NULL #define DEFAULT_PROP_SERVER NULL
#define DEFAULT_PROP_CLIENT_NAME NULL
enum enum
{ {
...@@ -653,6 +658,7 @@ enum ...@@ -653,6 +658,7 @@ enum
PROP_CONNECT, PROP_CONNECT,
PROP_SERVER, PROP_SERVER,
PROP_CLIENT, PROP_CLIENT,
PROP_CLIENT_NAME,
PROP_LAST PROP_LAST
}; };
...@@ -711,6 +717,12 @@ gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass) ...@@ -711,6 +717,12 @@ gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
"The Jack server to connect to (NULL = default)", "The Jack server to connect to (NULL = default)",
DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CLIENT_NAME,
g_param_spec_string ("client-name", "Client name",
"The client name of the Jack instance (NULL = default)",
DEFAULT_PROP_CLIENT_NAME,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CLIENT, g_object_class_install_property (gobject_class, PROP_CLIENT,
g_param_spec_boxed ("client", "JackClient", "Handle for jack client", g_param_spec_boxed ("client", "JackClient", "Handle for jack client",
GST_TYPE_JACK_CLIENT, GST_TYPE_JACK_CLIENT,
...@@ -738,6 +750,7 @@ gst_jack_audio_sink_init (GstJackAudioSink * sink, ...@@ -738,6 +750,7 @@ gst_jack_audio_sink_init (GstJackAudioSink * sink,
sink->jclient = NULL; sink->jclient = NULL;
sink->ports = NULL; sink->ports = NULL;
sink->port_count = 0; sink->port_count = 0;
sink->client_name = g_strdup (DEFAULT_PROP_CLIENT_NAME);
sink->buffers = NULL; sink->buffers = NULL;
} }
...@@ -759,6 +772,10 @@ gst_jack_audio_sink_set_property (GObject * object, guint prop_id, ...@@ -759,6 +772,10 @@ gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
sink = GST_JACK_AUDIO_SINK (object); sink = GST_JACK_AUDIO_SINK (object);
switch (prop_id) { switch (prop_id) {
case PROP_CLIENT_NAME:
g_free (sink->client_name);
sink->client_name = g_value_dup_string (value);
break;
case PROP_CONNECT: case PROP_CONNECT:
sink->connect = g_value_get_enum (value); sink->connect = g_value_get_enum (value);
break; break;
...@@ -787,6 +804,9 @@ gst_jack_audio_sink_get_property (GObject * object, guint prop_id, ...@@ -787,6 +804,9 @@ gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
sink = GST_JACK_AUDIO_SINK (object); sink = GST_JACK_AUDIO_SINK (object);
switch (prop_id) { switch (prop_id) {
case PROP_CLIENT_NAME:
g_value_set_string (value, sink->client_name);
break;
case PROP_CONNECT: case PROP_CONNECT:
g_value_set_enum (value, sink->connect); g_value_set_enum (value, sink->connect);
break; break;
......
...@@ -58,6 +58,7 @@ struct _GstJackAudioSink { ...@@ -58,6 +58,7 @@ struct _GstJackAudioSink {
GstJackConnect connect; GstJackConnect connect;
gchar *server; gchar *server;
jack_client_t *jclient; jack_client_t *jclient;
gchar *client_name;
/* our client */ /* our client */
GstJackAudioClient *client; GstJackAudioClient *client;
......
...@@ -336,7 +336,11 @@ gst_jack_ring_buffer_open_device (GstRingBuffer * buf) ...@@ -336,7 +336,11 @@ gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
GST_DEBUG_OBJECT (src, "open"); GST_DEBUG_OBJECT (src, "open");
name = g_get_application_name (); if (src->client_name) {
name = src->client_name;
} else {
name = g_get_application_name ();
}
if (!name) if (!name)
name = "GStreamer"; name = "GStreamer";
...@@ -647,8 +651,9 @@ enum ...@@ -647,8 +651,9 @@ enum
LAST_SIGNAL LAST_SIGNAL
}; };
#define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO #define DEFAULT_PROP_CONNECT GST_JACK_CONNECT_AUTO
#define DEFAULT_PROP_SERVER NULL #define DEFAULT_PROP_SERVER NULL
#define DEFAULT_PROP_CLIENT_NAME NULL
enum enum
{ {
...@@ -656,6 +661,7 @@ enum ...@@ -656,6 +661,7 @@ enum
PROP_CONNECT, PROP_CONNECT,
PROP_SERVER, PROP_SERVER,
PROP_CLIENT, PROP_CLIENT,
PROP_CLIENT_NAME,
PROP_LAST PROP_LAST
}; };
...@@ -731,6 +737,12 @@ gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass) ...@@ -731,6 +737,12 @@ gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
"The Jack server to connect to (NULL = default)", "The Jack server to connect to (NULL = default)",
DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CLIENT_NAME,
g_param_spec_string ("client-name", "Client name",
"The client name of the Jack instance (NULL = default)",
DEFAULT_PROP_CLIENT_NAME,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CLIENT, g_object_class_install_property (gobject_class, PROP_CLIENT,
g_param_spec_boxed ("client", "JackClient", "Handle for jack client", g_param_spec_boxed ("client", "JackClient", "Handle for jack client",
GST_TYPE_JACK_CLIENT, GST_TYPE_JACK_CLIENT,
...@@ -763,6 +775,7 @@ gst_jack_audio_src_init (GstJackAudioSrc * src, GstJackAudioSrcClass * gclass) ...@@ -763,6 +775,7 @@ gst_jack_audio_src_init (GstJackAudioSrc * src, GstJackAudioSrcClass * gclass)
src->ports = NULL; src->ports = NULL;
src->port_count = 0; src->port_count = 0;
src->buffers = NULL; src->buffers = NULL;
src->client_name = g_strdup (DEFAULT_PROP_CLIENT_NAME);
} }
static void static void
...@@ -781,6 +794,10 @@ gst_jack_audio_src_set_property (GObject * object, guint prop_id, ...@@ -781,6 +794,10 @@ gst_jack_audio_src_set_property (GObject * object, guint prop_id,
GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object); GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
switch (prop_id) { switch (prop_id) {
case PROP_CLIENT_NAME:
g_free (src->client_name);
src->client_name = g_value_dup_string (value);
break;
case PROP_CONNECT: case PROP_CONNECT:
src->connect = g_value_get_enum (value); src->connect = g_value_get_enum (value);
break; break;
...@@ -807,6 +824,9 @@ gst_jack_audio_src_get_property (GObject * object, guint prop_id, ...@@ -807,6 +824,9 @@ gst_jack_audio_src_get_property (GObject * object, guint prop_id,
GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object); GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
switch (prop_id) { switch (prop_id) {
case PROP_CLIENT_NAME:
g_value_set_string (value, src->client_name);
break;
case PROP_CONNECT: case PROP_CONNECT:
g_value_set_enum (value, src->connect); g_value_set_enum (value, src->connect);
break; break;
......
...@@ -75,6 +75,7 @@ struct _GstJackAudioSrc ...@@ -75,6 +75,7 @@ struct _GstJackAudioSrc
GstJackConnect connect; GstJackConnect connect;
gchar *server; gchar *server;
jack_client_t *jclient; jack_client_t *jclient;
gchar *client_name;
/* our client */ /* our client */
GstJackAudioClient *client; GstJackAudioClient *client;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment