diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-08-16 09:28:15 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-08-16 09:39:32 -0700 |
commit | 44d9f62f34e0561d83ea32941f0ea1b529b1490d (patch) | |
tree | 5345eba046b6e3bcf8c063e7bae8b501b7a99f4a /src/inputPlugins/aac_plugin.c | |
parent | f9f70860622613686e6ac0bf7ebd448f437d92a7 (diff) | |
download | mpd-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/aac_plugin.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 6e53c6420..98329a4b3 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -339,9 +339,8 @@ static int aac_decode(char *path) return -1; } - dc.audioFormat.bits = 16; - - dc.totalTime = totalTime; + dc.audio_format.bits = 16; + dc.total_time = totalTime; file_time = 0.0; @@ -372,13 +371,8 @@ static int aac_decode(char *path) sampleRate = frameInfo.samplerate; #endif - if (dc.state != DECODE_STATE_DECODE) { - dc.audioFormat.channels = frameInfo.channels; - dc.audioFormat.sampleRate = sampleRate; - getOutputAudioFormat(&(dc.audioFormat), - &(ob.audioFormat)); - dc.state = DECODE_STATE_DECODE; - } + dc.audio_format.channels = frameInfo.channels; + dc.audio_format.sampleRate = sampleRate; advanceAacBuffer(&b, frameInfo.bytesconsumed); @@ -395,34 +389,24 @@ static int aac_decode(char *path) sampleBufferLen = sampleCount * 2; - ob_send(NULL, 0, sampleBuffer, - sampleBufferLen, file_time, - bitRate, NULL); - if (dc.seek) { - dc.seekError = 1; - dc.seek = 0; - decoder_wakeup_player(); - } else if (dc.stop) { - eof = 1; + switch (ob_send(sampleBuffer, sampleBufferLen, + file_time, bitRate, NULL)) { + case DC_ACTION_NONE: break; + case DC_ACTION_SEEK: + /* + * this plugin doesn't support seek because nobody + * has bothered, yet... + */ + dc_action_seek_fail(DC_SEEK_ERROR); break; + default: eof = 1; } } - ob_flush(); - faacDecClose(decoder); if (b.buffer) free(b.buffer); - if (dc.state != DECODE_STATE_DECODE) - return -1; - - if (dc.seek) { - dc.seekError = 1; - dc.seek = 0; - decoder_wakeup_player(); - } - return 0; } |