modules: add {sink|source|card}_properties argument to all modules

This commit is contained in:
Lennart Poettering 2009-05-28 02:39:22 +02:00
parent 208862698e
commit 1c4393acf0
20 changed files with 231 additions and 48 deletions

View file

@ -1693,6 +1693,12 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
pa_xfree(control_device); pa_xfree(control_device);
} }
if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&data);
goto fail;
}
u->sink = pa_sink_new(m->core, &data, PA_SINK_HARDWARE|PA_SINK_LATENCY|(u->use_tsched ? PA_SINK_DYNAMIC_LATENCY : 0)); u->sink = pa_sink_new(m->core, &data, PA_SINK_HARDWARE|PA_SINK_LATENCY|(u->use_tsched ? PA_SINK_DYNAMIC_LATENCY : 0));
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);

View file

@ -1548,6 +1548,12 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
pa_xfree(control_device); pa_xfree(control_device);
} }
if (pa_modargs_get_proplist(ma, "source_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_source_new_data_done(&data);
goto fail;
}
u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|(u->use_tsched ? PA_SOURCE_DYNAMIC_LATENCY : 0)); u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|(u->use_tsched ? PA_SOURCE_DYNAMIC_LATENCY : 0));
pa_source_new_data_done(&data); pa_source_new_data_done(&data);

View file

@ -43,9 +43,12 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"name=<name for the card/sink/source, to be prefixed> " "name=<name for the card/sink/source, to be prefixed> "
"card_name=<name for card> " "card_name=<name for the card> "
"sink_name=<name for sink> " "card_properties=<properties for the card> "
"source_name=<name for source> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"source_name=<name for the source> "
"source_properties=<properties for the source> "
"device_id=<ALSA card index> " "device_id=<ALSA card index> "
"format=<sample format> " "format=<sample format> "
"rate=<sample rate> " "rate=<sample rate> "
@ -61,8 +64,11 @@ PA_MODULE_USAGE(
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"name", "name",
"card_name", "card_name",
"card_properties",
"sink_name", "sink_name",
"sink_properties",
"source_name", "source_name",
"source_properties",
"device_id", "device_id",
"format", "format",
"rate", "rate",
@ -340,6 +346,12 @@ int pa__init(pa_module *m) {
add_disabled_profile(data.profiles); add_disabled_profile(data.profiles);
if (pa_modargs_get_proplist(ma, "card_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_card_new_data_done(&data);
goto fail;
}
u->card = pa_card_new(m->core, &data); u->card = pa_card_new(m->core, &data);
pa_card_new_data_done(&data); pa_card_new_data_done(&data);

View file

@ -40,6 +40,7 @@ PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"name=<name of the sink, to be prefixed> " "name=<name of the sink, to be prefixed> "
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properities=<properties for the sink> "
"device=<ALSA device> " "device=<ALSA device> "
"device_id=<ALSA card index> " "device_id=<ALSA card index> "
"format=<sample format> " "format=<sample format> "
@ -58,6 +59,7 @@ PA_MODULE_USAGE(
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"name", "name",
"sink_name", "sink_name",
"sink_properties",
"device", "device",
"device_id", "device_id",
"format", "format",

View file

@ -64,6 +64,7 @@ PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"name=<name for the source, to be prefixed> " "name=<name for the source, to be prefixed> "
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> "
"device=<ALSA device> " "device=<ALSA device> "
"device_id=<ALSA card index> " "device_id=<ALSA card index> "
"format=<sample format> " "format=<sample format> "
@ -82,6 +83,7 @@ PA_MODULE_USAGE(
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"name", "name",
"source_name", "source_name",
"source_properties",
"device", "device",
"device_id", "device_id",
"format", "format",

View file

@ -64,8 +64,11 @@ PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"name=<name for the card/sink/source, to be prefixed> " "name=<name for the card/sink/source, to be prefixed> "
"card_name=<name for the card> " "card_name=<name for the card> "
"card_properties=<properties for the card> "
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> "
"address=<address of the device> " "address=<address of the device> "
"profile=<a2dp|hsp> " "profile=<a2dp|hsp> "
"rate=<sample rate> " "rate=<sample rate> "
@ -84,8 +87,11 @@ PA_MODULE_USAGE(
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"name", "name",
"card_name", "card_name",
"card_properties",
"sink_name", "sink_name",
"sink_properties",
"source_name", "source_name",
"source_properties",
"address", "address",
"profile", "profile",
"rate", "rate",
@ -1620,6 +1626,12 @@ static int add_sink(struct userdata *u) {
data.name = get_name("sink", u->modargs, u->address, &b); data.name = get_name("sink", u->modargs, u->address, &b);
data.namereg_fail = b; data.namereg_fail = b;
if (pa_modargs_get_proplist(u->modargs, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&data);
return -1;
}
u->sink = pa_sink_new(u->core, &data, PA_SINK_HARDWARE|PA_SINK_LATENCY | (u->profile == PROFILE_HSP ? PA_SINK_HW_VOLUME_CTRL : 0)); u->sink = pa_sink_new(u->core, &data, PA_SINK_HARDWARE|PA_SINK_LATENCY | (u->profile == PROFILE_HSP ? PA_SINK_HW_VOLUME_CTRL : 0));
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);
@ -1672,6 +1684,12 @@ static int add_source(struct userdata *u) {
data.name = get_name("source", u->modargs, u->address, &b); data.name = get_name("source", u->modargs, u->address, &b);
data.namereg_fail = b; data.namereg_fail = b;
if (pa_modargs_get_proplist(u->modargs, "source_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_source_new_data_done(&data);
return -1;
}
u->source = pa_source_new(u->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY | (u->profile == PROFILE_HSP ? PA_SOURCE_HW_VOLUME_CTRL : 0)); u->source = pa_source_new(u->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY | (u->profile == PROFILE_HSP ? PA_SOURCE_HW_VOLUME_CTRL : 0));
pa_source_new_data_done(&data); pa_source_new_data_done(&data);
@ -1963,13 +1981,17 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
} }
/* Run from main thread */ /* Run from main thread */
static int add_card(struct userdata *u, const char *default_profile, const pa_bluetooth_device *device) { static int add_card(struct userdata *u, const pa_bluetooth_device *device) {
pa_card_new_data data; pa_card_new_data data;
pa_bool_t b; pa_bool_t b;
pa_card_profile *p; pa_card_profile *p;
enum profile *d; enum profile *d;
const char *ff; const char *ff;
char *n; char *n;
const char *default_profile;
pa_assert(u);
pa_assert(device);
pa_card_new_data_init(&data); pa_card_new_data_init(&data);
data.driver = __FILE__; data.driver = __FILE__;
@ -1990,6 +2012,12 @@ static int add_card(struct userdata *u, const char *default_profile, const pa_bl
data.name = get_name("card", u->modargs, device->address, &b); data.name = get_name("card", u->modargs, device->address, &b);
data.namereg_fail = b; data.namereg_fail = b;
if (pa_modargs_get_proplist(u->modargs, "card_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_card_new_data_done(&data);
return -1;
}
data.profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); data.profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
/* we base hsp/a2dp availability on UUIDs. /* we base hsp/a2dp availability on UUIDs.
@ -2032,7 +2060,7 @@ static int add_card(struct userdata *u, const char *default_profile, const pa_bl
*d = PROFILE_OFF; *d = PROFILE_OFF;
pa_hashmap_put(data.profiles, p->name, p); pa_hashmap_put(data.profiles, p->name, p);
if (default_profile) { if ((default_profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
if (pa_hashmap_get(data.profiles, default_profile)) if (pa_hashmap_get(data.profiles, default_profile))
pa_card_new_data_set_profile(&data, default_profile); pa_card_new_data_set_profile(&data, default_profile);
else else
@ -2178,7 +2206,7 @@ int pa__init(pa_module* m) {
goto fail; goto fail;
/* Add the card structure. This will also initialize the default profile */ /* Add the card structure. This will also initialize the default profile */
if (add_card(u, pa_modargs_get_value(ma, "profile", NULL), device) < 0) if (add_card(u, device) < 0)
goto fail; goto fail;
/* Connect to the BT service and query capabilities */ /* Connect to the BT service and query capabilities */

View file

@ -67,12 +67,13 @@ PA_MODULE_DESCRIPTION("JACK Sink");
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(TRUE);
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name of sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the card> "
"server_name=<jack server name> " "server_name=<jack server name> "
"client_name=<jack client name> " "client_name=<jack client name> "
"channels=<number of channels> " "channels=<number of channels> "
"connect=<connect ports?> " "channel_map=<channel map> "
"channel_map=<channel map>"); "connect=<connect ports?>");
#define DEFAULT_SINK_NAME "jack_out" #define DEFAULT_SINK_NAME "jack_out"
@ -102,11 +103,12 @@ struct userdata {
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"sink_name", "sink_name",
"sink_properties",
"server_name", "server_name",
"client_name", "client_name",
"channels", "channels",
"connect",
"channel_map", "channel_map",
"connect",
NULL NULL
}; };
@ -386,6 +388,12 @@ int pa__init(pa_module*m) {
pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Jack sink (%s)", jack_get_client_name(u->client)); pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Jack sink (%s)", jack_get_client_name(u->client));
pa_proplist_sets(data.proplist, "jack.client_name", jack_get_client_name(u->client)); pa_proplist_sets(data.proplist, "jack.client_name", jack_get_client_name(u->client));
if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&data);
goto fail;
}
u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY); u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY);
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);

View file

@ -57,12 +57,13 @@ PA_MODULE_DESCRIPTION("JACK Source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_LOAD_ONCE(TRUE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"source_name=<name of source> " "source_name=<name for the source> "
"source_properties=<properties for the source> "
"server_name=<jack server name> " "server_name=<jack server name> "
"client_name=<jack client name> " "client_name=<jack client name> "
"channels=<number of channels> " "channels=<number of channels> "
"connect=<connect ports?>" "channel_map=<channel map> "
"channel_map=<channel map>"); "connect=<connect ports?>");
#define DEFAULT_SOURCE_NAME "jack_in" #define DEFAULT_SOURCE_NAME "jack_in"
@ -89,11 +90,12 @@ struct userdata {
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"source_name", "source_name",
"source_properties",
"server_name", "server_name",
"client_name", "client_name",
"channels", "channels",
"connect",
"channel_map", "channel_map",
"connect",
NULL NULL
}; };
@ -338,6 +340,12 @@ int pa__init(pa_module*m) {
pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Jack source (%s)", jack_get_client_name(u->client)); pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Jack source (%s)", jack_get_client_name(u->client));
pa_proplist_sets(data.proplist, "jack.client_name", jack_get_client_name(u->client)); pa_proplist_sets(data.proplist, "jack.client_name", jack_get_client_name(u->client));
if (pa_modargs_get_proplist(ma, "source_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_source_new_data_done(&data);
goto fail;
}
u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY); u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY);
pa_source_new_data_done(&data); pa_source_new_data_done(&data);

View file

@ -55,12 +55,13 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"slaves=<slave sinks> " "slaves=<slave sinks> "
"adjust_time=<seconds> " "adjust_time=<seconds> "
"resample_method=<method> " "resample_method=<method> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> "
"rate=<sample rate> " "rate=<sample rate> "
"channels=<number of channels> "
"channel_map=<channel map>"); "channel_map=<channel map>");
#define DEFAULT_SINK_NAME "combined" #define DEFAULT_SINK_NAME "combined"
@ -73,12 +74,13 @@ PA_MODULE_USAGE(
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"sink_name", "sink_name",
"sink_properties",
"slaves", "slaves",
"adjust_time", "adjust_time",
"resample_method", "resample_method",
"format", "format",
"channels",
"rate", "rate",
"channels",
"channel_map", "channel_map",
NULL NULL
}; };
@ -1080,6 +1082,12 @@ int pa__init(pa_module*m) {
if (slaves) if (slaves)
pa_proplist_sets(data.proplist, "combine.slaves", slaves); pa_proplist_sets(data.proplist, "combine.slaves", slaves);
if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&data);
goto fail;
}
u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY); u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY);
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);

View file

@ -68,10 +68,11 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"server=<address> cookie=<filename> " "server=<address> cookie=<filename> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> " "rate=<sample rate> "
"rate=<sample rate>"); "channels=<number of channels>");
#define DEFAULT_SINK_NAME "esound_out" #define DEFAULT_SINK_NAME "esound_out"
@ -118,12 +119,13 @@ struct userdata {
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"sink_name",
"sink_properties",
"server", "server",
"cookie", "cookie",
"rate",
"format", "format",
"rate",
"channels", "channels",
"sink_name",
NULL NULL
}; };
@ -586,6 +588,12 @@ int pa__init(pa_module*m) {
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_API, "esd"); pa_proplist_sets(data.proplist, PA_PROP_DEVICE_API, "esd");
pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "EsounD Output on %s", espeaker); pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "EsounD Output on %s", espeaker);
if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&data);
goto fail;
}
u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_NETWORK); u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_NETWORK);
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);

