aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:29:35 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:29:35 +0200
commit70904adf18611348b3cefdda9aae437442ba90a8 (patch)
treebfc89dc15154e24fb14e8d2bd9c2848fcc65e70c /src/decode.h
parenta1ce999978adb716bec99ac259faf20d88306443 (diff)
downloadmpd-70904adf18611348b3cefdda9aae437442ba90a8.tar.gz
mpd-70904adf18611348b3cefdda9aae437442ba90a8.tar.xz
mpd-70904adf18611348b3cefdda9aae437442ba90a8.zip
hide DecoderControl accesses in inline functions
Unfortunately, we have to pass the DecoderControl pointer to these inline functions, because the global variable "dc" may not be available here. This will be fixed later.
Diffstat (limited to 'src/decode.h')
-rw-r--r--src/decode.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/decode.h b/src/decode.h
index f68507d3f..ba6193a99 100644
--- a/src/decode.h
+++ b/src/decode.h
@@ -61,6 +61,27 @@ typedef struct _DecoderControl {
void decoderInit(void);
+static inline int decoder_is_idle(DecoderControl *dc)
+{
+ return dc->state == DECODE_STATE_STOP &&
+ dc->command != DECODE_COMMAND_START;
+}
+
+static inline int decoder_is_starting(DecoderControl *dc)
+{
+ return dc->command == DECODE_COMMAND_START ||
+ dc->state == DECODE_STATE_START;
+}
+
+static inline Song *decoder_current_song(DecoderControl *dc)
+{
+ if (dc->state == DECODE_STATE_STOP ||
+ dc->error != DECODE_ERROR_NOERROR)
+ return NULL;
+
+ return dc->current_song;
+}
+
void dc_command_wait(Notify *notify);
void dc_start(Notify *notify, Song *song);