From 185a57cadd7b4e8e85c7fbecc866d7c279704e12 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 Apr 2006 15:40:14 +0000 Subject: 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 --- src/modules/module-alsa-sink.c | 16 +++++++++++++--- src/modules/module-alsa-source.c | 16 +++++++++++++--- src/modules/module-combine.c | 38 +++++++++++++++++++++++++++++++++++--- src/modules/module-jack-sink.c | 19 ++++++++++++------- src/modules/module-jack-source.c | 17 +++++++++++------ src/modules/module-null-sink.c | 15 +++++++++++---- src/modules/module-oss-mmap.c | 15 +++++++++------ src/modules/module-oss.c | 13 ++++++++----- src/modules/module-pipe-sink.c | 14 +++++++++++--- src/modules/module-pipe-source.c | 16 ++++++++++++---- src/modules/module-tunnel.c | 28 +++++++++++++++++++++++----- 11 files changed, 158 insertions(+), 49 deletions(-) diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c index ecdf8cb05..2c2f1f3e4 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= device= format= channels= rate= fragments= fragment_size=") +PA_MODULE_USAGE( + "sink_name= " + "device= " + "format= " + "channels= " + "rate= " + "fragments= " + "fragment_size= " + "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 7a3652866..e49389173 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= device= format= channels= rate= fragments= fragment_size=") +PA_MODULE_USAGE( + "source_name= " + "device= " + "format= " + "channels= " + "rate= " + "fragments= " + "fragment_size= " + "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 801539004..543fffa4a 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= master= slaves= adjust_time= resample_method=") +PA_MODULE_USAGE( + "sink_name= " + "master= " + "slaves= " + "adjust_time= " + "resample_method= " + "format= " + "channels= " + "rate= " + "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 f340ab6d2..090305303 100644 --- a/src/modules/module-jack-sink.c +++ b/src/modules/module-jack-sink.c @@ -55,8 +55,8 @@ PA_MODULE_USAGE( "server_name= " "client_name= " "channels= " - "connect=" -) + "connect= " + "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 5f0e560d5..ad39b9ddc 100644 --- a/src/modules/module-jack-source.c +++ b/src/modules/module-jack-source.c @@ -56,7 +56,7 @@ PA_MODULE_USAGE( "client_name= " "channels= " "connect=" -) + "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 611782399..9c564429c 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= channels= rate= sink_name=") +PA_MODULE_USAGE( + "format= " + "channels= " + "rate= " + "sink_name=" + "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 c487f40c3..e032ce466 100644 --- a/src/modules/module-oss-mmap.c +++ b/src/modules/module-oss-mmap.c @@ -62,7 +62,8 @@ PA_MODULE_USAGE( "channels= " "rate= " "fragments= " - "fragment_size=") + "fragment_size= " + "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 ccc3c7d98..0795ae39a 100644 --- a/src/modules/module-oss.c +++ b/src/modules/module-oss.c @@ -61,7 +61,8 @@ PA_MODULE_USAGE( "channels= " "rate= " "fragments= " - "fragment_size=") + "fragment_size= " + "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 4ddf26acb..2be1b297b 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= file= format= channels= rate=") +PA_MODULE_USAGE( + "sink_name= " + "file= " + "format= " + "channels= " + "rate=" + "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 d3753d25c..c80bfd093 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= file= format= channels= rate=") +PA_MODULE_USAGE( + "source_name= " + "file= " + "format= " + "channels= " + "rate= " + "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 abfa68a41..bffcc7c0c 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=
sink= cookie= format= channels= rate= sink_name=") +PA_MODULE_USAGE( + "server=
" + "sink= " + "cookie= " + "format= " + "channels= " + "rate= " + "sink_name= " + "channel_map=") #else #include "module-tunnel-source-symdef.h" PA_MODULE_DESCRIPTION("Tunnel module for sources") -PA_MODULE_USAGE("server=
source= cookie= format= channels= rate= source_name=") +PA_MODULE_USAGE( + "server=
" + "source= " + "cookie= " + "format= " + "channels= " + "rate= " + "source_name= " + "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; } -- cgit v1.2.1