[pulseaudio-commits] 2 commits - src/pulsecore

Tanu Kaskinen tanuk at kemper.freedesktop.org
Tue Oct 29 18:37:06 CET 2013


 src/pulsecore/modargs.c |   33 +++++++++++++++++++++++++++++++++
 src/pulsecore/modargs.h |    7 +++++++
 2 files changed, 40 insertions(+)

New commits:
commit 832ad693f5081b09a36d180f81c19be9092eb2e9
Author: Peter Meerwald <pmeerw at pmeerw.net>
Date:   Thu Aug 8 08:19:34 2013 +0200

    modargs: Add pa_modargs_get_sample_rate()
    
    return sample rate from the "rate" module argument
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c
index 8333de7..04e60fd 100644
--- a/src/pulsecore/modargs.c
+++ b/src/pulsecore/modargs.c
@@ -364,6 +364,21 @@ int pa_modargs_get_value_volume(pa_modargs *ma, const char *key, pa_volume_t *va
     return 0;
 }
 
+int pa_modargs_get_sample_rate(pa_modargs *ma, uint32_t *rate) {
+    uint32_t rate_local;
+
+    pa_assert(rate);
+
+    if ((pa_modargs_get_value_u32(ma, "rate", &rate_local)) < 0 ||
+        rate_local <= 0 ||
+        rate_local > PA_RATE_MAX)
+        return -1;
+
+    *rate = rate_local;
+
+    return 0;
+}
+
 int pa_modargs_get_sample_spec(pa_modargs *ma, pa_sample_spec *rss) {
     const char *format;
     uint32_t channels;
diff --git a/src/pulsecore/modargs.h b/src/pulsecore/modargs.h
index 274e943..6d6b477 100644
--- a/src/pulsecore/modargs.h
+++ b/src/pulsecore/modargs.h
@@ -53,6 +53,9 @@ int pa_modargs_get_value_double(pa_modargs *ma, const char *key, double *value);
 /* Return a module argument as pa_volume_t value in *value */
 int pa_modargs_get_value_volume(pa_modargs *ma, const char *key, pa_volume_t *value);
 
+/* Return sample rate from the "rate" argument */
+int pa_modargs_get_sample_rate(pa_modargs *ma, uint32_t *rate);
+
 /* Return sample spec data from the three arguments "rate", "format" and "channels" */
 int pa_modargs_get_sample_spec(pa_modargs *ma, pa_sample_spec *ss);
 

commit 22ee1b9d530c33d4b6b65fc097b476496aecc883
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Thu Aug 8 08:19:33 2013 +0200

    modargs: Add pa_modargs_get_resample_method()
    
    Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>

diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c
index 7665b91..8333de7 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 95be54d..274e943 100644
--- a/src/pulsecore/modargs.h
+++ b/src/pulsecore/modargs.h
@@ -28,6 +28,7 @@
 #include <pulse/proplist.h>
 #include <pulse/volume.h>
 #include <pulsecore/macro.h>
+#include <pulsecore/resampler.h>
 
 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



More information about the pulseaudio-commits mailing list