keys: let env variables overwrite the keys

This commit is contained in:
Wim Taymans 2020-07-22 11:25:19 +02:00
parent 2955182e4e
commit 2bb1d88fbe
3 changed files with 10 additions and 10 deletions

View file

@ -980,12 +980,11 @@ static const struct spa_loop_control_hooks impl_hooks = {
static const char *
get_name(const struct spa_dict *props)
{
const char *name = NULL;
const char *name;
if (props)
name = getenv("PIPEWIRE_CORE");
if (props && name == NULL)
name = spa_dict_lookup(props, PW_KEY_CORE_NAME);
if (name == NULL)
name = getenv("PIPEWIRE_CORE");
if (name == NULL)
name = "pipewire-0";
return name;

View file

@ -39,12 +39,11 @@
static const char *
get_remote(const struct spa_dict *props)
{
const char *name = NULL;
const char *name;
if (props)
name = getenv("PIPEWIRE_REMOTE");
if (props && name == NULL)
name = spa_dict_lookup(props, PW_KEY_REMOTE_NAME);
if (name == NULL)
name = getenv("PIPEWIRE_REMOTE");
if (name == NULL)
name = "pipewire-0";
return name;

View file

@ -64,7 +64,8 @@ extern "C" {
/* core */
#define PW_KEY_CORE_NAME "core.name" /**< The name of the core. Default is
* pipewire-<user-name>-<pid> */
* pipewire-<user-name>-<pid>, overwritten
* by env(PIPEWIRE_CORE) */
#define PW_KEY_CORE_VERSION "core.version" /**< The version of the core. */
#define PW_KEY_CORE_DAEMON "core.daemon" /**< If the core is listening for connections. */
@ -82,7 +83,8 @@ extern "C" {
/* remote keys */
#define PW_KEY_REMOTE_NAME "remote.name" /**< The name of the remote to connect to,
* default env(PIPEWIRE_REMOTE) or pipewire-0 */
* default pipewire-0, overwritten by
* env(PIPEWIRE_REMOTE) */
#define PW_KEY_REMOTE_INTENTION "remote.intention" /**< The intention of the remote connection,
* "generic", "screencast" */