audio: don't pass "fd" to {en,dis}ableAudioDevice()
No protocol code in the audio output library.
This commit is contained in:
parent
f7e414d934
commit
4ddc0a48e2
17
src/audio.c
17
src/audio.c
@ -19,9 +19,7 @@
|
||||
#include "audio.h"
|
||||
#include "audioOutput.h"
|
||||
#include "log.h"
|
||||
#include "command.h"
|
||||
#include "path.h"
|
||||
#include "ack.h"
|
||||
#include "myfprintf.h"
|
||||
#include "os_compat.h"
|
||||
|
||||
@ -428,13 +426,10 @@ void sendMetadataToAudioDevice(const struct tag *tag)
|
||||
}
|
||||
}
|
||||
|
||||
int enableAudioDevice(int fd, unsigned int device)
|
||||
int enableAudioDevice(unsigned int device)
|
||||
{
|
||||
if (device >= audioOutputArraySize) {
|
||||
commandError(fd, ACK_ERROR_ARG, "audio output device id %i "
|
||||
"doesn't exist\n", device);
|
||||
if (device >= audioOutputArraySize)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(audioDeviceStates[device] & 0x01))
|
||||
audioDeviceStates[device] = DEVICE_ENABLE;
|
||||
@ -442,13 +437,11 @@ int enableAudioDevice(int fd, unsigned int device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int disableAudioDevice(int fd, unsigned int device)
|
||||
int disableAudioDevice(unsigned int device)
|
||||
{
|
||||
if (device >= audioOutputArraySize) {
|
||||
commandError(fd, ACK_ERROR_ARG, "audio output device id %i "
|
||||
"doesn't exist\n", device);
|
||||
if (device >= audioOutputArraySize)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (audioDeviceStates[device] & 0x01)
|
||||
audioDeviceStates[device] = DEVICE_DISABLE;
|
||||
|
||||
|
@ -60,9 +60,9 @@ void sendMetadataToAudioDevice(const struct tag *tag);
|
||||
|
||||
/* these functions are called in the main parent process while the child
|
||||
process is busy playing to the audio */
|
||||
int enableAudioDevice(int fd, unsigned int device);
|
||||
int enableAudioDevice(unsigned int device);
|
||||
|
||||
int disableAudioDevice(int fd, unsigned int device);
|
||||
int disableAudioDevice(unsigned int device);
|
||||
|
||||
void printAudioDevices(int fd);
|
||||
|
||||
|
@ -1177,21 +1177,31 @@ static int handleCrossfade(int fd, mpd_unused int *permission,
|
||||
static int handleEnableDevice(int fd, mpd_unused int *permission,
|
||||
mpd_unused int argc, char *argv[])
|
||||
{
|
||||
int device;
|
||||
int device, ret;
|
||||
|
||||
if (check_int(fd, &device, argv[1], check_non_negative, argv[1]) < 0)
|
||||
return -1;
|
||||
return enableAudioDevice(fd, device);
|
||||
|
||||
ret = enableAudioDevice(device);
|
||||
if (ret == -1)
|
||||
commandError(fd, ACK_ERROR_NO_EXIST, "No such audio output");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int handleDisableDevice(int fd, mpd_unused int *permission,
|
||||
mpd_unused int argc, char *argv[])
|
||||
{
|
||||
int device;
|
||||
int device, ret;
|
||||
|
||||
if (check_int(fd, &device, argv[1], check_non_negative, argv[1]) < 0)
|
||||
return -1;
|
||||
return disableAudioDevice(fd, device);
|
||||
|
||||
ret = disableAudioDevice(device);
|
||||
if (ret == -1)
|
||||
commandError(fd, ACK_ERROR_NO_EXIST, "No such audio output");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int handleDevices(int fd, mpd_unused int *permission,
|
||||
|
Loading…
Reference in New Issue
Block a user