From 22ee1b9d530c33d4b6b65fc097b476496aecc883 Mon Sep 17 00:00:00 2001
From: Peter Meerwald
Date: Thu, 8 Aug 2013 08:19:33 +0200
Subject: [PATCH] modargs: Add pa_modargs_get_resample_method()
Signed-off-by: Peter Meerwald
---
src/pulsecore/modargs.c | 18 ++++++++++++++++++
src/pulsecore/modargs.h | 4 ++++
2 files changed, 22 insertions(+)
diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c
index 7665b91b8..8333de7d6 100644
--- a/src/pulsecore/modargs.c
+++ b/src/pulsecore/modargs.c
@@ -428,6 +428,24 @@ int pa_modargs_get_channel_map(pa_modargs *ma, const char *name, pa_channel_map
return 0;
}
+int pa_modargs_get_resample_method(pa_modargs *ma, pa_resample_method_t *rmethod) {
+ const char *m;
+
+ pa_assert(ma);
+ pa_assert(rmethod);
+
+ if ((m = pa_modargs_get_value(ma, "resample_method", NULL))) {
+ pa_resample_method_t method = pa_parse_resample_method(m);
+
+ if (method == PA_RESAMPLER_INVALID)
+ return -1;
+
+ *rmethod = method;
+ }
+
+ return 0;
+}
+
int pa_modargs_get_sample_spec_and_channel_map(
pa_modargs *ma,
pa_sample_spec *rss,
diff --git a/src/pulsecore/modargs.h b/src/pulsecore/modargs.h
index 95be54d8f..274e94306 100644
--- a/src/pulsecore/modargs.h
+++ b/src/pulsecore/modargs.h
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
typedef struct pa_modargs pa_modargs;
@@ -58,6 +59,9 @@ int pa_modargs_get_sample_spec(pa_modargs *ma, pa_sample_spec *ss);
/* Return channel map data from the argument "channel_map" if name is NULL, otherwise read from the specified argument */
int pa_modargs_get_channel_map(pa_modargs *ma, const char *name, pa_channel_map *map);
+/* Return resample method from the argument "resample_method" */
+int pa_modargs_get_resample_method(pa_modargs *ma, pa_resample_method_t *method);
+
/* Combination of pa_modargs_get_sample_spec() and
pa_modargs_get_channel_map(). Not always suitable, since this routine
initializes the map parameter based on the channels field of the ss