[player] Config option to disable speaker autoselection (closes #282)

This commit is contained in:
ejurgensen 2016-09-10 23:26:06 +02:00
parent 3d6d4e8521
commit ac290b8b65
3 changed files with 9 additions and 2 deletions

View File

@ -33,6 +33,10 @@ general {
# DAAP requests that take longer than this threshold (in msec) get their # DAAP requests that take longer than this threshold (in msec) get their
# replies cached for next time. Set to 0 to disable caching. # replies cached for next time. Set to 0 to disable caching.
# cache_daap_threshold = 1000 # cache_daap_threshold = 1000
# When starting playback, autoselect speaker (if none of the previously
# selected speakers/outputs are available)
# speaker_autoselect = yes
} }
# Library configuration # Library configuration

View File

@ -55,6 +55,7 @@ static cfg_opt_t sec_general[] =
CFG_BOOL("ipv6", cfg_true, CFGF_NONE), CFG_BOOL("ipv6", cfg_true, CFGF_NONE),
CFG_STR("cache_path", STATEDIR "/cache/" PACKAGE "/cache.db", CFGF_NONE), CFG_STR("cache_path", STATEDIR "/cache/" PACKAGE "/cache.db", CFGF_NONE),
CFG_INT("cache_daap_threshold", 1000, CFGF_NONE), CFG_INT("cache_daap_threshold", 1000, CFGF_NONE),
CFG_BOOL("speaker_autoselect", cfg_true, CFGF_NONE),
CFG_STR("allow_origin", NULL, CFGF_NONE), CFG_STR("allow_origin", NULL, CFGF_NONE),
CFG_END() CFG_END()
}; };

View File

@ -225,6 +225,7 @@ static pthread_t tid_player;
static struct commands_base *cmdbase; static struct commands_base *cmdbase;
/* Config values */ /* Config values */
static int speaker_autoselect;
static int clear_queue_on_stop_disabled; static int clear_queue_on_stop_disabled;
/* Player status */ /* Player status */
@ -2384,8 +2385,8 @@ playback_start_item(union player_arg *cmdarg, int *retval, struct queue_item *qi
} }
} }
/* Try to autoselect a non-selected device if the above failed */ /* If autoselecting is enabled, try to autoselect a non-selected device if the above failed */
if ((*retval == 0) && (output_sessions == 0)) if (speaker_autoselect && (*retval == 0) && (output_sessions == 0))
for (device = dev_list; device; device = device->next) for (device = dev_list; device; device = device->next)
{ {
if ((outputs_priority(device) == 0) || device->session) if ((outputs_priority(device) == 0) || device->session)
@ -3969,6 +3970,7 @@ player_init(void)
player_exit = 0; player_exit = 0;
speaker_autoselect = cfg_getbool(cfg_getsec(cfg, "general"), "speaker_autoselect");
clear_queue_on_stop_disabled = cfg_getbool(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable"); clear_queue_on_stop_disabled = cfg_getbool(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable");
dev_list = NULL; dev_list = NULL;