[PATCH 16/23] core: mix: Export function to get/set mixing implementation for a sample format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/pulsecore/mix.c |   16 ++++++++++++++--
 src/pulsecore/mix.h |    5 +++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/mix.c b/src/pulsecore/mix.c
index 2a132e1..73a0962 100644
--- a/src/pulsecore/mix.c
+++ b/src/pulsecore/mix.c
@@ -534,8 +534,6 @@ static void pa_mix_float32re_c(pa_mix_info streams[], unsigned nstreams, unsigne
     }
 }
 
-typedef void (*pa_do_mix_func_t) (pa_mix_info streams[], unsigned nstreams, unsigned channels, void *data, void *end);
-
 static pa_do_mix_func_t do_mix_table[] = {
     [PA_SAMPLE_U8]        = (pa_do_mix_func_t) pa_mix_u8_c,
     [PA_SAMPLE_ALAW]      = (pa_do_mix_func_t) pa_mix_alaw_c,
@@ -597,6 +595,20 @@ size_t pa_mix(
     return length;
 }
 
+pa_do_mix_func_t pa_get_mix_func(pa_sample_format_t f) {
+    pa_assert(f >= 0);
+    pa_assert(f < PA_SAMPLE_MAX);
+
+    return do_mix_table[f];
+}
+
+void pa_set_mix_func(pa_sample_format_t f, pa_do_mix_func_t func) {
+    pa_assert(f >= 0);
+    pa_assert(f < PA_SAMPLE_MAX);
+
+    do_mix_table[f] = func;
+}
+
 typedef union {
   float f;
   uint32_t i;
diff --git a/src/pulsecore/mix.h b/src/pulsecore/mix.h
index 34c998b..27198fc 100644
--- a/src/pulsecore/mix.h
+++ b/src/pulsecore/mix.h
@@ -51,6 +51,11 @@ size_t pa_mix(
     const pa_cvolume *volume,
     pa_bool_t mute);
 
+typedef void (*pa_do_mix_func_t) (pa_mix_info streams[], unsigned nstreams, unsigned channels, void *data, void *end);
+
+pa_do_mix_func_t pa_get_mix_func(pa_sample_format_t f);
+void pa_set_mix_func(pa_sample_format_t f, pa_do_mix_func_t func);
+
 void pa_volume_memchunk(
     pa_memchunk*c,
     const pa_sample_spec *spec,
-- 
1.7.9.5



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux