mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
media-session: add option to restore bluetooth profile
Add default-profile.restore-bluetooth option to restore the BT profile. See #1567
This commit is contained in:
parent
f277487887
commit
9052b1be33
2 changed files with 8 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ context.properties = {
|
||||||
#support.dbus = true
|
#support.dbus = true
|
||||||
#log.level = 2
|
#log.level = 2
|
||||||
#alsa.seq.name = Midi-Bridge
|
#alsa.seq.name = Midi-Bridge
|
||||||
|
#default-profile.restore-bluetooth = false
|
||||||
}
|
}
|
||||||
|
|
||||||
context.spa-libs = {
|
context.spa-libs = {
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,8 @@ struct impl {
|
||||||
struct spa_hook meta_listener;
|
struct spa_hook meta_listener;
|
||||||
|
|
||||||
struct pw_properties *properties;
|
struct pw_properties *properties;
|
||||||
|
|
||||||
|
unsigned int restore_bluetooth:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct device {
|
struct device {
|
||||||
|
|
@ -399,7 +401,7 @@ static void object_update(void *data)
|
||||||
|
|
||||||
if (dev->obj->info && dev->obj->info->props &&
|
if (dev->obj->info && dev->obj->info->props &&
|
||||||
(str = spa_dict_lookup(dev->obj->info->props, PW_KEY_DEVICE_BUS)) != NULL &&
|
(str = spa_dict_lookup(dev->obj->info->props, PW_KEY_DEVICE_BUS)) != NULL &&
|
||||||
spa_streq(str, "bluetooth"))
|
spa_streq(str, "bluetooth") && !impl->restore_bluetooth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dev->obj->obj.changed & SM_DEVICE_CHANGE_MASK_PARAMS)
|
if (dev->obj->obj.changed & SM_DEVICE_CHANGE_MASK_PARAMS)
|
||||||
|
|
@ -479,6 +481,7 @@ int sm_default_profile_start(struct sm_media_session *session)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
int res;
|
int res;
|
||||||
|
const char *str;
|
||||||
|
|
||||||
impl = calloc(1, sizeof(struct impl));
|
impl = calloc(1, sizeof(struct impl));
|
||||||
if (impl == NULL)
|
if (impl == NULL)
|
||||||
|
|
@ -493,6 +496,9 @@ int sm_default_profile_start(struct sm_media_session *session)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((str = pw_properties_get(session->props, "default-profile.restore-bluetooth")) != NULL)
|
||||||
|
impl->restore_bluetooth = pw_properties_parse_bool(str);
|
||||||
|
|
||||||
if ((res = sm_media_session_load_state(impl->session,
|
if ((res = sm_media_session_load_state(impl->session,
|
||||||
SESSION_KEY, impl->properties)) < 0)
|
SESSION_KEY, impl->properties)) < 0)
|
||||||
pw_log_info("can't load "SESSION_KEY" state: %s", spa_strerror(res));
|
pw_log_info("can't load "SESSION_KEY" state: %s", spa_strerror(res));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue