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
8edc4163
Commit
8edc4163
authored
Feb 25, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more cleanups
git-svn-id:
https://svn.musicpd.org/mpd/trunk@60
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
e1c839cd
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
36 additions
and
33 deletions
+36
-33
audiofile_decode.c
src/audiofile_decode.c
+1
-1
conf.c
src/conf.c
+5
-2
decode.c
src/decode.c
+10
-10
flac_decode.c
src/flac_decode.c
+1
-1
ls.c
src/ls.c
+1
-1
mp3_decode.c
src/mp3_decode.c
+1
-1
ogg_decode.c
src/ogg_decode.c
+1
-1
path.c
src/path.c
+2
-2
playerData.c
src/playerData.c
+12
-12
playerData.h
src/playerData.h
+1
-1
playlist.c
src/playlist.c
+1
-1
No files found.
src/audiofile_decode.c
View file @
8edc4163
...
...
@@ -115,7 +115,7 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
++
cb
->
end
;
if
(
cb
->
end
>=
BUFFERED_CHUNKS
)
{
if
(
cb
->
end
>=
buffered_chunks
)
{
cb
->
end
=
0
;
cb
->
wrap
=
1
;
}
...
...
src/conf.c
View file @
8edc4163
...
...
@@ -216,13 +216,16 @@ char ** readConf(char * file) {
conf_params
[
conf_absolutePaths
[
i
]]);
exit
(
-
1
);
}
/* Parse ~ in path */
else
if
(
conf_params
[
conf_absolutePaths
[
i
]]
&&
conf_params
[
conf_absolutePaths
[
i
]][
0
]
==
'~'
)
{
struct
passwd
*
pwd
=
NULL
;
char
*
path
;
int
pos
=
1
;
if
(
conf_params
[
conf_absolutePaths
[
i
]][
1
]
==
'/'
)
{
if
(
conf_params
[
conf_absolutePaths
[
i
]][
1
]
==
'/'
||
conf_params
[
conf_absolutePaths
[
i
]][
1
]
==
'\0'
)
{
uid_t
uid
=
geteuid
();
if
((
pwd
=
getpwuid
(
uid
))
==
NULL
)
{
ERROR
(
"problems getting passwd entry "
...
...
@@ -251,7 +254,7 @@ char ** readConf(char * file) {
if
(
foundSlash
)
*
ch
=
'/'
;
}
path
=
malloc
(
strlen
(
pwd
->
pw_dir
)
+
strlen
(
&
(
conf_params
[
conf_absolutePaths
[
i
]][
pos
])));
&
(
conf_params
[
conf_absolutePaths
[
i
]][
pos
]))
+
1
);
strcpy
(
path
,
pwd
->
pw_dir
);
strcat
(
path
,
&
(
conf_params
[
conf_absolutePaths
[
i
]][
pos
]));
free
(
conf_params
[
conf_absolutePaths
[
i
]]);
...
...
src/decode.c
View file @
8edc4163
...
...
@@ -93,8 +93,8 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
chunks
=
(
af
->
sampleRate
*
af
->
bits
*
af
->
channels
/
8
.
0
/
CHUNK_SIZE
);
chunks
=
(
chunks
*
pc
->
crossFade
+
0
.
5
);
if
(
chunks
>
(
BUFFERED_CHUNKS
-
buffered_before_play
))
{
chunks
=
BUFFERED_CHUNKS
-
buffered_before_play
;
if
(
chunks
>
(
buffered_chunks
-
buffered_before_play
))
{
chunks
=
buffered_chunks
-
buffered_before_play
;
}
if
(
chunks
<
0
)
chunks
=
0
;
...
...
@@ -338,19 +338,19 @@ void decode() {
<=
crossFadeChunks
)
||
(
cb
->
begin
>
cb
->
next
&&
(
fadePosition
=
cb
->
next
-
cb
->
begin
+
BUFFERED_CHUNKS
)
<=
crossFadeChunks
)))
buffered_chunks
)
<=
crossFadeChunks
)))
{
if
(
nextChunk
<
0
)
{
crossFadeChunks
=
fadePosition
;
}
nextChunk
=
cb
->
begin
+
crossFadeChunks
;
test
=
cb
->
end
;
if
(
cb
->
wrap
)
test
+=
BUFFERED_CHUNKS
;
if
(
cb
->
wrap
)
test
+=
buffered_chunks
;
if
(
nextChunk
<
test
)
{
if
(
nextChunk
>=
BUFFERED_CHUNKS
)
if
(
nextChunk
>=
buffered_chunks
)
{
nextChunk
-=
BUFFERED_CHUNKS
;
buffered_chunks
;
}
pcm_mix
(
cb
->
chunks
+
cb
->
begin
*
CHUNK_SIZE
,
...
...
@@ -393,7 +393,7 @@ void decode() {
playAudio
(
cb
->
chunks
+
cb
->
begin
*
CHUNK_SIZE
,
cb
->
chunkSize
[
cb
->
begin
]);
cb
->
begin
++
;
if
(
cb
->
begin
>=
BUFFERED_CHUNKS
)
{
if
(
cb
->
begin
>=
buffered_chunks
)
{
cb
->
begin
=
0
;
cb
->
wrap
=
0
;
}
...
...
@@ -404,12 +404,12 @@ void decode() {
if
(
doCrossFade
==
1
&&
nextChunk
>=
0
)
{
nextChunk
=
cb
->
begin
+
crossFadeChunks
;
test
=
cb
->
end
;
if
(
cb
->
wrap
)
test
+=
BUFFERED_CHUNKS
;
if
(
cb
->
wrap
)
test
+=
buffered_chunks
;
if
(
nextChunk
<
test
)
{
if
(
nextChunk
>=
BUFFERED_CHUNKS
)
if
(
nextChunk
>=
buffered_chunks
)
{
nextChunk
-=
BUFFERED_CHUNKS
;
buffered_chunks
;
}
cb
->
begin
=
nextChunk
;
}
...
...
src/flac_decode.c
View file @
8edc4163
...
...
@@ -192,7 +192,7 @@ int flacSendChunk(FlacData * data) {
data
->
cb
->
bitRate
[
data
->
cb
->
end
]
=
0
;
data
->
cb
->
end
++
;
if
(
data
->
cb
->
end
>=
BUFFERED_CHUNKS
)
{
if
(
data
->
cb
->
end
>=
buffered_chunks
)
{
data
->
cb
->
end
=
0
;
data
->
cb
->
wrap
=
1
;
}
...
...
src/ls.c
View file @
8edc4163
...
...
@@ -32,7 +32,7 @@
#include <stdlib.h>
char
*
dupAndStripPlaylistSuffix
(
char
*
file
)
{
in
t
size
=
strlen
(
file
)
-
strlen
(
PLAYLIST_FILE_SUFFIX
)
-
1
;
size_
t
size
=
strlen
(
file
)
-
strlen
(
PLAYLIST_FILE_SUFFIX
)
-
1
;
char
*
ret
=
malloc
(
size
+
1
);
strncpy
(
ret
,
file
,
size
);
...
...
src/mp3_decode.c
View file @
8edc4163
...
...
@@ -374,7 +374,7 @@ int mp3ChildSendData(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
cb
->
times
[
cb
->
end
]
=
data
->
elapsedTime
;
cb
->
end
++
;
if
(
cb
->
end
>=
BUFFERED_CHUNKS
)
{
if
(
cb
->
end
>=
buffered_chunks
)
{
cb
->
end
=
0
;
cb
->
wrap
=
1
;
}
...
...
src/ogg_decode.c
View file @
8edc4163
...
...
@@ -97,7 +97,7 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
}
cb
->
bitRate
[
cb
->
end
]
=
bitRate
;
cb
->
end
++
;
if
(
cb
->
end
>=
BUFFERED_CHUNKS
)
{
if
(
cb
->
end
>=
buffered_chunks
)
{
cb
->
end
=
0
;
cb
->
wrap
=
1
;
}
...
...
src/path.c
View file @
8edc4163
...
...
@@ -134,7 +134,7 @@ char * rmp2amp(char * relativePath) {
memset
(
absolutePath
,
0
,
MAXPATHLEN
+
1
);
str
cpy
(
absolutePath
,
musicDir
);
str
ncpy
(
absolutePath
,
musicDir
,
MAXPATHLEN
);
strncat
(
absolutePath
,
relativePath
,
MAXPATHLEN
-
strlen
(
musicDir
));
return
absolutePath
;
...
...
@@ -145,7 +145,7 @@ char * rpp2app(char * relativePath) {
memset
(
absolutePath
,
0
,
MAXPATHLEN
+
1
);
str
cpy
(
absolutePath
,
playlistDir
);
str
ncpy
(
absolutePath
,
playlistDir
,
MAXPATHLEN
);
strncat
(
absolutePath
,
relativePath
,
MAXPATHLEN
-
strlen
(
musicDir
));
return
absolutePath
;
...
...
src/playerData.c
View file @
8edc4163
...
...
@@ -28,7 +28,7 @@
#include <string.h>
int
buffered_before_play
;
int
BUFFERED_CHUNKS
;
int
buffered_chunks
;
PlayerData
*
playerData_pd
;
...
...
@@ -49,7 +49,7 @@ void initPlayerData() {
}
bufferSize
*=
1024
;
BUFFERED_CHUNKS
=
bufferSize
/
CHUNK_SIZE
;
buffered_chunks
=
bufferSize
/
CHUNK_SIZE
;
perc
=
strtod
((
getConf
())[
CONF_BUFFER_BEFORE_PLAY
],
&
test
);
if
(
*
test
!=
'%'
||
perc
<
0
||
perc
>
100
)
{
...
...
@@ -58,16 +58,16 @@ void initPlayerData() {
(
getConf
())[
CONF_BUFFER_BEFORE_PLAY
]);
exit
(
-
1
);
}
buffered_before_play
=
(
perc
/
100
)
*
BUFFERED_CHUNKS
;
if
(
buffered_before_play
>
BUFFERED_CHUNKS
)
{
buffered_before_play
=
BUFFERED_CHUNKS
;
buffered_before_play
=
(
perc
/
100
)
*
buffered_chunks
;
if
(
buffered_before_play
>
buffered_chunks
)
{
buffered_before_play
=
buffered_chunks
;
}
else
if
(
buffered_before_play
<
0
)
buffered_before_play
=
0
;
allocationSize
=
BUFFERED_CHUNKS
*
CHUNK_SIZE
;
/*actual buffer*/
allocationSize
+=
BUFFERED_CHUNKS
*
sizeof
(
float
);
/*for times*/
allocationSize
+=
BUFFERED_CHUNKS
*
sizeof
(
mpd_sint16
);
/*for chunkSize*/
allocationSize
+=
BUFFERED_CHUNKS
*
sizeof
(
mpd_sint16
);
/*for bitRate*/
allocationSize
=
buffered_chunks
*
CHUNK_SIZE
;
/*actual buffer*/
allocationSize
+=
buffered_chunks
*
sizeof
(
float
);
/*for times*/
allocationSize
+=
buffered_chunks
*
sizeof
(
mpd_sint16
);
/*for chunkSize*/
allocationSize
+=
buffered_chunks
*
sizeof
(
mpd_sint16
);
/*for bitRate*/
allocationSize
+=
sizeof
(
PlayerData
);
/*for playerData struct*/
if
((
shmid
=
shmget
(
IPC_PRIVATE
,
allocationSize
,
IPC_CREAT
|
0600
))
<
0
)
{
...
...
@@ -87,11 +87,11 @@ void initPlayerData() {
buffer
->
chunks
=
((
char
*
)
playerData_pd
)
+
sizeof
(
PlayerData
);
buffer
->
chunkSize
=
(
mpd_sint16
*
)(((
char
*
)
buffer
->
chunks
)
+
BUFFERED_CHUNKS
*
CHUNK_SIZE
);
buffered_chunks
*
CHUNK_SIZE
);
buffer
->
bitRate
=
(
mpd_sint16
*
)(((
char
*
)
buffer
->
chunkSize
)
+
BUFFERED_CHUNKS
*
sizeof
(
mpd_sint16
));
buffered_chunks
*
sizeof
(
mpd_sint16
));
buffer
->
times
=
(
float
*
)(((
char
*
)
buffer
->
bitRate
)
+
BUFFERED_CHUNKS
*
sizeof
(
mpd_sint16
));
buffered_chunks
*
sizeof
(
mpd_sint16
));
playerData_pd
->
playerControl
.
stop
=
0
;
playerData_pd
->
playerControl
.
pause
=
0
;
...
...
src/playerData.h
View file @
8edc4163
...
...
@@ -27,7 +27,7 @@
#define CHUNK_SIZE 1024
extern
int
buffered_before_play
;
extern
int
BUFFERED_CHUNKS
;
extern
int
buffered_chunks
;
typedef
struct
_Buffer
{
char
*
chunks
;
...
...
src/playlist.c
View file @
8edc4163
...
...
@@ -130,7 +130,7 @@ void initPlaylist() {
playlist
.
songs
=
malloc
(
sizeof
(
Song
*
)
*
playlist_max_length
);
playlist
.
order
=
malloc
(
sizeof
(
Song
*
)
*
playlist_max_length
);
memset
(
playlist
.
songs
,
(
int
)
NULL
,
sizeof
(
char
*
)
*
playlist_max_length
);
memset
(
playlist
.
songs
,
0
,
sizeof
(
char
*
)
*
playlist_max_length
);
srand
(
time
(
NULL
));
...
...
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