notify: removed the "Notify" typedef

Typedefs shouldn't be used, use the bare struct names instead.
This commit is contained in:
Max Kellermann 2008-10-08 10:49:16 +02:00
parent d562ba5fbb
commit b159832418
7 changed files with 29 additions and 19 deletions

View File

@ -33,7 +33,8 @@ void dc_deinit(void)
notify_deinit(&dc.notify); notify_deinit(&dc.notify);
} }
void dc_command_wait(Notify *notify) void
dc_command_wait(struct notify *notify)
{ {
while (dc.command != DECODE_COMMAND_NONE) { while (dc.command != DECODE_COMMAND_NONE) {
notify_signal(&dc.notify); 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 = cmd;
dc_command_wait(notify); dc_command_wait(notify);
@ -54,7 +56,7 @@ static void dc_command_async(enum decoder_command cmd)
} }
void void
dc_start(Notify *notify, struct song *song) dc_start(struct notify *notify, struct song *song)
{ {
assert(song != NULL); assert(song != NULL);
@ -73,14 +75,16 @@ dc_start_async(struct song *song)
dc_command_async(DECODE_COMMAND_START); dc_command_async(DECODE_COMMAND_START);
} }
void dc_stop(Notify *notify) void
dc_stop(struct notify *notify)
{ {
if (dc.command == DECODE_COMMAND_START || if (dc.command == DECODE_COMMAND_START ||
dc.state != DECODE_STATE_STOP) dc.state != DECODE_STATE_STOP)
dc_command(notify, DECODE_COMMAND_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); assert(where >= 0.0);

View File

@ -39,7 +39,7 @@ enum decoder_state {
#define DECODE_ERROR_FILE 20 #define DECODE_ERROR_FILE 20
struct decoder_control { struct decoder_control {
Notify notify; struct notify notify;
volatile enum decoder_state state; volatile enum decoder_state state;
volatile enum decoder_command command; volatile enum decoder_command command;
@ -81,16 +81,19 @@ decoder_current_song(void)
return dc.current_song; return dc.current_song;
} }
void dc_command_wait(Notify *notify); void
dc_command_wait(struct notify *notify);
void void
dc_start(Notify *notify, struct song *song); dc_start(struct notify *notify, struct song *song);
void void
dc_start_async(struct song *song); 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 #endif

View File

@ -28,7 +28,7 @@
static struct ioOps main_notify_IO; static struct ioOps main_notify_IO;
static int main_pipe[2]; static int main_pipe[2];
pthread_t main_task; pthread_t main_task;
static Notify main_notify; static struct notify main_notify;
static pthread_mutex_t select_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t select_mutex = PTHREAD_MUTEX_INITIALIZER;
static int ioops_fdset(fd_set * rfds, static int ioops_fdset(fd_set * rfds,

View File

@ -21,11 +21,11 @@
#include "os_compat.h" #include "os_compat.h"
typedef struct notify { struct notify {
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
int pending; int pending;
} Notify; };
#define NOTIFY_INITIALIZER { \ #define NOTIFY_INITIALIZER { \
.mutex = PTHREAD_MUTEX_INITIALIZER, \ .mutex = PTHREAD_MUTEX_INITIALIZER, \

View File

@ -17,12 +17,13 @@
*/ */
#include "outputBuffer.h" #include "outputBuffer.h"
#include "notify.h"
#include "utils.h" #include "utils.h"
struct output_buffer ob; struct output_buffer ob;
void ob_init(unsigned int size, Notify *notify) void
ob_init(unsigned int size, struct notify *notify)
{ {
assert(size > 0); assert(size > 0);

View File

@ -19,9 +19,10 @@
#ifndef OUTPUT_BUFFER_H #ifndef OUTPUT_BUFFER_H
#define OUTPUT_BUFFER_H #define OUTPUT_BUFFER_H
#include "notify.h"
#include "audio_format.h" #include "audio_format.h"
#include <stddef.h>
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */ /* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
#define CHUNK_SIZE 1020 #define CHUNK_SIZE 1020
@ -53,12 +54,13 @@ struct output_buffer {
struct audio_format audioFormat; struct audio_format audioFormat;
Notify *notify; struct notify *notify;
}; };
extern struct output_buffer ob; 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); void ob_free(void);

View File

@ -80,7 +80,7 @@ enum player_queue_state {
struct player_control { struct player_control {
unsigned int buffered_before_play; unsigned int buffered_before_play;
Notify notify; struct notify notify;
volatile enum player_command command; volatile enum player_command command;
volatile enum player_state state; volatile enum player_state state;
volatile int8_t error; volatile int8_t error;