View file

@ -50,10 +50,11 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"master=<name of sink to remap> " "master=<name of sink to remap> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> "
"rate=<sample rate> " "rate=<sample rate> "
"channels=<number of channels> "
"channel_map=<channel map> " "channel_map=<channel map> "
"plugin=<ladspa plugin name> " "plugin=<ladspa plugin name> "
"label=<ladspa plugin label> " "label=<ladspa plugin label> "
@ -85,10 +86,11 @@ struct userdata {
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"sink_name", "sink_name",
"sink_properties",
"master", "master",
"format", "format",
"channels",
"rate", "rate",
"channels",
"channel_map", "channel_map",
"plugin", "plugin",
"label", "label",
@ -705,6 +707,12 @@ int pa__init(pa_module*m) {
pa_proplist_sets(sink_data.proplist, "device.ladspa.copyright", d->Copyright); pa_proplist_sets(sink_data.proplist, "device.ladspa.copyright", d->Copyright);
pa_proplist_setf(sink_data.proplist, "device.ladspa.unique_id", "%lu", (unsigned long) d->UniqueID); pa_proplist_setf(sink_data.proplist, "device.ladspa.unique_id", "%lu", (unsigned long) d->UniqueID);
if (pa_modargs_get_proplist(ma, "sink_properties", sink_data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&sink_data);
goto fail;
}
u->sink = pa_sink_new(m->core, &sink_data, PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY); u->sink = pa_sink_new(m->core, &sink_data, PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY);
pa_sink_new_data_done(&sink_data); pa_sink_new_data_done(&sink_data);

View file

@ -291,7 +291,7 @@ int pa__init(pa_module*m) {
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_CLASS, "abstract"); pa_proplist_sets(data.proplist, PA_PROP_DEVICE_CLASS, "abstract");
if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) { if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties."); pa_log("Invalid properties");
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);
goto fail; goto fail;
} }

View file

@ -54,10 +54,11 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"file=<path of the FIFO> " "file=<path of the FIFO> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> "
"rate=<sample rate>" "rate=<sample rate>"
"channels=<number of channels> "
"channel_map=<channel map>"); "channel_map=<channel map>");
#define DEFAULT_FILE_NAME "fifo_output" #define DEFAULT_FILE_NAME "fifo_output"
@ -83,11 +84,12 @@ struct userdata {
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"file",
"rate",
"format",
"channels",
"sink_name", "sink_name",
"sink_properties",
"file",
"format",
"rate",
"channels",
"channel_map", "channel_map",
NULL NULL
}; };
@ -279,6 +281,12 @@ int pa__init(pa_module*m) {
pa_sink_new_data_set_sample_spec(&data, &ss); pa_sink_new_data_set_sample_spec(&data, &ss);
pa_sink_new_data_set_channel_map(&data, &map); pa_sink_new_data_set_channel_map(&data, &map);
if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&data);
goto fail;
}
u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY); u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY);
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);

View file

@ -54,10 +54,11 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> "
"file=<path of the FIFO> " "file=<path of the FIFO> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> "
"rate=<sample rate> " "rate=<sample rate> "
"channels=<number of channels> "
"channel_map=<channel map>"); "channel_map=<channel map>");
#define DEFAULT_FILE_NAME "/tmp/music.input" #define DEFAULT_FILE_NAME "/tmp/music.input"
@ -81,11 +82,12 @@ struct userdata {
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"source_name",
"source_properties",
"file", "file",
"format",
"rate", "rate",
"channels", "channels",
"format",
"source_name",
"channel_map", "channel_map",
NULL NULL
}; };
@ -264,6 +266,12 @@ int pa__init(pa_module*m) {
pa_source_new_data_set_sample_spec(&data, &ss); pa_source_new_data_set_sample_spec(&data, &ss);
pa_source_new_data_set_channel_map(&data, &map); pa_source_new_data_set_channel_map(&data, &map);
if (pa_modargs_get_proplist(ma, "source_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_source_new_data_done(&data);
goto fail;
}
u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY); u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY);
pa_source_new_data_done(&data); pa_source_new_data_done(&data);

View file

@ -72,11 +72,11 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"description=<description for the sink> " "sink_properties=<properties for the sink> "
"server=<address> " "server=<address> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> " "rate=<sample rate> "
"rate=<sample rate>"); "channels=<number of channels>");
#define DEFAULT_SINK_NAME "raop" #define DEFAULT_SINK_NAME "raop"
@ -118,12 +118,13 @@ struct userdata {
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"server",
"rate",
"format",
"channels",
"sink_name", "sink_name",
"description", "sink_properties",
"server",
"format",
"rate",
"channels",
"description", /* supported for compatibility reasons, made redundant by sink_properties= */
NULL NULL
}; };
@ -587,6 +588,12 @@ int pa__init(pa_module*m) {
else else
pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "RAOP sink '%s'", server); pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "RAOP sink '%s'", server);
if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&data);
goto fail;
}
u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_NETWORK); u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_NETWORK);
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);

View file

@ -44,6 +44,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"master=<name of sink to remap> " "master=<name of sink to remap> "
"master_channel_map=<channel map> " "master_channel_map=<channel map> "
"format=<sample format> " "format=<sample format> "
@ -62,10 +63,11 @@ struct userdata {
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"sink_name", "sink_name",
"sink_properties",
"master", "master",
"master_channel_map", "master_channel_map",
"rate",
"format", "format",
"rate",
"channels", "channels",
"channel_map", "channel_map",
"remix", "remix",
@ -354,6 +356,12 @@ int pa__init(pa_module*m) {
pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_MASTER_DEVICE, master->name); pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_MASTER_DEVICE, master->name);
pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_CLASS, "filter"); pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_CLASS, "filter");
if (pa_modargs_get_proplist(ma, "sink_properties", sink_data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&sink_data);
goto fail;
}
u->sink = pa_sink_new(m->core, &sink_data, PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY); u->sink = pa_sink_new(m->core, &sink_data, PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY);
pa_sink_new_data_done(&sink_data); pa_sink_new_data_done(&sink_data);

View file

@ -55,8 +55,9 @@ PA_MODULE_DESCRIPTION("Sine wave generator source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"rate=<sample rate> "
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> "
"rate=<sample rate> "
"frequency=<frequency in Hz>"); "frequency=<frequency in Hz>");
#define DEFAULT_SOURCE_NAME "sine_input" #define DEFAULT_SOURCE_NAME "sine_input"
@ -79,8 +80,9 @@ struct userdata {
}; };
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"rate",
"source_name", "source_name",
"source_properties",
"rate",
"frequency", "frequency",
NULL NULL
}; };
@ -248,6 +250,12 @@ int pa__init(pa_module*m) {
pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency); pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency);
pa_source_new_data_set_sample_spec(&data, &ss); pa_source_new_data_set_sample_spec(&data, &ss);
if (pa_modargs_get_proplist(ma, "source_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_source_new_data_done(&data);
goto fail;
}
u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY); u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY);
pa_source_new_data_done(&data); pa_source_new_data_done(&data);

View file

@ -68,7 +68,9 @@ PA_MODULE_DESCRIPTION("Solaris Sink/Source");
PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> "
"device=<audio device file name> " "device=<audio device file name> "
"record=<enable source?> " "record=<enable source?> "
"playback=<enable sink?> " "playback=<enable sink?> "
@ -112,7 +114,9 @@ struct userdata {
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"sink_name", "sink_name",
"sink_properties",
"source_name", "source_name",
"source_properties",
"device", "device",
"record", "record",
"playback", "playback",
@ -897,10 +901,16 @@ int pa__init(pa_module *m) {
pa_source_new_data_set_channel_map(&source_new_data, &map); pa_source_new_data_set_channel_map(&source_new_data, &map);
pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_STRING, u->device_name); pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_STRING, u->device_name);
pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_API, "solaris"); pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_API, "solaris");
pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Solaris PCM source"); pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Solaris PCM source");
pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_ACCESS_MODE, "serial"); pa_proplist_sets(source_new_data.proplist, PA_PROP_DEVICE_ACCESS_MODE, "serial");
pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) u->buffer_size); pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) u->buffer_size);
if (pa_modargs_get_proplist(ma, "source_properties", source_new_data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_source_new_data_done(&source_new_data);
goto fail;
}
u->source = pa_source_new(m->core, &source_new_data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|PA_SOURCE_HW_VOLUME_CTRL); u->source = pa_source_new(m->core, &source_new_data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|PA_SOURCE_HW_VOLUME_CTRL);
pa_source_new_data_done(&source_new_data); pa_source_new_data_done(&source_new_data);
pa_xfree(name_buf); pa_xfree(name_buf);
@ -939,9 +949,15 @@ int pa__init(pa_module *m) {
pa_sink_new_data_set_channel_map(&sink_new_data, &map); pa_sink_new_data_set_channel_map(&sink_new_data, &map);
pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_STRING, u->device_name); pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_STRING, u->device_name);
pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_API, "solaris"); pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_API, "solaris");
pa_proplist_setf(sink_new_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Solaris PCM sink"); pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Solaris PCM sink");
pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_ACCESS_MODE, "serial"); pa_proplist_sets(sink_new_data.proplist, PA_PROP_DEVICE_ACCESS_MODE, "serial");
if (pa_modargs_get_proplist(ma, "sink_properties", sink_new_data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&sink_new_data);
goto fail;
}
u->sink = pa_sink_new(m->core, &sink_new_data, PA_SINK_HARDWARE|PA_SINK_LATENCY|PA_SINK_HW_VOLUME_CTRL|PA_SINK_HW_MUTE_CTRL); u->sink = pa_sink_new(m->core, &sink_new_data, PA_SINK_HARDWARE|PA_SINK_LATENCY|PA_SINK_HW_VOLUME_CTRL|PA_SINK_HW_MUTE_CTRL);
pa_sink_new_data_done(&sink_new_data); pa_sink_new_data_done(&sink_new_data);

View file

