From f75ab9d3d9335b87c183caba8d45af5a9721b29e Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sat, 14 Mar 2009 09:37:36 +0000 Subject: [PATCH] Expose command backend pause mode to server configuration as well. Organization: Straylight/Edgeware From: Richard Kettlewell --- doc/disorder_config.5.in | 17 +++++++++++++++++ lib/configuration.c | 10 ++++++++++ lib/configuration.h | 3 +++ lib/uaudio-command.c | 1 + 4 files changed, 31 insertions(+) diff --git a/doc/disorder_config.5.in b/doc/disorder_config.5.in index d033258..85135f5 100644 --- a/doc/disorder_config.5.in +++ b/doc/disorder_config.5.in @@ -275,6 +275,10 @@ Execute a command. This is the default if .B speaker_command is specified, or if no native is available. +.IP +You might want to set +.B pause_mode +with this backend. .TP .B rtp Transmit audio over the network. @@ -527,6 +531,19 @@ The maximum days that a track can survive in the database of newly added tracks. The default is 31. .TP +.B pause_mode \fIMODE +Sets the pause mode for the \fBcommand\fR backend. +The possible values are: +.RS +.TP +.B silence +Send silent (0-value) samples when paused. +This is the default. +.TP +.B suspend +Stop writing when paused. +.RE +.TP .B player \fIPATTERN\fR \fIMODULE\fR [\fIOPTIONS.. [\fB\-\-\fR]] \fIARGS\fR... Specifies the player for files matching the glob \fIPATTERN\fR. \fIMODULE\fR specifies which plugin module to use. diff --git a/lib/configuration.c b/lib/configuration.c index 8f04e7d..67d50a0 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -889,6 +889,15 @@ static int validate_backend(const struct config_state attribute((unused)) *cs, return 0; } +static int validate_pausemode(const struct config_state attribute((unused)) *cs, + int nvec, + char **vec) { + if(nvec == 1 && (!strcmp(vec[0], "silence") || !strcmp(vec[0], "suspend"))) + return 0; + error(0, "%s:%d: invalid pause mode", cs->path, cs->line); + return -1; +} + /** @brief Item name and and offset */ #define C(x) #x, offsetof(struct config, x) /** @brief Item name and and offset */ @@ -931,6 +940,7 @@ static const struct conf conf[] = { { C(nice_speaker), &type_integer, validate_any }, { C(noticed_history), &type_integer, validate_positive }, { C(password), &type_string, validate_any }, + { C(pause_mode), &type_string, validate_pausemode }, { C(player), &type_stringlist_accum, validate_player }, { C(plugins), &type_string_accum, validate_isdir }, { C(prefsync), &type_integer, validate_positive }, diff --git a/lib/configuration.h b/lib/configuration.h index acb96b7..9a85e5d 100644 --- a/lib/configuration.h +++ b/lib/configuration.h @@ -171,6 +171,9 @@ struct config { /** @brief Command execute by speaker to play audio */ const char *speaker_command; + /** @brief Pause mode for command backend */ + const char *pause_mode; + /** @brief Target sample format */ struct stream_header sample_format; diff --git a/lib/uaudio-command.c b/lib/uaudio-command.c index 812a3f2..2c610ff 100644 --- a/lib/uaudio-command.c +++ b/lib/uaudio-command.c @@ -151,6 +151,7 @@ static void command_deactivate(void) { static void command_configure(void) { uaudio_set("command", config->speaker_command); + uaudio_set("pause-mode", config->pause_mode); } const struct uaudio uaudio_command = { -- [mdw]