Use preferred pa_context_new_with_proplist API
authorRobin Gareus <robin@gareus.org>
Sun, 1 Sep 2019 17:01:18 +0000 (19:01 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 1 Sep 2019 17:01:18 +0000 (19:01 +0200)
libs/backends/pulseaudio/pulseaudio_backend.cc

index 04ac74a98ed249b840c92f1a0d434e8d8a6c8511..af7138cb1ebe4e1ab83f81c54c780b4b476feef9 100644 (file)
@@ -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<major>'
+        */
+       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) {