From 4625d00df14e2dc10ac2108e1aaf2c75b66f998f Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 30 Jun 2015 17:07:45 +0200 Subject: [PATCH] module-tunnel: export application properties Makes them configurable via module arguments. Useful if you wish to identify particular PulseAudio servers. Signed-off-by: Pierre Ossman --- src/modules/module-tunnel.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index 833423a..bd88165 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -81,6 +81,10 @@ PA_MODULE_USAGE( "auto= " "server=
" "sink= " + "app_name= " + "app_id= " + "app_version= " + "app_icon= " "cookie= " "format= " "channels= " @@ -94,6 +98,10 @@ PA_MODULE_USAGE( "auto= " "server=
" "source= " + "app_name= " + "app_id= " + "app_version= " + "app_icon= " "cookie= " "format= " "channels= " @@ -121,6 +129,10 @@ static const char* const valid_modargs[] = { "source_properties", "source", #endif + "app_name", + "app_id", + "app_version", + "app_icon", "channel_map", NULL, }; @@ -211,6 +223,11 @@ struct userdata { pa_mcalign *mcalign; #endif + char *app_name; + char *app_id; + char *app_version; + char *app_icon; + pa_auth_cookie *auth_cookie; uint32_t version; @@ -1626,13 +1643,21 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t if (u->version >= 13) { pa_proplist *pl; pl = pa_proplist_new(); - pa_proplist_sets(pl, PA_PROP_APPLICATION_ID, "org.PulseAudio.PulseAudio"); - pa_proplist_sets(pl, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION); + if (u->app_name[0]) + pa_proplist_sets(pl, PA_PROP_APPLICATION_NAME, u->app_name); + if (u->app_id[0]) + pa_proplist_sets(pl, PA_PROP_APPLICATION_ID, u->app_id); + if (u->app_version[0]) + pa_proplist_sets(pl, PA_PROP_APPLICATION_VERSION, u->app_version); + if (u->app_icon[0]) + pa_proplist_sets(pl, PA_PROP_APPLICATION_ICON_NAME, u->app_icon); pa_init_proplist(pl); pa_tagstruct_put_proplist(reply, pl); pa_proplist_free(pl); - } else - pa_tagstruct_puts(reply, "PulseAudio"); + } else { + if (u->app_name[0]) + pa_tagstruct_puts(reply, u->app_name); + } pa_pstream_send_tagstruct(u->pstream, reply); /* We ignore the server's reply here */ @@ -1951,6 +1976,10 @@ int pa__init(pa_module*m) { u->source_name = pa_xstrdup(pa_modargs_get_value(ma, "source", NULL));; u->source = NULL; #endif + u->app_name = pa_xstrdup(pa_modargs_get_value(ma, "app_name", "PulseAudio"));; + u->app_id = pa_xstrdup(pa_modargs_get_value(ma, "app_id", "org.PulseAudio.PulseAudio"));; + u->app_version = pa_xstrdup(pa_modargs_get_value(ma, "app_version", PACKAGE_VERSION));; + u->app_icon = pa_xstrdup(pa_modargs_get_value(ma, "app_icon", ""));; u->smoother = pa_smoother_new( PA_USEC_PER_SEC, PA_USEC_PER_SEC*2, -- 2.4.3