@ -64,24 +64,26 @@
#ifdef TUNNEL_SINK #ifdef TUNNEL_SINK
PA_MODULE_DESCRIPTION("Tunnel module for sinks"); PA_MODULE_DESCRIPTION("Tunnel module for sinks");
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the local sink> "
"sink_properties=<properties for the local sink> "
"server=<address> " "server=<address> "
"sink=<remote sink name> " "sink=<remote sink name> "
"cookie=<filename> " "cookie=<filename> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> " "channels=<number of channels> "
"rate=<sample rate> " "rate=<sample rate> "
"sink_name=<name for the local sink> "
"channel_map=<channel map>"); "channel_map=<channel map>");
#else #else
PA_MODULE_DESCRIPTION("Tunnel module for sources"); PA_MODULE_DESCRIPTION("Tunnel module for sources");
PA_MODULE_USAGE( PA_MODULE_USAGE(
"source_name=<name for the local source> "
"source_properties=<properties for the local source> "
"server=<address> " "server=<address> "
"source=<remote source name> " "source=<remote source name> "
"cookie=<filename> " "cookie=<filename> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> " "channels=<number of channels> "
"rate=<sample rate> " "rate=<sample rate> "
"source_name=<name for the local source> "
"channel_map=<channel map>"); "channel_map=<channel map>");
#endif #endif
@ -97,9 +99,11 @@ static const char* const valid_modargs[] = {
"rate", "rate",
#ifdef TUNNEL_SINK #ifdef TUNNEL_SINK
"sink_name", "sink_name",
"sink_properties",
"sink", "sink",
#else #else
"source_name", "source_name",
"source_properties",
"source", "source",
#endif #endif
"channel_map", "channel_map",
@ -1873,6 +1877,12 @@ int pa__init(pa_module*m) {
if (u->sink_name) if (u->sink_name)
pa_proplist_sets(data.proplist, "tunnel.remote.sink", u->sink_name); pa_proplist_sets(data.proplist, "tunnel.remote.sink", u->sink_name);
if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&data);
goto fail;
}
u->sink = pa_sink_new(m->core, &data, PA_SINK_NETWORK|PA_SINK_LATENCY|PA_SINK_HW_VOLUME_CTRL|PA_SINK_HW_MUTE_CTRL); u->sink = pa_sink_new(m->core, &data, PA_SINK_NETWORK|PA_SINK_LATENCY|PA_SINK_HW_VOLUME_CTRL|PA_SINK_HW_MUTE_CTRL);
pa_sink_new_data_done(&data); pa_sink_new_data_done(&data);
@ -1911,6 +1921,12 @@ int pa__init(pa_module*m) {
if (u->source_name) if (u->source_name)
pa_proplist_sets(data.proplist, "tunnel.remote.source", u->source_name); pa_proplist_sets(data.proplist, "tunnel.remote.source", u->source_name);
if (pa_modargs_get_proplist(ma, "source_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_source_new_data_done(&data);
goto fail;
}
u->source = pa_source_new(m->core, &data, PA_SOURCE_NETWORK|PA_SOURCE_LATENCY); u->source = pa_source_new(m->core, &data, PA_SOURCE_NETWORK|PA_SOURCE_LATENCY);
pa_source_new_data_done(&data); pa_source_new_data_done(&data);

View file

@ -85,16 +85,18 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_LOAD_ONCE(FALSE);
PA_MODULE_USAGE( PA_MODULE_USAGE(
"sink_name=<name for the sink> " "sink_name=<name for the sink> "
"sink_properties=<properties for the sink> "
"source_name=<name for the source> " "source_name=<name for the source> "
"source_properties=<properties for the source> "
"device=<OSS device> " "device=<OSS device> "
"record=<enable source?> " "record=<enable source?> "
"playback=<enable sink?> " "playback=<enable sink?> "
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> "
"rate=<sample rate> " "rate=<sample rate> "
"channels=<number of channels> "
"channel_map=<channel map> "
"fragments=<number of fragments> " "fragments=<number of fragments> "
"fragment_size=<fragment size> " "fragment_size=<fragment size> "
"channel_map=<channel map> "
"mmap=<enable memory mapping?>"); "mmap=<enable memory mapping?>");
#define DEFAULT_DEVICE "/dev/dsp" #define DEFAULT_DEVICE "/dev/dsp"
@ -140,7 +142,9 @@ struct userdata {
static const char* const valid_modargs[] = { static const char* const valid_modargs[] = {
"sink_name", "sink_name",
"sink_properties",
"source_name", "source_name",
"source_properties",
"device", "device",
"record", "record",
"playback", "playback",
@ -1314,6 +1318,12 @@ int pa__init(pa_module*m) {
pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) (u->in_hwbuf_size)); pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) (u->in_hwbuf_size));
pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (u->in_fragment_size)); pa_proplist_setf(source_new_data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (u->in_fragment_size));
if (pa_modargs_get_proplist(ma, "source_properties", source_new_data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_source_new_data_done(&source_new_data);
goto fail;
}
u->source = pa_source_new(m->core, &source_new_data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY); u->source = pa_source_new(m->core, &source_new_data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY);
pa_source_new_data_done(&source_new_data); pa_source_new_data_done(&source_new_data);
pa_xfree(name_buf); pa_xfree(name_buf);
@ -1376,6 +1386,12 @@ int pa__init(pa_module*m) {
pa_proplist_setf(sink_new_data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) (u->out_hwbuf_size)); pa_proplist_setf(sink_new_data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) (u->out_hwbuf_size));
pa_proplist_setf(sink_new_data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (u->out_fragment_size)); pa_proplist_setf(sink_new_data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (u->out_fragment_size));
if (pa_modargs_get_proplist(ma, "sink_properties", sink_new_data.proplist, PA_UPDATE_REPLACE) < 0) {
pa_log("Invalid properties");
pa_sink_new_data_done(&sink_new_data);
goto fail;
}
u->sink = pa_sink_new(m->core, &sink_new_data, PA_SINK_HARDWARE|PA_SINK_LATENCY); u->sink = pa_sink_new(m->core, &sink_new_data, PA_SINK_HARDWARE|PA_SINK_LATENCY);
pa_sink_new_data_done(&sink_new_data); pa_sink_new_data_done(&sink_new_data);
pa_xfree(name_buf); pa_xfree(name_buf);