aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/mod_plugin.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-08-16 09:28:15 -0700
committerEric Wong <normalperson@yhbt.net>2008-08-16 09:39:32 -0700
commit44d9f62f34e0561d83ea32941f0ea1b529b1490d (patch)
tree5345eba046b6e3bcf8c063e7bae8b501b7a99f4a /src/inputPlugins/mod_plugin.c
parentf9f70860622613686e6ac0bf7ebd448f437d92a7 (diff)
downloadmpd-44d9f62f34e0561d83ea32941f0ea1b529b1490d.tar.gz
mpd-44d9f62f34e0561d83ea32941f0ea1b529b1490d.tar.xz
mpd-44d9f62f34e0561d83ea32941f0ea1b529b1490d.zip
core rewrite (decode,player,outputBuffer,playlist)
This is a huge refactoring of the core mpd process. The queueing/buffering mechanism is heavily reworked. The player.c code has been merged into outputBuffer (the actual ring buffering logic is handled by ringbuf.c); and decode.c actually handles decoding stuff. The end result is several hundreds of lines shorter, even though we still have a lot of DEBUG statements left in there for tracing and a lot of assertions, too.
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/mod_plugin.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c
index 23b16fa23..cfa7d6e3d 100644
--- a/src/inputPlugins/mod_plugin.c
+++ b/src/inputPlugins/mod_plugin.c
@@ -179,25 +179,20 @@ static int mod_decode(char *path)
return -1;
}
- dc.totalTime = 0;
- dc.audioFormat.bits = 16;
- dc.audioFormat.sampleRate = 44100;
- dc.audioFormat.channels = 2;
- getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat));
+ dc.total_time = 0;
+ dc.audio_format.bits = 16;
+ dc.audio_format.sampleRate = 44100;
+ dc.audio_format.channels = 2;
secPerByte =
- 1.0 / ((dc.audioFormat.bits * dc.audioFormat.channels / 8.0) *
- (float)dc.audioFormat.sampleRate);
+ 1.0 / ((dc.audio_format.bits * dc.audio_format.channels / 8.0) *
+ (float)dc.audio_format.sampleRate);
- dc.state = DECODE_STATE_DECODE;
while (1) {
- if (dc.seek) {
- dc.seekError = 1;
- dc.seek = 0;
- decoder_wakeup_player();
- }
+ if (dc_seek())
+ dc_action_seek_fail(DC_SEEK_ERROR);
- if (dc.stop)
+ if (dc_intr())
break;
if (!Player_Active())
@@ -205,13 +200,8 @@ static int mod_decode(char *path)
ret = VC_WriteBytes(data->audio_buffer, MIKMOD_FRAME_SIZE);
total_time += ret * secPerByte;
- ob_send(NULL, 0,
- (char *)data->audio_buffer, ret,
- total_time, 0, NULL);
+ ob_send((char *)data->audio_buffer, ret, total_time, 0, NULL);
}
-
- ob_flush();
-
mod_close(data);
MikMod_Exit();