mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	implement device reservation scheme
This commit is contained in:
		
							parent
							
								
									3c73025bf5
								
							
						
					
					
						commit
						c341010304
					
				
					 10 changed files with 1102 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -30,6 +30,8 @@
 | 
			
		|||
#include <pulsecore/modargs.h>
 | 
			
		||||
#include <pulsecore/queue.h>
 | 
			
		||||
 | 
			
		||||
#include <modules/reserve-wrap.h>
 | 
			
		||||
 | 
			
		||||
#include "alsa-util.h"
 | 
			
		||||
#include "alsa-sink.h"
 | 
			
		||||
#include "alsa-source.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -273,11 +275,13 @@ static void set_card_name(pa_card_new_data *data, pa_modargs *ma, const char *de
 | 
			
		|||
    pa_xfree(t);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pa__init(pa_module*m) {
 | 
			
		||||
int pa__init(pa_module *m) {
 | 
			
		||||
    pa_card_new_data data;
 | 
			
		||||
    pa_modargs *ma;
 | 
			
		||||
    int alsa_card_index;
 | 
			
		||||
    struct userdata *u;
 | 
			
		||||
    char rname[32];
 | 
			
		||||
    pa_reserve_wrapper *reserve = NULL;
 | 
			
		||||
 | 
			
		||||
    pa_alsa_redirect_errors_inc();
 | 
			
		||||
    snd_config_update_free_global();
 | 
			
		||||
| 
						 | 
				
			
			@ -303,6 +307,11 @@ int pa__init(pa_module*m) {
 | 
			
		|||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pa_snprintf(rname, sizeof(rname), "Audio%i", alsa_card_index);
 | 
			
		||||
 | 
			
		||||
    if (!(reserve = pa_reserve_wrapper_get(m->core, rname)))
 | 
			
		||||
        goto fail;
 | 
			
		||||
 | 
			
		||||
    pa_card_new_data_init(&data);
 | 
			
		||||
    data.driver = __FILE__;
 | 
			
		||||
    data.module = m;
 | 
			
		||||
| 
						 | 
				
			
			@ -335,11 +344,16 @@ int pa__init(pa_module*m) {
 | 
			
		|||
 | 
			
		||||
    init_profile(u);
 | 
			
		||||
 | 
			
		||||
    pa_reserve_wrapper_unref(reserve);
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
    if (reserve)
 | 
			
		||||
        pa_reserve_wrapper_unref(reserve);
 | 
			
		||||
 | 
			
		||||
    pa__done(m);
 | 
			
		||||
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue