aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/player_thread.c')
-rw-r--r--src/player_thread.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/player_thread.c b/src/player_thread.c
index 6f0828f93..bdc140852 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -65,9 +65,7 @@ static int decodeSeek(int *decodeWaitedOn, int *next)
int ret = -1;
double where;
- if (dc.state == DECODE_STATE_STOP ||
- dc.error != DECODE_ERROR_NOERROR ||
- dc.current_song != pc.next_song) {
+ if (decoder_current_song(&dc) != pc.next_song) {
dc_stop(&pc.notify);
*next = -1;
ob_clear();
@@ -224,7 +222,7 @@ static void decodeParent(void)
pc.error = PLAYER_ERROR_FILE;
break;
}
- else if (dc.state != DECODE_STATE_START) {
+ else if (!decoder_is_starting(&dc)) {
/* the decoder is ready and ok */
decodeWaitedOn = 0;
if(openAudioDevice(&(ob.audioFormat))<0) {
@@ -256,7 +254,7 @@ static void decodeParent(void)
}
}
- if (dc.state == DECODE_STATE_STOP &&
+ if (decoder_is_idle(&dc) &&
pc.queueState == PLAYER_QUEUE_FULL &&
pc.queueLockState == PLAYER_QUEUE_UNLOCKED) {
/* the decoder has finished the current song;
@@ -267,8 +265,7 @@ static void decodeParent(void)
wakeup_main_task();
}
if (next >= 0 && do_xfade == XFADE_UNKNOWN &&
- dc.command != DECODE_COMMAND_START &&
- dc.state != DECODE_STATE_START) {
+ !decoder_is_starting(&dc)) {
/* enable cross fading in this song? if yes,
calculate how many chunks will be required
for it */
@@ -314,7 +311,7 @@ static void decodeParent(void)
} else {
/* there are not enough
decoded chunks yet */
- if (dc.state == DECODE_STATE_STOP) {
+ if (decoder_is_idle(&dc)) {
/* the decoder isn't
running, abort
cross fading */
@@ -362,8 +359,7 @@ static void decodeParent(void)
pc.queueState = PLAYER_QUEUE_EMPTY;
wakeup_main_task();
- } else if (dc.state == DECODE_STATE_STOP &&
- dc.command != DECODE_COMMAND_START) {
+ } else if (decoder_is_idle(&dc)) {
break;
} else {
/*DEBUG("waiting for decoded audio, play silence\n");*/