aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/flac_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/flac_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/flac_plugin.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c
index 890c78fa3..fd6ab4e2f 100644
--- a/src/inputPlugins/flac_plugin.c
+++ b/src/inputPlugins/flac_plugin.c
@@ -37,14 +37,14 @@ static flac_read_status flacRead(mpd_unused const flac_decoder * flacDec,
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;
}
*bytes = r;
- if (r == 0 && dc.command != DECODE_COMMAND_STOP) {
+ if (r == 0 && decoder_get_command(data->decoder) != DECODE_COMMAND_STOP) {
if (inputStreamAtEOF(data->inStream))
return flac_read_status_eof;
else
@@ -287,7 +287,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
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;
}
@@ -423,7 +423,7 @@ static int flac_decode_internal(struct decoder * decoder,
break;
if (flac_get_state(flacDec) == flac_decoder_eof)
break;
- if (dc.command == DECODE_COMMAND_SEEK) {
+ if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
FLAC__uint64 sampleToSeek = dc.seekWhere *
data.audio_format.sampleRate + 0.5;
if (flac_seek_absolute(flacDec, sampleToSeek)) {
@@ -436,12 +436,12 @@ static int flac_decode_internal(struct decoder * decoder,
dc_command_finished();
}
}
- if (dc.command != DECODE_COMMAND_STOP) {
+ if (decoder_get_command(decoder) != DECODE_COMMAND_STOP) {
flacPrintErroredState(flac_get_state(flacDec));
flac_finish(flacDec);
}
/* send last little bit */
- if (data.chunk_length > 0 && dc.command != DECODE_COMMAND_STOP) {
+ if (data.chunk_length > 0 && decoder_get_command(decoder) != DECODE_COMMAND_STOP) {
flacSendChunk(&data);
decoder_flush(decoder);
}