summaryrefslogtreecommitdiff
path: root/ext/jack/gstjackaudiosrc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/jack/gstjackaudiosrc.c')
-rw-r--r--ext/jack/gstjackaudiosrc.c46
1 files changed, 39 insertions, 7 deletions
diff --git a/ext/jack/gstjackaudiosrc.c b/ext/jack/gstjackaudiosrc.c
index d5a8733..3c37970 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";
@@ -355,12 +359,12 @@ gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
/* ERRORS */
could_not_open:
{
- if (status & JackServerFailed) {
+ if (status & (JackServerFailed | JackFailure)) {
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
(_("Jack server not found")),
("Cannot connect to the Jack server (status %d)", status));
} else {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_WRITE,
+ GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
(NULL), ("Jack client open error (status %d)", status));
}
return FALSE;
@@ -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
};
@@ -697,8 +703,7 @@ gst_jack_audio_src_base_init (gpointer gclass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_static_pad_template (element_class, &src_factory);
gst_element_class_set_details_simple (element_class, "Audio Source (Jack)",
"Source/Audio", "Captures audio from a JACK server",
"Tristan Matthews <tristan@sat.qc.ca>");
@@ -732,6 +737,19 @@ 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));
+ /**
+ * GstJackAudioSrc:client-name
+ *
+ * The client name to use.
+ *
+ * Since: 0.10.31
+ */
+ 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,
@@ -764,6 +782,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
@@ -772,6 +791,12 @@ gst_jack_audio_src_dispose (GObject * object)
GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);
gst_caps_replace (&src->caps, NULL);
+
+ if (src->client_name != NULL) {
+ g_free (src->client_name);
+ src->client_name = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -782,6 +807,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;
@@ -808,6 +837,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;