mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	module-remap-sink: Add resample_method argument
the main intent is to make testing different sample rate resampling implementations easier; so far there is only global control via resample-method (command line argument and /etc/pulse/daemon.conf) module-remap-*'s only purpose is resampling (comprising format conversion, channel remapping, sample rate adjustment), it can easily be introduced into any audio pipeline Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
This commit is contained in:
		
							parent
							
								
									f8e0b86592
								
							
						
					
					
						commit
						5f7dfd9b91
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
					@ -48,6 +48,7 @@ PA_MODULE_USAGE(
 | 
				
			||||||
        "rate=<sample rate> "
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
        "channels=<number of channels> "
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
        "channel_map=<channel map> "
 | 
					        "channel_map=<channel map> "
 | 
				
			||||||
 | 
					        "resample_method=<resampler> "
 | 
				
			||||||
        "remix=<remix channels?>");
 | 
					        "remix=<remix channels?>");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct userdata {
 | 
					struct userdata {
 | 
				
			||||||
| 
						 | 
					@ -68,6 +69,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "rate",
 | 
					    "rate",
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
    "channel_map",
 | 
					    "channel_map",
 | 
				
			||||||
 | 
					    "resample_method",
 | 
				
			||||||
    "remix",
 | 
					    "remix",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -318,6 +320,7 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
 | 
				
			||||||
int pa__init(pa_module*m) {
 | 
					int pa__init(pa_module*m) {
 | 
				
			||||||
    struct userdata *u;
 | 
					    struct userdata *u;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss;
 | 
				
			||||||
 | 
					    pa_resample_method_t resample_method = PA_RESAMPLER_INVALID;
 | 
				
			||||||
    pa_channel_map sink_map, stream_map;
 | 
					    pa_channel_map sink_map, stream_map;
 | 
				
			||||||
    pa_modargs *ma;
 | 
					    pa_modargs *ma;
 | 
				
			||||||
    pa_sink *master;
 | 
					    pa_sink *master;
 | 
				
			||||||
| 
						 | 
					@ -363,6 +366,11 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (pa_modargs_get_resample_method(ma, &resample_method) < 0) {
 | 
				
			||||||
 | 
					        pa_log("Invalid resampling method");
 | 
				
			||||||
 | 
					        goto fail;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u = pa_xnew0(struct userdata, 1);
 | 
					    u = pa_xnew0(struct userdata, 1);
 | 
				
			||||||
    u->module = m;
 | 
					    u->module = m;
 | 
				
			||||||
    m->userdata = u;
 | 
					    m->userdata = u;
 | 
				
			||||||
| 
						 | 
					@ -418,6 +426,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);
 | 
				
			||||||
    sink_input_data.flags = (remix ? 0 : PA_SINK_INPUT_NO_REMIX);
 | 
					    sink_input_data.flags = (remix ? 0 : PA_SINK_INPUT_NO_REMIX);
 | 
				
			||||||
 | 
					    sink_input_data.resample_method = resample_method;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
 | 
					    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
 | 
				
			||||||
    pa_sink_input_new_data_done(&sink_input_data);
 | 
					    pa_sink_input_new_data_done(&sink_input_data);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue