aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/mpc_plugin.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-02-02 02:21:58 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-02-02 02:21:58 +0000
commitc87b9cf439d0ceaae1dbfd092f0ed495845a4564 (patch)
treea12670df0b5ad4e84cd48911ffcf9036b5f4395f /src/inputPlugins/mpc_plugin.c
parent3d671eca3a63c8239cb0b155db79769c7465cacc (diff)
downloadmpd-c87b9cf439d0ceaae1dbfd092f0ed495845a4564.tar.gz
mpd-c87b9cf439d0ceaae1dbfd092f0ed495845a4564.tar.xz
mpd-c87b9cf439d0ceaae1dbfd092f0ed495845a4564.zip
playing, stopping, and seeking mpc files should work now. next is parsing metadata for the db.
git-svn-id: https://svn.musicpd.org/mpd/trunk@2924 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/mpc_plugin.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c
index 05ca53ee6..3550fa2e3 100644
--- a/src/inputPlugins/mpc_plugin.c
+++ b/src/inputPlugins/mpc_plugin.c
@@ -60,7 +60,7 @@ mpc_int32_t mpc_read_cb(void * vdata, void * ptr, mpc_int32_t size) {
static mpc_bool_t mpc_seek_cb(void * vdata, mpc_int32_t offset) {
MpcCallbackData * data = (MpcCallbackData *)vdata;
- return !seekInputStream(data->inStream , offset, SEEK_SET);
+ return seekInputStream(data->inStream , offset, SEEK_SET) < 0 ? 0 : 1;
}
mpc_int32_t mpc_tell_cb(void * vdata) {
@@ -149,7 +149,6 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
closeInputStream(inStream);
if(!dc->stop) {
ERROR("Not a valid musepack stream");
- DEBUG("ret: %i\n", ret);
return -1;
}
else {
@@ -185,7 +184,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
while(!eof) {
if(dc->seek) {
samplePos = dc->seekWhere * dc->audioFormat.sampleRate;
- if(0 == mpc_decoder_seek_sample(&decoder, samplePos)) {
+ if(mpc_decoder_seek_sample(&decoder, samplePos)) {
clearOutputBuffer(cb);
chunkpos = 0;
}
@@ -193,10 +192,12 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
dc->seek = 0;
}
+ DEBUG("HERE 1\n");
ret = mpc_decoder_decode(&decoder, sample_buffer,
&vbrUpdateAcc, &vbrUpdateBits);
+ DEBUG("HERE 2\n");
- if(ret <= 0 ) {
+ if(ret <= 0 || dc->stop ) {
eof = 1;
break;
}
@@ -228,7 +229,10 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
NULL);
chunkpos = 0;
s16 = (mpd_sint16 *)chunk;
- if(dc->stop) break;
+ if(dc->stop) {
+ eof = 1;
+ break;
+ }
}
}
}
@@ -246,12 +250,13 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
closeInputStream(inStream);
+ flushOutputBuffer(cb);
+
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
else {
- flushOutputBuffer(cb);
dc->state = DECODE_STATE_STOP;
}