Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
2d312d0c
Commit
2d312d0c
authored
Nov 10, 2008
by
Led
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.11.0-rc2
parent
ac298765
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
148 additions
and
49 deletions
+148
-49
ChangeLog
ChangeLog
+1
-1
TODO
TODO
+4
-0
ack.h
src/ack.h
+18
-0
command.c
src/command.c
+13
-12
command.h
src/command.h
+2
-2
directory.c
src/directory.c
+8
-6
inputPlugin.c
src/inputPlugin.c
+18
-0
inputPlugin.h
src/inputPlugin.h
+18
-0
interface.c
src/interface.c
+9
-8
interface.h
src/interface.h
+1
-1
metadataChunk.c
src/metadataChunk.c
+18
-0
metadataChunk.h
src/metadataChunk.h
+18
-0
myfprintf.c
src/myfprintf.c
+8
-11
player.c
src/player.c
+1
-1
playlist.c
src/playlist.c
+4
-3
volume.c
src/volume.c
+7
-4
No files found.
ChangeLog
View file @
2d312d0c
ver 0.11.0 (2004/6/1
7
)
ver 0.11.0 (2004/6/1
8
)
1) Support for playing mp3 and Ogg Vorbis streams
2) Non-blocking Update
3) Replaygain support for Ogg Vorbis and FLAC (by Eric Moore aka AliasMrJones)
...
...
TODO
View file @
2d312d0c
*) add add command that returns song id
*) add option for inserting at a specific position in the playlist
*) put some sort of error reporting for streaming/inputStream!
Post-1.0
...
...
src/ack.h
View file @
2d312d0c
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ACK_H
#define ACK_H
...
...
src/command.c
View file @
2d312d0c
...
...
@@ -164,7 +164,7 @@ int handlePlay(FILE * fp, unsigned int * permission, int argArrayLength,
song
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need a positive integer"
);
"need a positive integer"
,
NULL
);
return
-
1
;
}
}
...
...
@@ -181,7 +181,7 @@ int handlePlayId(FILE * fp, unsigned int * permission, int argArrayLength,
id
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need a positive integer"
);
"need a positive integer"
,
NULL
);
return
-
1
;
}
}
...
...
@@ -309,7 +309,7 @@ int handleDelete(FILE * fp, unsigned int * permission, int argArrayLength,
song
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need a positive integer"
);
"need a positive integer"
,
NULL
);
return
-
1
;
}
return
deleteFromPlaylist
(
fp
,
song
);
...
...
@@ -324,7 +324,7 @@ int handleDeleteId(FILE * fp, unsigned int * permission, int argArrayLength,
id
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need a positive integer"
);
"need a positive integer"
,
NULL
);
return
-
1
;
}
return
deleteFromPlaylistById
(
fp
,
id
);
...
...
@@ -387,7 +387,8 @@ int handlePlaylistChanges(FILE * fp, unsigned int * permission,
version
=
strtoul
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need a positive integer"
);
commandError
(
fp
,
ACK_ERROR_ARG
,
"need a positive integer"
,
NULL
);
return
-
1
;
}
return
playlistChanges
(
fp
,
version
);
...
...
@@ -403,7 +404,7 @@ int handlePlaylistInfo(FILE * fp, unsigned int * permission,
song
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"
%s need a positive integer"
);
"
need a positive integer"
,
NULL
);
return
-
1
;
}
}
...
...
@@ -420,7 +421,7 @@ int handlePlaylistId(FILE * fp, unsigned int * permission,
id
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"
%s need a positive integer"
);
"
need a positive integer"
,
NULL
);
return
-
1
;
}
}
...
...
@@ -509,7 +510,7 @@ int handleVolume(FILE * fp, unsigned int * permission, int argArrayLength,
change
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need an integer"
);
commandError
(
fp
,
ACK_ERROR_ARG
,
"need an integer"
,
NULL
);
return
-
1
;
}
return
changeVolumeLevel
(
fp
,
change
,
1
);
...
...
@@ -523,7 +524,7 @@ int handleSetVol(FILE * fp, unsigned int * permission, int argArrayLength,
level
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need an integer"
);
commandError
(
fp
,
ACK_ERROR_ARG
,
"need an integer"
,
NULL
);
return
-
1
;
}
return
changeVolumeLevel
(
fp
,
level
,
0
);
...
...
@@ -537,7 +538,7 @@ int handleRepeat(FILE * fp, unsigned int * permission, int argArrayLength,
status
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need an integer"
);
commandError
(
fp
,
ACK_ERROR_ARG
,
"need an integer"
,
NULL
);
return
-
1
;
}
return
setPlaylistRepeatStatus
(
fp
,
status
);
...
...
@@ -551,7 +552,7 @@ int handleRandom(FILE * fp, unsigned int * permission, int argArrayLength,
status
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fp
,
ACK_ERROR_ARG
,
"need an integer"
);
commandError
(
fp
,
ACK_ERROR_ARG
,
"need an integer"
,
NULL
);
return
-
1
;
}
return
setPlaylistRandomStatus
(
fp
,
status
);
...
...
@@ -730,7 +731,7 @@ int handlePassword(FILE * fp, unsigned int * permission, int argArrayLength,
char
**
argArray
)
{
if
(
getPermissionFromPassword
(
argArray
[
1
],
permission
)
<
0
)
{
commandError
(
fp
,
ACK_ERROR_PASSWORD
,
"incorrect password"
);
commandError
(
fp
,
ACK_ERROR_PASSWORD
,
"incorrect password"
,
NULL
);
return
-
1
;
}
...
...
src/command.h
View file @
2d312d0c
...
...
@@ -50,13 +50,13 @@ void finishCommands();
if(current_command) { \
myfprintf(fp, "ACK [%i@%i] {%s} " format "\n", \
(int)error, command_listNum, \
current_command,
##
__VA_ARGS__); \
current_command, __VA_ARGS__); \
current_command = NULL; \
} \
else { \
myfprintf(stderr, "ACK [%i@%i] " format "\n", \
(int)error, command_listNum, \
##
__VA_ARGS__); \
__VA_ARGS__); \
} \
}
...
...
src/directory.c
View file @
2d312d0c
...
...
@@ -166,7 +166,8 @@ void readDirectoryDBIfUpdateIsFinished() {
int
updateInit
(
FILE
*
fp
,
List
*
pathList
)
{
if
(
directory_updatePid
>
0
)
{
commandError
(
fp
,
ACK_ERROR_UPDATE_ALREADY
,
"already updating"
);
commandError
(
fp
,
ACK_ERROR_UPDATE_ALREADY
,
"already updating"
,
NULL
);
return
-
1
;
}
...
...
@@ -224,7 +225,7 @@ int updateInit(FILE * fp, List * pathList) {
unblockSignals
();
ERROR
(
"updateInit: Problems forking()'ing
\n
"
);
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems trying to update"
);
"problems trying to update"
,
NULL
);
directory_updatePid
=
0
;
return
-
1
;
}
...
...
@@ -745,7 +746,8 @@ int printDirectoryInfo(FILE * fp, char * name) {
Directory
*
directory
;
if
((
directory
=
getDirectory
(
name
))
==
NULL
)
{
commandError
(
fp
,
ACK_ERROR_NO_EXIST
,
"directory not found"
);
commandError
(
fp
,
ACK_ERROR_NO_EXIST
,
"directory not found"
,
NULL
);
return
-
1
;
}
...
...
@@ -1047,7 +1049,7 @@ int traverseAllIn(FILE * fp, char * name,
return
forEachSong
(
fp
,
song
,
data
);
}
commandError
(
fp
,
ACK_ERROR_NO_EXIST
,
"directory or file not found"
);
"directory or file not found"
,
NULL
);
return
-
1
;
}
...
...
@@ -1129,7 +1131,7 @@ int searchForSongsIn(FILE * fp, char * name, char * item, char * string) {
ret
=
traverseAllIn
(
fp
,
name
,
searchForFilenameInDirectory
,
NULL
,
(
void
*
)
dup
);
}
else
commandError
(
fp
,
ACK_ERROR_ARG
,
"unknown table"
);
else
commandError
(
fp
,
ACK_ERROR_ARG
,
"unknown table"
,
NULL
);
free
(
dup
);
...
...
@@ -1166,7 +1168,7 @@ int findSongsIn(FILE * fp, char * name, char * item, char * string) {
(
void
*
)
string
);
}
commandError
(
fp
,
ACK_ERROR_ARG
,
"unknown table"
);
commandError
(
fp
,
ACK_ERROR_ARG
,
"unknown table"
,
NULL
);
return
-
1
;
}
...
...
src/inputPlugin.c
View file @
2d312d0c
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "inputPlugin.h"
#include "list.h"
...
...
src/inputPlugin.h
View file @
2d312d0c
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef INPUT_PLUGIN_H
#define INPUT_PLUGIN_H
...
...
src/interface.c
View file @
2d312d0c
...
...
@@ -542,20 +542,21 @@ void flushAllInterfaceBuffers() {
}
}
int
interfacePrintWithFD
(
int
fd
,
char
*
buffer
)
{
int
i
;
int
buflen
;
int
interfacePrintWithFD
(
int
fd
,
char
*
buffer
,
int
buflen
)
{
static
int
i
=
0
;
int
copylen
;
Interface
*
interface
;
if
(
!
(
buflen
=
strlen
(
buffer
)))
return
-
1
;
for
(
i
=
0
;
i
<
interface_max_connections
;
i
++
)
{
if
(
interfaces
[
i
].
open
&&
interfaces
[
i
].
fd
==
fd
)
break
;
if
(
i
>=
interface_max_connections
||
!
interfaces
[
i
].
open
||
interfaces
[
i
].
fd
!=
fd
)
{
for
(
i
=
0
;
i
<
interface_max_connections
;
i
++
)
{
if
(
interfaces
[
i
].
open
&&
interfaces
[
i
].
fd
==
fd
)
break
;
}
if
(
i
==
interface_max_connections
)
return
-
1
;
}
/* if fd isn't found or interfaces is going to be closed, do nothing */
if
(
i
==
interface_max_connections
)
return
-
1
;
if
(
interfaces
[
i
].
expired
)
return
0
;
interface
=
interfaces
+
i
;
...
...
src/interface.h
View file @
2d312d0c
...
...
@@ -33,7 +33,7 @@ void freeAllInterfaces();
void
closeOldInterfaces
();
void
closeInterfaceWithFD
(
int
fd
);
void
flushAllInterfaceBuffers
();
int
interfacePrintWithFD
(
int
fd
,
char
*
buffer
);
int
interfacePrintWithFD
(
int
fd
,
char
*
buffer
,
int
len
);
int
doIOForInterfaces
();
...
...
src/metadataChunk.c
View file @
2d312d0c
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "metadataChunk.h"
#include <string.h>
...
...
src/metadataChunk.h
View file @
2d312d0c
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef METADATA_CHUNK_H
#define METADATA_CHUNK_H
...
...
src/myfprintf.c
View file @
2d312d0c
...
...
@@ -37,8 +37,7 @@ FILE * myfprintf_err;
char
*
myfprintf_outFilename
;
char
*
myfprintf_errFilename
;
void
blockingWrite
(
int
fd
,
char
*
string
)
{
int
len
=
strlen
(
string
);
void
blockingWrite
(
int
fd
,
char
*
string
,
int
len
)
{
int
ret
;
while
(
len
)
{
...
...
@@ -71,28 +70,26 @@ void myfprintf(FILE * fp, char * format, ... ) {
char
buffer
[
BUFFER_LENGTH
+
1
];
va_list
arglist
;
int
fd
=
fileno
(
fp
);
int
fcntlret
;
memset
(
buffer
,
0
,
BUFFER_LENGTH
+
1
);
va_start
(
arglist
,
format
);
while
((
fcntlret
=
fcntl
(
fd
,
F_GETFL
))
==-
1
&&
errno
==
EINTR
);
if
(
myfprintf_stdLogMode
&&
(
fd
==
1
||
fd
==
2
))
{
time_t
t
=
time
(
NULL
);
if
(
fd
==
1
)
fp
=
myfprintf_out
;
else
fp
=
myfprintf_err
;
strftime
(
buffer
,
14
,
"%b %e %R"
,
localtime
(
&
t
));
blockingWrite
(
fd
,
buffer
);
blockingWrite
(
fd
,
" : "
);
blockingWrite
(
fd
,
buffer
,
strlen
(
buffer
)
);
blockingWrite
(
fd
,
" : "
,
3
);
vsnprintf
(
buffer
,
BUFFER_LENGTH
,
format
,
arglist
);
blockingWrite
(
fd
,
buffer
);
blockingWrite
(
fd
,
buffer
,
strlen
(
buffer
)
);
}
else
{
int
len
;
vsnprintf
(
buffer
,
BUFFER_LENGTH
,
format
,
arglist
);
if
(
!
(
fcntlret
&
O_NONBLOCK
)
||
interfacePrintWithFD
(
fd
,
buffer
)
<
0
)
{
blockingWrite
(
fd
,
buffer
);
len
=
strlen
(
buffer
);
if
(
interfacePrintWithFD
(
fd
,
buffer
,
len
)
<
0
)
{
blockingWrite
(
fd
,
buffer
,
len
);
}
}
...
...
src/player.c
View file @
2d312d0c
...
...
@@ -382,7 +382,7 @@ int playerSeek(FILE * fp, Song * song, float time) {
if
(
pc
->
state
==
PLAYER_STATE_STOP
)
{
commandError
(
fp
,
ACK_ERROR_PLAYER_SYNC
,
"player not currently playing"
);
"player not currently playing"
,
NULL
);
return
-
1
;
}
...
...
src/playlist.c
View file @
2d312d0c
...
...
@@ -609,7 +609,7 @@ int addToPlaylist(FILE * fp, char * url) {
int
addSongToPlaylist
(
FILE
*
fp
,
Song
*
song
)
{
if
(
playlist
.
length
==
playlist_max_length
)
{
commandError
(
fp
,
ACK_ERROR_PLAYLIST_MAX
,
"playlist is at the max size"
);
"playlist is at the max size"
,
NULL
);
return
-
1
;
}
...
...
@@ -1248,7 +1248,7 @@ int deletePlaylist(FILE * fp, char * utf8file) {
if
(
unlink
(
actualFile
)
<
0
)
{
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems deleting file"
);
"problems deleting file"
,
NULL
);
return
-
1
;
}
...
...
@@ -1293,7 +1293,8 @@ int savePlaylist(FILE * fp, char * utf8file) {
while
(
!
(
fileP
=
fopen
(
actualFile
,
"w"
))
&&
errno
==
EINTR
);
if
(
fileP
==
NULL
)
{
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems opening file"
);
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems opening file"
,
NULL
);
return
-
1
;
}
...
...
src/volume.c
View file @
2d312d0c
...
...
@@ -145,7 +145,7 @@ int changeOssVolumeLevel(FILE * fp, int change, int rel) {
if
(
rel
)
{
if
((
current
=
getOssVolumeLevel
())
<
0
)
{
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problem getting current volume"
);
"problem getting current volume"
,
NULL
);
return
-
1
;
}
...
...
@@ -159,7 +159,8 @@ int changeOssVolumeLevel(FILE * fp, int change, int rel) {
level
=
(
new
<<
8
)
+
new
;
if
(
ioctl
(
volume_ossFd
,
MIXER_WRITE
(
volume_ossControl
),
&
level
)
<
0
)
{
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems setting volume"
);
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems setting volume"
,
NULL
);
return
-
1
;
}
...
...
@@ -271,7 +272,8 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
if
((
err
=
snd_mixer_selem_get_playback_volume
(
volume_alsaElem
,
SND_MIXER_SCHN_FRONT_LEFT
,
&
level
))
<
0
)
{
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems getting volume"
);
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems getting volume"
,
NULL
);
WARNING
(
"problems getting alsa volume: %s
\n
"
,
snd_strerror
(
err
));
return
-
1
;
}
...
...
@@ -297,7 +299,8 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
if
((
err
=
snd_mixer_selem_set_playback_volume_all
(
volume_alsaElem
,
level
))
<
0
)
{
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems setting volume"
);
commandError
(
fp
,
ACK_ERROR_SYSTEM
,
"problems setting volume"
,
NULL
);
WARNING
(
"problems setting alsa volume: %s
\n
"
,
snd_strerror
(
err
));
return
-
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment