mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	try to use glib's g_get_application_name() to set PA_PROP_APPLICATION_NAME
This commit is contained in:
		
							parent
							
								
									8fbce6eb89
								
							
						
					
					
						commit
						8ccc9aa665
					
				
					 1 changed files with 25 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -25,6 +25,7 @@
 | 
			
		|||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <locale.h>
 | 
			
		||||
#include <dlfcn.h>
 | 
			
		||||
 | 
			
		||||
#include <pulse/proplist.h>
 | 
			
		||||
#include <pulse/utf8.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +37,6 @@
 | 
			
		|||
#include "proplist-util.h"
 | 
			
		||||
 | 
			
		||||
void pa_init_proplist(pa_proplist *p) {
 | 
			
		||||
    int a, b;
 | 
			
		||||
#if !HAVE_DECL_ENVIRON
 | 
			
		||||
    extern char **environ;
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -99,23 +99,37 @@ void pa_init_proplist(pa_proplist *p) {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    a = pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_BINARY);
 | 
			
		||||
    b = pa_proplist_contains(p, PA_PROP_APPLICATION_NAME);
 | 
			
		||||
 | 
			
		||||
    if (!a || !b) {
 | 
			
		||||
    if (!pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_BINARY)) {
 | 
			
		||||
        char t[PATH_MAX];
 | 
			
		||||
        if (pa_get_binary_name(t, sizeof(t))) {
 | 
			
		||||
            char *c = pa_utf8_filter(t);
 | 
			
		||||
 | 
			
		||||
            if (!a)
 | 
			
		||||
                pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_BINARY, c);
 | 
			
		||||
            if (!b)
 | 
			
		||||
                pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, c);
 | 
			
		||||
 | 
			
		||||
            pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_BINARY, c);
 | 
			
		||||
            pa_xfree(c);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef RTLD_NOLOAD
 | 
			
		||||
    if (!pa_proplist_contains(p, PA_PROP_APPLICATION_NAME)) {
 | 
			
		||||
        void *dl;
 | 
			
		||||
 | 
			
		||||
        if ((dl = dlopen("libglib-2.0", RTLD_NOLOAD))) {
 | 
			
		||||
            const char *(*_g_get_application_name)(void);
 | 
			
		||||
 | 
			
		||||
            if ((*(void**) &_g_get_application_name = dlsym(dl, "g_get_application_name")))
 | 
			
		||||
                pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, _g_get_application_name());
 | 
			
		||||
 | 
			
		||||
            dlclose(dl);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if (!pa_proplist_contains(p, PA_PROP_APPLICATION_NAME)) {
 | 
			
		||||
        const char *t;
 | 
			
		||||
 | 
			
		||||
        if ((t = pa_proplist_gets(p, PA_PROP_APPLICATION_PROCESS_BINARY)))
 | 
			
		||||
            pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, t);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!pa_proplist_contains(p, PA_PROP_APPLICATION_LANGUAGE)) {
 | 
			
		||||
        const char *l;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue