[player] Add config option to disable clearing the queue after playback

stops (default is clearing the queue) and if true do not clear the
queue.

This option is necessary because some dacp clients rely on the queue
being empty if player is stopped. Retune for example does not always
show the queue contents if player state is stopped.
This commit is contained in:
chme
2016-02-28 10:34:18 +01:00
parent e3750957f5
commit 1fb1fc7d2d
3 changed files with 14 additions and 2 deletions

View File

@@ -139,6 +139,7 @@ static cfg_opt_t sec_mpd[] =
{
CFG_INT("port", 6600, CFGF_NONE),
CFG_INT("http_port", 0, CFGF_NONE),
CFG_BOOL("clear_queue_on_stop_disable", cfg_false, CFGF_NONE),
CFG_END()
};

View File

@@ -244,6 +244,9 @@ static struct event *exitev;
static struct event *cmdev;
static pthread_t tid_player;
/* Config values */
static int clear_queue_on_stop_disabled;
/* Player status */
static enum play_status player_state;
static enum repeat_mode repeat;
@@ -2167,10 +2170,11 @@ playback_abort(void)
source_stop();
playerqueue_clear(NULL);
evbuffer_drain(audio_buf, evbuffer_get_length(audio_buf));
if (!clear_queue_on_stop_disabled)
playerqueue_clear(NULL);
status_update(PLAY_STOPPED);
metadata_purge();
@@ -4590,6 +4594,8 @@ player_init(void)
player_exit = 0;
clear_queue_on_stop_disabled = cfg_getbool(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable");
dev_autoselect = 1;
dev_list = NULL;