mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	acp: add more properties for the card
Use snd_ctl_card_info to set some more card properties such as the alsa.id, alsa.mixer_name and alsa.components. alsa.id is interesting because it is possible to use udev rules to set a custom id, which is handy when you have two identical cards in the system and want to assign unique ids to them. See #3912
This commit is contained in:
		
							parent
							
								
									99795cb8c1
								
							
						
					
					
						commit
						cc841a7667
					
				
					 2 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
					@ -929,7 +929,7 @@ bool pa_alsa_init_description(pa_proplist *p, pa_card *card) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
 | 
					void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
 | 
				
			||||||
    char *cn, *lcn, *dn;
 | 
					    char *cn, *lcn, *dn, name[64];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(p);
 | 
					    pa_assert(p);
 | 
				
			||||||
    pa_assert(card >= 0);
 | 
					    pa_assert(card >= 0);
 | 
				
			||||||
| 
						 | 
					@ -951,6 +951,9 @@ void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
 | 
				
			||||||
        pa_xfree(dn);
 | 
					        pa_xfree(dn);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    snprintf(name, sizeof(name), "hw:%d", card);
 | 
				
			||||||
 | 
					    pa_alsa_init_proplist_ctl(p, name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_UDEV
 | 
					#ifdef HAVE_UDEV
 | 
				
			||||||
    pa_udev_get_info(card, p);
 | 
					    pa_udev_get_info(card, p);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					@ -1037,7 +1040,6 @@ void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm) {
 | 
				
			||||||
        pa_alsa_init_proplist_pcm_info(c, p, info);
 | 
					        pa_alsa_init_proplist_pcm_info(c, p, info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
					 | 
				
			||||||
void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name) {
 | 
					void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name) {
 | 
				
			||||||
    int err;
 | 
					    int err;
 | 
				
			||||||
    snd_ctl_t *ctl;
 | 
					    snd_ctl_t *ctl;
 | 
				
			||||||
| 
						 | 
					@ -1065,9 +1067,13 @@ void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name) {
 | 
				
			||||||
    if ((t = snd_ctl_card_info_get_components(info)) && *t)
 | 
					    if ((t = snd_ctl_card_info_get_components(info)) && *t)
 | 
				
			||||||
        pa_proplist_sets(p, "alsa.components", t);
 | 
					        pa_proplist_sets(p, "alsa.components", t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ((t = snd_ctl_card_info_get_id(info)) && *t)
 | 
				
			||||||
 | 
					        pa_proplist_sets(p, "alsa.id", t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    snd_ctl_close(ctl);
 | 
					    snd_ctl_close(ctl);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents) {
 | 
					int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents) {
 | 
				
			||||||
    snd_pcm_state_t state;
 | 
					    snd_pcm_state_t state;
 | 
				
			||||||
    snd_pcm_hw_params_t *hwparams;
 | 
					    snd_pcm_hw_params_t *hwparams;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -123,9 +123,7 @@ void pa_alsa_refcnt_dec(void);
 | 
				
			||||||
void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info);
 | 
					void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info);
 | 
				
			||||||
void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card);
 | 
					void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card);
 | 
				
			||||||
void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm);
 | 
					void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm);
 | 
				
			||||||
#if 0
 | 
					 | 
				
			||||||
void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name);
 | 
					void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
bool pa_alsa_init_description(pa_proplist *p, pa_card *card);
 | 
					bool pa_alsa_init_description(pa_proplist *p, pa_card *card);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue