mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	module-alsa-card: New argument: namereg_fail.
This is added so that module-udev-detect can load multiple module-alsa-card instances with the same card name - forcing namereg_fail to false allows the name registry to mangle the card names to be unique.
This commit is contained in:
		
							parent
							
								
									ef0c73cb9d
								
							
						
					
					
						commit
						c277dc65a3
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
					@ -53,6 +53,7 @@ PA_MODULE_USAGE(
 | 
				
			||||||
        "sink_properties=<properties for the sink> "
 | 
					        "sink_properties=<properties for the sink> "
 | 
				
			||||||
        "source_name=<name for the source> "
 | 
					        "source_name=<name for the source> "
 | 
				
			||||||
        "source_properties=<properties for the source> "
 | 
					        "source_properties=<properties for the source> "
 | 
				
			||||||
 | 
					        "namereg_fail=<pa_namereg_register() fail parameter value> "
 | 
				
			||||||
        "device_id=<ALSA card index> "
 | 
					        "device_id=<ALSA card index> "
 | 
				
			||||||
        "format=<sample format> "
 | 
					        "format=<sample format> "
 | 
				
			||||||
        "rate=<sample rate> "
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
| 
						 | 
					@ -73,6 +74,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "sink_properties",
 | 
					    "sink_properties",
 | 
				
			||||||
    "source_name",
 | 
					    "source_name",
 | 
				
			||||||
    "source_properties",
 | 
					    "source_properties",
 | 
				
			||||||
 | 
					    "namereg_fail",
 | 
				
			||||||
    "device_id",
 | 
					    "device_id",
 | 
				
			||||||
    "format",
 | 
					    "format",
 | 
				
			||||||
    "rate",
 | 
					    "rate",
 | 
				
			||||||
| 
						 | 
					@ -286,6 +288,7 @@ int pa__init(pa_module *m) {
 | 
				
			||||||
    pa_reserve_wrapper *reserve = NULL;
 | 
					    pa_reserve_wrapper *reserve = NULL;
 | 
				
			||||||
    const char *description;
 | 
					    const char *description;
 | 
				
			||||||
    char *fn = NULL;
 | 
					    char *fn = NULL;
 | 
				
			||||||
 | 
					    pa_bool_t namereg_fail = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_alsa_refcnt_inc();
 | 
					    pa_alsa_refcnt_inc();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -341,6 +344,18 @@ int pa__init(pa_module *m) {
 | 
				
			||||||
    pa_alsa_init_description(data.proplist);
 | 
					    pa_alsa_init_description(data.proplist);
 | 
				
			||||||
    set_card_name(&data, ma, u->device_id);
 | 
					    set_card_name(&data, ma, u->device_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* We need to give pa_modargs_get_value_boolean() a pointer to a local
 | 
				
			||||||
 | 
					     * variable instead of using &data.namereg_fail directly, because
 | 
				
			||||||
 | 
					     * data.namereg_fail is a bitfield and taking the address of a bitfield
 | 
				
			||||||
 | 
					     * variable is impossible. */
 | 
				
			||||||
 | 
					    namereg_fail = data.namereg_fail;
 | 
				
			||||||
 | 
					    if (pa_modargs_get_value_boolean(ma, "namereg_fail", &namereg_fail) < 0) {
 | 
				
			||||||
 | 
					        pa_log("Failed to parse boolean argument namereg_fail.");
 | 
				
			||||||
 | 
					        pa_card_new_data_done(&data);
 | 
				
			||||||
 | 
					        goto fail;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    data.namereg_fail = namereg_fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (reserve)
 | 
					    if (reserve)
 | 
				
			||||||
        if ((description = pa_proplist_gets(data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
 | 
					        if ((description = pa_proplist_gets(data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
 | 
				
			||||||
            pa_reserve_wrapper_set_application_device_name(reserve, description);
 | 
					            pa_reserve_wrapper_set_application_device_name(reserve, description);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue