diff options
Diffstat (limited to 'src/inputPlugins')
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 12 | ||||
-rw-r--r-- | src/inputPlugins/audiofile_plugin.c | 2 | ||||
-rw-r--r-- | src/inputPlugins/flac_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/mod_plugin.c | 3 | ||||
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 12 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 11 | ||||
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 7 | ||||
-rw-r--r-- | src/inputPlugins/oggflac_plugin.c | 7 | ||||
-rw-r--r-- | src/inputPlugins/oggvorbis_plugin.c | 7 | ||||
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 13 |
10 files changed, 40 insertions, 40 deletions
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index b3c72f5f1..178b4c608 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -389,10 +389,9 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) decoder_data(mpd_decoder, NULL, 0, sampleBuffer, sampleBufferLen, file_time, bitRate, NULL); - if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { - dc.seekError = 1; - decoder_command_finished(decoder); - } else if (decoder_get_command(decoder) == DECODE_COMMAND_STOP) + if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { + decoder_seek_error(mpd_decoder); + } else if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP) break; } @@ -405,9 +404,8 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) if (dc.state != DECODE_STATE_DECODE) return -1; - if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { - dc.seekError = 1; - decoder_command_finished(decoder); + if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { + decoder_seek_error(mpd_decoder); } return 0; diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index 105edc414..f3c945455 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -92,7 +92,7 @@ static int audiofile_decode(struct decoder * decoder, char *path) do { if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { decoder_clear(decoder); - current = dc.seekWhere * + current = decoder_seek_where(decoder) * audio_format.sampleRate; afSeekFrame(af_fp, AF_DEFAULT_TRACK, current); decoder_command_finished(decoder); diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index cef1f6ed0..b76327dc1 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -424,16 +424,16 @@ static int flac_decode_internal(struct decoder * decoder, if (flac_get_state(flacDec) == flac_decoder_eof) break; if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { - FLAC__uint64 sampleToSeek = dc.seekWhere * + FLAC__uint64 sampleToSeek = decoder_seek_where(decoder) * data.audio_format.sampleRate + 0.5; if (flac_seek_absolute(flacDec, sampleToSeek)) { decoder_clear(decoder); data.time = ((float)sampleToSeek) / data.audio_format.sampleRate; data.position = 0; + decoder_command_finished(decoder); } else - dc.seekError = 1; - decoder_command_finished(decoder); + decoder_seek_error(decoder); } } if (decoder_get_command(decoder) != DECODE_COMMAND_STOP) { diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index 9386bfca8..384381ea0 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -188,8 +188,7 @@ static int mod_decode(struct decoder * decoder, char *path) while (1) { if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { - dc.seekError = 1; - decoder_command_finished(decoder); + decoder_seek_error(decoder); } if (decoder_get_command(decoder) == DECODE_COMMAND_STOP) diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 5685cb507..66ca85e2e 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -851,7 +851,7 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder, data->muteFrame = 0; break; case MUTEFRAME_SEEK: - if (dc.seekWhere <= data->elapsedTime) { + if (decoder_seek_where(decoder) <= data->elapsedTime) { data->outputPtr = data->outputBuffer; decoder_clear(decoder); data->muteFrame = 0; @@ -952,7 +952,8 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder, data->inStream->seekable) { long j = 0; data->muteFrame = MUTEFRAME_SEEK; - while (j < data->highestFrame && dc.seekWhere > + while (j < data->highestFrame && + decoder_seek_where(decoder) > ((float)mad_timer_count(data->times[j], MAD_UNITS_MILLISECONDS)) / 1000) { @@ -965,15 +966,14 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder, data->outputPtr = data->outputBuffer; decoder_clear(decoder); data->currentFrame = j; + decoder_command_finished(decoder); } else - dc.seekError = 1; + decoder_seek_error(decoder); data->muteFrame = 0; - decoder_command_finished(decoder); } } else if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK && !data->inStream->seekable) { - dc.seekError = 1; - decoder_command_finished(decoder); + decoder_seek_error(decoder); } } diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 2ebb2a49e..8b468168b 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -106,6 +106,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) long offset; mpd_uint16 bitRate = 0; int seeking = 0; + double seek_where = 0; mp4cb = xmalloc(sizeof(mp4ff_callback_t)); mp4cb->read = mp4_inputStreamReadCallback; @@ -178,13 +179,15 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) seekTable = xmalloc(sizeof(float) * numSamples); for (sampleId = 0; sampleId < numSamples; sampleId++) { - if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) + if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { seeking = 1; + seek_where = decoder_seek_where(mpd_decoder); + } if (seeking && seekTableEnd > 1 && - seekTable[seekTableEnd] >= dc.seekWhere) { + seekTable[seekTableEnd] >= seek_where) { int i = 2; - while (seekTable[i] < dc.seekWhere) + while (seekTable[i] < seek_where) i++; sampleId = i - 1; file_time = seekTable[sampleId]; @@ -206,7 +209,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) dur -= offset; file_time += ((float)dur) / scale; - if (seeking && file_time > dc.seekWhere) + if (seeking && file_time > seek_where) seekPositionFound = 1; if (seeking && seekPositionFound) { diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index 5be9ba446..829f15c67 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -178,14 +178,15 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) while (!eof) { if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { - samplePos = dc.seekWhere * audio_format.sampleRate; + samplePos = decoder_seek_where(mpd_decoder) * + audio_format.sampleRate; if (mpc_decoder_seek_sample(&decoder, samplePos)) { decoder_clear(mpd_decoder); s16 = (mpd_sint16 *) chunk; chunkpos = 0; + decoder_command_finished(mpd_decoder); } else - dc.seekError = 1; - decoder_command_finished(mpd_decoder); + decoder_seek_error(mpd_decoder); } vbrUpdateAcc = 0; diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 38474d7d0..10acf75fe 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -333,7 +333,6 @@ static unsigned int oggflac_try_decode(InputStream * inStream) static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream) { - DecoderControl *dc = mpd_decoder->dc; OggFLAC__SeekableStreamDecoder *decoder = NULL; FlacData data; int ret = 0; @@ -354,7 +353,7 @@ static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream) break; } if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { - FLAC__uint64 sampleToSeek = dc->seekWhere * + FLAC__uint64 sampleToSeek = decoder_seek_where(mpd_decoder) * data.audio_format.sampleRate + 0.5; if (OggFLAC__seekable_stream_decoder_seek_absolute (decoder, sampleToSeek)) { @@ -362,9 +361,9 @@ static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream) data.time = ((float)sampleToSeek) / data.audio_format.sampleRate; data.position = 0; + decoder_command_finished(mpd_decoder); } else - dc.seekError = 1; - decoder_command_finished(mpd_decoder); + decoder_seek_error(mpd_decoder); } } diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index 1b8c7154f..340287cf5 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -268,12 +268,13 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream) while (1) { if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { - if (0 == ov_time_seek_page(&vf, dc.seekWhere)) { + double seek_where = decoder_seek_where(decoder); + if (0 == ov_time_seek_page(&vf, seek_where)) { decoder_clear(decoder); chunkpos = 0; + decoder_command_finished(decoder); } else - dc.seekError = 1; - decoder_command_finished(decoder); + decoder_seek_error(decoder); } ret = ov_read(&vf, chunk + chunkpos, OGG_CHUNK_SIZE - chunkpos, diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 75afb8603..59a482034 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -178,17 +178,16 @@ static void wavpack_decode(struct decoder * decoder, decoder_clear(decoder); - where = dc.seekWhere * + where = decoder_seek_where(decoder) * audio_format.sampleRate; - if (WavpackSeekSample(wpc, where)) + if (WavpackSeekSample(wpc, where)) { position = where; - else - dc.seekError = 1; + decoder_command_finished(decoder); + } else + decoder_seek_error(decoder); } else { - dc.seekError = 1; + decoder_seek_error(decoder); } - - decoder_command_finished(decoder); } if (decoder_get_command(decoder) == DECODE_COMMAND_STOP) |