X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faudio_output%2Fvlcpulse.c;h=feecfa722928a732081de7c09c77a359bec260d9;hb=98748a4a98cefe26451a93b6deb646dbdb8d4366;hp=7926f6e2777f84d97297194ef615c85bb0149fd2;hpb=a666d9b2109c2b1b6e5ac8365eb3edce496830f2;p=vlc diff --git a/modules/audio_output/vlcpulse.c b/modules/audio_output/vlcpulse.c index 7926f6e277..feecfa7229 100644 --- a/modules/audio_output/vlcpulse.c +++ b/modules/audio_output/vlcpulse.c @@ -12,7 +12,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License @@ -27,7 +27,7 @@ #include #include -#include "vlcpulse.h" +#include "audio_output/vlcpulse.h" #include #include #include @@ -104,10 +104,29 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp) pa_proplist *props = pa_proplist_new (); if (likely(props != NULL)) { - pa_proplist_sets (props, PA_PROP_APPLICATION_NAME, ua); - pa_proplist_sets (props, PA_PROP_APPLICATION_ID, "org.VideoLAN.VLC"); - pa_proplist_sets (props, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION); - pa_proplist_sets (props, PA_PROP_APPLICATION_ICON_NAME, PACKAGE_NAME); + char *str; + + if (ua != NULL) + pa_proplist_sets (props, PA_PROP_APPLICATION_NAME, ua); + + str = var_InheritString (obj, "app-id"); + if (str != NULL) + { + pa_proplist_sets (props, PA_PROP_APPLICATION_ID, str); + free (str); + } + str = var_InheritString (obj, "app-version"); + if (str != NULL) + { + pa_proplist_sets (props, PA_PROP_APPLICATION_VERSION, str); + free (str); + } + str = var_InheritString (obj, "app-icon-name"); + if (str != NULL) + { + pa_proplist_sets (props, PA_PROP_APPLICATION_ICON_NAME, str); + free (str); + } //pa_proplist_sets (props, PA_PROP_APPLICATION_LANGUAGE, _("C")); pa_proplist_sets (props, PA_PROP_APPLICATION_LANGUAGE, setlocale (LC_MESSAGES, NULL)); @@ -117,18 +136,33 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp) //pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_BINARY, // PACKAGE_NAME); - char buf[sysconf (_SC_GETPW_R_SIZE_MAX)]; - struct passwd pwbuf, *pw; + for (size_t max = sysconf (_SC_GETPW_R_SIZE_MAX), len = max % 1024 + 1024; + len < max; len += 1024) + { + struct passwd pwbuf, *pw; + char buf[len]; + + if (getpwuid_r (getuid (), &pwbuf, buf, sizeof (buf), &pw) == 0) + { + if (pw != NULL) + pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_USER, + pw->pw_name); + break; + } + } - if (getpwuid_r (getuid (), &pwbuf, buf, sizeof (buf), &pw) == 0 - && pw != NULL) - pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_USER, - pw->pw_name); + for (size_t max = sysconf (_SC_HOST_NAME_MAX), len = max % 1024 + 1024; + len < max; len += 1024) + { + char hostname[len]; - char hostname[sysconf (_SC_HOST_NAME_MAX)]; - if (gethostname (hostname, sizeof (hostname)) == 0) - pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_HOST, - hostname); + if (gethostname (hostname, sizeof (hostname)) == 0) + { + pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_HOST, + hostname); + break; + } + } const char *session = getenv ("XDG_SESSION_COOKIE"); if (session != NULL)