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
3ab98417
Commit
3ab98417
authored
Apr 01, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use our own portable version of usleep using select()
git-svn-id:
https://svn.musicpd.org/mpd/trunk@578
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
917af619
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
40 additions
and
23 deletions
+40
-23
aac_decode.c
src/aac_decode.c
+1
-1
audiofile_decode.c
src/audiofile_decode.c
+1
-1
decode.c
src/decode.c
+8
-8
flac_decode.c
src/flac_decode.c
+1
-1
interface.c
src/interface.c
+3
-2
mp3_decode.c
src/mp3_decode.c
+1
-1
mp4_decode.c
src/mp4_decode.c
+1
-1
ogg_decode.c
src/ogg_decode.c
+1
-1
player.c
src/player.c
+7
-7
utils.c
src/utils.c
+14
-0
utils.h
src/utils.h
+2
-0
No files found.
src/aac_decode.c
View file @
3ab98417
...
...
@@ -371,7 +371,7 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
while
(
cb
->
begin
==
cb
->
end
&&
cb
->
wrap
&&
!
dc
->
stop
&&
!
dc
->
seek
)
{
usleep
(
10000
);
my_
usleep
(
10000
);
}
if
(
dc
->
seek
)
{
dc
->
seekError
=
1
;
...
...
src/audiofile_decode.c
View file @
3ab98417
...
...
@@ -111,7 +111,7 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
else
{
while
(
cb
->
begin
==
cb
->
end
&&
cb
->
wrap
&&
!
dc
->
stop
&&
!
dc
->
seek
){
usleep
(
10000
);
my_
usleep
(
10000
);
}
if
(
dc
->
stop
)
break
;
else
if
(
dc
->
seek
)
continue
;
...
...
src/decode.c
View file @
3ab98417
...
...
@@ -79,7 +79,7 @@ void stopDecode(DecoderControl * dc) {
(
dc
->
start
||
dc
->
state
==
DECODE_STATE_DECODE
))
{
dc
->
stop
=
1
;
while
(
decode_pid
&&
*
decode_pid
>
0
&&
dc
->
stop
)
usleep
(
1000
);
while
(
decode_pid
&&
*
decode_pid
>
0
&&
dc
->
stop
)
my_
usleep
(
1000
);
}
}
...
...
@@ -112,7 +112,7 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
int
waitOnDecode
(
PlayerControl
*
pc
,
AudioFormat
*
af
,
DecoderControl
*
dc
,
Buffer
*
cb
)
{
while
(
decode_pid
&&
*
decode_pid
>
0
&&
dc
->
start
)
usleep
(
1000
);
while
(
decode_pid
&&
*
decode_pid
>
0
&&
dc
->
start
)
my_
usleep
(
1000
);
if
(
dc
->
start
||
dc
->
error
!=
DECODE_ERROR_NOERROR
)
{
strncpy
(
pc
->
erroredFile
,
pc
->
file
,
MAXPATHLEN
);
...
...
@@ -164,7 +164,7 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
dc
->
seekError
=
0
;
dc
->
seek
=
1
;
pc
->
bitRate
=
0
;
while
(
*
decode_pid
>
0
&&
dc
->
seek
)
usleep
(
1000
);
while
(
*
decode_pid
>
0
&&
dc
->
seek
)
my_
usleep
(
1000
);
if
(
!
dc
->
seekError
)
pc
->
elapsedTime
=
dc
->
seekWhere
;
}
}
...
...
@@ -272,7 +272,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
dc
->
stop
=
0
;
}
else
if
(
dc
->
seek
)
dc
->
start
=
1
;
else
usleep
(
10000
);
else
my_
usleep
(
10000
);
}
exit
(
0
);
...
...
@@ -339,7 +339,7 @@ void decode() {
{
processDecodeInput
();
if
(
quit
)
return
;
usleep
(
1000
);
my_
usleep
(
1000
);
}
while
(
!
quit
)
{
...
...
@@ -367,7 +367,7 @@ void decode() {
}
else
doCrossFade
=
-
1
;
}
if
(
pause
)
usleep
(
10000
);
if
(
pause
)
my_
usleep
(
10000
);
else
if
((
cb
->
begin
!=
cb
->
end
||
cb
->
wrap
)
&&
cb
->
begin
!=
cb
->
next
)
{
...
...
@@ -461,7 +461,7 @@ void decode() {
quitDecode
(
pc
,
dc
);
return
;
}
usleep
(
1000
);
my_
usleep
(
1000
);
}
if
(
pc
->
queueState
!=
PLAYER_QUEUE_PLAY
)
{
quit
=
1
;
...
...
@@ -484,7 +484,7 @@ void decode() {
quit
=
1
;
break
;
}
else
usleep
(
1000
);
else
my_
usleep
(
1000
);
}
pc
->
totalPlayTime
+=
pc
->
elapsedTime
-
pc
->
beginTime
;
\
...
...
src/flac_decode.c
View file @
3ab98417
...
...
@@ -182,7 +182,7 @@ int flacSendChunk(FlacData * data) {
while
(
data
->
cb
->
begin
==
data
->
cb
->
end
&&
data
->
cb
->
wrap
&&
!
data
->
dc
->
stop
&&
!
data
->
dc
->
seek
)
{
usleep
(
10000
);
my_
usleep
(
10000
);
}
if
(
data
->
dc
->
stop
)
return
-
1
;
...
...
src/interface.c
View file @
3ab98417
...
...
@@ -27,13 +27,14 @@
#include "playlist.h"
#include "permission.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
...
...
src/mp3_decode.c
View file @
3ab98417
...
...
@@ -407,7 +407,7 @@ int openMp3(char * file, mp3DecodeData * data) {
int
mp3ChildSendData
(
mp3DecodeData
*
data
,
Buffer
*
cb
,
DecoderControl
*
dc
)
{
while
(
cb
->
begin
==
cb
->
end
&&
cb
->
wrap
&&
!
dc
->
stop
&&
!
dc
->
seek
)
usleep
(
10000
);
my_
usleep
(
10000
);
if
(
dc
->
stop
)
return
-
1
;
/* just for now, so it doesn't hang */
if
(
dc
->
seek
)
return
0
;
...
...
src/mp4_decode.c
View file @
3ab98417
...
...
@@ -285,7 +285,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
while
(
cb
->
begin
==
cb
->
end
&&
cb
->
wrap
&&
!
dc
->
stop
&&
!
dc
->
seek
)
{
usleep
(
10000
);
my_
usleep
(
10000
);
}
if
(
dc
->
stop
)
{
eof
=
1
;
...
...
src/ogg_decode.c
View file @
3ab98417
...
...
@@ -112,7 +112,7 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
while
(
cb
->
begin
==
cb
->
end
&&
cb
->
wrap
&&
!
dc
->
stop
&&
!
dc
->
seek
)
{
usleep
(
10000
);
my_
usleep
(
10000
);
}
if
(
dc
->
stop
)
break
;
else
if
(
dc
->
seek
)
continue
;
...
...
src/player.c
View file @
3ab98417
...
...
@@ -134,7 +134,7 @@ int playerInit() {
pc
->
queueLockState
=
PLAYER_QUEUE_UNLOCKED
;
pc
->
unlockQueue
=
0
;
}
else
usleep
(
10000
);
else
my_
usleep
(
10000
);
}
exit
(
0
);
...
...
@@ -206,7 +206,7 @@ int playerPlay(FILE * fp, char * utf8file) {
return
-
1
;
}
while
(
player_pid
>
0
&&
pc
->
play
)
usleep
(
1000
);
while
(
player_pid
>
0
&&
pc
->
play
)
my_
usleep
(
1000
);
return
0
;
}
...
...
@@ -216,7 +216,7 @@ int playerStop(FILE * fp) {
if
(
player_pid
>
0
&&
pc
->
state
!=
PLAYER_STATE_STOP
)
{
pc
->
stop
=
1
;
while
(
player_pid
>
0
&&
pc
->
stop
)
usleep
(
1000
);
while
(
player_pid
>
0
&&
pc
->
stop
)
my_
usleep
(
1000
);
}
pc
->
queueState
=
PLAYER_QUEUE_BLANK
;
...
...
@@ -242,7 +242,7 @@ int playerPause(FILE * fp) {
if
(
player_pid
>
0
&&
pc
->
state
!=
PLAYER_STATE_STOP
)
{
pc
->
pause
=
1
;
while
(
player_pid
>
0
&&
pc
->
pause
)
usleep
(
1000
);
while
(
player_pid
>
0
&&
pc
->
pause
)
my_
usleep
(
1000
);
}
return
0
;
...
...
@@ -361,7 +361,7 @@ void playerQueueLock() {
if
(
player_pid
>
0
&&
pc
->
queueLockState
==
PLAYER_QUEUE_UNLOCKED
)
{
pc
->
lockQueue
=
1
;
while
(
player_pid
>
0
&&
pc
->
lockQueue
)
usleep
(
1000
);
while
(
player_pid
>
0
&&
pc
->
lockQueue
)
my_
usleep
(
1000
);
}
}
...
...
@@ -371,7 +371,7 @@ void playerQueueUnlock() {
if
(
player_pid
>
0
&&
pc
->
queueLockState
==
PLAYER_QUEUE_LOCKED
)
{
pc
->
unlockQueue
=
1
;
while
(
player_pid
>
0
&&
pc
->
unlockQueue
)
usleep
(
1000
);
while
(
player_pid
>
0
&&
pc
->
unlockQueue
)
my_
usleep
(
1000
);
}
}
...
...
@@ -403,7 +403,7 @@ int playerSeek(FILE * fp, char * utf8file, float time) {
if
(
pc
->
error
==
PLAYER_ERROR_NOERROR
)
{
pc
->
seekWhere
=
time
;
pc
->
seek
=
1
;
while
(
player_pid
>
0
&&
pc
->
seek
)
usleep
(
1000
);
while
(
player_pid
>
0
&&
pc
->
seek
)
my_
usleep
(
1000
);
}
return
0
;
...
...
src/utils.c
View file @
3ab98417
...
...
@@ -18,8 +18,13 @@
#include "utils.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
char
*
myFgets
(
char
*
buffer
,
int
bufferSize
,
FILE
*
fp
)
{
char
*
ret
=
fgets
(
buffer
,
bufferSize
,
fp
);
...
...
@@ -43,3 +48,12 @@ void stripReturnChar(char * string) {
*
string
=
' '
;
}
}
void
my_usleep
(
long
usec
)
{
struct
timeval
tv
;
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
usec
;
select
(
0
,
NULL
,
NULL
,
NULL
,
&
tv
);
}
src/utils.h
View file @
3ab98417
...
...
@@ -29,4 +29,6 @@ char * strDupToUpper(char * str);
void
stripReturnChar
(
char
*
string
);
void
my_usleep
(
long
usec
);
#endif
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