From 45cf29b7c5aa315f59b8fccda4639da5508a232d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 1 Sep 2019 19:01:18 +0200 Subject: Use preferred pa_context_new_with_proplist API --- libs/backends/pulseaudio/pulseaudio_backend.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'libs/backends/pulseaudio') diff --git a/libs/backends/pulseaudio/pulseaudio_backend.cc b/libs/backends/pulseaudio/pulseaudio_backend.cc index 04ac74a98e..af7138cb1e 100644 --- a/libs/backends/pulseaudio/pulseaudio_backend.cc +++ b/libs/backends/pulseaudio/pulseaudio_backend.cc @@ -235,12 +235,30 @@ PulseAudioBackend::init_pulse () return BackendInitializationError; } - if (!(p_context = pa_context_new (pa_threaded_mainloop_get_api (p_mainloop), PROGRAM_NAME))) { + /* see https://freedesktop.org/software/pulseaudio/doxygen/proplist_8h.html */ + pa_proplist* proplist = pa_proplist_new (); + pa_proplist_sets (proplist, PA_PROP_MEDIA_SOFTWARE, PROGRAM_NAME); + pa_proplist_sets (proplist, PA_PROP_MEDIA_ROLE, "production"); +#if 0 // TODO + /* in tools/linux_packaging/stage2.run.in uses xdg + * ICON_NAME="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}" + * e.g. "Harrison-Mixbus32C_3.7.24" "Ardour-Ardour_5.12.0" + * + * gtk2_ardour/wscript $ARDOUR_ICON is used in .desktop.in + * 'ardour' + */ + pa_proplist_sets (proplist, PA_PROP_APPLICATION_ICON_NAME, "Ardour-Ardour_5.12.0"); +#endif + + if (!(p_context = pa_context_new_with_proplist (pa_threaded_mainloop_get_api (p_mainloop), PROGRAM_NAME, proplist))) { PBD::error << _("PulseAudioBackend: Failed to allocate context") << endmsg; close_pulse (); + pa_proplist_free (proplist); return BackendInitializationError; } + pa_proplist_free (proplist); + pa_context_set_state_callback (p_context, PulseAudioBackend::context_state_cb, this); if (pa_context_connect (p_context, NULL, PA_CONTEXT_NOFLAGS, NULL) < 0) { -- cgit v1.2.3