summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-04-26 15:40:14 +0000
committerLennart Poettering <lennart@poettering.net>2006-04-26 15:40:14 +0000
commit185a57cadd7b4e8e85c7fbecc866d7c279704e12 (patch)
tree41414796a864bf51b65bab997dafb40c1cef07f1 /src/modules
parentfbb0d1436c5c415e3964d57b0dedaa0d8817c289 (diff)
support new channel_map argument in sink/source modules
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@803 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/module-alsa-sink.c16
-rw-r--r--src/modules/module-alsa-source.c16
-rw-r--r--src/modules/module-combine.c38
-rw-r--r--src/modules/module-jack-sink.c19
-rw-r--r--src/modules/module-jack-source.c17
-rw-r--r--src/modules/module-null-sink.c15
-rw-r--r--src/modules/module-oss-mmap.c15
-rw-r--r--src/modules/module-oss.c13
-rw-r--r--src/modules/module-pipe-sink.c14
-rw-r--r--src/modules/module-pipe-source.c16
-rw-r--r--src/modules/module-tunnel.c28
11 files changed, 158 insertions, 49 deletions
diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c
index ecdf8cb0..2c2f1f3e 100644
--- a/src/modules/module-alsa-sink.c
+++ b/src/modules/module-alsa-sink.c
@@ -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 @@ static const char* const valid_modargs[] = {
"rate",
"fragments",
"fragment_size",
+ "channel_map",
NULL
};
@@ -299,6 +308,7 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
diff --git a/src/modules/module-alsa-source.c b/src/modules/module-alsa-source.c
index 7a365286..e4938917 100644
--- a/src/modules/module-alsa-source.c
+++ b/src/modules/module-alsa-source.c
@@ -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 @@ static const char* const valid_modargs[] = {
"format",
"fragments",
"fragment_size",
+ "channel_map",
NULL
};
@@ -287,6 +296,7 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index 80153900..543fffa4 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -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 @@ static const char* const valid_modargs[] = {
"slaves",
"adjust_time",
"resample_method",
+ "format",
+ "channels",
+ "rate",
+ "channel_map",
NULL
};
@@ -296,6 +309,9 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
}
- 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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
}
diff --git a/src/modules/module-jack-sink.c b/src/modules/module-jack-sink.c
index f340ab6d..09030530 100644
--- a/src/modules/module-jack-sink.c
+++ b/src/modules/module-jack-sink.c
@@ -55,8 +55,8 @@ PA_MODULE_USAGE(
"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 @@ static const char* const valid_modargs[] = {
"client_name",
"channels",
"connect",
+ "channel_map",
NULL
};
@@ -233,7 +234,7 @@ static void jack_error_func(const char*t) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
}
diff --git a/src/modules/module-jack-source.c b/src/modules/module-jack-source.c
index 5f0e560d..ad39b9dd 100644
--- a/src/modules/module-jack-source.c
+++ b/src/modules/module-jack-source.c
@@ -56,7 +56,7 @@ PA_MODULE_USAGE(
"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 @@ static const char* const valid_modargs[] = {
"client_name",
"channels",
"connect",
+ "channel_map",
NULL
};
@@ -231,7 +232,7 @@ static void jack_error_func(const char*t) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
}
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 61178239..9c564429 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -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 @@ static const char* const valid_modargs[] = {
"format",
"channels",
"sink_name",
+ "channel_map",
NULL
};
@@ -87,6 +93,7 @@ static void time_callback(pa_mainloop_api *m, pa_time_event*e, const struct time
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
}
diff --git a/src/modules/module-oss-mmap.c b/src/modules/module-oss-mmap.c
index c487f40c..e032ce46 100644
--- a/src/modules/module-oss-mmap.c
+++ b/src/modules/module-oss-mmap.c
@@ -62,7 +62,8 @@ PA_MODULE_USAGE(
"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 @@ static const char* const valid_modargs[] = {
"format",
"rate",
"channels",
+ "channel_map",
NULL
};
@@ -346,7 +348,8 @@ int pa__init(pa_core *c, pa_module*m) {
int playback = 1, record = 1;
pa_modargs *ma = NULL;
char hwdesc[64];
-
+ pa_channel_map map;
+
assert(c);
assert(m);
@@ -380,8 +383,8 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
} 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 @@ int pa__init(pa_core *c, pa_module*m) {
} 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;
diff --git a/src/modules/module-oss.c b/src/modules/module-oss.c
index ccc3c7d9..0795ae39 100644
--- a/src/modules/module-oss.c
+++ b/src/modules/module-oss.c
@@ -61,7 +61,8 @@ PA_MODULE_USAGE(
"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 @@ static const char* const valid_modargs[] = {
"format",
"rate",
"channels",
+ "channel_map",
NULL
};
@@ -322,6 +324,7 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 4ddf26ac..2be1b297 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -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 @@ static const char* const valid_modargs[] = {
"format",
"channels",
"sink_name",
+ "channel_map",
NULL
};
@@ -137,6 +144,7 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
}
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index d3753d25..c80bfd09 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -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 @@ static const char* const valid_modargs[] = {
"channels",
"format",
"source_name",
+ "channel_map",
NULL
};
@@ -115,6 +122,7 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
}
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index abfa68a4..bffcc7c0 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -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 @@ static const char* const valid_modargs[] = {
"source_name",
"source",
#endif
+ "channel_map",
NULL,
};
@@ -838,6 +855,7 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
}
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 @@ int pa__init(pa_core *c, pa_module*m) {
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 @@ int pa__init(pa_core *c, pa_module*m) {
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;
}