aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/oggflac_plugin.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-04-13 01:16:03 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-13 01:16:03 +0000
commitdec6b1612e953c6029d963ff55d2b4a669b60f43 (patch)
treea1138cb07f67c821ee5000618302d21367ab2245 /src/inputPlugins/oggflac_plugin.c
parent98acfa8ac5bac09ca49a7c21938b5a5801e01ca5 (diff)
downloadmpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.tar.gz
mpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.tar.xz
mpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.zip
Stop passing our single DecoderControl object everywhere
This at least makes the argument list to a lot of our plugin functions shorter and removes a good amount of line nois^W^Wcode, hopefully making things easier to read and follow. git-svn-id: https://svn.musicpd.org/mpd/trunk@7353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputPlugins/oggflac_plugin.c')
-rw-r--r--src/inputPlugins/oggflac_plugin.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c
index 6638362b6..070404e26 100644
--- a/src/inputPlugins/oggflac_plugin.c
+++ b/src/inputPlugins/oggflac_plugin.c
@@ -56,14 +56,14 @@ static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(const
while (1) {
r = readFromInputStream(data->inStream, (void *)buf, 1, *bytes);
if (r == 0 && !inputStreamAtEOF(data->inStream) &&
- !data->dc->stop)
+ !dc.stop)
my_usleep(10000);
else
break;
}
*bytes = r;
- if (r == 0 && !inputStreamAtEOF(data->inStream) && !data->dc->stop)
+ if (r == 0 && !inputStreamAtEOF(data->inStream) && !dc.stop)
return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
@@ -193,14 +193,14 @@ static FLAC__StreamDecoderWriteStatus oggflacWrite(const
c_chan++) {
u16 = buf[c_chan][c_samp];
uc = (unsigned char *)&u16;
- for (i = 0; i < (data->dc->audioFormat.bits / 8); i++) {
+ for (i = 0; i < (dc.audioFormat.bits / 8); i++) {
if (data->chunk_length >= FLAC_CHUNK_SIZE) {
if (flacSendChunk(data) < 0) {
return
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
data->chunk_length = 0;
- if (data->dc->seek) {
+ if (dc.seek) {
return
FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
@@ -336,21 +336,20 @@ static unsigned int oggflac_try_decode(InputStream * inStream)
return (ogg_stream_type_detect(inStream) == FLAC) ? 1 : 0;
}
-static int oggflac_decode(OutputBuffer * cb, DecoderControl * dc,
- InputStream * inStream)
+static int oggflac_decode(OutputBuffer * cb, InputStream * inStream)
{
OggFLAC__SeekableStreamDecoder *decoder = NULL;
FlacData data;
int ret = 0;
- init_FlacData(&data, cb, dc, inStream);
+ init_FlacData(&data, cb, inStream);
if (!(decoder = full_decoder_init_and_read_metadata(&data, 0))) {
ret = -1;
goto fail;
}
- dc->state = DECODE_STATE_DECODE;
+ dc.state = DECODE_STATE_DECODE;
while (1) {
OggFLAC__seekable_stream_decoder_process_single(decoder);
@@ -358,29 +357,29 @@ static int oggflac_decode(OutputBuffer * cb, DecoderControl * dc,
OggFLAC__SEEKABLE_STREAM_DECODER_OK) {
break;
}
- if (dc->seek) {
- FLAC__uint64 sampleToSeek = dc->seekWhere *
- dc->audioFormat.sampleRate + 0.5;
+ if (dc.seek) {
+ FLAC__uint64 sampleToSeek = dc.seekWhere *
+ dc.audioFormat.sampleRate + 0.5;
if (OggFLAC__seekable_stream_decoder_seek_absolute
(decoder, sampleToSeek)) {
clearOutputBuffer(cb);
data.time = ((float)sampleToSeek) /
- dc->audioFormat.sampleRate;
+ dc.audioFormat.sampleRate;
data.position = 0;
} else
- dc->seekError = 1;
- dc->seek = 0;
+ dc.seekError = 1;
+ dc.seek = 0;
decoder_wakeup_player();
}
}
- if (!dc->stop) {
+ if (!dc.stop) {
oggflacPrintErroredState
(OggFLAC__seekable_stream_decoder_get_state(decoder));
OggFLAC__seekable_stream_decoder_finish(decoder);
}
/* send last little bit */
- if (data.chunk_length > 0 && !dc->stop) {
+ if (data.chunk_length > 0 && !dc.stop) {
flacSendChunk(&data);
flushOutputBuffer(data.cb);
}