aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-02 22:13:58 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-02 22:13:58 +0000
commit44eb26c16fb66908f75d395e63a16c343c28e00d (patch)
tree34a098ea018bfea9305300662d1b0dfe10a2deb5
parent69176148bfd4a9a40a8d653997a6f2714d65776b (diff)
downloadmpd-44eb26c16fb66908f75d395e63a16c343c28e00d.tar.gz
mpd-44eb26c16fb66908f75d395e63a16c343c28e00d.tar.xz
mpd-44eb26c16fb66908f75d395e63a16c343c28e00d.zip
new commands: enalbe_device, and disable_device, (maybe these commands should be toggles instead of two seperate commands?)
also, on close device, close the shout connection git-svn-id: https://svn.musicpd.org/mpd/trunk@2485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--TODO3
-rw-r--r--src/audio.h6
-rw-r--r--src/audioOutputs/audioOutput_shout.c8
-rw-r--r--src/command.c36
4 files changed, 52 insertions, 1 deletions
diff --git a/TODO b/TODO
index 0e824dd99..5a0a8cb95 100644
--- a/TODO
+++ b/TODO
@@ -30,6 +30,9 @@
*) have children ignore SIGHUP
+*) put more debugging info when failing to read/write db and other similar
+ errors
+
Post-1.0
--------
*) crosslink "list" stuff, for example, artists are crosslinked to alubms and
diff --git a/src/audio.h b/src/audio.h
index 73ad73336..791b7889f 100644
--- a/src/audio.h
+++ b/src/audio.h
@@ -65,4 +65,10 @@ int isCurrentAudioFormat(AudioFormat * audioFormat);
void sendMetadataToAudioDevice(MpdTag * tag);
+/* these functions are called in the main parent process while the child
+ process is busy playing to the audio */
+int enableAudioDevice(FILE * fp, int device);
+
+int disableAudioDevice(FILE * fp, int device);
+
#endif
diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c
index 12ef8c968..414fcdfde 100644
--- a/src/audioOutputs/audioOutput_shout.c
+++ b/src/audioOutputs/audioOutput_shout.c
@@ -289,6 +289,10 @@ static void myShout_finishDriver(AudioOutput * audioOutput) {
}
static void myShout_closeDevice(AudioOutput * audioOutput) {
+ ShoutData * sd = (ShoutData *)audioOutput->data;
+
+ myShout_closeShoutConn(sd);
+
audioOutput->open = 0;
}
@@ -376,7 +380,9 @@ static int myShout_openShoutConn(AudioOutput * audioOutput) {
ShoutData * sd = (ShoutData *)audioOutput->data;
time_t t = time(NULL);
- if(t - sd->lastAttempt < CONN_ATTEMPT_INTERVAL) {
+ if(sd->connAttempts!= 0 &&
+ (t - sd->lastAttempt) < CONN_ATTEMPT_INTERVAL)
+ {
return -1;
}
diff --git a/src/command.c b/src/command.c
index 2155485a1..a98c1cf1f 100644
--- a/src/command.c
+++ b/src/command.c
@@ -82,6 +82,8 @@
#define COMMAND_URL_HANDLERS "urlhandlers"
#define COMMAND_PLCHANGES "plchanges"
#define COMMAND_CURRENTSONG "currentsong"
+#define COMMAND_ENABLE_DEV "enable_device"
+#define COMMAND_DISABLE_DEV "disable_device"
#define COMMAND_STATUS_VOLUME "volume"
#define COMMAND_STATUS_STATE "state"
@@ -756,6 +758,38 @@ int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLength,
return 0;
}
+int handleEnableDevice(FILE * fp, unsigned int * permission, int argArrayLength,
+ char ** argArray)
+{
+ int device;
+ char * test;
+
+ device = strtol(argArray[1],&test,10);
+ if(*test!='\0' || device<0) {
+ commandError(fp, ACK_ERROR_ARG,
+ "\"%s\" is not a integer >= 0", argArray[1]);
+ return -1;
+ }
+
+ return enableAudioDevice(fp, device);
+}
+
+int handleDisableDevice(FILE * fp, unsigned int * permission,
+ int argArrayLength, char ** argArray)
+{
+ int device;
+ char * test;
+
+ device = strtol(argArray[1],&test,10);
+ if(*test!='\0' || device<0) {
+ commandError(fp, ACK_ERROR_ARG,
+ "\"%s\" is not a integer >= 0", argArray[1]);
+ return -1;
+ }
+
+ return disableAudioDevice(fp, device);
+}
+
void initCommands() {
commandList = makeList(free);
@@ -804,6 +838,8 @@ void initCommands() {
addCommand(COMMAND_CROSSFADE ,PERMISSION_CONTROL, 1, 1,handleCrossfade,NULL);
addCommand(COMMAND_URL_HANDLERS,PERMISSION_READ, 0, 0,handleUrlHandlers,NULL);
addCommand(COMMAND_PLCHANGES ,PERMISSION_READ, 1, 1,handlePlaylistChanges,NULL);
+ addCommand(COMMAND_ENABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleEnableDevice,NULL);
+ addCommand(COMMAND_DISABLE_DEV ,PERMISSION_ADMIN, 1, 1,handleDisableDevice,NULL);
sortList(commandList);
}