aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/oggflac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:07 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:07 +0200
commit817a68b2b27dc65fb5fc550c83117832e8048c6f (patch)
tree324fed7254ab6d8c64bf5736049ab50ce558af5f /src/inputPlugins/oggflac_plugin.c
parent2e9169de9d859fd5d5629a4d1b3789155a5dac62 (diff)
downloadmpd-817a68b2b27dc65fb5fc550c83117832e8048c6f.tar.gz
mpd-817a68b2b27dc65fb5fc550c83117832e8048c6f.tar.xz
mpd-817a68b2b27dc65fb5fc550c83117832e8048c6f.zip
added decoder_get_command()
Another big patch which hides internal mpd APIs from decoder plugins: decoder plugins regularly poll dc->command; expose it with a decoder_api.h function.
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/oggflac_plugin.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c
index f8cb4c09a..09a514194 100644
--- a/src/inputPlugins/oggflac_plugin.c
+++ b/src/inputPlugins/oggflac_plugin.c
@@ -50,7 +50,7 @@ static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(const
while (1) {
r = readFromInputStream(data->inStream, (void *)buf, 1, *bytes);
if (r == 0 && !inputStreamAtEOF(data->inStream) &&
- dc.command != DECODE_COMMAND_STOP)
+ decoder_get_command(data->decoder) != DECODE_COMMAND_STOP)
my_usleep(10000);
else
break;
@@ -58,7 +58,7 @@ static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(const
*bytes = r;
if (r == 0 && !inputStreamAtEOF(data->inStream) &&
- dc.command != DECODE_COMMAND_STOP)
+ decoder_get_command(data->decoder) != DECODE_COMMAND_STOP)
return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
@@ -195,7 +195,7 @@ static FLAC__StreamDecoderWriteStatus oggflacWrite(const
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
data->chunk_length = 0;
- if (dc.command == DECODE_COMMAND_SEEK) {
+ if (decoder_get_command(data->decoder) == DECODE_COMMAND_SEEK) {
return
FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
@@ -353,7 +353,7 @@ static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream)
OggFLAC__SEEKABLE_STREAM_DECODER_OK) {
break;
}
- if (dc->command == DECODE_COMMAND_SEEK) {
+ if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) {
FLAC__uint64 sampleToSeek = dc->seekWhere *
data.audio_format.sampleRate + 0.5;
if (OggFLAC__seekable_stream_decoder_seek_absolute
@@ -368,13 +368,14 @@ static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream)
}
}
- if (dc.command != DECODE_COMMAND_STOP) {
+ if (decoder_get_command(mpd_decoder) != DECODE_COMMAND_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.command != DECODE_COMMAND_STOP) {
+ if (data.chunk_length > 0 &&
+ decoder_get_command(mpd_decoder) != DECODE_COMMAND_STOP) {
flacSendChunk(&data);
decoder_flush(mpd_decoder);
}