[polypaudio-commits] r803 - in /trunk/src/modules: module-alsa-sink.c module-alsa-source.c module-combine.c module-jack-sink.c module-jack-source.c module-null-sink.c module-oss-mmap.c module-oss.c module-pipe-sink.c module-pipe-source.c module-tunnel.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed Apr 26 08:40:16 PDT 2006


Author: lennart
Date: Wed Apr 26 17:40:14 2006
New Revision: 803

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=803&root=polypaudio&view=rev
Log:
support new channel_map argument in sink/source modules

Modified:
    trunk/src/modules/module-alsa-sink.c
    trunk/src/modules/module-alsa-source.c
    trunk/src/modules/module-combine.c
    trunk/src/modules/module-jack-sink.c
    trunk/src/modules/module-jack-source.c
    trunk/src/modules/module-null-sink.c
    trunk/src/modules/module-oss-mmap.c
    trunk/src/modules/module-oss.c
    trunk/src/modules/module-pipe-sink.c
    trunk/src/modules/module-pipe-source.c
    trunk/src/modules/module-tunnel.c

Modified: trunk/src/modules/module-alsa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-alsa-sink.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-alsa-sink.c (original)
+++ trunk/src/modules/module-alsa-sink.c Wed Apr 26 17:40:14 2006
@@ -50,7 +50,15 @@
 PA_MODULE_AUTHOR("Lennart Poettering")
 PA_MODULE_DESCRIPTION("ALSA Sink")
 PA_MODULE_VERSION(PACKAGE_VERSION)
-PA_MODULE_USAGE("sink_name=<name for the sink> device=<ALSA device> format=<sample format> channels=<number of channels> rate=<sample rate> fragments=<number of fragments> fragment_size=<fragment size>")
+PA_MODULE_USAGE(
+        "sink_name=<name for the sink> "
+        "device=<ALSA device> "
+        "format=<sample format> "
+        "channels=<number of channels> "
+        "rate=<sample rate> "
+        "fragments=<number of fragments> "
+        "fragment_size=<fragment size> "
+        "channel_map=<channel map>")
 
 struct userdata {
     snd_pcm_t *pcm_handle;
@@ -74,6 +82,7 @@
     "rate",
     "fragments",
     "fragment_size",
+    "channel_map",
     NULL
 };
 
@@ -299,6 +308,7 @@
     struct userdata *u = NULL;
     const char *dev;
     pa_sample_spec ss;
+    pa_channel_map map;
     uint32_t periods, fragsize;
     snd_pcm_uframes_t period_size;
     size_t frame_size;
@@ -311,7 +321,7 @@
     }
 
     ss = c->default_sample_spec;
-    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
+    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
         pa_log(__FILE__": failed to parse sample specification");
         goto fail;
     }
@@ -357,7 +367,7 @@
         u->mixer_handle = NULL;
     }
 
-    u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL);
+    u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map);
     assert(u->sink);
 
     u->sink->get_latency = sink_get_latency_cb;

Modified: trunk/src/modules/module-alsa-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-alsa-source.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-alsa-source.c (original)
+++ trunk/src/modules/module-alsa-source.c Wed Apr 26 17:40:14 2006
@@ -50,7 +50,15 @@
 PA_MODULE_AUTHOR("Lennart Poettering")
 PA_MODULE_DESCRIPTION("ALSA Source")
 PA_MODULE_VERSION(PACKAGE_VERSION)
-PA_MODULE_USAGE("source_name=<name for the source> device=<ALSA device> format=<sample format> channels=<number of channels> rate=<sample rate> fragments=<number of fragments> fragment_size=<fragment size>")
+PA_MODULE_USAGE(
+        "source_name=<name for the source> "
+        "device=<ALSA device> "
+        "format=<sample format> "
+        "channels=<number of channels> "
+        "rate=<sample rate> "
+        "fragments=<number of fragments> "
+        "fragment_size=<fragment size> "
+        "channel_map=<channel map>")
 
 struct userdata {
     snd_pcm_t *pcm_handle;
@@ -74,6 +82,7 @@
     "format",
     "fragments",
     "fragment_size",
+    "channel_map",
     NULL
 };
 
