diff options
Diffstat (limited to 'src/decode.c')
-rw-r--r-- | src/decode.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/decode.c b/src/decode.c index 45ffd8d97..af5ca2c21 100644 --- a/src/decode.c +++ b/src/decode.c @@ -128,7 +128,7 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) { pc->channels = dc->audioFormat.channels; \ } \ else if(decodeWaitedOn) { \ - my_usleep(10); \ + my_usleep(10000); \ continue; \ } @@ -161,7 +161,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb, { int ret = -1; - if(decode_pid && *decode_pid>0) { + if(decode_pid && *decode_pid>0 && !dc->seek) { cb->next = -1; if(dc->state==DECODE_STATE_STOP || dc->error || strcmp(dc->file,pc->file)!=0) @@ -180,13 +180,14 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb, pc->seekWhere; dc->seekWhere = 0 > dc->seekWhere ? 0 : dc->seekWhere; dc->seekError = 0; + dc->seekChunk = -1; dc->seek = 1; - pc->bitRate = 0; - while(*decode_pid>0 && dc->seek) my_usleep(1000); - if(!dc->seekError) { + /*pc->bitRate = 0;*/ + /*while(*decode_pid>0 && dc->seek) my_usleep(1000);*/ + /*if(!dc->seekError) {*/ ret = 0; pc->elapsedTime = dc->seekWhere; - } + /*}*/ } } pc->seek = 0; @@ -231,6 +232,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb, doCrossFade = 0; \ nextChunk = -1; \ bbp = 0; \ + seeking = 1; \ } \ } \ if(pc->stop) { \ @@ -254,7 +256,6 @@ void decodeStart(PlayerControl * pc, OutputBuffer * cb, DecoderControl * dc) { return; } - dc->seekable = inStream.seekable; dc->state = DECODE_STATE_START; dc->start = 0; @@ -386,6 +387,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { int test; int decodeWaitedOn = 0; char silence[CHUNK_SIZE]; + int seeking = 0; memset(silence,0,CHUNK_SIZE); @@ -407,6 +409,10 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { while(!quit) { processDecodeInput(); handleDecodeStart(); + if(!dc->seek && seeking) { + if(dc->seekChunk >= 0) cb->begin = dc->seekChunk; + seeking = 0; + } if(dc->state==DECODE_STATE_STOP && pc->queueState==PLAYER_QUEUE_FULL && pc->queueLockState==PLAYER_QUEUE_UNLOCKED) @@ -481,7 +487,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { else continue; } } - pc->elapsedTime = cb->times[cb->begin]; + if(!seeking) pc->elapsedTime = cb->times[cb->begin]; pc->bitRate = cb->bitRate[cb->begin]; pcm_volumeChange(cb->chunks+cb->begin* CHUNK_SIZE, |