diff options
author | Andy Wingo <wingo@oblong.com> | 2010-11-15 15:58:28 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-12-29 17:02:40 +0100 |
commit | 82ee35372bfbe1ba78071502b2f28a25696f6f95 (patch) | |
tree | 6f74c916827f19990d8b54a6bca14367bffe560e | |
parent | 96830324a577caae9e2d77e346b98d4a29cc4a76 (diff) |
add "client" property
* ext/pulse/pulsesrc.c (gst_pulsesrc_class_init, gst_pulsesrc_init)
(gst_pulsesrc_set_property, gst_pulsesrc_get_property)
(gst_pulsesrc_open): Add a "client" property, as in pulsesink.
Fixes #634914
-rw-r--r-- | ext/pulse/pulsesrc.c | 34 | ||||
-rw-r--r-- | ext/pulse/pulsesrc.h | 3 |
2 files changed, 31 insertions, 6 deletions
diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c index 0509bfd6e..06fb2069c 100644 --- a/ext/pulse/pulsesrc.c +++ b/ext/pulse/pulsesrc.c @@ -61,6 +61,7 @@ enum PROP_SERVER, PROP_DEVICE, PROP_DEVICE_NAME, + PROP_CLIENT, PROP_STREAM_PROPERTIES, PROP_LAST }; @@ -247,6 +248,20 @@ gst_pulsesrc_class_init (GstPulseSrcClass * klass) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** + * GstPulseSink:client + * + * The PulseAudio client name to use. + * + * Since: 0.10.27 + */ + g_object_class_install_property (gobject_class, + PROP_CLIENT, + g_param_spec_string ("client", "Client", + "The PulseAudio client_name_to_use", gst_pulse_client_name (), + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | + GST_PARAM_MUTABLE_READY)); + + /** * GstPulseSrc:stream-properties * * List of pulseaudio stream properties. A list of defined properties can be @@ -275,6 +290,7 @@ gst_pulsesrc_init (GstPulseSrc * pulsesrc, GstPulseSrcClass * klass) { pulsesrc->server = NULL; pulsesrc->device = NULL; + pulsesrc->client_name = gst_pulse_client_name (); pulsesrc->device_description = NULL; pulsesrc->context = NULL; @@ -340,6 +356,7 @@ gst_pulsesrc_finalize (GObject * object) g_free (pulsesrc->server); g_free (pulsesrc->device); + g_free (pulsesrc->client_name); if (pulsesrc->properties) gst_structure_free (pulsesrc->properties); @@ -463,6 +480,15 @@ gst_pulsesrc_set_property (GObject * object, g_free (pulsesrc->device); pulsesrc->device = g_value_dup_string (value); break; + case PROP_CLIENT: + g_free (pulsesrc->client_name); + if (!g_value_get_string (value)) { + GST_WARNING_OBJECT (pulsesrc, + "Empty PulseAudio client name not allowed. Resetting to default value"); + pulsesrc->client_name = gst_pulse_client_name (); + } else + pulsesrc->client_name = g_value_dup_string (value); + break; case PROP_STREAM_PROPERTIES: if (pulsesrc->properties) gst_structure_free (pulsesrc->properties); @@ -495,6 +521,9 @@ gst_pulsesrc_get_property (GObject * object, case PROP_DEVICE_NAME: g_value_take_string (value, gst_pulsesrc_device_description (pulsesrc)); break; + case PROP_CLIENT: + g_value_set_string (value, pulsesrc->client_name); + break; case PROP_STREAM_PROPERTIES: gst_value_set_structure (value, pulsesrc->properties); break; @@ -599,7 +628,6 @@ static gboolean gst_pulsesrc_open (GstAudioSrc * asrc) { GstPulseSrc *pulsesrc = GST_PULSESRC_CAST (asrc); - gchar *name = gst_pulse_client_name (); pa_threaded_mainloop_lock (pulsesrc->mainloop); @@ -610,7 +638,7 @@ gst_pulsesrc_open (GstAudioSrc * asrc) if (!(pulsesrc->context = pa_context_new (pa_threaded_mainloop_get_api (pulsesrc->mainloop), - name))) { + pulsesrc->client_name))) { GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Failed to create context"), (NULL)); goto unlock_and_fail; @@ -649,7 +677,6 @@ gst_pulsesrc_open (GstAudioSrc * asrc) pa_threaded_mainloop_unlock (pulsesrc->mainloop); - g_free (name); return TRUE; /* ERRORS */ @@ -659,7 +686,6 @@ unlock_and_fail: pa_threaded_mainloop_unlock (pulsesrc->mainloop); - g_free (name); return FALSE; } } diff --git a/ext/pulse/pulsesrc.h b/ext/pulse/pulsesrc.h index fb5006d6f..6e6322b9c 100644 --- a/ext/pulse/pulsesrc.h +++ b/ext/pulse/pulsesrc.h @@ -55,7 +55,7 @@ struct _GstPulseSrc { GstAudioSrc src; - gchar *server, *device; + gchar *server, *device, *client_name; pa_threaded_mainloop *mainloop; @@ -68,7 +68,6 @@ struct _GstPulseSrc size_t read_buffer_length; gchar *device_description; - GstPulseMixerCtrl *mixer; GstPulseProbe *probe; |