[pulseaudio-commits] src/pulsecore

Tanu Kaskinen tanuk at kemper.freedesktop.org
Fri Oct 19 11:35:13 PDT 2012


 src/pulsecore/modargs.c |   14 ++++++++++++++
 src/pulsecore/modargs.h |    3 +++
 2 files changed, 17 insertions(+)

New commits:
commit ffe6e28ea7473e5e7a630d4f16a6d89cd75184b8
Author: Flavio Ceolin <flavio.ceolin at profusion.mobi>
Date:   Tue Oct 9 15:16:29 2012 -0300

    modargs: New function: pa_modargs_get_value_double().

diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c
index 58a7045..af9fabf 100644
--- a/src/pulsecore/modargs.c
+++ b/src/pulsecore/modargs.c
@@ -336,6 +336,20 @@ int pa_modargs_get_value_boolean(pa_modargs *ma, const char *key, pa_bool_t *val
     return 0;
 }
 
+int pa_modargs_get_value_double(pa_modargs *ma, const char *key, double *value) {
+    const char *v;
+
+    pa_assert(value);
+
+    if (!(v = pa_modargs_get_value(ma, key, NULL)))
+        return 0;
+
+    if (pa_atod(v, value) < 0)
+        return -1;
+
+    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 f6e1861..5da9cf1 100644
--- a/src/pulsecore/modargs.h
+++ b/src/pulsecore/modargs.h
@@ -45,6 +45,9 @@ int pa_modargs_get_value_u32(pa_modargs *ma, const char *key, uint32_t *value);
 int pa_modargs_get_value_s32(pa_modargs *ma, const char *key, int32_t *value);
 int pa_modargs_get_value_boolean(pa_modargs *ma, const char *key, pa_bool_t *value);
 
+/* Return a module argument as double value in *value */
+int pa_modargs_get_value_double(pa_modargs *ma, const char *key, double *value);
+
 /* 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);
 



More information about the pulseaudio-commits mailing list