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;
"rate",
"fragments",
"fragment_size",
+ "channel_map",
NULL
};
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;
}
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;
}
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;
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;
"format",
"fragments",
"fragment_size",
+ "channel_map",
NULL
};
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;
}
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;
}
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;
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)
"slaves",
"adjust_time",
"resample_method",
+ "format",
+ "channels",
+ "rate",
+ "channel_map",
NULL
};
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))) {
}
}
- u = pa_xmalloc(sizeof(struct userdata));
+ u = pa_xnew(struct userdata, 1);
m->userdata = u;
u->sink = NULL;
u->n_outputs = 0;
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;
}
"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"
"client_name",
"channels",
"connect",
+ "channel_map",
NULL
};
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;
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));
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;
}
"client_name=<jack client name> "
"channels=<number of channels> "
"connect=<connect ports?>"
-)
+ "channel_map=<channel map>")
#define DEFAULT_SOURCE_NAME "jack_in"
"client_name",
"channels",
"connect",
+ "channel_map",
NULL
};
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;
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));
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;
}
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"
"format",
"channels",
"sink_name",
+ "channel_map",
NULL
};
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);
}
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;
}
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;
}
"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;
"format",
"rate",
"channels",
+ "channel_map",
NULL
};
int playback = 1, record = 1;
pa_modargs *ma = NULL;
char hwdesc[64];
-
+ pa_channel_map map;
+
assert(c);
assert(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;
}
}
} 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;
} 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;
"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;
"format",
"rate",
"channels",
+ "channel_map",
NULL
};
int mode;
int record = 1, playback = 1;
pa_sample_spec ss;
+ pa_channel_map map;
pa_modargs *ma = NULL;
char hwdesc[64];
}
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;
}
}
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;
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;
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"
"format",
"channels",
"sink_name",
+ "channel_map",
NULL
};
const char *p;
int fd = -1;
pa_sample_spec ss;
+ pa_channel_map map;
pa_modargs *ma = NULL;
assert(c && 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;
}
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;
}
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"
"channels",
"format",
"source_name",
+ "channel_map",
NULL
};
const char *p;
int fd = -1;
pa_sample_spec ss;
+ pa_channel_map map;
pa_modargs *ma = NULL;
assert(c && 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;
}
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;
}
#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")
"source_name",
"source",
#endif
+ "channel_map",
NULL,
};
pa_modargs *ma = NULL;
struct userdata *u = NULL;
pa_sample_spec ss;
+ pa_channel_map map;
struct timeval ntv;
assert(c && 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;
}
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;
}
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;
}