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:
@ -362,7 +362,7 @@ int aac_decode(OutputBuffer * cb, DecoderControl * dc) {
|
|||||||
|
|
||||||
sampleBufferLen = sampleCount*2;
|
sampleBufferLen = sampleCount*2;
|
||||||
|
|
||||||
sendDataToOutputBuffer(cb, NULL, dc, sampleBuffer,
|
sendDataToOutputBuffer(cb, NULL, dc, 0, sampleBuffer,
|
||||||
sampleBufferLen, time, bitRate);
|
sampleBufferLen, time, bitRate);
|
||||||
if(dc->seek) dc->seek = 0;
|
if(dc->seek) dc->seek = 0;
|
||||||
else if(dc->stop) {
|
else if(dc->stop) {
|
||||||
|
@ -112,6 +112,7 @@ int audiofile_decode(OutputBuffer * cb, DecoderControl * dc) {
|
|||||||
sendDataToOutputBuffer(cb,
|
sendDataToOutputBuffer(cb,
|
||||||
NULL,
|
NULL,
|
||||||
dc,
|
dc,
|
||||||
|
1,
|
||||||
chunk,
|
chunk,
|
||||||
ret*fs,
|
ret*fs,
|
||||||
(float)current /
|
(float)current /
|
||||||
|
@ -376,7 +376,7 @@ int flacSendChunk(FlacData * data) {
|
|||||||
doReplayGain(data->chunk,data->chunk_length,&(data->dc->audioFormat),
|
doReplayGain(data->chunk,data->chunk_length,&(data->dc->audioFormat),
|
||||||
data->replayGainScale);
|
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))
|
data->chunk_length, data->time, data->bitRate))
|
||||||
{
|
{
|
||||||
case OUTPUT_BUFFER_DC_STOP:
|
case OUTPUT_BUFFER_DC_STOP:
|
||||||
|
@ -498,6 +498,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
|
|||||||
ret = sendDataToOutputBuffer(cb,
|
ret = sendDataToOutputBuffer(cb,
|
||||||
data->inStream,
|
data->inStream,
|
||||||
dc,
|
dc,
|
||||||
|
data->inStream->seekable,
|
||||||
data->outputBuffer,
|
data->outputBuffer,
|
||||||
MP3_DATA_OUTPUT_BUFFER_SIZE,
|
MP3_DATA_OUTPUT_BUFFER_SIZE,
|
||||||
data->elapsedTime,
|
data->elapsedTime,
|
||||||
@ -589,7 +590,7 @@ int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream,
|
|||||||
while(mp3Read(&data,cb,dc)!=DECODE_BREAK);
|
while(mp3Read(&data,cb,dc)!=DECODE_BREAK);
|
||||||
/* send last little bit if not dc->stop */
|
/* send last little bit if not dc->stop */
|
||||||
if(data.outputPtr!=data.outputBuffer && data.flush) {
|
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.outputPtr-data.outputBuffer,
|
||||||
data.elapsedTime,data.bitRate/1000) == 0)
|
data.elapsedTime,data.bitRate/1000) == 0)
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "pcm_utils.h"
|
#include "pcm_utils.h"
|
||||||
#include "inputStream.h"
|
#include "inputStream.h"
|
||||||
|
#include "outputBuffer.h"
|
||||||
|
|
||||||
#include "mp4ff/mp4ff.h"
|
#include "mp4ff/mp4ff.h"
|
||||||
|
|
||||||
@ -279,7 +280,7 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) {
|
|||||||
|
|
||||||
sampleBuffer+=offset*channels*2;
|
sampleBuffer+=offset*channels*2;
|
||||||
|
|
||||||
sendDataToOutputBuffer(cb, NULL, dc, sampleBuffer,
|
sendDataToOutputBuffer(cb, NULL, dc, 1, sampleBuffer,
|
||||||
sampleBufferLen, time, bitRate);
|
sampleBufferLen, time, bitRate);
|
||||||
if(dc->stop) {
|
if(dc->stop) {
|
||||||
eof = 1;
|
eof = 1;
|
||||||
|
@ -242,15 +242,16 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
|
|||||||
}
|
}
|
||||||
doReplayGain(chunk,ret,&(dc->audioFormat),
|
doReplayGain(chunk,ret,&(dc->audioFormat),
|
||||||
replayGainScale);
|
replayGainScale);
|
||||||
sendDataToOutputBuffer(cb, inStream, dc, chunk,
|
sendDataToOutputBuffer(cb, inStream, dc,
|
||||||
chunkpos, ov_time_tell(&vf), bitRate);
|
inStream->seekable, chunk, chunkpos,
|
||||||
|
ov_time_tell(&vf), bitRate);
|
||||||
if(dc->stop) break;
|
if(dc->stop) break;
|
||||||
chunkpos = 0;
|
chunkpos = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!dc->stop && 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);
|
ov_time_tell(&vf), bitRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ void flushOutputBuffer(OutputBuffer * cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
||||||
DecoderControl * dc, char * dataIn, long dataInLen, float time,
|
DecoderControl * dc, int seekable, char * dataIn,
|
||||||
mpd_uint16 bitRate)
|
long dataInLen, float time, mpd_uint16 bitRate)
|
||||||
{
|
{
|
||||||
mpd_uint16 dataToSend;
|
mpd_uint16 dataToSend;
|
||||||
mpd_uint16 chunkLeft;
|
mpd_uint16 chunkLeft;
|
||||||
@ -76,6 +76,12 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
|||||||
if(currentChunk != cb->end) {
|
if(currentChunk != cb->end) {
|
||||||
while(cb->begin==cb->end && cb->wrap && !dc->stop)
|
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 ||
|
if(!inStream ||
|
||||||
bufferInputStream(inStream) <= 0)
|
bufferInputStream(inStream) <= 0)
|
||||||
{
|
{
|
||||||
|
@ -46,8 +46,8 @@ void flushOutputBuffer(OutputBuffer * cb);
|
|||||||
/* we send inStream where for buffering the inputStream while waiting to
|
/* we send inStream where for buffering the inputStream while waiting to
|
||||||
send the next chunk */
|
send the next chunk */
|
||||||
int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
||||||
DecoderControl * dc, char * data, long datalen, float time,
|
DecoderControl * dc, int seekable, char * data, long datalen,
|
||||||
mpd_uint16 bitRate);
|
float time, mpd_uint16 bitRate);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
||||||
|
Reference in New Issue
Block a user