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

https://bugzilla.gnome.org/show_bug.cgi?id=665872
This commit is contained in:
Nicolas Baron 2011-12-09 15:45:03 +00:00 committed by Tim-Philipp Müller
parent c363ae8254
commit 92cfb335cd
4 changed files with 48 additions and 6 deletions

View file

@ -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;

View file

@ -58,6 +58,7 @@ struct _GstJackAudioSink {
GstJackConnect connect;
gchar *server;
jack_client_t *jclient;
gchar *client_name;
/* our client */
GstJackAudioClient *client;

View file

@ -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;

View file

@ -75,6 +75,7 @@ struct _GstJackAudioSrc
GstJackConnect connect;
gchar *server;
jack_client_t *jclient;
gchar *client_name;
/* our client */
GstJackAudioClient *client;