@@ -287,6 +296,7 @@
     struct userdata *u = NULL;
     const char *dev;
     pa_sample_spec ss;
+    pa_channel_map map;
     unsigned periods, fragsize;
     snd_pcm_uframes_t period_size;
     size_t frame_size;
@@ -299,7 +309,7 @@
     }
 
     ss = c->default_sample_spec;
-    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
+    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
         pa_log(__FILE__": failed to parse sample specification");
         goto fail;
     }
@@ -345,7 +355,7 @@
         u->mixer_handle = NULL;
     }
 
-    u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL);
+    u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map);
     assert(u->source);
 
     u->source->userdata = u;

Modified: trunk/src/modules/module-combine.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-combine.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-combine.c (original)
+++ trunk/src/modules/module-combine.c Wed Apr 26 17:40:14 2006
@@ -42,7 +42,16 @@
 PA_MODULE_AUTHOR("Lennart Poettering")
 PA_MODULE_DESCRIPTION("Combine multiple sinks to one")
 PA_MODULE_VERSION(PACKAGE_VERSION)
-PA_MODULE_USAGE("sink_name=<name for the sink> master=<master sink> slaves=<slave sinks> adjust_time=<seconds> resample_method=<method>")
+PA_MODULE_USAGE(
+        "sink_name=<name for the sink> "
+        "master=<master sink> "
+        "slaves=<slave sinks> "
+        "adjust_time=<seconds> "
+        "resample_method=<method> "
+        "format=<sample format> "
+        "channels=<number of channels> "
+        "rate=<sample rate> "
+        "channel_map=<channel map> ")
 
 #define DEFAULT_SINK_NAME "combined"
 #define MEMBLOCKQ_MAXLENGTH (1024*170)
@@ -56,6 +65,10 @@
     "slaves",
     "adjust_time",
     "resample_method",
+    "format",
+    "channels",
+    "rate",
+    "channel_map",
     NULL
 };
 
@@ -296,6 +309,9 @@
     const char*split_state;
     struct timeval tv;
     int resample_method = -1;
+    pa_sample_spec ss;
+    pa_channel_map map;
+    
     assert(c && m);
 
     if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
@@ -310,7 +326,7 @@
         }
     }
     
-    u = pa_xmalloc(sizeof(struct userdata));
+    u = pa_xnew(struct userdata, 1);
     m->userdata = u;
     u->sink = NULL;
     u->n_outputs = 0;
@@ -336,7 +352,23 @@
         goto fail;
     }
 
-    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &master_sink->sample_spec, &master_sink->channel_map))) {
+    ss = master_sink->sample_spec;
+    if ((pa_modargs_get_sample_spec(ma, &ss) < 0)) {
+        pa_log(__FILE__": invalid sample specification.");
+        goto fail;
+    }
+
+    if (ss.channels == master_sink->sample_spec.channels)
+        map = master_sink->channel_map;
+    else
+        pa_channel_map_init_auto(&map, ss.channels);
+
+    if ((pa_modargs_get_channel_map(ma, &map) < 0)) {
+        pa_log(__FILE__": invalid channel map.");
+        goto fail;
+    }
+    
+    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
         pa_log(__FILE__": failed to create sink");
         goto fail;
     }

Modified: trunk/src/modules/module-jack-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-jack-sink.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-jack-sink.c (original)
+++ trunk/src/modules/module-jack-sink.c Wed Apr 26 17:40:14 2006
@@ -55,8 +55,8 @@
         "server_name=<jack server name> "
         "client_name=<jack client name> "
         "channels=<number of channels> "
