[0.11] gst-plugins-good: jack: add "client-name" property to jackaudiosink and jackaudiosrc

Sebastian Dröge slomo at kemper.freedesktop.org
Tue Jan 10 05:33:00 PST 2012


Module: gst-plugins-good
Branch: 0.11
Commit: 92cfb335cde7386b53c76e030603a0897429a6ff
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=92cfb335cde7386b53c76e030603a0897429a6ff

Author: Nicolas Baron <hoggins at radiom.fr>
Date:   Fri Dec  9 15:45:03 2011 +0000

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

https://bugzilla.gnome.org/show_bug.cgi?id=665872

---

 ext/jack/gstjackaudiosink.c |   26 +++++++++++++++++++++++---
 ext/jack/gstjackaudiosink.h |    1 +
 ext/jack/gstjackaudiosrc.c  |   26 +++++++++++++++++++++++---
 ext/jack/gstjackaudiosrc.h  |    1 +
 4 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/ext/jack/gstjackaudiosink.c b/ext/jack/gstjackaudiosink.c
index 58e2acf..e1513b7 100644
--- a/ext/jack/gstjackaudiosink.c
+++ b/ext/jack/gstjackaudiosink.c
@@ -329,7 +329,11 @@ gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
 
   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)
     name = "GStreamer";
 
@@ -644,8 +648,9 @@ enum
   SIGNAL_LAST
 };
 
-#define DEFAULT_PROP_CONNECT 	GST_JACK_CONNECT_AUTO
-#define DEFAULT_PROP_SERVER 	NULL
+#define DEFAULT_PROP_CONNECT 		GST_JACK_CONNECT_AUTO
+#define DEFAULT_PROP_SERVER 		NULL
+#define DEFAULT_PROP_CLIENT_NAME 	NULL
 
 enum
 {
@@ -653,6 +658,7 @@ enum
   PROP_CONNECT,
   PROP_SERVER,
   PROP_CLIENT,
+  PROP_CLIENT_NAME,
   PROP_LAST
 };
 
@@ -711,6 +717,12 @@ gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
           "The Jack server to connect to (NULL = default)",
           DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  g_object_class_install_property (gobject_class, PROP_CLIENT_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_param_spec_boxed ("client", "JackClient", "Handle for jack client",
           GST_TYPE_JACK_CLIENT,
@@ -738,6 +750,7 @@ gst_jack_audio_sink_init (GstJackAudioSink * sink,
   sink->jclient = NULL;
   sink->ports = NULL;
   sink->port_count = 0;
+  sink->client_name = g_strdup (DEFAULT_PROP_CLIENT_NAME);
   sink->buffers = NULL;
 }
 
@@ -759,6 +772,10 @@ gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
   sink = GST_JACK_AUDIO_SINK (object);
 
   switch (prop_id) {
+    case PROP_CLIENT_NAME:
+      g_free (sink->client_name);
+      sink->client_name = g_value_dup_string (value);
+      break;
     case PROP_CONNECT:
       sink->connect = g_value_get_enum (value);
       break;
@@ -787,6 +804,9 @@ gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
   sink = GST_JACK_AUDIO_SINK (object);
 
   switch (prop_id) {
+    case PROP_CLIENT_NAME:
+      g_value_set_string (value, sink->client_name);
+      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 6f9c45c..db5fc28 100644
--- a/ext/jack/gstjackaudiosink.h
+++ b/ext/jack/gstjackaudiosink.h
@@ -58,6 +58,7 @@ struct _GstJackAudioSink {
   GstJackConnect   connect;
   gchar           *server;
   jack_client_t   *jclient;
+  gchar           *client_name;
 
   /* our client */
   GstJackAudioClient *client;
diff --git a/ext/jack/gstjackaudiosrc.c b/ext/jack/gstjackaudiosrc.c
index 27faa82..469737d 100644
--- a/ext/jack/gstjackaudiosrc.c
+++ b/ext/jack/gstjackaudiosrc.c
@@ -336,7 +336,11 @@ gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
 
   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)
     name = "GStreamer";
 
@@ -647,8 +651,9 @@ enum
   LAST_SIGNAL
 };
 
-#define DEFAULT_PROP_CONNECT 	GST_JACK_CONNECT_AUTO
-#define DEFAULT_PROP_SERVER 	NULL
+#define DEFAULT_PROP_CONNECT 		GST_JACK_CONNECT_AUTO
+#define DEFAULT_PROP_SERVER 		NULL
+#define DEFAULT_PROP_CLIENT_NAME	NULL
 
 enum
 {
@@ -656,6 +661,7 @@ enum
   PROP_CONNECT,
   PROP_SERVER,
   PROP_CLIENT,
+  PROP_CLIENT_NAME,
   PROP_LAST
 };
 
@@ -731,6 +737,12 @@ gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
           "The Jack server to connect to (NULL = default)",
           DEFAULT_PROP_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  g_object_class_install_property (gobject_class, PROP_CLIENT_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_param_spec_boxed ("client", "JackClient", "Handle for jack client",
           GST_TYPE_JACK_CLIENT,
@@ -763,6 +775,7 @@ gst_jack_audio_src_init (GstJackAudioSrc * src, GstJackAudioSrcClass * gclass)
   src->ports = NULL;
   src->port_count = 0;
   src->buffers = NULL;
+  src->client_name = g_strdup (DEFAULT_PROP_CLIENT_NAME);
 }
 
 static void
@@ -781,6 +794,10 @@ gst_jack_audio_src_set_property (GObject * object, guint prop_id,
   GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
 
   switch (prop_id) {
+    case PROP_CLIENT_NAME:
+      g_free (src->client_name);
+      src->client_name = g_value_dup_string (value);
+      break;
     case PROP_CONNECT:
       src->connect = g_value_get_enum (value);
       break;
@@ -807,6 +824,9 @@ gst_jack_audio_src_get_property (GObject * object, guint prop_id,
   GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
 
   switch (prop_id) {
+    case PROP_CLIENT_NAME:
+      g_value_set_string (value, src->client_name);
+      break;
     case PROP_CONNECT:
       g_value_set_enum (value, src->connect);
       break;
diff --git a/ext/jack/gstjackaudiosrc.h b/ext/jack/gstjackaudiosrc.h
index 7e99b69..b69a4d6 100644
--- a/ext/jack/gstjackaudiosrc.h
+++ b/ext/jack/gstjackaudiosrc.h
@@ -75,6 +75,7 @@ struct _GstJackAudioSrc
     GstJackConnect connect;
     gchar           *server;
     jack_client_t   *jclient;
+    gchar           *client_name;
 
     /* our client */
     GstJackAudioClient *client;



More information about the gstreamer-commits mailing list