(Ab)use the decoder_command enumeration, which has nearly the same
values and the same meaning.
---
src/decoder_api.c | 22 +++++++++++-----------
src/decoder_api.h | 9 ++++-----
src/inputPlugins/_flac_common.h | 2 +-
src/inputPlugins/mp3_plugin.c | 7 ++++---
src/outputBuffer.h | 3 ---
5 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 2009733..d933f6c 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -82,15 +82,15 @@ void decoder_seek_error(struct decoder * decoder)
* All chunks are full of decoded data; wait for the player to free
* one.
*/
-static int need_chunks(struct decoder *decoder, InputStream * inStream,
- int seekable)
+static enum decoder_command
+need_chunks(struct decoder *decoder, InputStream * inStream, int seekable)
{
if (dc.command == DECODE_COMMAND_STOP)
- return OUTPUT_BUFFER_DC_STOP;
+ return DECODE_COMMAND_STOP;
if (dc.command == DECODE_COMMAND_SEEK) {
if (seekable) {
- return OUTPUT_BUFFER_DC_SEEK;
+ return DECODE_COMMAND_SEEK;
} else {
decoder_seek_error(decoder);
}
@@ -102,14 +102,14 @@ static int need_chunks(struct decoder *decoder,
InputStream * inStream,
notify_signal(&pc.notify);
}
- return 0;
+ return DECODE_COMMAND_NONE;
}
-int decoder_data(struct decoder *decoder, InputStream * inStream,
- int seekable,
- void *dataIn, size_t dataInLen,
- float data_time, mpd_uint16 bitRate,
- ReplayGainInfo * replayGainInfo)
+enum decoder_command
+decoder_data(struct decoder *decoder, InputStream * inStream, int seekable,
+ void *dataIn, size_t dataInLen,
+ float data_time, mpd_uint16 bitRate,
+ ReplayGainInfo * replayGainInfo)
{
size_t nbytes;
char *data;
@@ -153,7 +153,7 @@ int decoder_data(struct decoder *decoder, InputStream *
inStream,
}
}
- return 0;
+ return DECODE_COMMAND_NONE;
}
void decoder_flush(mpd_unused struct decoder *decoder)
diff --git a/src/decoder_api.h b/src/decoder_api.h
index c730669..bb85172 100644
--- a/src/decoder_api.h
+++ b/src/decoder_api.h
@@ -125,11 +125,10 @@ void decoder_seek_error(struct decoder * decoder);
* We send inStream for buffering the inputStream while waiting to
* send the next chunk
*/
-int decoder_data(struct decoder *decoder, InputStream * inStream,
- int seekable,
- void *data, size_t datalen,
- float data_time, mpd_uint16 bitRate,
- ReplayGainInfo * replayGainInfo);
+enum decoder_command
+decoder_data(struct decoder *decoder, InputStream * inStream, int seekable,
+ void *data, size_t datalen, float data_time, mpd_uint16 bitRate,
+ ReplayGainInfo * replayGainInfo);
void decoder_flush(struct decoder *decoder);
diff --git a/src/inputPlugins/_flac_common.h b/src/inputPlugins/_flac_common.h
index 21f7106..df9d7a8 100644
--- a/src/inputPlugins/_flac_common.h
+++ b/src/inputPlugins/_flac_common.h
@@ -171,7 +171,7 @@ static inline int flacSendChunk(FlacData * data)
1, data->chunk,
data->chunk_length, data->time,
data->bitRate,
- data->replayGainInfo) == OUTPUT_BUFFER_DC_STOP)
+ data->replayGainInfo) == DECODE_COMMAND_STOP)
return -1;
return 0;
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index 66ca85e..3e7e0ea 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -927,21 +927,22 @@ static int mp3Read(mp3DecodeData * data, struct decoder
*decoder,
}
if (data->outputPtr >= data->outputBufferEnd) {
- ret = decoder_data(decoder, data->inStream,
+ enum decoder_command cmd;
+ cmd = decoder_data(decoder, data->inStream,
data->inStream->seekable,
data->outputBuffer,
data->outputPtr -
data->outputBuffer,
data->elapsedTime,
data->bitRate / 1000,
(replayGainInfo != NULL) ?
*replayGainInfo : NULL);
- if (ret == OUTPUT_BUFFER_DC_STOP) {
+ if (cmd == DECODE_COMMAND_STOP) {
data->flush = 0;
return DECODE_BREAK;
}
data->outputPtr = data->outputBuffer;
- if (ret == OUTPUT_BUFFER_DC_SEEK)
+ if (cmd == DECODE_COMMAND_STOP)
break;
}
}
diff --git a/src/outputBuffer.h b/src/outputBuffer.h
index 67bb093..624b6db 100644
--- a/src/outputBuffer.h
+++ b/src/outputBuffer.h
@@ -22,9 +22,6 @@
#include "notify.h"
#include "audio_format.h"
-#define OUTPUT_BUFFER_DC_STOP -1
-#define OUTPUT_BUFFER_DC_SEEK -2
-
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
#define CHUNK_SIZE 1020
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team