]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/remap.c
remap: Don't use PA_VOLUME_NORM
[pulseaudio] / src / pulsecore / remap.c
index a0fc85b96996ba3fb11b477aa5b2a536c06d071e..da72a620c4124a684145c40781fb3626299853e9 100644 (file)
 #include <string.h>
 
 #include <pulse/sample.h>
+#include <pulse/volume.h>
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 
 #include "remap.h"
 
-static void remap_mono_to_stereo_c (pa_remap_t *m, void *dst, const void *src, unsigned n) {
+static void remap_mono_to_stereo_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
     unsigned i;
 
     switch (*m->format) {
@@ -85,7 +86,7 @@ static void remap_mono_to_stereo_c (pa_remap_t *m, void *dst, const void *src, u
     }
 }
 
-static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src, unsigned n) {
+static void remap_channels_matrix_c(pa_remap_t *m, void *dst, const void *src, unsigned n) {
     unsigned oc, ic, i;
     unsigned n_ic, n_oc;
 
@@ -97,7 +98,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
         {
             float *d, *s;
 
-            memset(dst, 0, n * sizeof (float) * n_oc);
+            memset(dst, 0, n * sizeof(float) * n_oc);
 
             for (oc = 0; oc < n_oc; oc++) {
 
@@ -128,7 +129,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
         {
             int16_t *d, *s;
 
-            memset(dst, 0, n * sizeof (int16_t) * n_oc);
+            memset(dst, 0, n * sizeof(int16_t) * n_oc);
 
             for (oc = 0; oc < n_oc; oc++) {
 
@@ -160,7 +161,7 @@ static void remap_channels_matrix_c (pa_remap_t *m, void *dst, const void *src,
 }
 
 /* set the function that will execute the remapping based on the matrices */
-static void init_remap_c (pa_remap_t *m) {
+static void init_remap_c(pa_remap_t *m) {
     unsigned n_oc, n_ic;
 
     n_oc = m->o_ss->channels;
@@ -168,7 +169,7 @@ static void init_remap_c (pa_remap_t *m) {
 
     /* find some common channel remappings, fall back to full matrix operation. */
     if (n_ic == 1 && n_oc == 2 &&
-            m->map_table_f[0][0] >= 1.0 && m->map_table_f[1][0] >= 1.0) {
+            m->map_table_i[0][0] == 0x10000 && m->map_table_i[1][0] == 0x10000) {
         m->do_remap = (pa_do_remap_func_t) remap_mono_to_stereo_c;
         pa_log_info("Using mono to stereo remapping");
     } else {
@@ -177,21 +178,20 @@ static void init_remap_c (pa_remap_t *m) {
     }
 }
 
-
 /* default C implementation */
 static pa_init_remap_func_t remap_func = init_remap_c;
 
-void pa_init_remap (pa_remap_t *m) {
-    pa_assert (remap_func);
+void pa_init_remap(pa_remap_t *m) {
+    pa_assert(remap_func);
 
     m->do_remap = NULL;
 
     /* call the installed remap init function */
-    remap_func (m);
+    remap_func(m);
 
     if (m->do_remap == NULL) {
         /* nothing was installed, fallback to C version */
-        init_remap_c (m);
+        init_remap_c(m);
     }
 }