mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	ucm: add LibraryConfig support
This commit allows to define private alsa-lib's configuration. When
the configuration is present, the device values ("PlaybackCTL",
"CaptureCTL", "PlaybackMixer", "CaptureMixer", "CapturePCM")
are prefixed with '_ucmHEXA.' string where HEXA is replaced by the
unique hexadecimal number identifying the opened ucm manager handle.
    Syntax 4
    LibraryConfig.a_label.SubstiConfig {
            # substituted library configuration like:
            usr_share_dir "${ConfLibDir}"
    }
    LibraryConfig.b_label.Config {
            # non-substituted library configuration like:
            usr_share_dir "/usr/share/alsa"
    }
    The File counterparts:
    LibraryConfig.c_label.SubstiFile "/some/path"
    LibraryConfig.d_label.File "/some/path"
Note that for files the contents is substituted on the request,
but the file name is always substituted (useful for ${ConfDir} etc.).
The private configuration is not saved or preserved. It's life time
belongs to the opened ucm manager handle.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
			
			
This commit is contained in:
		
							parent
							
								
									3e0140088c
								
							
						
					
					
						commit
						8f5779eb3f
					
				
					 11 changed files with 400 additions and 36 deletions
				
			
		| 
						 | 
				
			
			@ -1520,9 +1520,15 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
 | 
			
		|||
	int err;
 | 
			
		||||
 | 
			
		||||
	assert(ctlp && name);
 | 
			
		||||
	err = snd_config_update_ref(&top);
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
		return err;
 | 
			
		||||
	if (_snd_is_ucm_device(name)) {
 | 
			
		||||
		name = uc_mgr_alibcfg_by_device(&top, name);
 | 
			
		||||
		if (name == NULL)
 | 
			
		||||
			return -ENODEV;
 | 
			
		||||
	} else {
 | 
			
		||||
		err = snd_config_update_ref(&top);
 | 
			
		||||
		if (err < 0)
 | 
			
		||||
			return err;
 | 
			
		||||
	}
 | 
			
		||||
	err = snd_ctl_open_noupdate(ctlp, top, name, mode, 0);
 | 
			
		||||
	snd_config_unref(top);
 | 
			
		||||
	return err;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue