Commit 26ebfc04 authored by Max Kellermann's avatar Max Kellermann

EventPipe: rename to GlobalEvents

parent 8782f6d2
...@@ -243,7 +243,7 @@ src_mpd_SOURCES = \ ...@@ -243,7 +243,7 @@ src_mpd_SOURCES = \
src/io_thread.c src/io_thread.h \ src/io_thread.c src/io_thread.h \
src/Main.cxx src/Main.hxx \ src/Main.cxx src/Main.hxx \
src/Win32Main.cxx \ src/Win32Main.cxx \
src/EventPipe.cxx src/EventPipe.hxx \ src/GlobalEvents.cxx src/GlobalEvents.hxx \
src/daemon.c \ src/daemon.c \
src/AudioCompress/compress.c \ src/AudioCompress/compress.c \
src/MusicBuffer.cxx src/MusicBuffer.hxx \ src/MusicBuffer.cxx src/MusicBuffer.hxx \
......
...@@ -18,144 +18,136 @@ ...@@ -18,144 +18,136 @@
*/ */
#include "config.h" #include "config.h"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "fd_util.h" #include "fd_util.h"
#include "mpd_error.h" #include "mpd_error.h"
#include <stdbool.h>
#include <assert.h> #include <assert.h>
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#ifdef WIN32
/* for _O_BINARY */
#include <fcntl.h>
#endif
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "event_pipe" #define G_LOG_DOMAIN "global_events"
static int event_pipe[2]; namespace GlobalEvents {
static GIOChannel *event_channel; static int fds[2];
static guint event_pipe_source_id; static GIOChannel *channel;
static Mutex event_pipe_mutex; static guint source_id;
static bool pipe_events[PIPE_EVENT_MAX]; static Mutex mutex;
static event_pipe_callback_t event_pipe_callbacks[PIPE_EVENT_MAX]; static bool flags[MAX];
static Handler handlers[MAX];
}
/** /**
* Invoke the callback for a certain event. * Invoke the callback for a certain event.
*/ */
static void static void
event_pipe_invoke(enum pipe_event event) InvokeGlobalEvent(GlobalEvents::Event event)
{ {
assert((unsigned)event < PIPE_EVENT_MAX); assert((unsigned)event < GlobalEvents::MAX);
assert(event_pipe_callbacks[event] != NULL); assert(GlobalEvents::handlers[event] != NULL);
event_pipe_callbacks[event](); GlobalEvents::handlers[event]();
} }
static gboolean static gboolean
main_notify_event(G_GNUC_UNUSED GIOChannel *source, GlobalEventCallback(G_GNUC_UNUSED GIOChannel *source,
G_GNUC_UNUSED GIOCondition condition, G_GNUC_UNUSED GIOCondition condition,
G_GNUC_UNUSED gpointer data) G_GNUC_UNUSED gpointer data)
{ {
char buffer[256]; char buffer[256];
gsize bytes_read; gsize bytes_read;
GError *error = NULL; GError *error = NULL;
GIOStatus status = g_io_channel_read_chars(event_channel, GIOStatus status = g_io_channel_read_chars(GlobalEvents::channel,
buffer, sizeof(buffer), buffer, sizeof(buffer),
&bytes_read, &error); &bytes_read, &error);
if (status == G_IO_STATUS_ERROR) if (status == G_IO_STATUS_ERROR)
MPD_ERROR("error reading from pipe: %s", error->message); MPD_ERROR("error reading from pipe: %s", error->message);
bool events[PIPE_EVENT_MAX]; bool events[GlobalEvents::MAX];
event_pipe_mutex.lock(); GlobalEvents::mutex.lock();
memcpy(events, pipe_events, sizeof(events)); memcpy(events, GlobalEvents::flags, sizeof(events));
memset(pipe_events, 0, sizeof(pipe_events)); memset(GlobalEvents::flags, 0,
event_pipe_mutex.unlock(); sizeof(GlobalEvents::flags));
GlobalEvents::mutex.unlock();
for (unsigned i = 0; i < PIPE_EVENT_MAX; ++i) for (unsigned i = 0; i < GlobalEvents::MAX; ++i)
if (events[i]) if (events[i])
/* invoke the event handler */ /* invoke the event handler */
event_pipe_invoke(pipe_event(i)); InvokeGlobalEvent(GlobalEvents::Event(i));
return true; return true;
} }
void event_pipe_init(void) void
GlobalEvents::Initialize()
{ {
GIOChannel *channel; if (pipe_cloexec_nonblock(fds) < 0)
int ret;
ret = pipe_cloexec_nonblock(event_pipe);
if (ret < 0)
MPD_ERROR("Couldn't open pipe: %s", strerror(errno)); MPD_ERROR("Couldn't open pipe: %s", strerror(errno));
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
channel = g_io_channel_unix_new(event_pipe[0]); channel = g_io_channel_unix_new(fds[0]);
#else #else
channel = g_io_channel_win32_new_fd(event_pipe[0]); channel = g_io_channel_win32_new_fd(fds[0]);
#endif #endif
g_io_channel_set_encoding(channel, NULL, NULL); g_io_channel_set_encoding(channel, NULL, NULL);
g_io_channel_set_buffered(channel, false); g_io_channel_set_buffered(channel, false);
event_pipe_source_id = g_io_add_watch(channel, G_IO_IN, source_id = g_io_add_watch(channel, G_IO_IN,
main_notify_event, NULL); GlobalEventCallback, NULL);
event_channel = channel;
} }
void event_pipe_deinit(void) void
GlobalEvents::Deinitialize()
{ {
g_source_remove(event_pipe_source_id); g_source_remove(source_id);
g_io_channel_unref(event_channel); g_io_channel_unref(channel);
#ifndef WIN32 #ifndef WIN32
/* By some strange reason this call hangs on Win32 */ /* By some strange reason this call hangs on Win32 */
close(event_pipe[0]); close(fds[0]);
#endif #endif
close(event_pipe[1]); close(fds[1]);
} }
void void
event_pipe_register(enum pipe_event event, event_pipe_callback_t callback) GlobalEvents::Register(Event event, Handler callback)
{ {
assert((unsigned)event < PIPE_EVENT_MAX); assert((unsigned)event < MAX);
assert(event_pipe_callbacks[event] == NULL); assert(handlers[event] == NULL);
event_pipe_callbacks[event] = callback; handlers[event] = callback;
} }
void event_pipe_emit(enum pipe_event event) void
GlobalEvents::Emit(Event event)
{ {
ssize_t w; assert((unsigned)event < MAX);
assert((unsigned)event < PIPE_EVENT_MAX); mutex.lock();
if (flags[event]) {
event_pipe_mutex.lock();
if (pipe_events[event]) {
/* already set: don't write */ /* already set: don't write */
event_pipe_mutex.unlock(); mutex.unlock();
return; return;
} }
pipe_events[event] = true; flags[event] = true;
event_pipe_mutex.unlock(); mutex.unlock();
w = write(event_pipe[1], "", 1); ssize_t w = write(fds[1], "", 1);
if (w < 0 && errno != EAGAIN && errno != EINTR) if (w < 0 && errno != EAGAIN && errno != EINTR)
MPD_ERROR("error writing to pipe: %s", strerror(errno)); MPD_ERROR("error writing to pipe: %s", strerror(errno));
} }
void event_pipe_emit_fast(enum pipe_event event) void
GlobalEvents::FastEmit(Event event)
{ {
assert((unsigned)event < PIPE_EVENT_MAX); assert((unsigned)event < MAX);
pipe_events[event] = true; flags[event] = true;
G_GNUC_UNUSED ssize_t nbytes = write(event_pipe[1], "", 1); G_GNUC_UNUSED ssize_t nbytes = write(fds[1], "", 1);
} }
...@@ -17,53 +17,54 @@ ...@@ -17,53 +17,54 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef MPD_EVENT_PIPE_HXX #ifndef MPD_GLOBAL_EVENTS_HXX
#define MPD_EVENT_PIPE_HXX #define MPD_GLOBAL_EVENTS_HXX
enum pipe_event { namespace GlobalEvents {
/** database update was finished */ enum Event {
PIPE_EVENT_UPDATE, /** database update was finished */
UPDATE,
/** during database update, a song was deleted */ /** during database update, a song was deleted */
PIPE_EVENT_DELETE, DELETE,
/** an idle event was emitted */ /** an idle event was emitted */
PIPE_EVENT_IDLE, IDLE,
/** must call playlist_sync() */ /** must call playlist_sync() */
PIPE_EVENT_PLAYLIST, PLAYLIST,
/** the current song's tag has changed */ /** the current song's tag has changed */
PIPE_EVENT_TAG, TAG,
/** SIGHUP received: reload configuration, roll log file */ /** SIGHUP received: reload configuration, roll log file */
PIPE_EVENT_RELOAD, RELOAD,
/** a hardware mixer plugin has detected a change */ /** a hardware mixer plugin has detected a change */
PIPE_EVENT_MIXER, MIXER,
/** shutdown requested */ /** shutdown requested */
PIPE_EVENT_SHUTDOWN, SHUTDOWN,
PIPE_EVENT_MAX MAX
}; };
typedef void (*event_pipe_callback_t)(void); typedef void (*Handler)();
void event_pipe_init(void); void Initialize();
void event_pipe_deinit(void); void Deinitialize();
void void Register(Event event, Handler handler);
event_pipe_register(enum pipe_event event, event_pipe_callback_t callback);
void event_pipe_emit(enum pipe_event event); void Emit(Event event);
/** /**
* Similar to event_pipe_emit(), but aimed for use in signal handlers: * Similar to event_pipe_emit(), but aimed for use in signal handlers:
* it doesn't lock the mutex, and doesn't log on error. That makes it * it doesn't lock the mutex, and doesn't log on error. That makes it
* potentially lossy, but for its intended use, that does not matter. * potentially lossy, but for its intended use, that does not matter.
*/ */
void event_pipe_emit_fast(enum pipe_event event); void FastEmit(Event event);
}
#endif /* MAIN_NOTIFY_H */ #endif /* MAIN_NOTIFY_H */
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "config.h" #include "config.h"
#include "Idle.hxx" #include "Idle.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include <assert.h> #include <assert.h>
#include <glib.h> #include <glib.h>
...@@ -71,7 +71,7 @@ idle_add(unsigned flags) ...@@ -71,7 +71,7 @@ idle_add(unsigned flags)
idle_flags |= flags; idle_flags |= flags;
g_mutex_unlock(idle_mutex); g_mutex_unlock(idle_mutex);
event_pipe_emit(PIPE_EVENT_IDLE); GlobalEvents::Emit(GlobalEvents::IDLE);
} }
unsigned unsigned
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "Idle.hxx" #include "Idle.hxx"
#include "SignalHandlers.hxx" #include "SignalHandlers.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
extern "C" { extern "C" {
#include "daemon.h" #include "daemon.h"
...@@ -316,7 +316,7 @@ initialize_decoder_and_player(void) ...@@ -316,7 +316,7 @@ initialize_decoder_and_player(void)
} }
/** /**
* event_pipe callback function for PIPE_EVENT_IDLE * Handler for GlobalEvents::IDLE.
*/ */
static void static void
idle_event_emitted(void) idle_event_emitted(void)
...@@ -329,7 +329,7 @@ idle_event_emitted(void) ...@@ -329,7 +329,7 @@ idle_event_emitted(void)
} }
/** /**
* event_pipe callback function for PIPE_EVENT_SHUTDOWN * Handler for GlobalEvents::SHUTDOWN.
*/ */
static void static void
shutdown_event_emitted(void) shutdown_event_emitted(void)
...@@ -406,9 +406,9 @@ int mpd_main(int argc, char *argv[]) ...@@ -406,9 +406,9 @@ int mpd_main(int argc, char *argv[])
main_loop = g_main_loop_new(NULL, FALSE); main_loop = g_main_loop_new(NULL, FALSE);
main_cond = g_cond_new(); main_cond = g_cond_new();
event_pipe_init(); GlobalEvents::Initialize();
event_pipe_register(PIPE_EVENT_IDLE, idle_event_emitted); GlobalEvents::Register(GlobalEvents::IDLE, idle_event_emitted);
event_pipe_register(PIPE_EVENT_SHUTDOWN, shutdown_event_emitted); GlobalEvents::Register(GlobalEvents::SHUTDOWN, shutdown_event_emitted);
path_global_init(); path_global_init();
...@@ -537,7 +537,7 @@ int mpd_main(int argc, char *argv[]) ...@@ -537,7 +537,7 @@ int mpd_main(int argc, char *argv[])
#endif #endif
g_cond_free(main_cond); g_cond_free(main_cond);
event_pipe_deinit(); GlobalEvents::Deinitialize();
playlist_list_global_finish(); playlist_list_global_finish();
input_stream_global_finish(); input_stream_global_finish();
......
...@@ -52,7 +52,7 @@ win32_main(int argc, char *argv[]); ...@@ -52,7 +52,7 @@ win32_main(int argc, char *argv[]);
* When running as a service reports to service control manager * When running as a service reports to service control manager
* that our service is started. * that our service is started.
* When running as a console application enables console handler that will * When running as a console application enables console handler that will
* trigger PIPE_EVENT_SHUTDOWN when user closes console window * trigger GlobalEvents::SHUTDOWN when user closes console window
* or presses Ctrl+C. * or presses Ctrl+C.
* This function should be called just before entering main loop. * This function should be called just before entering main loop.
*/ */
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "OutputAll.hxx" #include "OutputAll.hxx"
#include "tag.h" #include "tag.h"
#include "Idle.hxx" #include "Idle.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include <cmath> #include <cmath>
...@@ -285,7 +285,7 @@ player_wait_for_decoder(struct player *player) ...@@ -285,7 +285,7 @@ player_wait_for_decoder(struct player *player)
player_unlock(pc); player_unlock(pc);
/* call syncPlaylistWithQueue() in the main thread */ /* call syncPlaylistWithQueue() in the main thread */
event_pipe_emit(PIPE_EVENT_PLAYLIST); GlobalEvents::Emit(GlobalEvents::PLAYLIST);
return true; return true;
} }
...@@ -665,7 +665,7 @@ update_song_tag(struct song *song, const struct tag *new_tag) ...@@ -665,7 +665,7 @@ update_song_tag(struct song *song, const struct tag *new_tag)
/* the main thread will update the playlist version when he /* the main thread will update the playlist version when he
receives this event */ receives this event */
event_pipe_emit(PIPE_EVENT_TAG); GlobalEvents::Emit(GlobalEvents::TAG);
/* notify all clients that the tag of the current song has /* notify all clients that the tag of the current song has
changed */ changed */
...@@ -909,7 +909,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc) ...@@ -909,7 +909,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc)
player_dc_stop(&player); player_dc_stop(&player);
player_command_finished(pc); player_command_finished(pc);
music_pipe_free(player.pipe); music_pipe_free(player.pipe);
event_pipe_emit(PIPE_EVENT_PLAYLIST); GlobalEvents::Emit(GlobalEvents::PLAYLIST);
player_lock(pc); player_lock(pc);
return; return;
} }
...@@ -1086,7 +1086,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc) ...@@ -1086,7 +1086,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc)
player_unlock(pc); player_unlock(pc);
event_pipe_emit(PIPE_EVENT_PLAYLIST); GlobalEvents::Emit(GlobalEvents::PLAYLIST);
player_lock(pc); player_lock(pc);
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "Playlist.hxx" #include "Playlist.hxx"
#include "Main.hxx" #include "Main.hxx"
#include "Partition.hxx" #include "Partition.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
static void static void
playlist_tag_event(void) playlist_tag_event(void)
...@@ -44,6 +44,6 @@ playlist_event(void) ...@@ -44,6 +44,6 @@ playlist_event(void)
void void
playlist_global_init() playlist_global_init()
{ {
event_pipe_register(PIPE_EVENT_TAG, playlist_tag_event); GlobalEvents::Register(GlobalEvents::TAG, playlist_tag_event);
event_pipe_register(PIPE_EVENT_PLAYLIST, playlist_event); GlobalEvents::Register(GlobalEvents::PLAYLIST, playlist_event);
} }
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "Log.hxx" #include "Log.hxx"
#include "Main.hxx" #include "Main.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include "mpd_error.h" #include "mpd_error.h"
#include <glib.h> #include <glib.h>
...@@ -40,7 +40,7 @@ static void exit_signal_handler(G_GNUC_UNUSED int signum) ...@@ -40,7 +40,7 @@ static void exit_signal_handler(G_GNUC_UNUSED int signum)
static void reload_signal_handler(G_GNUC_UNUSED int signum) static void reload_signal_handler(G_GNUC_UNUSED int signum)
{ {
event_pipe_emit_fast(PIPE_EVENT_RELOAD); GlobalEvents::FastEmit(GlobalEvents::RELOAD);
} }
static void static void
...@@ -73,7 +73,7 @@ void initSigHandlers(void) ...@@ -73,7 +73,7 @@ void initSigHandlers(void)
x_sigaction(SIGINT, &sa); x_sigaction(SIGINT, &sa);
x_sigaction(SIGTERM, &sa); x_sigaction(SIGTERM, &sa);
event_pipe_register(PIPE_EVENT_RELOAD, handle_reload_event); GlobalEvents::Register(GlobalEvents::RELOAD, handle_reload_event);
sa.sa_handler = reload_signal_handler; sa.sa_handler = reload_signal_handler;
x_sigaction(SIGHUP, &sa); x_sigaction(SIGHUP, &sa);
#endif #endif
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "Mapper.hxx" #include "Mapper.hxx"
#include "DatabaseSimple.hxx" #include "DatabaseSimple.hxx"
#include "Idle.hxx" #include "Idle.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
extern "C" { extern "C" {
#include "stats.h" #include "stats.h"
...@@ -92,7 +92,7 @@ static void * update_task(void *_path) ...@@ -92,7 +92,7 @@ static void * update_task(void *_path)
g_free(_path); g_free(_path);
progress = UPDATE_PROGRESS_DONE; progress = UPDATE_PROGRESS_DONE;
event_pipe_emit(PIPE_EVENT_UPDATE); GlobalEvents::Emit(GlobalEvents::UPDATE);
return NULL; return NULL;
} }
...@@ -173,7 +173,7 @@ static void update_finished_event(void) ...@@ -173,7 +173,7 @@ static void update_finished_event(void)
void update_global_init(void) void update_global_init(void)
{ {
event_pipe_register(PIPE_EVENT_UPDATE, update_finished_event); GlobalEvents::Register(GlobalEvents::UPDATE, update_finished_event);
update_remove_global_init(); update_remove_global_init();
update_walk_global_init(); update_walk_global_init();
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "UpdateRemove.hxx" #include "UpdateRemove.hxx"
#include "Playlist.hxx" #include "Playlist.hxx"
#include "Partition.hxx" #include "Partition.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include "song.h" #include "song.h"
#include "Main.hxx" #include "Main.hxx"
...@@ -76,7 +76,7 @@ update_remove_global_init(void) ...@@ -76,7 +76,7 @@ update_remove_global_init(void)
remove_mutex = g_mutex_new(); remove_mutex = g_mutex_new();
remove_cond = g_cond_new(); remove_cond = g_cond_new();
event_pipe_register(PIPE_EVENT_DELETE, song_remove_event); GlobalEvents::Register(GlobalEvents::DELETE, song_remove_event);
} }
void void
...@@ -93,7 +93,7 @@ update_remove_song(const struct song *song) ...@@ -93,7 +93,7 @@ update_remove_song(const struct song *song)
removed_song = song; removed_song = song;
event_pipe_emit(PIPE_EVENT_DELETE); GlobalEvents::Emit(GlobalEvents::DELETE);
g_mutex_lock(remove_mutex); g_mutex_lock(remove_mutex);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "Volume.hxx" #include "Volume.hxx"
#include "MixerAll.hxx" #include "MixerAll.hxx"
#include "Idle.hxx" #include "Idle.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include <glib.h> #include <glib.h>
...@@ -41,7 +41,7 @@ static int last_hardware_volume = -1; ...@@ -41,7 +41,7 @@ static int last_hardware_volume = -1;
static GTimer *hardware_volume_timer; static GTimer *hardware_volume_timer;
/** /**
* Handler for #PIPE_EVENT_MIXER. * Handler for #GlobalEvents::MIXER.
*/ */
static void static void
mixer_event_callback(void) mixer_event_callback(void)
...@@ -62,7 +62,7 @@ void volume_init(void) ...@@ -62,7 +62,7 @@ void volume_init(void)
{ {
hardware_volume_timer = g_timer_new(); hardware_volume_timer = g_timer_new();
event_pipe_register(PIPE_EVENT_MIXER, mixer_event_callback); GlobalEvents::Register(GlobalEvents::MIXER, mixer_event_callback);
} }
int volume_level_get(void) int volume_level_get(void)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#ifdef WIN32 #ifdef WIN32
#include "mpd_error.h" #include "mpd_error.h"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include <glib.h> #include <glib.h>
...@@ -68,7 +68,7 @@ service_dispatcher(G_GNUC_UNUSED DWORD control, G_GNUC_UNUSED DWORD event_type, ...@@ -68,7 +68,7 @@ service_dispatcher(G_GNUC_UNUSED DWORD control, G_GNUC_UNUSED DWORD event_type,
switch (control) { switch (control) {
case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_SHUTDOWN:
case SERVICE_CONTROL_STOP: case SERVICE_CONTROL_STOP:
event_pipe_emit(PIPE_EVENT_SHUTDOWN); GlobalEvents::Emit(GlobalEvents::SHUTDOWN);
return NO_ERROR; return NO_ERROR;
default: default:
return NO_ERROR; return NO_ERROR;
...@@ -104,7 +104,7 @@ console_handler(DWORD event) ...@@ -104,7 +104,7 @@ console_handler(DWORD event)
case CTRL_C_EVENT: case CTRL_C_EVENT:
case CTRL_CLOSE_EVENT: case CTRL_CLOSE_EVENT:
if (!ignore_console_events) if (!ignore_console_events)
event_pipe_emit(PIPE_EVENT_SHUTDOWN); GlobalEvents::Emit(GlobalEvents::SHUTDOWN);
return TRUE; return TRUE;
default: default:
return FALSE; return FALSE;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "config.h" #include "config.h"
#include "mixer_api.h" #include "mixer_api.h"
#include "output_api.h" #include "output_api.h"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include <glib.h> #include <glib.h>
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
...@@ -211,7 +211,7 @@ static int ...@@ -211,7 +211,7 @@ static int
alsa_mixer_elem_callback(G_GNUC_UNUSED snd_mixer_elem_t *elem, unsigned mask) alsa_mixer_elem_callback(G_GNUC_UNUSED snd_mixer_elem_t *elem, unsigned mask)
{ {
if (mask & SND_CTL_EVENT_MASK_VALUE) if (mask & SND_CTL_EVENT_MASK_VALUE)
event_pipe_emit(PIPE_EVENT_MIXER); GlobalEvents::Emit(GlobalEvents::MIXER);
return 0; return 0;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "mixer_api.h" #include "mixer_api.h"
#include "output/pulse_output_plugin.h" #include "output/pulse_output_plugin.h"
#include "conf.h" #include "conf.h"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include <glib.h> #include <glib.h>
...@@ -66,7 +66,7 @@ pulse_mixer_offline(struct pulse_mixer *pm) ...@@ -66,7 +66,7 @@ pulse_mixer_offline(struct pulse_mixer *pm)
pm->online = false; pm->online = false;
event_pipe_emit(PIPE_EVENT_MIXER); GlobalEvents::Emit(GlobalEvents::MIXER);
} }
/** /**
...@@ -90,7 +90,7 @@ pulse_mixer_volume_cb(G_GNUC_UNUSED pa_context *context, const pa_sink_input_inf ...@@ -90,7 +90,7 @@ pulse_mixer_volume_cb(G_GNUC_UNUSED pa_context *context, const pa_sink_input_inf
pm->online = true; pm->online = true;
pm->volume = i->volume; pm->volume = i->volume;
event_pipe_emit(PIPE_EVENT_MIXER); GlobalEvents::Emit(GlobalEvents::MIXER);
} }
static void static void
......
...@@ -26,7 +26,7 @@ extern "C" { ...@@ -26,7 +26,7 @@ extern "C" {
} }
#include "pcm_volume.h" #include "pcm_volume.h"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
#include <glib.h> #include <glib.h>
...@@ -88,7 +88,7 @@ roar_output_set_volume(G_GNUC_UNUSED struct roar *roar, ...@@ -88,7 +88,7 @@ roar_output_set_volume(G_GNUC_UNUSED struct roar *roar,
#endif #endif
void void
event_pipe_emit(G_GNUC_UNUSED enum pipe_event event) GlobalEvents::Emit(gcc_unused Event event)
{ {
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "OutputControl.hxx" #include "OutputControl.hxx"
#include "conf.h" #include "conf.h"
#include "Idle.hxx" #include "Idle.hxx"
#include "EventPipe.hxx" #include "GlobalEvents.hxx"
extern "C" { extern "C" {
#include "output_plugin.h" #include "output_plugin.h"
...@@ -43,7 +43,7 @@ extern "C" { ...@@ -43,7 +43,7 @@ extern "C" {
#include <stdlib.h> #include <stdlib.h>
void void
event_pipe_emit(G_GNUC_UNUSED enum pipe_event event) GlobalEvents::Emit(gcc_unused Event event)
{ {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment