mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	Handle "Input Source" as a capture element
Some drivers use "Input Source" as the capture source mixer element because mixer abstraction layer can't handle multiple "Capture Source" elements. This patch adds a hack to handle Input Source as a capture route, and let mixer apps know that it's a capture stuff, at least.
This commit is contained in:
		
							parent
							
								
									686a32c61f
								
							
						
					
					
						commit
						dac0e3b17c
					
				
					 1 changed files with 31 additions and 3 deletions
				
			
		| 
						 | 
					@ -918,6 +918,19 @@ static int base_len(const char *name, selem_ctl_type_t *type)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		p++;
 | 
							p++;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Special case - handle "Input Source" as a capture route.
 | 
				
			||||||
 | 
						 * Note that it's *NO* capture source.  A capture source is split over
 | 
				
			||||||
 | 
						 * sub-elements, and multiple capture-sources will result in an error.
 | 
				
			||||||
 | 
						 * That's why some drivers use "Input Source" as a workaround.
 | 
				
			||||||
 | 
						 * Hence, this is a workaround for a workaround to get the things
 | 
				
			||||||
 | 
						 * straight back again.  Sigh.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						if (!strcmp(name, "Input Source")) {
 | 
				
			||||||
 | 
							*type = CTL_CAPTURE_ROUTE;
 | 
				
			||||||
 | 
							return strlen(name);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1629,6 +1642,11 @@ static int simple_add1(snd_mixer_class_t *class, const char *name,
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		unsigned int n;
 | 
							unsigned int n;
 | 
				
			||||||
		if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
 | 
							if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
 | 
				
			||||||
 | 
								if (type == CTL_PLAYBACK_ROUTE)
 | 
				
			||||||
 | 
									type = CTL_PLAYBACK_ENUM;
 | 
				
			||||||
 | 
								else if (type == CTL_CAPTURE_ROUTE)
 | 
				
			||||||
 | 
									type = CTL_CAPTURE_ENUM;
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
				type = CTL_GLOBAL_ENUM;
 | 
									type = CTL_GLOBAL_ENUM;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -1644,6 +1662,11 @@ static int simple_add1(snd_mixer_class_t *class, const char *name,
 | 
				
			||||||
	case CTL_PLAYBACK_SWITCH:
 | 
						case CTL_PLAYBACK_SWITCH:
 | 
				
			||||||
	case CTL_CAPTURE_SWITCH:
 | 
						case CTL_CAPTURE_SWITCH:
 | 
				
			||||||
		if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
 | 
							if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
 | 
				
			||||||
 | 
								if (type == CTL_PLAYBACK_SWITCH)
 | 
				
			||||||
 | 
									type = CTL_PLAYBACK_ENUM;
 | 
				
			||||||
 | 
								else if (type == CTL_CAPTURE_SWITCH)
 | 
				
			||||||
 | 
									type = CTL_CAPTURE_ENUM;
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
				type = CTL_GLOBAL_ENUM;
 | 
									type = CTL_GLOBAL_ENUM;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -1654,6 +1677,11 @@ static int simple_add1(snd_mixer_class_t *class, const char *name,
 | 
				
			||||||
	case CTL_PLAYBACK_VOLUME:
 | 
						case CTL_PLAYBACK_VOLUME:
 | 
				
			||||||
	case CTL_CAPTURE_VOLUME:
 | 
						case CTL_CAPTURE_VOLUME:
 | 
				
			||||||
		if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
 | 
							if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
 | 
				
			||||||
 | 
								if (type == CTL_PLAYBACK_VOLUME)
 | 
				
			||||||
 | 
									type = CTL_PLAYBACK_ENUM;
 | 
				
			||||||
 | 
								else if (type == CTL_CAPTURE_VOLUME)
 | 
				
			||||||
 | 
									type = CTL_CAPTURE_ENUM;
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
				type = CTL_GLOBAL_ENUM;
 | 
									type = CTL_GLOBAL_ENUM;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue