module-jack: add jack.client-name option

This commit is contained in:
Wim Taymans 2023-05-04 11:44:55 +02:00
parent 7ac8e29160
commit 43b6054631

View file

@ -43,6 +43,7 @@
* ## Module Options * ## Module Options
* *
* - `jack.server`: the name of the JACK server to tunnel to. * - `jack.server`: the name of the JACK server to tunnel to.
* - `jack.client-name`: the name of the JACK client.
* - `tunnel.mode`: the tunnel mode, sink|source|duplex, default duplex * - `tunnel.mode`: the tunnel mode, sink|source|duplex, default duplex
* - `source.props`: Extra properties for the source filter. * - `source.props`: Extra properties for the source filter.
* - `sink.props`: Extra properties for the sink filter. * - `sink.props`: Extra properties for the sink filter.
@ -67,10 +68,11 @@
* context.modules = [ * context.modules = [
* { name = libpipewire-module-jack-tunnel * { name = libpipewire-module-jack-tunnel
* args = { * args = {
* #jack.server = null * #jack.server = null
* #tunnel.mode = duplex * #jack.client-name = PipeWire
* #audio.channels = 2 * #tunnel.mode = duplex
* #audio.position = [ FL FR ] * #audio.channels = 2
* #audio.position = [ FL FR ]
* source.props = { * source.props = {
* # extra sink properties * # extra sink properties
* } * }
@ -88,15 +90,16 @@
PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
#define PW_LOG_TOPIC_DEFAULT mod_topic #define PW_LOG_TOPIC_DEFAULT mod_topic
#define DEFAULT_CHANNELS 2 #define DEFAULT_CLIENT_NAME "PipeWire"
#define DEFAULT_POSITION "[ FL FR ]" #define DEFAULT_CHANNELS 2
#define DEFAULT_POSITION "[ FL FR ]"
#define MODULE_USAGE "( remote.name=<remote> ] " \ #define MODULE_USAGE "( remote.name=<remote> ] " \
"( node.name=<name of the nodes> ] " \ "( jack.server=<server name> ) " \
"( node.description=<description of the nodes> ] " \ "( jack.client-name=<name of the JACK client> ] " \
"( tunnel.mode=<sink|source|duplex> ] " \
"( audio.channels=<number of channels> ] " \ "( audio.channels=<number of channels> ] " \
"( audio.position=<channel map> ] " \ "( audio.position=<channel map> ] " \
"( jack.server=<server name> ) " \
"( source.props=<properties> ) " \ "( source.props=<properties> ) " \
"( sink.props=<properties> ) " "( sink.props=<properties> ) "
@ -745,16 +748,19 @@ static void jack_latency(jack_latency_callback_mode_t mode, void *arg)
static int create_jack_client(struct impl *impl) static int create_jack_client(struct impl *impl)
{ {
const char *server_name; const char *server_name, *client_name;
jack_options_t options = JackNullOption; jack_options_t options = JackNullOption;
jack_status_t status; jack_status_t status;
server_name = pw_properties_get(impl->props, "jack.server"); server_name = pw_properties_get(impl->props, "jack.server");
if (server_name != NULL) if (server_name != NULL)
options |= JackServerName; options |= JackServerName;
impl->client = jack_client_open("pipewire", options, &status, server_name); client_name = pw_properties_get(impl->props, "jack.client-name");
if (client_name == NULL)
client_name = DEFAULT_CLIENT_NAME;
impl->client = jack_client_open(client_name, options, &status, server_name);
if (impl->client == NULL) { if (impl->client == NULL) {
pw_log_error ("jack_client_open() failed 0x%2.0x\n", status); pw_log_error ("jack_client_open() failed 0x%2.0x\n", status);
return -EIO; return -EIO;