undo change 3081
git-svn-id: https://svn.musicpd.org/mpd/trunk@3085 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
f723517057
commit
d4352ac996
23
AUTHORS
23
AUTHORS
@ -1,19 +1,10 @@
|
|||||||
General Development
|
Developer -> Warren Dukes <shank@mercury.chem.pitt.edu>
|
||||||
- Warren Dukes <shank@mercury.chem.pitt.edu>
|
Developer -> tw-nym
|
||||||
- tw-nym
|
audiofile support and command.c cleanup -> normalperson
|
||||||
- normalperson
|
setuid patch -> Nagilum
|
||||||
|
'next' and 'previous' patch -> Niklas Hofer
|
||||||
'next' and 'previous' command
|
command.c and signal handling cleanup -> mackstann
|
||||||
- Niklas Hofer
|
replayGain -> AliasMrJones
|
||||||
|
|
||||||
'mute' command
|
|
||||||
- danb
|
|
||||||
|
|
||||||
setuid support
|
|
||||||
- nagilum
|
|
||||||
|
|
||||||
replayGain support
|
|
||||||
- AliasMrJones
|
|
||||||
|
|
||||||
libid3tag and libmad copyrighted by Robert Leslie, http://www.underbit.com/products/mad
|
libid3tag and libmad copyrighted by Robert Leslie, http://www.underbit.com/products/mad
|
||||||
mp4ff copyrighted by M. Bakker, Ahead Software AG, http://www.nero.com
|
mp4ff copyrighted by M. Bakker, Ahead Software AG, http://www.nero.com
|
||||||
|
8
TODO
8
TODO
@ -25,12 +25,8 @@
|
|||||||
*) add support for saving and restoring audioOutput state to the
|
*) add support for saving and restoring audioOutput state to the
|
||||||
state_file
|
state_file
|
||||||
|
|
||||||
*) fix killall mpd
|
*) on resetPlayer(), store last state info, so that a killall mpd will
|
||||||
*) have it determine if SIGTERM received from parent pid, if not
|
properlly save the state, even if the player process dies first
|
||||||
then it doesn't exit with EXIT_SUCCESS, but EXIT_FAILURE
|
|
||||||
*) if player died w/ EXIT FAILURE, then store the current
|
|
||||||
state somewhere in case we a SIGTERM was received by the
|
|
||||||
parent
|
|
||||||
|
|
||||||
0.13
|
0.13
|
||||||
----
|
----
|
||||||
|
@ -64,7 +64,6 @@
|
|||||||
#define COMMAND_PREVIOUS "previous"
|
#define COMMAND_PREVIOUS "previous"
|
||||||
#define COMMAND_LISTALL "listall"
|
#define COMMAND_LISTALL "listall"
|
||||||
#define COMMAND_VOLUME "volume"
|
#define COMMAND_VOLUME "volume"
|
||||||
#define COMMAND_MUTE "mute"
|
|
||||||
#define COMMAND_REPEAT "repeat"
|
#define COMMAND_REPEAT "repeat"
|
||||||
#define COMMAND_RANDOM "random"
|
#define COMMAND_RANDOM "random"
|
||||||
#define COMMAND_STATS "stats"
|
#define COMMAND_STATS "stats"
|
||||||
@ -91,7 +90,6 @@
|
|||||||
#define COMMAND_NOTCOMMANDS "notcommands"
|
#define COMMAND_NOTCOMMANDS "notcommands"
|
||||||
|
|
||||||
#define COMMAND_STATUS_VOLUME "volume"
|
#define COMMAND_STATUS_VOLUME "volume"
|
||||||
#define COMMAND_STATUS_MUTE "mute"
|
|
||||||
#define COMMAND_STATUS_STATE "state"
|
#define COMMAND_STATUS_STATE "state"
|
||||||
#define COMMAND_STATUS_REPEAT "repeat"
|
#define COMMAND_STATUS_REPEAT "repeat"
|
||||||
#define COMMAND_STATUS_RANDOM "random"
|
#define COMMAND_STATUS_RANDOM "random"
|
||||||
@ -250,7 +248,6 @@ int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength,
|
|||||||
}
|
}
|
||||||
|
|
||||||
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_VOLUME,getVolumeLevel());
|
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_VOLUME,getVolumeLevel());
|
||||||
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_MUTE,getVolumeMuteStatus());
|
|
||||||
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_REPEAT,getPlaylistRepeatStatus());
|
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_REPEAT,getPlaylistRepeatStatus());
|
||||||
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_RANDOM,getPlaylistRandomStatus());
|
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_RANDOM,getPlaylistRandomStatus());
|
||||||
myfprintf(fp,"%s: %li\n",COMMAND_STATUS_PLAYLIST,getPlaylistVersion());
|
myfprintf(fp,"%s: %li\n",COMMAND_STATUS_PLAYLIST,getPlaylistVersion());
|
||||||
@ -575,20 +572,6 @@ int handleSetVol(FILE * fp, unsigned int * permission, int argArrayLength,
|
|||||||
return changeVolumeLevel(fp,level,0);
|
return changeVolumeLevel(fp,level,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int handleMute(FILE * fp, unsigned int * permission, int argArrayLength,
|
|
||||||
char ** argArray)
|
|
||||||
{
|
|
||||||
int status;
|
|
||||||
char * test;
|
|
||||||
|
|
||||||
status = strtol(argArray[1],&test,10);
|
|
||||||
if(*test!='\0') {
|
|
||||||
commandError(fp, ACK_ERROR_ARG, "need an integer", NULL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return setVolumeMuteStatus(fp,status);
|
|
||||||
}
|
|
||||||
|
|
||||||
int handleRepeat(FILE * fp, unsigned int * permission, int argArrayLength,
|
int handleRepeat(FILE * fp, unsigned int * permission, int argArrayLength,
|
||||||
char ** argArray)
|
char ** argArray)
|
||||||
{
|
{
|
||||||
@ -959,7 +942,6 @@ void initCommands() {
|
|||||||
addCommand(COMMAND_PREVIOUS ,PERMISSION_CONTROL, 0, 0,handlePrevious,NULL);
|
addCommand(COMMAND_PREVIOUS ,PERMISSION_CONTROL, 0, 0,handlePrevious,NULL);
|
||||||
addCommand(COMMAND_LISTALL ,PERMISSION_READ, 0, 1,handleListAll,NULL);
|
addCommand(COMMAND_LISTALL ,PERMISSION_READ, 0, 1,handleListAll,NULL);
|
||||||
addCommand(COMMAND_VOLUME ,PERMISSION_CONTROL, 1, 1,handleVolume,NULL);
|
addCommand(COMMAND_VOLUME ,PERMISSION_CONTROL, 1, 1,handleVolume,NULL);
|
||||||
addCommand(COMMAND_MUTE ,PERMISSION_CONTROL, 1, 1,handleMute,NULL);
|
|
||||||
addCommand(COMMAND_REPEAT ,PERMISSION_CONTROL, 1, 1,handleRepeat,NULL);
|
addCommand(COMMAND_REPEAT ,PERMISSION_CONTROL, 1, 1,handleRepeat,NULL);
|
||||||
addCommand(COMMAND_RANDOM ,PERMISSION_CONTROL, 1, 1,handleRandom,NULL);
|
addCommand(COMMAND_RANDOM ,PERMISSION_CONTROL, 1, 1,handleRandom,NULL);
|
||||||
addCommand(COMMAND_STATS ,PERMISSION_READ, 0, 0,handleStats,NULL);
|
addCommand(COMMAND_STATS ,PERMISSION_READ, 0, 0,handleStats,NULL);
|
||||||
|
114
src/volume.c
114
src/volume.c
@ -63,9 +63,6 @@ char * volume_mixerDevice = VOLUME_MIXER_DEVICE_DEFAULT;
|
|||||||
|
|
||||||
int volume_softwareSet = 100;
|
int volume_softwareSet = 100;
|
||||||
|
|
||||||
int volume_fakeMuteStatus = 0;
|
|
||||||
int volume_fakeLastUnmutedLevel = -1;
|
|
||||||
|
|
||||||
#ifdef HAVE_OSS
|
#ifdef HAVE_OSS
|
||||||
int volume_ossFd;
|
int volume_ossFd;
|
||||||
int volume_ossControl = SOUND_MIXER_PCM;
|
int volume_ossControl = SOUND_MIXER_PCM;
|
||||||
@ -446,9 +443,6 @@ int changeSoftwareVolume(FILE * fp, int change, int rel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int changeVolumeLevel(FILE * fp, int change, int rel) {
|
int changeVolumeLevel(FILE * fp, int change, int rel) {
|
||||||
if(getVolumeMuteStatus())
|
|
||||||
setVolumeMuteStatus(fp,0);
|
|
||||||
|
|
||||||
switch(volume_mixerType) {
|
switch(volume_mixerType) {
|
||||||
#ifdef HAVE_ALSA
|
#ifdef HAVE_ALSA
|
||||||
case VOLUME_MIXER_TYPE_ALSA:
|
case VOLUME_MIXER_TYPE_ALSA:
|
||||||
@ -465,111 +459,3 @@ int changeVolumeLevel(FILE * fp, int change, int rel) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getAlsaVolumeMuteStatus() {
|
|
||||||
int err;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
if((err = snd_mixer_selem_get_playback_switch(volume_alsaElem,
|
|
||||||
SND_MIXER_SCHN_FRONT_LEFT,&status))<0) {
|
|
||||||
WARNING("problems getting alsa mute status: %s\n",
|
|
||||||
snd_strerror(err));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !status;
|
|
||||||
}
|
|
||||||
|
|
||||||
int setAlsaVolumeMuteStatus(FILE * fp, int status) {
|
|
||||||
int err;
|
|
||||||
|
|
||||||
if(status == getVolumeMuteStatus())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if((err = snd_mixer_selem_set_playback_switch_all(volume_alsaElem,
|
|
||||||
!status))<0) {
|
|
||||||
commandError(fp, ACK_ERROR_SYSTEM, "problems muting volume",
|
|
||||||
NULL);
|
|
||||||
WARNING("problems muting alsa volume: %s\n", snd_strerror(err));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getFakeVolumeMuteStatus() {
|
|
||||||
return volume_fakeMuteStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fake mute: just drop volume to 0
|
|
||||||
int setFakeVolumeMuteStatus(FILE * fp, int status) {
|
|
||||||
// Don't call changeVolumeLevel while volume_fakeMuteStatus is set!
|
|
||||||
if(status && !getVolumeMuteStatus()) {
|
|
||||||
// Mute
|
|
||||||
int ret;
|
|
||||||
volume_fakeLastUnmutedLevel = getVolumeLevel();
|
|
||||||
ret = changeVolumeLevel(fp,0,0);
|
|
||||||
volume_fakeMuteStatus = 1;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
else if(!status && getVolumeMuteStatus()){
|
|
||||||
// Unmute
|
|
||||||
volume_fakeMuteStatus = 0;
|
|
||||||
return changeVolumeLevel(fp,volume_fakeLastUnmutedLevel,0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int getOssVolumeMuteStatus() {
|
|
||||||
return getFakeVolumeMuteStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
int setOssVolumeMuteStatus(FILE * fp, int status) {
|
|
||||||
return setFakeVolumeMuteStatus(fp,status);
|
|
||||||
}
|
|
||||||
|
|
||||||
int getSoftwareVolumeMuteStatus() {
|
|
||||||
return getFakeVolumeMuteStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
int setSoftwareVolumeMuteStatus(FILE * fp, int status) {
|
|
||||||
return setFakeVolumeMuteStatus(fp,status);
|
|
||||||
}
|
|
||||||
|
|
||||||
int getVolumeMuteStatus() {
|
|
||||||
switch(volume_mixerType) {
|
|
||||||
#ifdef HAVE_ALSA
|
|
||||||
case VOLUME_MIXER_TYPE_ALSA:
|
|
||||||
return getAlsaVolumeMuteStatus();
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_OSS
|
|
||||||
case VOLUME_MIXER_TYPE_OSS:
|
|
||||||
return getOssVolumeMuteStatus();
|
|
||||||
#endif
|
|
||||||
case VOLUME_MIXER_TYPE_SOFTWARE:
|
|
||||||
return getSoftwareVolumeMuteStatus();
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int setVolumeMuteStatus(FILE * fp, int status) {
|
|
||||||
switch(volume_mixerType) {
|
|
||||||
#ifdef HAVE_ALSA
|
|
||||||
case VOLUME_MIXER_TYPE_ALSA:
|
|
||||||
return setAlsaVolumeMuteStatus(fp,status);
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_OSS
|
|
||||||
case VOLUME_MIXER_TYPE_OSS:
|
|
||||||
return setOssVolumeMuteStatus(fp,status);
|
|
||||||
#endif
|
|
||||||
case VOLUME_MIXER_TYPE_SOFTWARE:
|
|
||||||
return setSoftwareVolumeMuteStatus(fp,status);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -37,8 +37,4 @@ int getVolumeLevel();
|
|||||||
|
|
||||||
int changeVolumeLevel(FILE * fp, int change, int rel);
|
int changeVolumeLevel(FILE * fp, int change, int rel);
|
||||||
|
|
||||||
int getVolumeMuteStatus();
|
|
||||||
|
|
||||||
int setVolumeMuteStatus(FILE * fp, int status);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user