[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] 2 commits: module-jackdbus-detect: Allow omitting channels argument
Tanu Kaskinen
gitlab at gitlab.freedesktop.org
Thu Jan 2 16:50:38 UTC 2020
Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio
Commits:
64211b8f by Ben Buchwald at 2020-01-02T16:44:15+00:00
module-jackdbus-detect: Allow omitting channels argument
module-jackdbus-detect documents the channels argument as optional and "if
omitted, the sink wil use the number of physical output port and the source
will use the number of physical input ports registered in the JACK server."
However, although it would correctly omit the channels argument to
module-jack-sink and module-jack-source if its channel argument was omitted,
its argument validation was broken to consider omitting channels an error.
This commit properly validates the channels argument so omitting it is
accepted.
- - - - -
bcc2162f by Ben Buchwald at 2020-01-02T16:44:15+00:00
module-jackdbus-detect: Separate sink/source channels arguments
If a channels argument is passed module-jackdbus-detect, it is passed to both
module-jack-sink and module-jack-source when those are started. This is a
problem if you want a different number of input channels from output channels.
In particular, if you want more of one than you physically have of the other,
it will fail. This commit adds separate source_channels and sink_channels
arguments to be able to specify the channels arguments to module-jack-source
and module-jack-sink separately. The combined channels argument is kept for
backwards compatibility and will be used as a default for source_channels and
sink_channels if either of them is omitted.
- - - - -
1 changed file:
- src/modules/jack/module-jackdbus-detect.c
Changes:
=====================================
src/modules/jack/module-jackdbus-detect.c
=====================================
@@ -38,6 +38,8 @@ PA_MODULE_LOAD_ONCE(true);
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_USAGE(
"channels=<number of channels> "
+ "source_channels=<number of channels> "
+ "sink_channels=<number of channels> "
"connect=<connect ports?>");
#define JACK_SERVICE_NAME "org.jackaudio.service"
@@ -59,6 +61,8 @@ PA_MODULE_USAGE(
static const char* const valid_modargs[] = {
"channels",
+ "source_channels",
+ "sink_channels",
"connect",
NULL
};
@@ -79,7 +83,7 @@ struct userdata {
bool filter_added, match_added;
bool is_service_started;
bool autoconnect_ports;
- uint32_t channels;
+ uint32_t channels[JACK_SS_COUNT];
/* Using index here protects us from module unloading without us knowing */
int jack_module_index[JACK_SS_COUNT];
};
@@ -104,8 +108,8 @@ static void ensure_ports_started(struct userdata* u) {
if (!u->jack_module_index[i]) {
char* args;
pa_module* m;
- if (u->channels > 0) {
- args = pa_sprintf_malloc("connect=%s channels=%" PRIu32, pa_yes_no(u->autoconnect_ports), u->channels);
+ if (u->channels[i] > 0) {
+ args = pa_sprintf_malloc("connect=%s channels=%" PRIu32, pa_yes_no(u->autoconnect_ports), u->channels[i]);
} else {
args = pa_sprintf_malloc("connect=%s", pa_yes_no(u->autoconnect_ports));
}
@@ -213,6 +217,8 @@ int pa__init(pa_module *m) {
pa_dbus_connection *connection = NULL;
struct userdata *u = NULL;
pa_modargs *ma;
+ uint32_t channels = 0;
+ int i;
pa_assert(m);
@@ -227,17 +233,29 @@ int pa__init(pa_module *m) {
u->core = m->core;
u->module = m;
u->autoconnect_ports = true;
- u->channels = 0;
if (pa_modargs_get_value_boolean(ma, "connect", &u->autoconnect_ports) < 0) {
pa_log("Failed to parse connect= argument.");
goto fail;
}
- if (pa_modargs_get_value_u32(ma, "channels", &u->channels) < 0 || !pa_channels_valid(u->channels)) {
+ if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 || (channels > 0 && !pa_channels_valid(channels))) {
pa_log("Failed to parse channels= argument.");
goto fail;
}
+ for (i = 0; i < JACK_SS_COUNT; i++) {
+ u->channels[i] = channels;
+ }
+
+ if (pa_modargs_get_value_u32(ma, "source_channels", &u->channels[JACK_SS_SOURCE]) < 0 || (u->channels[JACK_SS_SOURCE] > 0 && !pa_channels_valid(u->channels[JACK_SS_SOURCE]))) {
+ pa_log("Failed to parse source_channels= argument.");
+ goto fail;
+ }
+
+ if (pa_modargs_get_value_u32(ma, "sink_channels", &u->channels[JACK_SS_SINK]) < 0 || (u->channels[JACK_SS_SINK] > 0 && !pa_channels_valid(u->channels[JACK_SS_SINK]))) {
+ pa_log("Failed to parse sink_channels= argument.");
+ goto fail;
+ }
if (!(connection = pa_dbus_bus_get(m->core, DBUS_BUS_SESSION, &error)) || dbus_error_is_set(&error)) {
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/compare/de66644776da40ac7e8d706fb5d5a36d007fa7ee...bcc2162fb4686cc3a7383847e4d2cc166c88e442
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/compare/de66644776da40ac7e8d706fb5d5a36d007fa7ee...bcc2162fb4686cc3a7383847e4d2cc166c88e442
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20200102/d462a3b6/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list