[pulseaudio-discuss] [PATCHv2 4/4] module-remap-source: Add resample_method argument

Peter Meerwald pmeerw at pmeerw.net
Fri Nov 29 06:32:44 PST 2013


From: Peter Meerwald <p.meerwald at bct-electronic.com>

Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
---
 src/modules/module-remap-source.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/modules/module-remap-source.c b/src/modules/module-remap-source.c
index 7c35085..5fa6465 100644
--- a/src/modules/module-remap-source.c
+++ b/src/modules/module-remap-source.c
@@ -55,6 +55,7 @@ PA_MODULE_USAGE(
         "rate=<sample rate> "
         "channels=<number of channels> "
         "channel_map=<channel map> "
+        "resample_method=<resampler> "
         "remix=<remix channels?>");
 
 struct userdata {
@@ -75,6 +76,7 @@ static const char* const valid_modargs[] = {
     "rate",
     "channels",
     "channel_map",
+    "resample_method",
     "remix",
     NULL
 };
@@ -263,6 +265,7 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
 int pa__init(pa_module*m) {
     struct userdata *u;
     pa_sample_spec ss;
+    pa_resample_method_t resample_method = PA_RESAMPLER_INVALID;
     pa_channel_map source_map, stream_map;
     pa_modargs *ma;
     pa_source *master;
@@ -308,6 +311,11 @@ int pa__init(pa_module*m) {
         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->module = m;
     m->userdata = u;
@@ -364,6 +372,7 @@ int pa__init(pa_module*m) {
     pa_source_output_new_data_set_sample_spec(&source_output_data, &ss);
     pa_source_output_new_data_set_channel_map(&source_output_data, &stream_map);
     source_output_data.flags = remix ? 0 : PA_SOURCE_OUTPUT_NO_REMIX;
+    source_output_data.resample_method = resample_method;
 
     pa_source_output_new(&u->source_output, m->core, &source_output_data);
     pa_source_output_new_data_done(&source_output_data);
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list