mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	Check PCM format aliases
Check PCM format alias strings (e.g. "S16") as acceptable PCM formats.
This commit is contained in:
		
							parent
							
								
									9207804912
								
							
						
					
					
						commit
						5c91ee386d
					
				
					 1 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
					@ -1430,6 +1430,18 @@ static const char *snd_pcm_format_names[] = {
 | 
				
			||||||
	FORMAT(U18_3BE),
 | 
						FORMAT(U18_3BE),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const char *snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = {
 | 
				
			||||||
 | 
						FORMAT(S16),
 | 
				
			||||||
 | 
						FORMAT(U16),
 | 
				
			||||||
 | 
						FORMAT(S24),
 | 
				
			||||||
 | 
						FORMAT(U24),
 | 
				
			||||||
 | 
						FORMAT(S32),
 | 
				
			||||||
 | 
						FORMAT(U32),
 | 
				
			||||||
 | 
						FORMAT(FLOAT),
 | 
				
			||||||
 | 
						FORMAT(FLOAT64),
 | 
				
			||||||
 | 
						FORMAT(IEC958_SUBFRAME),
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *snd_pcm_format_descriptions[] = {
 | 
					static const char *snd_pcm_format_descriptions[] = {
 | 
				
			||||||
	FORMATD(S8, "Signed 8 bit"), 
 | 
						FORMATD(S8, "Signed 8 bit"), 
 | 
				
			||||||
	FORMATD(U8, "Unsigned 8 bit"),
 | 
						FORMATD(U8, "Unsigned 8 bit"),
 | 
				
			||||||
| 
						 | 
					@ -1583,6 +1595,10 @@ snd_pcm_format_t snd_pcm_format_value(const char* name)
 | 
				
			||||||
		    strcasecmp(name, snd_pcm_format_names[format]) == 0) {
 | 
							    strcasecmp(name, snd_pcm_format_names[format]) == 0) {
 | 
				
			||||||
			return format;
 | 
								return format;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if (snd_pcm_format_aliases[format] &&
 | 
				
			||||||
 | 
							    strcasecmp(name, snd_pcm_format_aliases[format]) == 0) {
 | 
				
			||||||
 | 
								return format;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
 | 
						for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
 | 
				
			||||||
		if (snd_pcm_format_descriptions[format] &&
 | 
							if (snd_pcm_format_descriptions[format] &&
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue