mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	alsa: allow placing device id in alsa device strings at arbitrary positions
This commit is contained in:
		
							parent
							
								
									31575f7766
								
							
						
					
					
						commit
						334325efd7
					
				
					 4 changed files with 22 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -3179,7 +3179,7 @@ void pa_alsa_profile_set_probe(pa_alsa_profile_set *ps, const char *dev_id, cons
 | 
			
		|||
                try_ss = *ss;
 | 
			
		||||
                try_ss.channels = try_map.channels;
 | 
			
		||||
 | 
			
		||||
                if (!(m ->output_pcm = pa_alsa_open_by_device_string_strv(
 | 
			
		||||
                if (!(m ->output_pcm = pa_alsa_open_by_template(
 | 
			
		||||
                              m->device_strings,
 | 
			
		||||
                              dev_id,
 | 
			
		||||
                              NULL,
 | 
			
		||||
| 
						 | 
				
			
			@ -3203,7 +3203,7 @@ void pa_alsa_profile_set_probe(pa_alsa_profile_set *ps, const char *dev_id, cons
 | 
			
		|||
                try_ss = *ss;
 | 
			
		||||
                try_ss.channels = try_map.channels;
 | 
			
		||||
 | 
			
		||||
                if (!(m ->input_pcm = pa_alsa_open_by_device_string_strv(
 | 
			
		||||
                if (!(m ->input_pcm = pa_alsa_open_by_template(
 | 
			
		||||
                              m->device_strings,
 | 
			
		||||
                              dev_id,
 | 
			
		||||
                              NULL,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -514,7 +514,7 @@ snd_pcm_t *pa_alsa_open_by_device_id_mapping(
 | 
			
		|||
    try_ss.format = ss->format;
 | 
			
		||||
    try_map = m->channel_map;
 | 
			
		||||
 | 
			
		||||
    pcm_handle = pa_alsa_open_by_device_string_strv(
 | 
			
		||||
    pcm_handle = pa_alsa_open_by_template(
 | 
			
		||||
            m->device_strings,
 | 
			
		||||
            dev_id,
 | 
			
		||||
            dev,
 | 
			
		||||
| 
						 | 
				
			
			@ -622,8 +622,8 @@ fail:
 | 
			
		|||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_device_string_strv(
 | 
			
		||||
        char **prefix,
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_template(
 | 
			
		||||
        char **template,
 | 
			
		||||
        const char *dev_id,
 | 
			
		||||
        char **dev,
 | 
			
		||||
        pa_sample_spec *ss,
 | 
			
		||||
| 
						 | 
				
			
			@ -639,10 +639,10 @@ snd_pcm_t *pa_alsa_open_by_device_string_strv(
 | 
			
		|||
    snd_pcm_t *pcm_handle;
 | 
			
		||||
    char **i;
 | 
			
		||||
 | 
			
		||||
    for (i = prefix; *i; i++) {
 | 
			
		||||
    for (i = template; *i; i++) {
 | 
			
		||||
        char *d;
 | 
			
		||||
 | 
			
		||||
        d = pa_sprintf_malloc("%s:%s", *i, dev_id);
 | 
			
		||||
        d = pa_replace(*i, "%f", dev_id);
 | 
			
		||||
 | 
			
		||||
        pcm_handle = pa_alsa_open_by_device_string(
 | 
			
		||||
                d,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ snd_pcm_t *pa_alsa_open_by_device_id_mapping(
 | 
			
		|||
 | 
			
		||||
/* Opens the explicit ALSA device */
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_device_string(
 | 
			
		||||
        const char *device,
 | 
			
		||||
        const char *dir,
 | 
			
		||||
        char **dev,                       /* modified at return */
 | 
			
		||||
        pa_sample_spec *ss,               /* modified at return */
 | 
			
		||||
        pa_channel_map* map,              /* modified at return */
 | 
			
		||||
| 
						 | 
				
			
			@ -97,8 +97,8 @@ snd_pcm_t *pa_alsa_open_by_device_string(
 | 
			
		|||
        pa_bool_t require_exact_channel_number);
 | 
			
		||||
 | 
			
		||||
/* Opens the explicit ALSA device with a fallback list */
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_device_string_strv(
 | 
			
		||||
        char **device,
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_template(
 | 
			
		||||
        char **template,
 | 
			
		||||
        const char *dev_id,
 | 
			
		||||
        char **dev,                       /* modified at return */
 | 
			
		||||
        pa_sample_spec *ss,               /* modified at return */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,49 +22,49 @@
 | 
			
		|||
auto-profiles = yes
 | 
			
		||||
 | 
			
		||||
[Mapping analog-mono]
 | 
			
		||||
device-strings = hw
 | 
			
		||||
device-strings = hw:%f
 | 
			
		||||
channel-map = mono
 | 
			
		||||
paths-output = analog-output analog-output-headphones analog-output-mono analog-output-lfe-on-mono
 | 
			
		||||
paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
 | 
			
		||||
priority = 1
 | 
			
		||||
 | 
			
		||||
[Mapping analog-stereo]
 | 
			
		||||
device-strings = front hw
 | 
			
		||||
device-strings = front:%f hw:%f
 | 
			
		||||
channel-map = left,right
 | 
			
		||||
paths-output = analog-output analog-output-headphones analog-output-mono analog-output-lfe-on-mono
 | 
			
		||||
paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
 | 
			
		||||
priority = 10
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-40]
 | 
			
		||||
device-strings = surround40
 | 
			
		||||
device-strings = surround40:%f
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 7
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-41]
 | 
			
		||||
device-strings = surround41
 | 
			
		||||
device-strings = surround41:%f
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,lfe
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 8
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-50]
 | 
			
		||||
device-strings = surround50
 | 
			
		||||
device-strings = surround50:%f
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,front-center
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 7
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-51]
 | 
			
		||||
device-strings = surround51
 | 
			
		||||
device-strings = surround51:%f
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 8
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-71]
 | 
			
		||||
device-strings = surround71
 | 
			
		||||
device-strings = surround71:%f
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
 | 
			
		||||
description = Analog Surround 7.1
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
| 
						 | 
				
			
			@ -72,29 +72,29 @@ priority = 7
 | 
			
		|||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping iec958-stereo]
 | 
			
		||||
device-strings = iec958
 | 
			
		||||
device-strings = iec958:%f
 | 
			
		||||
channel-map = left,right
 | 
			
		||||
priority = 5
 | 
			
		||||
 | 
			
		||||
[Mapping iec958-surround-40]
 | 
			
		||||
device-strings = iec958
 | 
			
		||||
device-strings = iec958:%f
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right
 | 
			
		||||
priority = 1
 | 
			
		||||
 | 
			
		||||
[Mapping iec958-ac3-surround-40]
 | 
			
		||||
device-strings = a52
 | 
			
		||||
device-strings = a52:%f
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right
 | 
			
		||||
priority = 2
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping iec958-ac3-surround-51]
 | 
			
		||||
device-strings = a52
 | 
			
		||||
device-strings = a52:%f
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
 | 
			
		||||
priority = 3
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping hdmi-stereo]
 | 
			
		||||
device-strings = hdmi
 | 
			
		||||
device-strings = hdmi:%f
 | 
			
		||||
channel-map = left,right
 | 
			
		||||
priority = 4
 | 
			
		||||
direction = output
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue