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
07adb14e
Commit
07adb14e
authored
Jan 26, 2008
by
Max Kellermann
Committed by
Eric Wong
Jan 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed -Wshadow warnings
Signed-off-by:
Eric Wong
<
normalperson@yhbt.net
>
git-svn-id:
https://svn.musicpd.org/mpd/trunk@7143
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
28008e69
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
185 additions
and
183 deletions
+185
-183
audio.c
src/audio.c
+7
-7
audioOutput_oss.c
src/audioOutputs/audioOutput_oss.c
+44
-44
command.c
src/command.c
+13
-13
dbUtils.c
src/dbUtils.c
+2
-2
directory.c
src/directory.c
+14
-14
_flac_common.c
src/inputPlugins/_flac_common.c
+6
-6
audiofile_plugin.c
src/inputPlugins/audiofile_plugin.c
+6
-6
mod_plugin.c
src/inputPlugins/mod_plugin.c
+4
-4
mp3_plugin.c
src/inputPlugins/mp3_plugin.c
+8
-8
mpc_plugin.c
src/inputPlugins/mpc_plugin.c
+11
-11
locate.c
src/locate.c
+4
-4
ls.c
src/ls.c
+18
-17
outputBuffer.c
src/outputBuffer.c
+2
-2
player.c
src/player.c
+5
-5
playlist.c
src/playlist.c
+10
-9
sig_handlers.c
src/sig_handlers.c
+1
-1
storedPlaylist.c
src/storedPlaylist.c
+4
-4
tag.c
src/tag.c
+14
-14
timer.c
src/timer.c
+4
-4
volume.c
src/volume.c
+8
-8
No files found.
src/audio.c
View file @
07adb14e
...
...
@@ -360,16 +360,16 @@ int openAudioDevice(AudioFormat * audioFormat)
int
playAudio
(
const
char
*
playChunk
,
int
size
)
{
int
send
;
int
send
_size
;
while
(
size
>
0
)
{
send
=
audioBufferSize
-
audioBufferPos
;
send
=
send
<
size
?
send
:
size
;
send
_size
=
audioBufferSize
-
audioBufferPos
;
send
_size
=
send_size
<
size
?
send_size
:
size
;
memcpy
(
audioBuffer
+
audioBufferPos
,
playChunk
,
send
);
audioBufferPos
+=
send
;
size
-=
send
;
playChunk
+=
send
;
memcpy
(
audioBuffer
+
audioBufferPos
,
playChunk
,
send
_size
);
audioBufferPos
+=
send
_size
;
size
-=
send
_size
;
playChunk
+=
send
_size
;
if
(
audioBufferPos
==
audioBufferSize
)
{
if
(
flushAudioBuffer
()
<
0
)
...
...
src/audioOutputs/audioOutput_oss.c
View file @
07adb14e
...
...
@@ -62,39 +62,39 @@ typedef struct _OssData {
static
int
getIndexForParam
(
int
param
)
{
int
i
nde
x
=
0
;
int
i
d
x
=
0
;
switch
(
param
)
{
case
SNDCTL_DSP_SPEED
:
i
nde
x
=
OSS_RATE
;
i
d
x
=
OSS_RATE
;
break
;
case
SNDCTL_DSP_CHANNELS
:
i
nde
x
=
OSS_CHANNELS
;
i
d
x
=
OSS_CHANNELS
;
break
;
case
SNDCTL_DSP_SAMPLESIZE
:
i
nde
x
=
OSS_BITS
;
i
d
x
=
OSS_BITS
;
break
;
}
return
i
nde
x
;
return
i
d
x
;
}
static
int
findSupportedParam
(
OssData
*
od
,
int
param
,
int
val
)
{
int
i
;
int
i
nde
x
=
getIndexForParam
(
param
);
int
i
d
x
=
getIndexForParam
(
param
);
for
(
i
=
0
;
i
<
od
->
numSupported
[
i
nde
x
];
i
++
)
{
if
(
od
->
supported
[
i
nde
x
][
i
]
==
val
)
for
(
i
=
0
;
i
<
od
->
numSupported
[
i
d
x
];
i
++
)
{
if
(
od
->
supported
[
i
d
x
][
i
]
==
val
)
return
1
;
}
return
0
;
}
static
int
canConvert
(
int
i
nde
x
,
int
val
)
static
int
canConvert
(
int
i
d
x
,
int
val
)
{
switch
(
i
nde
x
)
{
switch
(
i
d
x
)
{
case
OSS_BITS
:
if
(
val
!=
16
)
return
0
;
...
...
@@ -111,21 +111,21 @@ static int canConvert(int index, int val)
static
int
getSupportedParam
(
OssData
*
od
,
int
param
,
int
val
)
{
int
i
;
int
i
nde
x
=
getIndexForParam
(
param
);
int
i
d
x
=
getIndexForParam
(
param
);
int
ret
=
-
1
;
int
least
=
val
;
int
diff
;
for
(
i
=
0
;
i
<
od
->
numSupported
[
i
nde
x
];
i
++
)
{
diff
=
od
->
supported
[
i
nde
x
][
i
]
-
val
;
for
(
i
=
0
;
i
<
od
->
numSupported
[
i
d
x
];
i
++
)
{
diff
=
od
->
supported
[
i
d
x
][
i
]
-
val
;
if
(
diff
<
0
)
diff
=
-
diff
;
if
(
diff
<
least
)
{
if
(
!
canConvert
(
i
ndex
,
od
->
supported
[
inde
x
][
i
]))
{
if
(
!
canConvert
(
i
dx
,
od
->
supported
[
id
x
][
i
]))
{
continue
;
}
least
=
diff
;
ret
=
od
->
supported
[
i
nde
x
][
i
];
ret
=
od
->
supported
[
i
d
x
][
i
];
}
}
...
...
@@ -135,10 +135,10 @@ static int getSupportedParam(OssData * od, int param, int val)
static
int
findUnsupportedParam
(
OssData
*
od
,
int
param
,
int
val
)
{
int
i
;
int
i
nde
x
=
getIndexForParam
(
param
);
int
i
d
x
=
getIndexForParam
(
param
);
for
(
i
=
0
;
i
<
od
->
numUnsupported
[
i
nde
x
];
i
++
)
{
if
(
od
->
unsupported
[
i
nde
x
][
i
]
==
val
)
for
(
i
=
0
;
i
<
od
->
numUnsupported
[
i
d
x
];
i
++
)
{
if
(
od
->
unsupported
[
i
d
x
][
i
]
==
val
)
return
1
;
}
...
...
@@ -147,58 +147,58 @@ static int findUnsupportedParam(OssData * od, int param, int val)
static
void
addSupportedParam
(
OssData
*
od
,
int
param
,
int
val
)
{
int
i
nde
x
=
getIndexForParam
(
param
);
int
i
d
x
=
getIndexForParam
(
param
);
od
->
numSupported
[
i
nde
x
]
++
;
od
->
supported
[
i
ndex
]
=
xrealloc
(
od
->
supported
[
inde
x
],
od
->
numSupported
[
inde
x
]
*
sizeof
(
int
));
od
->
supported
[
i
ndex
][
od
->
numSupported
[
inde
x
]
-
1
]
=
val
;
od
->
numSupported
[
i
d
x
]
++
;
od
->
supported
[
i
dx
]
=
xrealloc
(
od
->
supported
[
id
x
],
od
->
numSupported
[
id
x
]
*
sizeof
(
int
));
od
->
supported
[
i
dx
][
od
->
numSupported
[
id
x
]
-
1
]
=
val
;
}
static
void
addUnsupportedParam
(
OssData
*
od
,
int
param
,
int
val
)
{
int
i
nde
x
=
getIndexForParam
(
param
);
int
i
d
x
=
getIndexForParam
(
param
);
od
->
numUnsupported
[
i
nde
x
]
++
;
od
->
unsupported
[
i
ndex
]
=
xrealloc
(
od
->
unsupported
[
inde
x
],
od
->
numUnsupported
[
inde
x
]
*
sizeof
(
int
));
od
->
unsupported
[
i
ndex
][
od
->
numUnsupported
[
inde
x
]
-
1
]
=
val
;
od
->
numUnsupported
[
i
d
x
]
++
;
od
->
unsupported
[
i
dx
]
=
xrealloc
(
od
->
unsupported
[
id
x
],
od
->
numUnsupported
[
id
x
]
*
sizeof
(
int
));
od
->
unsupported
[
i
dx
][
od
->
numUnsupported
[
id
x
]
-
1
]
=
val
;
}
static
void
removeSupportedParam
(
OssData
*
od
,
int
param
,
int
val
)
{
int
i
=
0
;
int
j
=
0
;
int
i
nde
x
=
getIndexForParam
(
param
);
int
i
d
x
=
getIndexForParam
(
param
);
for
(
i
=
0
;
i
<
od
->
numSupported
[
i
nde
x
]
-
1
;
i
++
)
{
if
(
od
->
supported
[
i
nde
x
][
i
]
==
val
)
for
(
i
=
0
;
i
<
od
->
numSupported
[
i
d
x
]
-
1
;
i
++
)
{
if
(
od
->
supported
[
i
d
x
][
i
]
==
val
)
j
=
1
;
od
->
supported
[
i
ndex
][
i
]
=
od
->
supported
[
inde
x
][
i
+
j
];
od
->
supported
[
i
dx
][
i
]
=
od
->
supported
[
id
x
][
i
+
j
];
}
od
->
numSupported
[
i
nde
x
]
--
;
od
->
supported
[
i
ndex
]
=
xrealloc
(
od
->
supported
[
inde
x
],
od
->
numSupported
[
inde
x
]
*
sizeof
(
int
));
od
->
numSupported
[
i
d
x
]
--
;
od
->
supported
[
i
dx
]
=
xrealloc
(
od
->
supported
[
id
x
],
od
->
numSupported
[
id
x
]
*
sizeof
(
int
));
}
static
void
removeUnsupportedParam
(
OssData
*
od
,
int
param
,
int
val
)
{
int
i
=
0
;
int
j
=
0
;
int
i
nde
x
=
getIndexForParam
(
param
);
int
i
d
x
=
getIndexForParam
(
param
);
for
(
i
=
0
;
i
<
od
->
numUnsupported
[
i
nde
x
]
-
1
;
i
++
)
{
if
(
od
->
unsupported
[
i
nde
x
][
i
]
==
val
)
for
(
i
=
0
;
i
<
od
->
numUnsupported
[
i
d
x
]
-
1
;
i
++
)
{
if
(
od
->
unsupported
[
i
d
x
][
i
]
==
val
)
j
=
1
;
od
->
unsupported
[
i
ndex
][
i
]
=
od
->
unsupported
[
inde
x
][
i
+
j
];
od
->
unsupported
[
i
dx
][
i
]
=
od
->
unsupported
[
id
x
][
i
+
j
];
}
od
->
numUnsupported
[
i
nde
x
]
--
;
od
->
unsupported
[
i
ndex
]
=
xrealloc
(
od
->
unsupported
[
inde
x
],
od
->
numUnsupported
[
inde
x
]
*
sizeof
(
int
));
od
->
numUnsupported
[
i
d
x
]
--
;
od
->
unsupported
[
i
dx
]
=
xrealloc
(
od
->
unsupported
[
id
x
],
od
->
numUnsupported
[
id
x
]
*
sizeof
(
int
));
}
static
int
isSupportedParam
(
OssData
*
od
,
int
param
,
int
val
)
...
...
src/command.c
View file @
07adb14e
...
...
@@ -239,13 +239,13 @@ static int handlePause(int fd, int *permission, int argc, char *argv[])
{
if
(
argc
==
2
)
{
char
*
test
;
int
pause
=
strtol
(
argv
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
(
pause
!=
0
&&
pause
!=
1
))
{
int
pause
_flag
=
strtol
(
argv
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
(
pause
_flag
!=
0
&&
pause_flag
!=
1
))
{
commandError
(
fd
,
ACK_ERROR_ARG
,
"
\"
%s
\"
is not 0 or 1"
,
argv
[
1
]);
return
-
1
;
}
return
playerSetPause
(
fd
,
pause
);
return
playerSetPause
(
fd
,
pause
_flag
);
}
return
playerPause
(
fd
);
}
...
...
@@ -929,7 +929,7 @@ static int handleSwapId(int fd, int *permission, int argc, char *argv[])
static
int
handleSeek
(
int
fd
,
int
*
permission
,
int
argc
,
char
*
argv
[])
{
int
song
;
int
time
;
int
seek_
time
;
char
*
test
;
song
=
strtol
(
argv
[
1
],
&
test
,
10
);
...
...
@@ -938,19 +938,19 @@ static int handleSeek(int fd, int *permission, int argc, char *argv[])
"
\"
%s
\"
is not a integer"
,
argv
[
1
]);
return
-
1
;
}
time
=
strtol
(
argv
[
2
],
&
test
,
10
);
seek_
time
=
strtol
(
argv
[
2
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fd
,
ACK_ERROR_ARG
,
"
\"
%s
\"
is not a integer"
,
argv
[
2
]);
return
-
1
;
}
return
seekSongInPlaylist
(
fd
,
song
,
time
);
return
seekSongInPlaylist
(
fd
,
song
,
seek_
time
);
}
static
int
handleSeekId
(
int
fd
,
int
*
permission
,
int
argc
,
char
*
argv
[])
{
int
id
;
int
time
;
int
seek_
time
;
char
*
test
;
id
=
strtol
(
argv
[
1
],
&
test
,
10
);
...
...
@@ -959,13 +959,13 @@ static int handleSeekId(int fd, int *permission, int argc, char *argv[])
"
\"
%s
\"
is not a integer"
,
argv
[
1
]);
return
-
1
;
}
time
=
strtol
(
argv
[
2
],
&
test
,
10
);
seek_
time
=
strtol
(
argv
[
2
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
commandError
(
fd
,
ACK_ERROR_ARG
,
"
\"
%s
\"
is not a integer"
,
argv
[
2
]);
return
-
1
;
}
return
seekSongInPlaylistById
(
fd
,
id
,
time
);
return
seekSongInPlaylistById
(
fd
,
id
,
seek_
time
);
}
static
int
handleListAllInfo
(
int
fd
,
int
*
permission
,
int
argc
,
char
*
argv
[])
...
...
@@ -994,17 +994,17 @@ static int handlePassword(int fd, int *permission, int argc, char *argv[])
static
int
handleCrossfade
(
int
fd
,
int
*
permission
,
int
argc
,
char
*
argv
[])
{
int
time
;
int
xfade_
time
;
char
*
test
;
time
=
strtol
(
argv
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
time
<
0
)
{
xfade_
time
=
strtol
(
argv
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
xfade_
time
<
0
)
{
commandError
(
fd
,
ACK_ERROR_ARG
,
"
\"
%s
\"
is not a integer >= 0"
,
argv
[
1
]);
return
-
1
;
}
setPlayerCrossFade
(
time
);
setPlayerCrossFade
(
xfade_
time
);
return
0
;
}
...
...
src/dbUtils.c
View file @
07adb14e
...
...
@@ -201,10 +201,10 @@ static int directoryPrintSongInfo(int fd, Song * song, void *data)
static
int
sumSongTime
(
int
fd
,
Song
*
song
,
void
*
data
)
{
unsigned
long
*
time
=
(
unsigned
long
*
)
data
;
unsigned
long
*
sum_
time
=
(
unsigned
long
*
)
data
;
if
(
song
->
tag
&&
song
->
tag
->
time
>=
0
)
*
time
+=
song
->
tag
->
time
;
*
sum_
time
+=
song
->
tag
->
time
;
return
0
;
}
...
...
src/directory.c
View file @
07adb14e
...
...
@@ -761,21 +761,21 @@ void closeMp3Directory(void)
static
Directory
*
findSubDirectory
(
Directory
*
directory
,
char
*
name
)
{
void
*
subDirectory
;
char
*
dup
=
xstrdup
(
name
);
char
*
dup
licated
=
xstrdup
(
name
);
char
*
key
;
key
=
strtok
(
dup
,
"/"
);
key
=
strtok
(
dup
licated
,
"/"
);
if
(
!
key
)
{
free
(
dup
);
free
(
dup
licated
);
return
NULL
;
}
if
(
findInList
(
directory
->
subDirectories
,
key
,
&
subDirectory
))
{
free
(
dup
);
free
(
dup
licated
);
return
(
Directory
*
)
subDirectory
;
}
free
(
dup
);
free
(
dup
licated
);
return
NULL
;
}
...
...
@@ -1264,9 +1264,9 @@ static Song *getSongDetails(char *file, char **shortnameRet,
void
*
song
=
NULL
;
Directory
*
directory
;
char
*
dir
=
NULL
;
char
*
dup
=
xstrdup
(
file
);
char
*
shortname
=
dup
;
char
*
c
=
strtok
(
dup
,
"/"
);
char
*
dup
licated
=
xstrdup
(
file
);
char
*
shortname
=
dup
licated
;
char
*
c
=
strtok
(
dup
licated
,
"/"
);
DEBUG
(
"get song: %s
\n
"
,
file
);
...
...
@@ -1275,25 +1275,25 @@ static Song *getSongDetails(char *file, char **shortnameRet,
c
=
strtok
(
NULL
,
"/"
);
}
if
(
shortname
!=
dup
)
{
for
(
c
=
dup
;
c
<
shortname
-
1
;
c
++
)
{
if
(
shortname
!=
dup
licated
)
{
for
(
c
=
dup
licated
;
c
<
shortname
-
1
;
c
++
)
{
if
(
*
c
==
'\0'
)
*
c
=
'/'
;
}
dir
=
dup
;
dir
=
dup
licated
;
}
if
(
!
(
directory
=
getDirectory
(
dir
)))
{
free
(
dup
);
free
(
dup
licated
);
return
NULL
;
}
if
(
!
findInList
(
directory
->
songs
,
shortname
,
&
song
))
{
free
(
dup
);
free
(
dup
licated
);
return
NULL
;
}
free
(
dup
);
free
(
dup
licated
);
if
(
shortnameRet
)
*
shortnameRet
=
shortname
;
if
(
directoryRet
)
...
...
src/inputPlugins/_flac_common.c
View file @
07adb14e
...
...
@@ -62,12 +62,12 @@ static int flacFindVorbisCommentFloat(const FLAC__StreamMetadata * block,
-
pos
;
if
(
len
>
0
)
{
unsigned
char
tmp
;
unsigned
char
*
du
p
=
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]);
tmp
=
du
p
[
len
];
du
p
[
len
]
=
'\0'
;
*
fl
=
atof
((
char
*
)
du
p
);
du
p
[
len
]
=
tmp
;
unsigned
char
*
p
=
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]);
tmp
=
p
[
len
];
p
[
len
]
=
'\0'
;
*
fl
=
atof
((
char
*
)
p
);
p
[
len
]
=
tmp
;
return
1
;
}
...
...
src/inputPlugins/audiofile_plugin.c
View file @
07adb14e
...
...
@@ -33,16 +33,16 @@
static
int
getAudiofileTotalTime
(
char
*
file
)
{
int
time
;
int
t
otal_t
ime
;
AFfilehandle
af_fp
=
afOpenFile
(
file
,
"r"
,
NULL
);
if
(
af_fp
==
AF_NULL_FILEHANDLE
)
{
return
-
1
;
}
time
=
(
int
)
t
otal_t
ime
=
(
int
)
((
double
)
afGetFrameCount
(
af_fp
,
AF_DEFAULT_TRACK
)
/
afGetRate
(
af_fp
,
AF_DEFAULT_TRACK
));
afCloseFile
(
af_fp
);
return
time
;
return
t
otal_t
ime
;
}
static
int
audiofile_decode
(
OutputBuffer
*
cb
,
DecoderControl
*
dc
,
char
*
path
)
...
...
@@ -134,12 +134,12 @@ static int audiofile_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
static
MpdTag
*
audiofileTagDup
(
char
*
file
)
{
MpdTag
*
ret
=
NULL
;
int
time
=
getAudiofileTotalTime
(
file
);
int
t
otal_t
ime
=
getAudiofileTotalTime
(
file
);
if
(
time
>=
0
)
{
if
(
t
otal_t
ime
>=
0
)
{
if
(
!
ret
)
ret
=
newMpdTag
();
ret
->
time
=
time
;
ret
->
time
=
t
otal_t
ime
;
}
else
{
DEBUG
(
"audiofileTagDup: Failed to get total song time from: %s
\n
"
,
...
...
src/inputPlugins/mod_plugin.c
View file @
07adb14e
...
...
@@ -166,7 +166,7 @@ static void mod_close(mod_Data * data)
static
int
mod_decode
(
OutputBuffer
*
cb
,
DecoderControl
*
dc
,
char
*
path
)
{
mod_Data
*
data
;
float
time
=
0
.
0
;
float
t
otal_t
ime
=
0
.
0
;
int
ret
;
float
secPerByte
;
...
...
@@ -203,10 +203,10 @@ static int mod_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
break
;
ret
=
VC_WriteBytes
(
data
->
audio_buffer
,
MIKMOD_FRAME_SIZE
);
time
+=
ret
*
secPerByte
;
t
otal_t
ime
+=
ret
*
secPerByte
;
sendDataToOutputBuffer
(
cb
,
NULL
,
dc
,
0
,
(
char
*
)
data
->
audio_buffer
,
ret
,
time
,
0
,
NULL
);
(
char
*
)
data
->
audio_buffer
,
ret
,
total_time
,
0
,
NULL
);
}
flushOutputBuffer
(
cb
);
...
...
src/inputPlugins/mp3_plugin.c
View file @
07adb14e
...
...
@@ -69,7 +69,7 @@ static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample,
struct
audio_dither
*
dither
)
{
unsigned
int
scalebits
;
mad_fixed_t
output
,
mask
,
r
andom
;
mad_fixed_t
output
,
mask
,
r
nd
;
enum
{
MIN
=
-
MAD_F_ONE
,
...
...
@@ -86,10 +86,10 @@ static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample,
scalebits
=
MAD_F_FRACBITS
+
1
-
bits
;
mask
=
(
1L
<<
scalebits
)
-
1
;
r
andom
=
prng
(
dither
->
random
);
output
+=
(
r
andom
&
mask
)
-
(
dither
->
random
&
mask
);
r
nd
=
prng
(
dither
->
random
);
output
+=
(
r
nd
&
mask
)
-
(
dither
->
random
&
mask
);
dither
->
random
=
r
andom
;
dither
->
random
=
r
nd
;
if
(
output
>
MAX
)
{
output
=
MAX
;
...
...
@@ -1093,16 +1093,16 @@ static int mp3_decode(OutputBuffer * cb, DecoderControl * dc,
static
MpdTag
*
mp3_tagDup
(
char
*
file
)
{
MpdTag
*
ret
=
NULL
;
int
time
;
int
t
otal_t
ime
;
ret
=
id3Dup
(
file
);
time
=
getMp3TotalTime
(
file
);
t
otal_t
ime
=
getMp3TotalTime
(
file
);
if
(
time
>=
0
)
{
if
(
t
otal_t
ime
>=
0
)
{
if
(
!
ret
)
ret
=
newMpdTag
();
ret
->
time
=
time
;
ret
->
time
=
t
otal_t
ime
;
}
else
{
DEBUG
(
"mp3_tagDup: Failed to get total song time from: %s
\n
"
,
file
);
...
...
src/inputPlugins/mpc_plugin.c
View file @
07adb14e
...
...
@@ -134,7 +134,7 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc,
unsigned
long
samplePos
=
0
;
mpc_uint32_t
vbrUpdateAcc
;
mpc_uint32_t
vbrUpdateBits
;
float
time
;
float
t
otal_t
ime
;
int
i
;
ReplayGainInfo
*
replayGainInfo
=
NULL
;
...
...
@@ -218,7 +218,7 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc,
s16
++
;
if
(
chunkpos
>=
MPC_CHUNK_SIZE
)
{
time
=
((
float
)
samplePos
)
/
t
otal_t
ime
=
((
float
)
samplePos
)
/
dc
->
audioFormat
.
sampleRate
;
bitRate
=
vbrUpdateBits
*
...
...
@@ -227,7 +227,7 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc,
sendDataToOutputBuffer
(
cb
,
inStream
,
dc
,
inStream
->
seekable
,
chunk
,
chunkpos
,
time
,
t
otal_t
ime
,
bitRate
,
replayGainInfo
);
chunkpos
=
0
;
...
...
@@ -241,13 +241,13 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc,
}
if
(
!
dc
->
stop
&&
chunkpos
>
0
)
{
time
=
((
float
)
samplePos
)
/
dc
->
audioFormat
.
sampleRate
;
t
otal_t
ime
=
((
float
)
samplePos
)
/
dc
->
audioFormat
.
sampleRate
;
bitRate
=
vbrUpdateBits
*
dc
->
audioFormat
.
sampleRate
/
1152
/
1000
;
sendDataToOutputBuffer
(
cb
,
NULL
,
dc
,
inStream
->
seekable
,
chunk
,
chunkpos
,
time
,
bitRate
,
chunk
,
chunkpos
,
t
otal_t
ime
,
bitRate
,
replayGainInfo
);
}
...
...
@@ -261,7 +261,7 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc,
static
float
mpcGetTime
(
char
*
file
)
{
InputStream
inStream
;
float
time
=
-
1
;
float
t
otal_t
ime
=
-
1
;
mpc_reader
reader
;
mpc_streaminfo
info
;
...
...
@@ -289,19 +289,19 @@ static float mpcGetTime(char *file)
return
-
1
;
}
time
=
mpc_streaminfo_get_length
(
&
info
);
t
otal_t
ime
=
mpc_streaminfo_get_length
(
&
info
);
closeInputStream
(
&
inStream
);
return
time
;
return
t
otal_t
ime
;
}
static
MpdTag
*
mpcTagDup
(
char
*
file
)
{
MpdTag
*
ret
=
NULL
;
float
time
=
mpcGetTime
(
file
);
float
t
otal_t
ime
=
mpcGetTime
(
file
);
if
(
time
<
0
)
{
if
(
t
otal_t
ime
<
0
)
{
DEBUG
(
"mpcTagDup: Failed to get Songlength of file: %s
\n
"
,
file
);
return
NULL
;
...
...
@@ -312,7 +312,7 @@ static MpdTag *mpcTagDup(char *file)
ret
=
id3Dup
(
file
);
if
(
!
ret
)
ret
=
newMpdTag
();
ret
->
time
=
time
;
ret
->
time
=
t
otal_t
ime
;
return
ret
;
}
...
...
src/locate.c
View file @
07adb14e
...
...
@@ -123,7 +123,7 @@ void freeLocateTagItem(LocateTagItem * item)
static
int
strstrSearchTag
(
Song
*
song
,
int
type
,
char
*
str
)
{
int
i
;
char
*
dup
;
char
*
dup
licate
;
int
ret
=
0
;
if
(
type
==
LOCATE_TAG_FILE_TYPE
||
type
==
LOCATE_TAG_ANY_TYPE
)
{
...
...
@@ -145,10 +145,10 @@ static int strstrSearchTag(Song * song, int type, char *str)
continue
;
}
dup
=
strDupToUpper
(
song
->
tag
->
items
[
i
].
value
);
if
(
strstr
(
dup
,
str
))
dup
licate
=
strDupToUpper
(
song
->
tag
->
items
[
i
].
value
);
if
(
strstr
(
dup
licate
,
str
))
ret
=
1
;
free
(
dup
);
free
(
dup
licate
);
}
return
ret
;
...
...
src/ls.c
View file @
07adb14e
...
...
@@ -103,7 +103,7 @@ int lsPlaylists(int fd, char *utf8path)
DIR
*
dir
;
struct
stat
st
;
struct
dirent
*
ent
;
char
*
dup
;
char
*
dup
licated
;
char
*
utf8
;
char
s
[
MPD_PATH_MAX
];
char
path_max_tmp
[
MPD_PATH_MAX
];
...
...
@@ -128,21 +128,20 @@ int lsPlaylists(int fd, char *utf8path)
while
((
ent
=
readdir
(
dir
)))
{
size_t
len
=
strlen
(
ent
->
d_name
)
+
1
;
dup
=
ent
->
d_name
;
dup
licated
=
ent
->
d_name
;
if
(
mpd_likely
(
len
<=
maxlen
)
&&
dup
[
0
]
!=
'.'
&&
(
suff
=
strlen
(
dup
)
-
suflen
)
>
0
&&
dup
[
suff
]
==
'.'
&&
strcmp
(
dup
+
suff
+
1
,
PLAYLIST_FILE_SUFFIX
)
==
0
)
{
dup
licated
[
0
]
!=
'.'
&&
(
suff
=
strlen
(
dup
licated
)
-
suflen
)
>
0
&&
dup
licated
[
suff
]
==
'.'
&&
strcmp
(
dup
licated
+
suff
+
1
,
PLAYLIST_FILE_SUFFIX
)
==
0
)
{
memcpy
(
s
+
actlen
,
ent
->
d_name
,
len
);
if
(
stat
(
s
,
&
st
)
==
0
)
{
if
(
S_ISREG
(
st
.
st_mode
))
{
char
path_max_tmp
[
MPD_PATH_MAX
];
if
(
list
==
NULL
)
list
=
makeList
(
NULL
,
1
);
dup
[
suff
]
=
'\0'
;
dup
licated
[
suff
]
=
'\0'
;
utf8
=
fs_charset_to_utf8
(
path_max_tmp
,
dup
);
dup
licated
);
if
(
utf8
)
insertInList
(
list
,
utf8
,
NULL
);
}
...
...
@@ -156,25 +155,27 @@ int lsPlaylists(int fd, char *utf8path)
int
i
;
sortList
(
list
);
dup
=
xmalloc
(
strlen
(
utf8path
)
+
2
);
strcpy
(
dup
,
utf8path
);
for
(
i
=
strlen
(
dup
)
-
1
;
i
>=
0
&&
dup
[
i
]
==
'/'
;
i
--
)
{
dup
[
i
]
=
'\0'
;
duplicated
=
xmalloc
(
strlen
(
utf8path
)
+
2
);
strcpy
(
duplicated
,
utf8path
);
for
(
i
=
strlen
(
duplicated
)
-
1
;
i
>=
0
&&
duplicated
[
i
]
==
'/'
;
i
--
)
{
duplicated
[
i
]
=
'\0'
;
}
if
(
strlen
(
dup
))
strcat
(
dup
,
"/"
);
if
(
strlen
(
dup
licated
))
strcat
(
dup
licated
,
"/"
);
node
=
list
->
firstNode
;
while
(
node
!=
NULL
)
{
if
(
!
strchr
(
node
->
key
,
'\n'
))
{
fdprintf
(
fd
,
"playlist: %s%s
\n
"
,
dup
,
fdprintf
(
fd
,
"playlist: %s%s
\n
"
,
dup
licated
,
node
->
key
);
}
node
=
node
->
nextNode
;
}
freeList
(
list
);
free
(
dup
);
free
(
dup
licated
);
}
return
0
;
...
...
src/outputBuffer.c
View file @
07adb14e
...
...
@@ -66,7 +66,7 @@ void flushOutputBuffer(OutputBuffer * cb)
int
sendDataToOutputBuffer
(
OutputBuffer
*
cb
,
InputStream
*
inStream
,
DecoderControl
*
dc
,
int
seekable
,
void
*
dataIn
,
long
dataInLen
,
float
time
,
mpd_uint16
bitRate
,
long
dataInLen
,
float
data_
time
,
mpd_uint16
bitRate
,
ReplayGainInfo
*
replayGainInfo
)
{
mpd_uint16
dataToSend
;
...
...
@@ -128,7 +128,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
}
else
cb
->
metaChunk
[
currentChunk
]
=
-
1
;
cb
->
bitRate
[
currentChunk
]
=
bitRate
;
cb
->
times
[
currentChunk
]
=
time
;
cb
->
times
[
currentChunk
]
=
data_
time
;
}
chunkLeft
=
CHUNK_SIZE
-
cb
->
chunkSize
[
currentChunk
];
...
...
src/player.c
View file @
07adb14e
...
...
@@ -276,7 +276,7 @@ int playerPause(int fd)
return
0
;
}
int
playerSetPause
(
int
fd
,
int
pause
)
int
playerSetPause
(
int
fd
,
int
pause
_flag
)
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
...
...
@@ -285,11 +285,11 @@ int playerSetPause(int fd, int pause)
switch
(
pc
->
state
)
{
case
PLAYER_STATE_PLAY
:
if
(
pause
)
if
(
pause
_flag
)
playerPause
(
fd
);
break
;
case
PLAYER_STATE_PAUSE
:
if
(
!
pause
)
if
(
!
pause
_flag
)
playerPause
(
fd
);
break
;
}
...
...
@@ -436,7 +436,7 @@ void playerQueueUnlock(void)
}
}
int
playerSeek
(
int
fd
,
Song
*
song
,
float
time
)
int
playerSeek
(
int
fd
,
Song
*
song
,
float
seek_
time
)
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
char
path_max_tmp
[
MPD_PATH_MAX
];
...
...
@@ -452,7 +452,7 @@ int playerSeek(int fd, Song * song, float time)
if
(
pc
->
error
==
PLAYER_ERROR_NOERROR
)
{
resetPlayerMetadata
();
pc
->
seekWhere
=
time
;
pc
->
seekWhere
=
seek_
time
;
pc
->
seek
=
1
;
if
(
player_pid
>
0
&&
pc
->
state
==
PLAYER_STATE_PAUSE
)
kill
(
player_pid
,
SIGCONT
);
...
...
src/playlist.c
View file @
07adb14e
...
...
@@ -279,7 +279,7 @@ void savePlaylistState(FILE *fp)
}
static
void
loadPlaylistFromStateFile
(
FILE
*
fp
,
char
*
buffer
,
int
state
,
int
current
,
int
time
)
int
state
,
int
current
,
int
seek_
time
)
{
char
*
temp
;
int
song
;
...
...
@@ -300,7 +300,8 @@ static void loadPlaylistFromStateFile(FILE *fp, char *buffer,
}
if
(
state
!=
PLAYER_STATE_STOP
)
{
seekSongInPlaylist
(
STDERR_FILENO
,
playlist
.
length
-
1
,
time
);
playlist
.
length
-
1
,
seek_time
);
}
}
if
(
!
myFgets
(
buffer
,
PLAYLIST_BUFFER_SIZE
,
fp
))
...
...
@@ -311,7 +312,7 @@ static void loadPlaylistFromStateFile(FILE *fp, char *buffer,
void
readPlaylistState
(
FILE
*
fp
)
{
int
current
=
-
1
;
int
time
=
0
;
int
seek_
time
=
0
;
int
state
=
PLAYER_STATE_STOP
;
char
buffer
[
PLAYLIST_BUFFER_SIZE
];
...
...
@@ -330,7 +331,7 @@ void readPlaylistState(FILE *fp)
}
}
else
if
(
strncmp
(
buffer
,
PLAYLIST_STATE_FILE_TIME
,
strlen
(
PLAYLIST_STATE_FILE_TIME
))
==
0
)
{
time
=
seek_
time
=
atoi
(
&
(
buffer
[
strlen
(
PLAYLIST_STATE_FILE_TIME
)]));
}
else
if
(
strncmp
...
...
@@ -380,7 +381,7 @@ void readPlaylistState(FILE *fp)
if
(
state
==
PLAYER_STATE_STOP
)
current
=
-
1
;
loadPlaylistFromStateFile
(
fp
,
buffer
,
state
,
current
,
time
);
current
,
seek_
time
);
}
}
}
...
...
@@ -1460,7 +1461,7 @@ int getPlaylistLength(void)
return
playlist
.
length
;
}
int
seekSongInPlaylist
(
int
fd
,
int
song
,
float
time
)
int
seekSongInPlaylist
(
int
fd
,
int
song
,
float
seek_
time
)
{
int
i
=
song
;
...
...
@@ -1491,14 +1492,14 @@ int seekSongInPlaylist(int fd, int song, float time)
return
-
1
;
}
return
playerSeek
(
fd
,
playlist
.
songs
[
playlist
.
order
[
i
]],
time
);
return
playerSeek
(
fd
,
playlist
.
songs
[
playlist
.
order
[
i
]],
seek_
time
);
}
int
seekSongInPlaylistById
(
int
fd
,
int
id
,
float
time
)
int
seekSongInPlaylistById
(
int
fd
,
int
id
,
float
seek_
time
)
{
checkSongId
(
id
);
return
seekSongInPlaylist
(
fd
,
playlist
.
idToPosition
[
id
],
time
);
return
seekSongInPlaylist
(
fd
,
playlist
.
idToPosition
[
id
],
seek_
time
);
}
int
getPlaylistSongId
(
int
song
)
...
...
src/sig_handlers.c
View file @
07adb14e
...
...
@@ -51,7 +51,7 @@ int handlePendingSignals(void)
return
0
;
}
static
void
chldSigHandler
(
int
sig
nal
)
static
void
chldSigHandler
(
int
sig
)
{
int
status
;
int
pid
;
...
...
src/storedPlaylist.c
View file @
07adb14e
...
...
@@ -27,16 +27,16 @@
#include "directory.h"
#include "os_compat.h"
static
ListNode
*
nodeOfStoredPlaylist
(
List
*
list
,
int
i
nde
x
)
static
ListNode
*
nodeOfStoredPlaylist
(
List
*
list
,
int
i
d
x
)
{
int
forward
;
ListNode
*
node
;
int
i
;
if
(
i
ndex
>=
list
->
numberOfNodes
||
inde
x
<
0
)
if
(
i
dx
>=
list
->
numberOfNodes
||
id
x
<
0
)
return
NULL
;
if
(
i
nde
x
>
(
list
->
numberOfNodes
/
2
))
{
if
(
i
d
x
>
(
list
->
numberOfNodes
/
2
))
{
forward
=
0
;
node
=
list
->
lastNode
;
i
=
list
->
numberOfNodes
-
1
;
...
...
@@ -47,7 +47,7 @@ static ListNode *nodeOfStoredPlaylist(List *list, int index)
}
while
(
node
!=
NULL
)
{
if
(
i
==
i
nde
x
)
if
(
i
==
i
d
x
)
return
node
;
if
(
forward
)
{
...
...
src/tag.c
View file @
07adb14e
...
...
@@ -588,17 +588,17 @@ MpdTag *newMpdTag(void)
return
ret
;
}
static
void
deleteItem
(
MpdTag
*
tag
,
int
i
nde
x
)
static
void
deleteItem
(
MpdTag
*
tag
,
int
i
d
x
)
{
assert
(
i
nde
x
<
tag
->
numOfItems
);
assert
(
i
d
x
<
tag
->
numOfItems
);
tag
->
numOfItems
--
;
removeTagItemString
(
tag
->
items
[
i
ndex
].
type
,
tag
->
items
[
inde
x
].
value
);
/* free(tag->items[i
nde
x].value); */
removeTagItemString
(
tag
->
items
[
i
dx
].
type
,
tag
->
items
[
id
x
].
value
);
/* free(tag->items[i
d
x].value); */
if
(
tag
->
numOfItems
-
i
nde
x
>
0
)
{
memmove
(
tag
->
items
+
i
ndex
,
tag
->
items
+
inde
x
+
1
,
tag
->
numOfItems
-
i
nde
x
);
if
(
tag
->
numOfItems
-
i
d
x
>
0
)
{
memmove
(
tag
->
items
+
i
dx
,
tag
->
items
+
id
x
+
1
,
tag
->
numOfItems
-
i
d
x
);
}
if
(
tag
->
numOfItems
>
0
)
{
...
...
@@ -704,21 +704,21 @@ int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2)
static
void
appendToTagItems
(
MpdTag
*
tag
,
int
type
,
char
*
value
,
int
len
)
{
int
i
=
tag
->
numOfItems
;
char
*
dup
=
xmalloc
(
len
+
1
);
char
*
dup
licated
=
xmalloc
(
len
+
1
);
memcpy
(
dup
,
value
,
len
);
dup
[
len
]
=
'\0'
;
memcpy
(
dup
licated
,
value
,
len
);
dup
licated
[
len
]
=
'\0'
;
fixUtf8
(
dup
);
stripReturnChar
(
dup
);
fixUtf8
(
dup
licated
);
stripReturnChar
(
dup
licated
);
tag
->
numOfItems
++
;
tag
->
items
=
xrealloc
(
tag
->
items
,
tag
->
numOfItems
*
sizeof
(
MpdTagItem
));
tag
->
items
[
i
].
type
=
type
;
tag
->
items
[
i
].
value
=
getTagItemString
(
type
,
dup
);
tag
->
items
[
i
].
value
=
getTagItemString
(
type
,
dup
licated
);
free
(
dup
);
free
(
dup
licated
);
}
void
addItemToMpdTagWithLen
(
MpdTag
*
tag
,
int
itemType
,
char
*
value
,
int
len
)
...
...
src/timer.c
View file @
07adb14e
...
...
@@ -67,11 +67,11 @@ void timer_add(Timer *timer, int size)
void
timer_sync
(
Timer
*
timer
)
{
int64_t
sleep
;
int64_t
sleep
_duration
;
assert
(
timer
->
started
);
sleep
=
timer
->
time
-
now
();
if
(
sleep
>
0
)
my_usleep
(
sleep
);
sleep
_duration
=
timer
->
time
-
now
();
if
(
sleep
_duration
>
0
)
my_usleep
(
sleep
_duration
);
}
src/volume.c
View file @
07adb14e
...
...
@@ -95,7 +95,7 @@ static int prepOssMixer(char *device)
if
(
param
)
{
char
*
labels
[
SOUND_MIXER_NRDEVICES
]
=
SOUND_DEVICE_LABELS
;
char
*
dup
;
char
*
dup
licated
;
int
i
,
j
;
int
devmask
=
0
;
...
...
@@ -106,16 +106,16 @@ static int prepOssMixer(char *device)
}
for
(
i
=
0
;
i
<
SOUND_MIXER_NRDEVICES
;
i
++
)
{
dup
=
xstrdup
(
labels
[
i
]);
dup
licated
=
xstrdup
(
labels
[
i
]);
/* eliminate spaces at the end */
j
=
strlen
(
dup
)
-
1
;
while
(
j
>=
0
&&
dup
[
j
]
==
' '
)
dup
[
j
--
]
=
'\0'
;
if
(
strcasecmp
(
dup
,
param
->
value
)
==
0
)
{
free
(
dup
);
j
=
strlen
(
dup
licated
)
-
1
;
while
(
j
>=
0
&&
dup
licated
[
j
]
==
' '
)
dup
licated
[
j
--
]
=
'\0'
;
if
(
strcasecmp
(
dup
licated
,
param
->
value
)
==
0
)
{
free
(
dup
licated
);
break
;
}
free
(
dup
);
free
(
dup
licated
);
}
if
(
i
>=
SOUND_MIXER_NRDEVICES
)
{
...
...
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