-        "connect=<connect ports?>"
-)
+        "connect=<connect ports?> "
+        "channel_map=<channel map>")
 
 #define DEFAULT_SINK_NAME "jack_out"
 
@@ -91,6 +91,7 @@
     "client_name",
     "channels",
     "connect",
+    "channel_map",
     NULL
 };
 
@@ -233,7 +234,7 @@
 int pa__init(pa_core *c, pa_module*m) {
     struct userdata *u = NULL;
     pa_sample_spec ss;
-    pa_channel_map cm;
+    pa_channel_map map;
     pa_modargs *ma = NULL;
     jack_status_t status;
     const char *server_name, *client_name;
@@ -294,6 +295,12 @@
         pa_log(__FILE__": failed to parse channels= argument.");
         goto fail;
     }
+
+    pa_channel_map_init_auto(&map, channels);
+    if (pa_modargs_get_channel_map(ma, &map) < 0 || map.channels != channels) {
+        pa_log(__FILE__": failed to parse channel_map= argument.");
+        goto fail;
+    }
     
     pa_log_info(__FILE__": Successfully connected as '%s'", jack_get_client_name(u->client));
 
@@ -303,16 +310,14 @@
 
     assert(pa_sample_spec_valid(&ss));
 
-    pa_channel_map_init_auto(&cm, channels);
-
     for (i = 0; i < ss.channels; i++) {
-        if (!(u->port[i] = jack_port_register(u->client, pa_channel_position_to_string(cm.map[i]), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput|JackPortIsTerminal, 0))) {
+        if (!(u->port[i] = jack_port_register(u->client, pa_channel_position_to_string(map.map[i]), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput|JackPortIsTerminal, 0))) {
             pa_log(__FILE__": jack_port_register() failed.");
             goto fail;
         }
     }
 
-    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &cm))) {
+    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
         pa_log(__FILE__": failed to create sink.");
         goto fail;
     }

Modified: trunk/src/modules/module-jack-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-jack-source.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-jack-source.c (original)
+++ trunk/src/modules/module-jack-source.c Wed Apr 26 17:40:14 2006
@@ -56,7 +56,7 @@
         "client_name=<jack client name> "
         "channels=<number of channels> "
         "connect=<connect ports?>"
-)
+        "channel_map=<channel map>")
 
 #define DEFAULT_SOURCE_NAME "jack_in"
 
@@ -91,6 +91,7 @@
     "client_name",
     "channels",
     "connect",
+    "channel_map",
     NULL
 };
 
@@ -231,7 +232,7 @@
 int pa__init(pa_core *c, pa_module*m) {
     struct userdata *u = NULL;
     pa_sample_spec ss;
-    pa_channel_map cm;
+    pa_channel_map map;
     pa_modargs *ma = NULL;
     jack_status_t status;
     const char *server_name, *client_name;
@@ -292,6 +293,12 @@
         pa_log(__FILE__": failed to parse channels= argument.");
         goto fail;
     }
+
+    pa_channel_map_init_auto(&map, channels);
+    if (pa_modargs_get_channel_map(ma, &map) < 0 || map.channels != channels) {
+        pa_log(__FILE__": failed to parse channel_map= argument.");
+        goto fail;
+    }
     
     pa_log_info(__FILE__": Successfully connected as '%s'", jack_get_client_name(u->client));
 
@@ -301,16 +308,14 @@
 
     assert(pa_sample_spec_valid(&ss));
 
-    pa_channel_map_init_auto(&cm, channels);
-
     for (i = 0; i < ss.channels; i++) {
-        if (!(u->port[i] = jack_port_register(u->client, pa_channel_position_to_string(cm.map[i]), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput|JackPortIsTerminal, 0))) {
+        if (!(u->port[i] = jack_port_register(u->client, pa_channel_position_to_string(map.map[i]), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput|JackPortIsTerminal, 0))) {
             pa_log(__FILE__": jack_port_register() failed.");
             goto fail;
         }
     }
 
-    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &cm))) {
+    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
         pa_log(__FILE__": failed to create source.");
         goto fail;
     }

Modified: trunk/src/modules/module-null-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-null-sink.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-null-sink.c (original)
+++ trunk/src/modules/module-null-sink.c Wed Apr 26 17:40:14 2006
@@ -46,7 +46,12 @@
 PA_MODULE_AUTHOR("Lennart Poettering")
 PA_MODULE_DESCRIPTION("Clocked NULL sink")
 PA_MODULE_VERSION(PACKAGE_VERSION)
-PA_MODULE_USAGE("format=<sample format> channels=<number of channels> rate=<sample rate> sink_name=<name of sink>")
+PA_MODULE_USAGE(
+        "format=<sample format> "
+        "channels=<number of channels> "
+        "rate=<sample rate> "
+        "sink_name=<name of sink>"
+        "channel_map=<channel map>")
 
 #define DEFAULT_SINK_NAME "null"
 
@@ -63,6 +68,7 @@
     "format",
     "channels",
     "sink_name",
+    "channel_map", 
     NULL
 };
 
@@ -87,6 +93,7 @@
 int pa__init(pa_core *c, pa_module*m) {
     struct userdata *u = NULL;
     pa_sample_spec ss;
+    pa_channel_map map;
     pa_modargs *ma = NULL;
     struct timeval tv;
     assert(c && m);
@@ -97,8 +104,8 @@
     }
 
     ss = c->default_sample_spec;
-    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
-        pa_log(__FILE__": invalid sample format specification.");
+    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
+        pa_log(__FILE__": invalid sample format specification or channel map.");
         goto fail;
     }
     
@@ -107,7 +114,7 @@
     u->module = m;
     m->userdata = u;
     
-    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) {
+    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
         pa_log(__FILE__": failed to create sink.");
         goto fail;
     }

Modified: trunk/src/modules/module-oss-mmap.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-oss-mmap.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-oss-mmap.c (original)
+++ trunk/src/modules/module-oss-mmap.c Wed Apr 26 17:40:14 2006
@@ -62,7 +62,8 @@
         "channels=<number of channels> "
         "rate=<sample rate> "
         "fragments=<number of fragments> "
-        "fragment_size=<fragment size>")
+        "fragment_size=<fragment size> "
+        "channel_map=<channel map>")
 
 struct userdata {
     pa_sink *sink;
@@ -97,6 +98,7 @@
     "format",
     "rate",
     "channels",
+    "channel_map",
     NULL
 };
 
@@ -346,7 +348,8 @@
     int playback = 1, record = 1;
     pa_modargs *ma = NULL;
     char hwdesc[64];
-    
+    pa_channel_map map;
+
     assert(c);
     assert(m);
 
@@ -380,8 +383,8 @@
     }
 
     u->sample_spec = c->default_sample_spec;
-    if (pa_modargs_get_sample_spec(ma, &u->sample_spec) < 0) {
-        pa_log(__FILE__": failed to parse sample specification");
+    if (pa_modargs_get_sample_spec_and_channel_map(ma, &u->sample_spec, &map) < 0) {
+        pa_log(__FILE__": failed to parse sample specification or channel map");
         goto fail;
     }
 
@@ -426,7 +429,7 @@
             }
         } else {
         
-            if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &u->sample_spec, NULL)))
+            if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &u->sample_spec, &map)))
                 goto fail;
             
             u->source->userdata = u;
@@ -466,7 +469,7 @@
         } else {
             pa_silence_memory(u->out_mmap, u->out_mmap_length, &u->sample_spec);
             
-            if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &u->sample_spec, NULL)))
+            if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &u->sample_spec, &map)))
                 goto fail;
 
             u->sink->get_latency = sink_get_latency_cb;

Modified: trunk/src/modules/module-oss.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-oss.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-oss.c (original)
+++ trunk/src/modules/module-oss.c Wed Apr 26 17:40:14 2006
@@ -61,7 +61,8 @@
         "channels=<number of channels> "
         "rate=<sample rate> "
         "fragments=<number of fragments> "
-        "fragment_size=<fragment size>")
+        "fragment_size=<fragment size> "
+        "channel_map=<channel map>")
 
 struct userdata {
     pa_sink *sink;
@@ -89,6 +90,7 @@
     "format",
     "rate",
     "channels",
+    "channel_map",
     NULL
 };
 
@@ -322,6 +324,7 @@
     int mode;
     int record = 1, playback = 1;
     pa_sample_spec ss;
+    pa_channel_map map;
     pa_modargs *ma = NULL;
     char hwdesc[64];
     
@@ -353,8 +356,8 @@
     }
 
     ss = c->default_sample_spec;
-    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
-        pa_log(__FILE__": failed to parse sample specification");
+    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
+        pa_log(__FILE__": failed to parse sample specification or channel map");
         goto fail;
     }
     
@@ -399,7 +402,7 @@
     }
 
     if (mode != O_WRONLY) {
-        if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL)))
+        if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map)))
             goto fail;
 
         u->source->userdata = u;
@@ -417,7 +420,7 @@
         u->source = NULL;
 
     if (mode != O_RDONLY) {
-        if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL)))
+        if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map)))
             goto fail;
 
         u->sink->get_latency = sink_get_latency_cb;

Modified: trunk/src/modules/module-pipe-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-pipe-sink.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-pipe-sink.c (original)
+++ trunk/src/modules/module-pipe-sink.c Wed Apr 26 17:40:14 2006
@@ -46,7 +46,13 @@
 PA_MODULE_AUTHOR("Lennart Poettering")
 PA_MODULE_DESCRIPTION("UNIX pipe sink")
 PA_MODULE_VERSION(PACKAGE_VERSION)
-PA_MODULE_USAGE("sink_name=<name for the sink> file=<path of the FIFO> format=<sample format> channels=<number of channels> rate=<sample rate>")
+PA_MODULE_USAGE(
+        "sink_name=<name for the sink> "
+        "file=<path of the FIFO> "
+        "format=<sample format> "
+        "channels=<number of channels> "
+        "rate=<sample rate>"
+        "channel_map=<channel map>")
 
 #define DEFAULT_FIFO_NAME "/tmp/music.output"
 #define DEFAULT_SINK_NAME "fifo_output"
@@ -70,6 +76,7 @@
     "format",
     "channels",
     "sink_name",
+    "channel_map",
     NULL
 };
 
@@ -137,6 +144,7 @@
     const char *p;
     int fd = -1;
     pa_sample_spec ss;
+    pa_channel_map map;
     pa_modargs *ma = NULL;
     assert(c && m);
     
@@ -146,7 +154,7 @@
     }
 
     ss = c->default_sample_spec;
-    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
+    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
         pa_log(__FILE__": invalid sample format specification");
         goto fail;
     }
@@ -176,7 +184,7 @@
     u->module = m;
     m->userdata = u;
     
-    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) {
+    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
         pa_log(__FILE__": failed to create sink.");
         goto fail;
     }

Modified: trunk/src/modules/module-pipe-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-pipe-source.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-pipe-source.c (original)
+++ trunk/src/modules/module-pipe-source.c Wed Apr 26 17:40:14 2006
@@ -46,7 +46,13 @@
 PA_MODULE_AUTHOR("Lennart Poettering")
 PA_MODULE_DESCRIPTION("UNIX pipe source")
 PA_MODULE_VERSION(PACKAGE_VERSION)
-PA_MODULE_USAGE("source_name=<name for the source> file=<path of the FIFO> format=<sample format> channels=<number of channels> rate=<sample rate>")
+PA_MODULE_USAGE(
+        "source_name=<name for the source> "
+        "file=<path of the FIFO> "
+        "format=<sample format> "
+        "channels=<number of channels> "
+        "rate=<sample rate> "
+        "channel_map=<channel map>")
 
 #define DEFAULT_FIFO_NAME "/tmp/music.input"
 #define DEFAULT_SOURCE_NAME "fifo_input"
@@ -68,6 +74,7 @@
     "channels",
     "format",
     "source_name",
+    "channel_map",
     NULL
 };
 
@@ -115,6 +122,7 @@
     const char *p;
     int fd = -1;
     pa_sample_spec ss;
+    pa_channel_map map;
     pa_modargs *ma = NULL;
     assert(c && m);
     
@@ -124,8 +132,8 @@
     }
 
     ss = c->default_sample_spec;
-    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
-        pa_log(__FILE__": invalid sample format specification");
+    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
+        pa_log(__FILE__": invalid sample format specification or channel map");
         goto fail;
     }
     
@@ -153,7 +161,7 @@
     u->filename = pa_xstrdup(p);
     u->core = c;
     
-    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL))) {
+    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
         pa_log(__FILE__": failed to create source.");
         goto fail;
     }

Modified: trunk/src/modules/module-tunnel.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-tunnel.c?rev=803&root=polypaudio&r1=802&r2=803&view=diff
==============================================================================
--- trunk/src/modules/module-tunnel.c (original)
+++ trunk/src/modules/module-tunnel.c Wed Apr 26 17:40:14 2006
@@ -51,11 +51,27 @@
 #ifdef TUNNEL_SINK
 #include "module-tunnel-sink-symdef.h"
 PA_MODULE_DESCRIPTION("Tunnel module for sinks")
-PA_MODULE_USAGE("server=<address> sink=<remote sink name> cookie=<filename> format=<sample format> channels=<number of channels> rate=<sample rate> sink_name=<name for the local sink>")
+PA_MODULE_USAGE(
+        "server=<address> "
+        "sink=<remote sink name> "
+        "cookie=<filename> "
+        "format=<sample format> "
+        "channels=<number of channels> "
+        "rate=<sample rate> "
+        "sink_name=<name for the local sink> "
+        "channel_map=<channel map>")
 #else
 #include "module-tunnel-source-symdef.h"
 PA_MODULE_DESCRIPTION("Tunnel module for sources")
-PA_MODULE_USAGE("server=<address> source=<remote source name> cookie=<filename> format=<sample format> channels=<number of channels> rate=<sample rate> source_name=<name for the local source>")
+PA_MODULE_USAGE(
+        "server=<address> "
+        "source=<remote source name> "
+        "cookie=<filename> "
+        "format=<sample format> "
+        "channels=<number of channels> "
+        "rate=<sample rate> "
+        "source_name=<name for the local source> "
+        "channel_map=<channel map>")
 #endif
 
 PA_MODULE_AUTHOR("Lennart Poettering")
@@ -87,6 +103,7 @@
     "source_name",
     "source",
 #endif
+    "channel_map",
     NULL,
 };
 
@@ -838,6 +855,7 @@
     pa_modargs *ma = NULL;
     struct userdata *u = NULL;
     pa_sample_spec ss;
+    pa_channel_map map;
     struct timeval ntv;
     assert(c && m);
 
@@ -877,7 +895,7 @@
     }
 
     ss = c->default_sample_spec;
-    if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
+    if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map) < 0) {
         pa_log(__FILE__": invalid sample format specification");
         goto fail;
     }
@@ -893,7 +911,7 @@
     pa_socket_client_set_callback(u->client, on_connection, u);
 
 #ifdef TUNNEL_SINK
-    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) {
+    if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
         pa_log(__FILE__": failed to create sink.");
         goto fail;
     }
@@ -909,7 +927,7 @@
 
     pa_sink_set_owner(u->sink, m);
 #else
-    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL))) {
+    if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
         pa_log(__FILE__": failed to create source.");
         goto fail;
     }




More information about the pulseaudio-commits mailing list