mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	generate default sink/source names from the device files they belong to
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1223 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									005017647b
								
							
						
					
					
						commit
						bf79e97591
					
				
					 3 changed files with 56 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -88,7 +88,6 @@ static const char* const valid_modargs[] = {
 | 
			
		|||
    NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_SOURCE_NAME "alsa_input"
 | 
			
		||||
#define DEFAULT_DEVICE "default"
 | 
			
		||||
 | 
			
		||||
static void update_usage(struct userdata *u) {
 | 
			
		||||
| 
						 | 
				
			
			@ -360,6 +359,9 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
			
		|||
    snd_pcm_info_t *pcm_info = NULL;
 | 
			
		||||
    int err;
 | 
			
		||||
    char *t;
 | 
			
		||||
    const char *name;
 | 
			
		||||
    char *name_buf = NULL;
 | 
			
		||||
    int namereg_fail;
 | 
			
		||||
    
 | 
			
		||||
    if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
 | 
			
		||||
        pa_log(__FILE__": failed to parse module arguments");
 | 
			
		||||
| 
						 | 
				
			
			@ -420,7 +422,14 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
			
		|||
        u->mixer_handle = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
 | 
			
		||||
    if ((name = pa_modargs_get_value(ma, "source_name", NULL)))
 | 
			
		||||
        namereg_fail = 1;
 | 
			
		||||
    else {
 | 
			
		||||
        name = name_buf = pa_sprintf_malloc("alsa_input.%s", dev);
 | 
			
		||||
        namereg_fail = 0;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    if (!(u->source = pa_source_new(c, __FILE__, name, namereg_fail, &ss, &map))) {
 | 
			
		||||
        pa_log(__FILE__": Failed to create source object");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -492,7 +501,9 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
			
		|||
        u->source->get_hw_mute(u->source);
 | 
			
		||||
 | 
			
		||||
finish:
 | 
			
		||||
     if (ma)
 | 
			
		||||
    pa_xfree(name_buf);
 | 
			
		||||
 | 
			
		||||
    if (ma)
 | 
			
		||||
         pa_modargs_free(ma);
 | 
			
		||||
 | 
			
		||||
    if (pcm_info)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue