mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
core: always use explicitly configured properties first
First use the configured properties, then use the env variables. Make the daemon use the env variable by default. This makes it possible to start servers with PIPEWIRE_CORE env variable names but still override with the command option. Makes it possible to make apps connect to PIPEWIRE_REMOTE env by default and allows you to override with the command option.
This commit is contained in:
parent
bb20e0646c
commit
141238d88b
4 changed files with 23 additions and 15 deletions
|
|
@ -978,15 +978,16 @@ static const struct spa_loop_control_hooks impl_hooks = {
|
|||
};
|
||||
|
||||
static const char *
|
||||
get_name(const struct spa_dict *props)
|
||||
get_server_name(const struct spa_dict *props)
|
||||
{
|
||||
const char *name;
|
||||
const char *name = NULL;
|
||||
|
||||
name = getenv("PIPEWIRE_CORE");
|
||||
if (props && name == NULL)
|
||||
if (props)
|
||||
name = spa_dict_lookup(props, PW_KEY_CORE_NAME);
|
||||
if (name == NULL)
|
||||
name = "pipewire-0";
|
||||
name = getenv("PIPEWIRE_CORE");
|
||||
if (name == NULL)
|
||||
name = PW_DEFAULT_REMOTE;
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
@ -1034,7 +1035,7 @@ impl_add_server(struct pw_protocol *protocol,
|
|||
|
||||
this = &s->this;
|
||||
|
||||
name = get_name(props);
|
||||
name = get_server_name(props);
|
||||
|
||||
if ((res = init_socket_name(s, name)) < 0)
|
||||
goto error;
|
||||
|
|
@ -1142,11 +1143,12 @@ static const struct pw_impl_module_events module_events = {
|
|||
|
||||
static int need_server(struct pw_context *context, const struct spa_dict *props)
|
||||
{
|
||||
const char *val;
|
||||
const char *val = NULL;
|
||||
|
||||
val = getenv("PIPEWIRE_DAEMON");
|
||||
if (val == NULL)
|
||||
if (props)
|
||||
val = spa_dict_lookup(props, PW_KEY_CORE_DAEMON);
|
||||
if (val == NULL)
|
||||
val = getenv("PIPEWIRE_DAEMON");
|
||||
if (val && pw_properties_parse_bool(val))
|
||||
return 1;
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue