diff options
Diffstat (limited to '')
-rw-r--r-- | src/decoder_control.c | 14 | ||||
-rw-r--r-- | src/decoder_control.h | 13 | ||||
-rw-r--r-- | src/main_notify.c | 2 | ||||
-rw-r--r-- | src/notify.h | 4 | ||||
-rw-r--r-- | src/outputBuffer.c | 5 | ||||
-rw-r--r-- | src/outputBuffer.h | 8 | ||||
-rw-r--r-- | src/player_control.h | 2 |
7 files changed, 29 insertions, 19 deletions
diff --git a/src/decoder_control.c b/src/decoder_control.c index 3c83e7371..82c8672c8 100644 --- a/src/decoder_control.c +++ b/src/decoder_control.c @@ -33,7 +33,8 @@ void dc_deinit(void) notify_deinit(&dc.notify); } -void dc_command_wait(Notify *notify) +void +dc_command_wait(struct notify *notify) { while (dc.command != DECODE_COMMAND_NONE) { notify_signal(&dc.notify); @@ -41,7 +42,8 @@ void dc_command_wait(Notify *notify) } } -static void dc_command(Notify *notify, enum decoder_command cmd) +static void +dc_command(struct notify *notify, enum decoder_command cmd) { dc.command = cmd; dc_command_wait(notify); @@ -54,7 +56,7 @@ static void dc_command_async(enum decoder_command cmd) } void -dc_start(Notify *notify, struct song *song) +dc_start(struct notify *notify, struct song *song) { assert(song != NULL); @@ -73,14 +75,16 @@ dc_start_async(struct song *song) dc_command_async(DECODE_COMMAND_START); } -void dc_stop(Notify *notify) +void +dc_stop(struct notify *notify) { if (dc.command == DECODE_COMMAND_START || dc.state != DECODE_STATE_STOP) dc_command(notify, DECODE_COMMAND_STOP); } -int dc_seek(Notify *notify, double where) +int +dc_seek(struct notify *notify, double where) { assert(where >= 0.0); diff --git a/src/decoder_control.h b/src/decoder_control.h index f9e65bc51..0d163257d 100644 --- a/src/decoder_control.h +++ b/src/decoder_control.h @@ -39,7 +39,7 @@ enum decoder_state { #define DECODE_ERROR_FILE 20 struct decoder_control { - Notify notify; + struct notify notify; volatile enum decoder_state state; volatile enum decoder_command command; @@ -81,16 +81,19 @@ decoder_current_song(void) return dc.current_song; } -void dc_command_wait(Notify *notify); +void +dc_command_wait(struct notify *notify); void -dc_start(Notify *notify, struct song *song); +dc_start(struct notify *notify, struct song *song); void dc_start_async(struct song *song); -void dc_stop(Notify *notify); +void +dc_stop(struct notify *notify); -int dc_seek(Notify *notify, double where); +int +dc_seek(struct notify *notify, double where); #endif diff --git a/src/main_notify.c b/src/main_notify.c index 996b750cf..8924d1921 100644 --- a/src/main_notify.c +++ b/src/main_notify.c @@ -28,7 +28,7 @@ static struct ioOps main_notify_IO; static int main_pipe[2]; pthread_t main_task; -static Notify main_notify; +static struct notify main_notify; static pthread_mutex_t select_mutex = PTHREAD_MUTEX_INITIALIZER; static int ioops_fdset(fd_set * rfds, diff --git a/src/notify.h b/src/notify.h index b8018232d..d2a7df027 100644 --- a/src/notify.h +++ b/src/notify.h @@ -21,11 +21,11 @@ #include "os_compat.h" -typedef struct notify { +struct notify { pthread_mutex_t mutex; pthread_cond_t cond; int pending; -} Notify; +}; #define NOTIFY_INITIALIZER { \ .mutex = PTHREAD_MUTEX_INITIALIZER, \ diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 15ba1aa97..14ec6804e 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -17,12 +17,13 @@ */ #include "outputBuffer.h" - +#include "notify.h" #include "utils.h" struct output_buffer ob; -void ob_init(unsigned int size, Notify *notify) +void +ob_init(unsigned int size, struct notify *notify) { assert(size > 0); diff --git a/src/outputBuffer.h b/src/outputBuffer.h index 835ac222e..03d15c9de 100644 --- a/src/outputBuffer.h +++ b/src/outputBuffer.h @@ -19,9 +19,10 @@ #ifndef OUTPUT_BUFFER_H #define OUTPUT_BUFFER_H -#include "notify.h" #include "audio_format.h" +#include <stddef.h> + /* pick 1020 since its devisible for 8,16,24, and 32-bit audio */ #define CHUNK_SIZE 1020 @@ -53,12 +54,13 @@ struct output_buffer { struct audio_format audioFormat; - Notify *notify; + struct notify *notify; }; extern struct output_buffer ob; -void ob_init(unsigned int size, Notify *notify); +void +ob_init(unsigned int size, struct notify *notify); void ob_free(void); diff --git a/src/player_control.h b/src/player_control.h index fd2a5ca45..46b03a9ac 100644 --- a/src/player_control.h +++ b/src/player_control.h @@ -80,7 +80,7 @@ enum player_queue_state { struct player_control { unsigned int buffered_before_play; - Notify notify; + struct notify notify; volatile enum player_command command; volatile enum player_state state; volatile int8_t error; |