Commit c180d2f9 authored by Warren Dukes's avatar Warren Dukes

try to make seeking more non-blocking

git-svn-id: https://svn.musicpd.org/mpd/trunk@1076 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent bf9e2afb
...@@ -341,13 +341,12 @@ int aac_decode(OutputBuffer * cb, DecoderControl * dc) { ...@@ -341,13 +341,12 @@ int aac_decode(OutputBuffer * cb, DecoderControl * dc) {
sampleRate = frameInfo.samplerate; sampleRate = frameInfo.samplerate;
#endif #endif
if(dc->start) { if(dc->state != DECODE_STATE_DECODE) {
dc->audioFormat.channels = frameInfo.channels; dc->audioFormat.channels = frameInfo.channels;
dc->audioFormat.sampleRate = sampleRate; dc->audioFormat.sampleRate = sampleRate;
getOutputAudioFormat(&(dc->audioFormat), getOutputAudioFormat(&(dc->audioFormat),
&(cb->audioFormat)); &(cb->audioFormat));
dc->state = DECODE_STATE_DECODE; dc->state = DECODE_STATE_DECODE;
dc->start = 0;
} }
advanceAacBuffer(&b,frameInfo.bytesconsumed); advanceAacBuffer(&b,frameInfo.bytesconsumed);
...@@ -382,7 +381,7 @@ int aac_decode(OutputBuffer * cb, DecoderControl * dc) { ...@@ -382,7 +381,7 @@ int aac_decode(OutputBuffer * cb, DecoderControl * dc) {
closeInputStream(b.inStream); closeInputStream(b.inStream);
if(b.buffer) free(b.buffer); if(b.buffer) free(b.buffer);
if(dc->start) return -1; if(dc->state != DECODE_STATE_DECODE) return -1;
if(!dc->stop && !dc->seek && chunkLen>0) { if(!dc->stop && !dc->seek && chunkLen>0) {
cb->chunkSize[cb->end] = chunkLen; cb->chunkSize[cb->end] = chunkLen;
......
...@@ -91,7 +91,6 @@ int audiofile_decode(OutputBuffer * cb, DecoderControl * dc) { ...@@ -91,7 +91,6 @@ int audiofile_decode(OutputBuffer * cb, DecoderControl * dc) {
fs = (int)afGetFrameSize(af_fp, AF_DEFAULT_TRACK,1); fs = (int)afGetFrameSize(af_fp, AF_DEFAULT_TRACK,1);
dc->state = DECODE_STATE_DECODE; dc->state = DECODE_STATE_DECODE;
dc->start = 0;
{ {
int ret, eof = 0, current = 0; int ret, eof = 0, current = 0;
unsigned char chunk[CHUNK_SIZE]; unsigned char chunk[CHUNK_SIZE];
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
#define DECODE_TYPE_URL 1 #define DECODE_TYPE_URL 1
#define DECODE_STATE_STOP 0 #define DECODE_STATE_STOP 0
#define DECODE_STATE_DECODE 1 #define DECODE_STATE_START 1
#define DECODE_STATE_DECODE 2
#define DECODE_ERROR_NOERROR 0 #define DECODE_ERROR_NOERROR 0
#define DECODE_ERROR_UNKTYPE 10 #define DECODE_ERROR_UNKTYPE 10
......
...@@ -135,7 +135,6 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc) { ...@@ -135,7 +135,6 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc) {
} }
dc->state = DECODE_STATE_DECODE; dc->state = DECODE_STATE_DECODE;
dc->start = 0;
while(1) { while(1) {
FLAC__seekable_stream_decoder_process_single(flacDec); FLAC__seekable_stream_decoder_process_single(flacDec);
......
...@@ -560,7 +560,6 @@ int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) { ...@@ -560,7 +560,6 @@ int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) {
getOutputAudioFormat(&(dc->audioFormat), &(cb->audioFormat)); getOutputAudioFormat(&(dc->audioFormat), &(cb->audioFormat));
dc->totalTime = data.totalTime; dc->totalTime = data.totalTime;
dc->start = 0;
dc->state = DECODE_STATE_DECODE; dc->state = DECODE_STATE_DECODE;
while(mp3Read(&data,cb,dc)!=DECODE_BREAK); while(mp3Read(&data,cb,dc)!=DECODE_BREAK);
......
...@@ -249,7 +249,7 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) { ...@@ -249,7 +249,7 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) {
break; break;
} }
if(dc->start) { if(dc->state != DECODE_STATE_DECODE) {
channels = frameInfo.channels; channels = frameInfo.channels;
#ifdef HAVE_FAACDECFRAMEINFO_SAMPLERATE #ifdef HAVE_FAACDECFRAMEINFO_SAMPLERATE
scale = frameInfo.samplerate; scale = frameInfo.samplerate;
...@@ -259,7 +259,6 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) { ...@@ -259,7 +259,6 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) {
getOutputAudioFormat(&(dc->audioFormat), getOutputAudioFormat(&(dc->audioFormat),
&(cb->audioFormat)); &(cb->audioFormat));
dc->state = DECODE_STATE_DECODE; dc->state = DECODE_STATE_DECODE;
dc->start = 0;
} }
if(channels*(dur+offset) > frameInfo.samples) { if(channels*(dur+offset) > frameInfo.samples) {
...@@ -297,7 +296,7 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) { ...@@ -297,7 +296,7 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) {
closeInputStream(&inStream); closeInputStream(&inStream);
free(mp4cb); free(mp4cb);
if(dc->start) return -1; if(dc->state != DECODE_STATE_DECODE) return -1;
if(!dc->stop && !dc->seek && chunkLen>0) { if(!dc->stop && !dc->seek && chunkLen>0) {
cb->chunkSize[cb->end] = chunkLen; cb->chunkSize[cb->end] = chunkLen;
......
...@@ -175,7 +175,6 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc) ...@@ -175,7 +175,6 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc)
dc->totalTime = ov_time_total(&vf,-1); dc->totalTime = ov_time_total(&vf,-1);
dc->state = DECODE_STATE_DECODE; dc->state = DECODE_STATE_DECODE;
dc->start = 0;
{ {
int current_section; int current_section;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment