aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-02-01 13:22:58 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-02-01 13:22:58 +0000
commit3d671eca3a63c8239cb0b155db79769c7465cacc (patch)
tree6a00f793d55fe0ad3e865c589ea9f81b13f4eff3 /src
parentb95426f58fc7ca1e7a6f8bac6c3a691d4cf7eb23 (diff)
downloadmpd-3d671eca3a63c8239cb0b155db79769c7465cacc.tar.gz
mpd-3d671eca3a63c8239cb0b155db79769c7465cacc.tar.xz
mpd-3d671eca3a63c8239cb0b155db79769c7465cacc.zip
mpc plugin basically working.
todo: 1) figure out why stop takes so long 2) fix seeking 3) parse tags git-svn-id: https://svn.musicpd.org/mpd/trunk@2923 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/inputPlugins/mpc_plugin.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c
index c274f0e83..05ca53ee6 100644
--- a/src/inputPlugins/mpc_plugin.c
+++ b/src/inputPlugins/mpc_plugin.c
@@ -132,7 +132,6 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
mpc_uint32_t vbrUpdateBits;
float time;
int i;
- ReplayGainInfo * replayGainInfo;
data.inStream = inStream;
data.dc = dc;
@@ -144,11 +143,8 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
reader.canseek = mpc_canseek_cb;
reader.data = &data;
- DEBUG("HERE 1\n");
-
mpc_streaminfo_init(&info);
- DEBUG("HERE 2\n");
if((ret = mpc_streaminfo_read(&info, &reader)) != ERROR_CODE_OK) {
closeInputStream(inStream);
if(!dc->stop) {
@@ -163,9 +159,8 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
return 0;
}
- DEBUG("HERE 3\n");
mpc_decoder_setup(&decoder, &reader);
- DEBUG("HERE 4\n");
+
if(!mpc_decoder_initialize(&decoder, &info)) {
closeInputStream(inStream);
if(!dc->stop) {
@@ -177,16 +172,16 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
}
}
- DEBUG("HERE 5\n");
dc->totalTime = mpc_streaminfo_get_length(&info);
dc->audioFormat.bits = 16;
- dc->audioFormat.channels = 16;
+ dc->audioFormat.channels = 2;
dc->audioFormat.sampleRate = info.sample_freq;
+
+ getOutputAudioFormat(&(dc->audioFormat), &(cb->audioFormat));
- replayGainInfo = newReplayGainInfo();
+ dc->state = DECODE_STATE_DECODE;
- DEBUG("HERE 6\n");
while(!eof) {
if(dc->seek) {
samplePos = dc->seekWhere * dc->audioFormat.sampleRate;
@@ -197,6 +192,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
else dc->seekError = 1;
dc->seek = 0;
}
+
ret = mpc_decoder_decode(&decoder, sample_buffer,
&vbrUpdateAcc, &vbrUpdateBits);
@@ -229,7 +225,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
chunk, chunkpos,
time,
bitRate,
- replayGainInfo);
+ NULL);
chunkpos = 0;
s16 = (mpd_sint16 *)chunk;
if(dc->stop) break;
@@ -237,7 +233,6 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
}
}
- DEBUG("HERE 7\n");
if(!dc->stop && chunkpos > 0) {
time = ((float)samplePos) / dc->audioFormat.sampleRate;
@@ -246,22 +241,19 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable,
chunk, chunkpos, time, bitRate,
- replayGainInfo);
+ NULL);
}
- DEBUG("HERE 8\n");
closeInputStream(inStream);
- DEBUG("HERE 9\n");
- flushOutputBuffer(cb);
-
- freeReplayGainInfo(replayGainInfo);
-
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
- else dc->state = DECODE_STATE_STOP;
+ else {
+ flushOutputBuffer(cb);
+ dc->state = DECODE_STATE_STOP;
+ }
return 0;
}