mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	add new remix= parameter to remap sink
This commit is contained in:
		
							parent
							
								
									fd5a1b1722
								
							
						
					
					
						commit
						11e55fe01f
					
				
					 1 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
					@ -49,7 +49,8 @@ PA_MODULE_USAGE(
 | 
				
			||||||
        "format=<sample format> "
 | 
					        "format=<sample format> "
 | 
				
			||||||
        "channels=<number of channels> "
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
        "rate=<sample rate> "
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
        "channel_map=<channel map>");
 | 
					        "channel_map=<channel map> "
 | 
				
			||||||
 | 
					        "remix=<remix channels?>");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct userdata {
 | 
					struct userdata {
 | 
				
			||||||
    pa_core *core;
 | 
					    pa_core *core;
 | 
				
			||||||
| 
						 | 
					@ -67,6 +68,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "format",
 | 
					    "format",
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
    "channel_map",
 | 
					    "channel_map",
 | 
				
			||||||
 | 
					    "remix",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -258,6 +260,7 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
    pa_sink *master;
 | 
					    pa_sink *master;
 | 
				
			||||||
    pa_sink_input_new_data sink_input_data;
 | 
					    pa_sink_input_new_data sink_input_data;
 | 
				
			||||||
    pa_sink_new_data sink_data;
 | 
					    pa_sink_new_data sink_data;
 | 
				
			||||||
 | 
					    pa_bool_t remix = TRUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(m);
 | 
					    pa_assert(m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -280,7 +283,7 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    stream_map = sink_map;
 | 
					    stream_map = sink_map;
 | 
				
			||||||
    if (pa_modargs_get_channel_map(ma, "master_channel_map", &stream_map) < 0) {
 | 
					    if (pa_modargs_get_channel_map(ma, "master_channel_map", &stream_map) < 0) {
 | 
				
			||||||
        pa_log("Invalid master hannel map");
 | 
					        pa_log("Invalid master channel map");
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -292,6 +295,11 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
    if (pa_channel_map_equal(&stream_map, &master->channel_map))
 | 
					    if (pa_channel_map_equal(&stream_map, &master->channel_map))
 | 
				
			||||||
        pa_log_warn("No remapping configured, proceeding nonetheless!");
 | 
					        pa_log_warn("No remapping configured, proceeding nonetheless!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (pa_modargs_get_value_boolean(ma, "remix", &remix) < 0) {
 | 
				
			||||||
 | 
					        pa_log("Invalid boolean remix parameter");
 | 
				
			||||||
 | 
					        goto fail;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u = pa_xnew0(struct userdata, 1);
 | 
					    u = pa_xnew0(struct userdata, 1);
 | 
				
			||||||
    u->core = m->core;
 | 
					    u->core = m->core;
 | 
				
			||||||
    u->module = m;
 | 
					    u->module = m;
 | 
				
			||||||
| 
						 | 
					@ -340,7 +348,7 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
    pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
 | 
					    pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
 | 
				
			||||||
    pa_sink_input_new_data_set_channel_map(&sink_input_data, &stream_map);
 | 
					    pa_sink_input_new_data_set_channel_map(&sink_input_data, &stream_map);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->sink_input = pa_sink_input_new(m->core, &sink_input_data, PA_SINK_INPUT_DONT_MOVE);
 | 
					    u->sink_input = pa_sink_input_new(m->core, &sink_input_data, PA_SINK_INPUT_DONT_MOVE | (remix ? PA_SINK_INPUT_NO_REMIX : 0));
 | 
				
			||||||
    pa_sink_input_new_data_done(&sink_input_data);
 | 
					    pa_sink_input_new_data_done(&sink_input_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!u->sink_input)
 | 
					    if (!u->sink_input)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue