aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-29 12:05:49 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-29 12:05:49 +0000
commit42a1a76efe43392f37abdac1259b392fee49c3e8 (patch)
tree9b7fed815f8847b4cb32c40813751fe5a37099f8 /src
parentccfff4f0f4bb0ba04cc19a6bc341208acfc5747d (diff)
downloadmpd-42a1a76efe43392f37abdac1259b392fee49c3e8.tar.gz
mpd-42a1a76efe43392f37abdac1259b392fee49c3e8.tar.xz
mpd-42a1a76efe43392f37abdac1259b392fee49c3e8.zip
fix TIcho's seeking while paused bug
git-svn-id: https://svn.musicpd.org/mpd/trunk@1225 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/aac_decode.c2
-rw-r--r--src/audiofile_decode.c1
-rw-r--r--src/flac_decode.c2
-rw-r--r--src/mp3_decode.c3
-rw-r--r--src/mp4_decode.c3
-rw-r--r--src/ogg_decode.c7
-rw-r--r--src/outputBuffer.c10
-rw-r--r--src/outputBuffer.h4
8 files changed, 21 insertions, 11 deletions
diff --git a/src/aac_decode.c b/src/aac_decode.c
index 22a1db51d..25af3f345 100644
--- a/src/aac_decode.c
+++ b/src/aac_decode.c
@@ -362,7 +362,7 @@ int aac_decode(OutputBuffer * cb, DecoderControl * dc) {
sampleBufferLen = sampleCount*2;
- sendDataToOutputBuffer(cb, NULL, dc, sampleBuffer,
+ sendDataToOutputBuffer(cb, NULL, dc, 0, sampleBuffer,
sampleBufferLen, time, bitRate);
if(dc->seek) dc->seek = 0;
else if(dc->stop) {
diff --git a/src/audiofile_decode.c b/src/audiofile_decode.c
index c62fb816d..855f628f0 100644
--- a/src/audiofile_decode.c
+++ b/src/audiofile_decode.c
@@ -112,6 +112,7 @@ int audiofile_decode(OutputBuffer * cb, DecoderControl * dc) {
sendDataToOutputBuffer(cb,
NULL,
dc,
+ 1,
chunk,
ret*fs,
(float)current /
diff --git a/src/flac_decode.c b/src/flac_decode.c
index 6ef56d22e..7c5b5238b 100644
--- a/src/flac_decode.c
+++ b/src/flac_decode.c
@@ -376,7 +376,7 @@ int flacSendChunk(FlacData * data) {
doReplayGain(data->chunk,data->chunk_length,&(data->dc->audioFormat),
data->replayGainScale);
- switch(sendDataToOutputBuffer(data->cb, NULL, data->dc, data->chunk,
+ switch(sendDataToOutputBuffer(data->cb, NULL, data->dc, 1, data->chunk,
data->chunk_length, data->time, data->bitRate))
{
case OUTPUT_BUFFER_DC_STOP:
diff --git a/src/mp3_decode.c b/src/mp3_decode.c
index c1eea2f0a..1e309bd79 100644
--- a/src/mp3_decode.c
+++ b/src/mp3_decode.c
@@ -498,6 +498,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
ret = sendDataToOutputBuffer(cb,
data->inStream,
dc,
+ data->inStream->seekable,
data->outputBuffer,
MP3_DATA_OUTPUT_BUFFER_SIZE,
data->elapsedTime,
@@ -589,7 +590,7 @@ int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream,
while(mp3Read(&data,cb,dc)!=DECODE_BREAK);
/* send last little bit if not dc->stop */
if(data.outputPtr!=data.outputBuffer && data.flush) {
- if(sendDataToOutputBuffer(cb,NULL,dc,data.outputBuffer,
+ if(sendDataToOutputBuffer(cb,NULL,dc,0,data.outputBuffer,
data.outputPtr-data.outputBuffer,
data.elapsedTime,data.bitRate/1000) == 0)
{
diff --git a/src/mp4_decode.c b/src/mp4_decode.c
index 71ae21d5e..e83200451 100644
--- a/src/mp4_decode.c
+++ b/src/mp4_decode.c
@@ -26,6 +26,7 @@
#include "log.h"
#include "pcm_utils.h"
#include "inputStream.h"
+#include "outputBuffer.h"
#include "mp4ff/mp4ff.h"
@@ -279,7 +280,7 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) {
sampleBuffer+=offset*channels*2;
- sendDataToOutputBuffer(cb, NULL, dc, sampleBuffer,
+ sendDataToOutputBuffer(cb, NULL, dc, 1, sampleBuffer,
sampleBufferLen, time, bitRate);
if(dc->stop) {
eof = 1;
diff --git a/src/ogg_decode.c b/src/ogg_decode.c
index 409e2868e..60f310fba 100644
--- a/src/ogg_decode.c
+++ b/src/ogg_decode.c
@@ -242,15 +242,16 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
}
doReplayGain(chunk,ret,&(dc->audioFormat),
replayGainScale);
- sendDataToOutputBuffer(cb, inStream, dc, chunk,
- chunkpos, ov_time_tell(&vf), bitRate);
+ sendDataToOutputBuffer(cb, inStream, dc,
+ inStream->seekable, chunk, chunkpos,
+ ov_time_tell(&vf), bitRate);
if(dc->stop) break;
chunkpos = 0;
}
}
if(!dc->stop && chunkpos > 0) {
- sendDataToOutputBuffer(cb, NULL, dc, chunk, chunkpos,
+ sendDataToOutputBuffer(cb, NULL, dc, 0, chunk, chunkpos,
ov_time_tell(&vf), bitRate);
}
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index f1ea86925..fb6bfe899 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -44,8 +44,8 @@ void flushOutputBuffer(OutputBuffer * cb) {
}
int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
- DecoderControl * dc, char * dataIn, long dataInLen, float time,
- mpd_uint16 bitRate)
+ DecoderControl * dc, int seekable, char * dataIn,
+ long dataInLen, float time, mpd_uint16 bitRate)
{
mpd_uint16 dataToSend;
mpd_uint16 chunkLeft;
@@ -76,6 +76,12 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
if(currentChunk != cb->end) {
while(cb->begin==cb->end && cb->wrap && !dc->stop)
{
+ if(dc->seek) {
+ if(seekable) {
+ return OUTPUT_BUFFER_DC_SEEK;
+ }
+ else dc->seek = 0;
+ }
if(!inStream ||
bufferInputStream(inStream) <= 0)
{
diff --git a/src/outputBuffer.h b/src/outputBuffer.h
index 0ebc8ad1d..cea8d00d5 100644
--- a/src/outputBuffer.h
+++ b/src/outputBuffer.h
@@ -46,8 +46,8 @@ void flushOutputBuffer(OutputBuffer * cb);
/* we send inStream where for buffering the inputStream while waiting to
send the next chunk */
int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
- DecoderControl * dc, char * data, long datalen, float time,
- mpd_uint16 bitRate);
+ DecoderControl * dc, int seekable, char * data, long datalen,
+ float time, mpd_uint16 bitRate);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */