aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-11 18:02:45 +0100
committerMax Kellermann <max@duempel.org>2009-02-11 18:02:45 +0100
commit9d447dda1da059105d0f5da92be384c5e2b57df3 (patch)
treea861a7a842fb318c266e48a7f365061985a2e340 /src/command.c
parent3bc4224bfda5ebf9cd6969ea0f6647b1af3e9da6 (diff)
downloadmpd-9d447dda1da059105d0f5da92be384c5e2b57df3.tar.gz
mpd-9d447dda1da059105d0f5da92be384c5e2b57df3.tar.xz
mpd-9d447dda1da059105d0f5da92be384c5e2b57df3.zip
audio: moved code to output_command.c
The output_command library provides a command interface to the audio outputs. It assumes the input comes from an untrusted source (i.e. the client) and verifies all parameters.
Diffstat (limited to '')
-rw-r--r--src/command.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/command.c b/src/command.c
index 834f0c4b5..e6401896d 100644
--- a/src/command.c
+++ b/src/command.c
@@ -34,7 +34,7 @@
#include "log.h"
#include "stored_playlist.h"
#include "ack.h"
-#include "audio.h"
+#include "output_command.h"
#include "output_print.h"
#include "locate.h"
#include "dbUtils.h"
@@ -1306,34 +1306,38 @@ static enum command_return
handle_enableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
{
unsigned device;
- int ret;
+ bool ret;
if (!check_unsigned(client, &device, argv[1]))
return COMMAND_RETURN_ERROR;
- ret = enableAudioDevice(device);
- if (ret == -1)
+ ret = audio_output_enable_index(device);
+ if (!ret) {
command_error(client, ACK_ERROR_NO_EXIST,
"No such audio output");
+ return COMMAND_RETURN_ERROR;
+ }
- return ret;
+ return COMMAND_RETURN_OK;
}
static enum command_return
handle_disableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
{
unsigned device;
- int ret;
+ bool ret;
if (!check_unsigned(client, &device, argv[1]))
return COMMAND_RETURN_ERROR;
- ret = disableAudioDevice(device);
- if (ret == -1)
+ ret = audio_output_disable_index(device);
+ if (!ret) {
command_error(client, ACK_ERROR_NO_EXIST,
"No such audio output");
+ return COMMAND_RETURN_ERROR;
+ }
- return ret;
+ return COMMAND_RETURN_OK;
}
static enum command_return