fix TIcho's seeking while paused bug
git-svn-id: https://svn.musicpd.org/mpd/trunk@1225 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
ccfff4f0f4
commit
42a1a76efe
@ -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) {
|
||||
|
@ -112,6 +112,7 @@ int audiofile_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
sendDataToOutputBuffer(cb,
|
||||
NULL,
|
||||
dc,
|
||||
1,
|
||||
chunk,
|
||||
ret*fs,
|
||||
(float)current /
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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: */
|
||||
|
Loading…
x
Reference in New Issue
Block a user