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
38a9ad01
Commit
38a9ad01
authored
Jan 21, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player_thread: use bool instead of int
Make player_wait_for_decoder() and play_chunk() return a bool instead of 0/-1.
parent
5541015a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
player_thread.c
src/player_thread.c
+13
-12
No files found.
src/player_thread.c
View file @
38a9ad01
...
...
@@ -94,7 +94,8 @@ static void player_stop_decoder(void)
event_pipe_emit
(
PIPE_EVENT_PLAYLIST
);
}
static
int
player_wait_for_decoder
(
struct
player
*
player
)
static
bool
player_wait_for_decoder
(
struct
player
*
player
)
{
dc_command_wait
(
&
pc
.
notify
);
...
...
@@ -102,7 +103,7 @@ static int player_wait_for_decoder(struct player *player)
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
url
!=
NULL
);
pc
.
errored_song
=
dc
.
next_song
;
pc
.
error
=
PLAYER_ERROR_FILE
;
return
-
1
;
return
false
;
}
pc
.
total_time
=
pc
.
next_song
->
tag
!=
NULL
...
...
@@ -119,7 +120,7 @@ static int player_wait_for_decoder(struct player *player)
/* call syncPlaylistWithQueue() in the main thread */
event_pipe_emit
(
PIPE_EVENT_PLAYLIST
);
return
0
;
return
true
;
}
static
bool
player_seek_decoder
(
struct
player
*
player
)
...
...
@@ -228,7 +229,7 @@ static void player_process_command(struct player *player)
}
}
static
int
static
bool
play_chunk
(
struct
song
*
song
,
struct
music_chunk
*
chunk
,
const
struct
audio_format
*
format
,
double
sizeToTime
)
{
...
...
@@ -258,16 +259,16 @@ play_chunk(struct song *song, struct music_chunk *chunk,
}
if
(
chunk
->
length
==
0
)
return
0
;
return
true
;
pcm_volume
(
chunk
->
data
,
chunk
->
length
,
format
,
pc
.
software_volume
);
if
(
!
playAudio
(
chunk
->
data
,
chunk
->
length
))
return
-
1
;
return
false
;
pc
.
total_play_time
+=
sizeToTime
*
chunk
->
length
;
return
0
;
return
true
;
}
static
void
do_play
(
void
)
...
...
@@ -293,7 +294,7 @@ static void do_play(void)
music_pipe_set_lazy
(
false
);
dc_start
(
&
pc
.
notify
,
pc
.
next_song
);
if
(
player_wait_for_decoder
(
&
player
)
<
0
)
{
if
(
!
player_wait_for_decoder
(
&
player
)
)
{
player_stop_decoder
();
player_command_finished
();
return
;
...
...
@@ -303,7 +304,7 @@ static void do_play(void)
pc
.
state
=
PLAYER_STATE_PLAY
;
player_command_finished
();
while
(
1
)
{
while
(
true
)
{
player_process_command
(
&
player
);
if
(
pc
.
command
==
PLAYER_COMMAND_STOP
||
pc
.
command
==
PLAYER_COMMAND_EXIT
||
...
...
@@ -457,8 +458,8 @@ static void do_play(void)
}
/* play the current chunk */
if
(
play_chunk
(
player
.
song
,
beginChunk
,
&
play_audio_format
,
sizeToTime
)
<
0
)
if
(
!
play_chunk
(
player
.
song
,
beginChunk
,
&
play_audio_format
,
sizeToTime
)
)
break
;
music_pipe_shift
();
...
...
@@ -481,7 +482,7 @@ static void do_play(void)
player
.
xfade
=
XFADE_UNKNOWN
;
player
.
next_song_chunk
=
-
1
;
if
(
player_wait_for_decoder
(
&
player
)
<
0
)
if
(
!
player_wait_for_decoder
(
&
player
)
)
return
;
}
else
if
(
decoder_is_idle
())
{
break
;
...
...
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