aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/EventPipe.cxx161
-rw-r--r--src/EventPipe.hxx69
-rw-r--r--src/GlobalEvents.cxx153
-rw-r--r--src/GlobalEvents.hxx70
-rw-r--r--src/Idle.cxx4
-rw-r--r--src/Main.cxx14
-rw-r--r--src/Main.hxx2
-rw-r--r--src/PlayerThread.cxx10
-rw-r--r--src/PlaylistGlobal.cxx6
-rw-r--r--src/SignalHandlers.cxx6
-rw-r--r--src/UpdateGlue.cxx6
-rw-r--r--src/UpdateRemove.cxx6
-rw-r--r--src/Volume.cxx6
-rw-r--r--src/Win32Main.cxx6
-rw-r--r--src/mixer/AlsaMixerPlugin.cxx4
-rw-r--r--src/mixer/PulseMixerPlugin.cxx6
16 files changed, 261 insertions, 268 deletions
diff --git a/src/EventPipe.cxx b/src/EventPipe.cxx
deleted file mode 100644
index 85f24f08a..000000000
--- a/src/EventPipe.cxx
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
- * http://www.musicpd.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-#include "EventPipe.hxx"
-#include "thread/Mutex.hxx"
-#include "fd_util.h"
-#include "mpd_error.h"
-
-#include <stdbool.h>
-#include <assert.h>
-#include <glib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#ifdef WIN32
-/* for _O_BINARY */
-#include <fcntl.h>
-#endif
-
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "event_pipe"
-
-static int event_pipe[2];
-static GIOChannel *event_channel;
-static guint event_pipe_source_id;
-static Mutex event_pipe_mutex;
-static bool pipe_events[PIPE_EVENT_MAX];
-static event_pipe_callback_t event_pipe_callbacks[PIPE_EVENT_MAX];
-
-/**
- * Invoke the callback for a certain event.
- */
-static void
-event_pipe_invoke(enum pipe_event event)
-{
- assert((unsigned)event < PIPE_EVENT_MAX);
- assert(event_pipe_callbacks[event] != NULL);
-
- event_pipe_callbacks[event]();
-}
-
-static gboolean
-main_notify_event(G_GNUC_UNUSED GIOChannel *source,
- G_GNUC_UNUSED GIOCondition condition,
- G_GNUC_UNUSED gpointer data)
-{
- char buffer[256];
- gsize bytes_read;
- GError *error = NULL;
- GIOStatus status = g_io_channel_read_chars(event_channel,
- buffer, sizeof(buffer),
- &bytes_read, &error);
- if (status == G_IO_STATUS_ERROR)
- MPD_ERROR("error reading from pipe: %s", error->message);
-
- bool events[PIPE_EVENT_MAX];
- event_pipe_mutex.lock();
- memcpy(events, pipe_events, sizeof(events));
- memset(pipe_events, 0, sizeof(pipe_events));
- event_pipe_mutex.unlock();
-
- for (unsigned i = 0; i < PIPE_EVENT_MAX; ++i)
- if (events[i])
- /* invoke the event handler */
- event_pipe_invoke(pipe_event(i));
-
- return true;
-}
-
-void event_pipe_init(void)
-{
- GIOChannel *channel;
- int ret;
-
- ret = pipe_cloexec_nonblock(event_pipe);
- if (ret < 0)
- MPD_ERROR("Couldn't open pipe: %s", strerror(errno));
-
-#ifndef G_OS_WIN32
- channel = g_io_channel_unix_new(event_pipe[0]);
-#else
- channel = g_io_channel_win32_new_fd(event_pipe[0]);
-#endif
- g_io_channel_set_encoding(channel, NULL, NULL);
- g_io_channel_set_buffered(channel, false);
-
- event_pipe_source_id = g_io_add_watch(channel, G_IO_IN,
- main_notify_event, NULL);
-
- event_channel = channel;
-}
-
-void event_pipe_deinit(void)
-{
- g_source_remove(event_pipe_source_id);
- g_io_channel_unref(event_channel);
-
-#ifndef WIN32
- /* By some strange reason this call hangs on Win32 */
- close(event_pipe[0]);
-#endif
- close(event_pipe[1]);
-}
-
-void
-event_pipe_register(enum pipe_event event, event_pipe_callback_t callback)
-{
- assert((unsigned)event < PIPE_EVENT_MAX);
- assert(event_pipe_callbacks[event] == NULL);
-
- event_pipe_callbacks[event] = callback;
-}
-
-void event_pipe_emit(enum pipe_event event)
-{
- ssize_t w;
-
- assert((unsigned)event < PIPE_EVENT_MAX);
-
- event_pipe_mutex.lock();
- if (pipe_events[event]) {
- /* already set: don't write */
- event_pipe_mutex.unlock();
- return;
- }
-
- pipe_events[event] = true;
- event_pipe_mutex.unlock();
-
- w = write(event_pipe[1], "", 1);
- if (w < 0 && errno != EAGAIN && errno != EINTR)
- MPD_ERROR("error writing to pipe: %s", strerror(errno));
-}
-
-void event_pipe_emit_fast(enum pipe_event event)
-{
- assert((unsigned)event < PIPE_EVENT_MAX);
-
- pipe_events[event] = true;
-
- G_GNUC_UNUSED ssize_t nbytes = write(event_pipe[1], "", 1);
-}
diff --git a/src/EventPipe.hxx b/src/EventPipe.hxx
deleted file mode 100644
index f7a0c30f3..000000000
--- a/src/EventPipe.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
- * http://www.musicpd.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPD_EVENT_PIPE_HXX
-#define MPD_EVENT_PIPE_HXX
-
-enum pipe_event {
- /** database update was finished */
- PIPE_EVENT_UPDATE,
-
- /** during database update, a song was deleted */
- PIPE_EVENT_DELETE,
-
- /** an idle event was emitted */
- PIPE_EVENT_IDLE,
-
- /** must call playlist_sync() */
- PIPE_EVENT_PLAYLIST,
-
- /** the current song's tag has changed */
- PIPE_EVENT_TAG,
-
- /** SIGHUP received: reload configuration, roll log file */
- PIPE_EVENT_RELOAD,
-
- /** a hardware mixer plugin has detected a change */
- PIPE_EVENT_MIXER,
-
- /** shutdown requested */
- PIPE_EVENT_SHUTDOWN,
-
- PIPE_EVENT_MAX
-};
-
-typedef void (*event_pipe_callback_t)(void);
-
-void event_pipe_init(void);
-
-void event_pipe_deinit(void);
-
-void
-event_pipe_register(enum pipe_event event, event_pipe_callback_t callback);
-
-void event_pipe_emit(enum pipe_event event);
-
-/**
- * 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
- * potentially lossy, but for its intended use, that does not matter.
- */
-void event_pipe_emit_fast(enum pipe_event event);
-
-#endif /* MAIN_NOTIFY_H */
diff --git a/src/GlobalEvents.cxx b/src/GlobalEvents.cxx
new file mode 100644
index 000000000..4bc607dfb
--- /dev/null
+++ b/src/GlobalEvents.cxx
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+#include "GlobalEvents.hxx"
+#include "thread/Mutex.hxx"
+#include "fd_util.h"
+#include "mpd_error.h"
+
+#include <assert.h>
+#include <glib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+
+#undef G_LOG_DOMAIN
+#define G_LOG_DOMAIN "global_events"
+
+namespace GlobalEvents {
+ static int fds[2];
+ static GIOChannel *channel;
+ static guint source_id;
+ static Mutex mutex;
+ static bool flags[MAX];
+ static Handler handlers[MAX];
+}
+
+/**
+ * Invoke the callback for a certain event.
+ */
+static void
+InvokeGlobalEvent(GlobalEvents::Event event)
+{
+ assert((unsigned)event < GlobalEvents::MAX);
+ assert(GlobalEvents::handlers[event] != NULL);
+
+ GlobalEvents::handlers[event]();
+}
+
+static gboolean
+GlobalEventCallback(G_GNUC_UNUSED GIOChannel *source,
+ G_GNUC_UNUSED GIOCondition condition,
+ G_GNUC_UNUSED gpointer data)
+{
+ char buffer[256];
+ gsize bytes_read;
+ GError *error = NULL;
+ GIOStatus status = g_io_channel_read_chars(GlobalEvents::channel,
+ buffer, sizeof(buffer),
+ &bytes_read, &error);
+ if (status == G_IO_STATUS_ERROR)
+ MPD_ERROR("error reading from pipe: %s", error->message);
+
+ bool events[GlobalEvents::MAX];
+ GlobalEvents::mutex.lock();
+ memcpy(events, GlobalEvents::flags, sizeof(events));
+ memset(GlobalEvents::flags, 0,
+ sizeof(GlobalEvents::flags));
+ GlobalEvents::mutex.unlock();
+
+ for (unsigned i = 0; i < GlobalEvents::MAX; ++i)
+ if (events[i])
+ /* invoke the event handler */
+ InvokeGlobalEvent(GlobalEvents::Event(i));
+
+ return true;
+}
+
+void
+GlobalEvents::Initialize()
+{
+ if (pipe_cloexec_nonblock(fds) < 0)
+ MPD_ERROR("Couldn't open pipe: %s", strerror(errno));
+
+#ifndef G_OS_WIN32
+ channel = g_io_channel_unix_new(fds[0]);
+#else
+ channel = g_io_channel_win32_new_fd(fds[0]);
+#endif
+ g_io_channel_set_encoding(channel, NULL, NULL);
+ g_io_channel_set_buffered(channel, false);
+
+ source_id = g_io_add_watch(channel, G_IO_IN,
+ GlobalEventCallback, NULL);
+}
+
+void
+GlobalEvents::Deinitialize()
+{
+ g_source_remove(source_id);
+ g_io_channel_unref(channel);
+
+#ifndef WIN32
+ /* By some strange reason this call hangs on Win32 */
+ close(fds[0]);
+#endif
+ close(fds[1]);
+}
+
+void
+GlobalEvents::Register(Event event, Handler callback)
+{
+ assert((unsigned)event < MAX);
+ assert(handlers[event] == NULL);
+
+ handlers[event] = callback;
+}
+
+void
+GlobalEvents::Emit(Event event)
+{
+ assert((unsigned)event < MAX);
+
+ mutex.lock();
+ if (flags[event]) {
+ /* already set: don't write */
+ mutex.unlock();
+ return;
+ }
+
+ flags[event] = true;
+ mutex.unlock();
+
+ ssize_t w = write(fds[1], "", 1);
+ if (w < 0 && errno != EAGAIN && errno != EINTR)
+ MPD_ERROR("error writing to pipe: %s", strerror(errno));
+}
+
+void
+GlobalEvents::FastEmit(Event event)
+{
+ assert((unsigned)event < MAX);
+
+ flags[event] = true;
+
+ G_GNUC_UNUSED ssize_t nbytes = write(fds[1], "", 1);
+}
diff --git a/src/GlobalEvents.hxx b/src/GlobalEvents.hxx
new file mode 100644
index 000000000..ee977936a
--- /dev/null
+++ b/src/GlobalEvents.hxx
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPD_GLOBAL_EVENTS_HXX
+#define MPD_GLOBAL_EVENTS_HXX
+
+namespace GlobalEvents {
+ enum Event {
+ /** database update was finished */
+ UPDATE,
+
+ /** during database update, a song was deleted */
+ DELETE,
+
+ /** an idle event was emitted */
+ IDLE,
+
+ /** must call playlist_sync() */
+ PLAYLIST,
+
+ /** the current song's tag has changed */
+ TAG,
+
+ /** SIGHUP received: reload configuration, roll log file */
+ RELOAD,
+
+ /** a hardware mixer plugin has detected a change */
+ MIXER,
+
+ /** shutdown requested */
+ SHUTDOWN,
+
+ MAX
+ };
+
+ typedef void (*Handler)();
+
+ void Initialize();
+
+ void Deinitialize();
+
+ void Register(Event event, Handler handler);
+
+ void Emit(Event event);
+
+ /**
+ * 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
+ * potentially lossy, but for its intended use, that does not matter.
+ */
+ void FastEmit(Event event);
+}
+
+#endif /* MAIN_NOTIFY_H */
diff --git a/src/Idle.cxx b/src/Idle.cxx
index 0d42f7dd5..fce0cb7da 100644
--- a/src/Idle.cxx
+++ b/src/Idle.cxx
@@ -24,7 +24,7 @@
#include "config.h"
#include "Idle.hxx"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
#include <assert.h>
#include <glib.h>
@@ -71,7 +71,7 @@ idle_add(unsigned flags)
idle_flags |= flags;
g_mutex_unlock(idle_mutex);
- event_pipe_emit(PIPE_EVENT_IDLE);
+ GlobalEvents::Emit(GlobalEvents::IDLE);
}
unsigned
diff --git a/src/Main.cxx b/src/Main.cxx
index a158b5e2f..0124cc38f 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -43,7 +43,7 @@
#include "Idle.hxx"
#include "SignalHandlers.hxx"
#include "Log.hxx"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
extern "C" {
#include "daemon.h"
@@ -316,7 +316,7 @@ initialize_decoder_and_player(void)
}
/**
- * event_pipe callback function for PIPE_EVENT_IDLE
+ * Handler for GlobalEvents::IDLE.
*/
static void
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
shutdown_event_emitted(void)
@@ -406,9 +406,9 @@ int mpd_main(int argc, char *argv[])
main_loop = g_main_loop_new(NULL, FALSE);
main_cond = g_cond_new();
- event_pipe_init();
- event_pipe_register(PIPE_EVENT_IDLE, idle_event_emitted);
- event_pipe_register(PIPE_EVENT_SHUTDOWN, shutdown_event_emitted);
+ GlobalEvents::Initialize();
+ GlobalEvents::Register(GlobalEvents::IDLE, idle_event_emitted);
+ GlobalEvents::Register(GlobalEvents::SHUTDOWN, shutdown_event_emitted);
path_global_init();
@@ -537,7 +537,7 @@ int mpd_main(int argc, char *argv[])
#endif
g_cond_free(main_cond);
- event_pipe_deinit();
+ GlobalEvents::Deinitialize();
playlist_list_global_finish();
input_stream_global_finish();
diff --git a/src/Main.hxx b/src/Main.hxx
index 6d61843a8..acc168bc5 100644
--- a/src/Main.hxx
+++ b/src/Main.hxx
@@ -52,7 +52,7 @@ win32_main(int argc, char *argv[]);
* When running as a service reports to service control manager
* that our service is started.
* 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.
* This function should be called just before entering main loop.
*/
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx
index 14c8a03f2..62b43739d 100644
--- a/src/PlayerThread.cxx
+++ b/src/PlayerThread.cxx
@@ -32,7 +32,7 @@
#include "OutputAll.hxx"
#include "tag.h"
#include "Idle.hxx"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
#include <cmath>
@@ -285,7 +285,7 @@ player_wait_for_decoder(struct player *player)
player_unlock(pc);
/* call syncPlaylistWithQueue() in the main thread */
- event_pipe_emit(PIPE_EVENT_PLAYLIST);
+ GlobalEvents::Emit(GlobalEvents::PLAYLIST);
return true;
}
@@ -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
receives this event */
- event_pipe_emit(PIPE_EVENT_TAG);
+ GlobalEvents::Emit(GlobalEvents::TAG);
/* notify all clients that the tag of the current song has
changed */
@@ -909,7 +909,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc)
player_dc_stop(&player);
player_command_finished(pc);
music_pipe_free(player.pipe);
- event_pipe_emit(PIPE_EVENT_PLAYLIST);
+ GlobalEvents::Emit(GlobalEvents::PLAYLIST);
player_lock(pc);
return;
}
@@ -1086,7 +1086,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc)
player_unlock(pc);
- event_pipe_emit(PIPE_EVENT_PLAYLIST);
+ GlobalEvents::Emit(GlobalEvents::PLAYLIST);
player_lock(pc);
}
diff --git a/src/PlaylistGlobal.cxx b/src/PlaylistGlobal.cxx
index 87f362a2e..9dd971d3f 100644
--- a/src/PlaylistGlobal.cxx
+++ b/src/PlaylistGlobal.cxx
@@ -27,7 +27,7 @@
#include "Playlist.hxx"
#include "Main.hxx"
#include "Partition.hxx"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
static void
playlist_tag_event(void)
@@ -44,6 +44,6 @@ playlist_event(void)
void
playlist_global_init()
{
- event_pipe_register(PIPE_EVENT_TAG, playlist_tag_event);
- event_pipe_register(PIPE_EVENT_PLAYLIST, playlist_event);
+ GlobalEvents::Register(GlobalEvents::TAG, playlist_tag_event);
+ GlobalEvents::Register(GlobalEvents::PLAYLIST, playlist_event);
}
diff --git a/src/SignalHandlers.cxx b/src/SignalHandlers.cxx
index 14da08c7b..331028bde 100644
--- a/src/SignalHandlers.cxx
+++ b/src/SignalHandlers.cxx
@@ -24,7 +24,7 @@
#include "Log.hxx"
#include "Main.hxx"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
#include "mpd_error.h"
#include <glib.h>
@@ -40,7 +40,7 @@ static void exit_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
@@ -73,7 +73,7 @@ void initSigHandlers(void)
x_sigaction(SIGINT, &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;
x_sigaction(SIGHUP, &sa);
#endif
diff --git a/src/UpdateGlue.cxx b/src/UpdateGlue.cxx
index fba4c1862..22a33ade9 100644
--- a/src/UpdateGlue.cxx
+++ b/src/UpdateGlue.cxx
@@ -25,7 +25,7 @@
#include "Mapper.hxx"
#include "DatabaseSimple.hxx"
#include "Idle.hxx"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
extern "C" {
#include "stats.h"
@@ -92,7 +92,7 @@ static void * update_task(void *_path)
g_free(_path);
progress = UPDATE_PROGRESS_DONE;
- event_pipe_emit(PIPE_EVENT_UPDATE);
+ GlobalEvents::Emit(GlobalEvents::UPDATE);
return NULL;
}
@@ -173,7 +173,7 @@ static void update_finished_event(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_walk_global_init();
diff --git a/src/UpdateRemove.cxx b/src/UpdateRemove.cxx
index afa7c2931..f7e6c80ec 100644
--- a/src/UpdateRemove.cxx
+++ b/src/UpdateRemove.cxx
@@ -21,7 +21,7 @@
#include "UpdateRemove.hxx"
#include "Playlist.hxx"
#include "Partition.hxx"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
#include "song.h"
#include "Main.hxx"
@@ -76,7 +76,7 @@ update_remove_global_init(void)
remove_mutex = g_mutex_new();
remove_cond = g_cond_new();
- event_pipe_register(PIPE_EVENT_DELETE, song_remove_event);
+ GlobalEvents::Register(GlobalEvents::DELETE, song_remove_event);
}
void
@@ -93,7 +93,7 @@ update_remove_song(const struct song *song)
removed_song = song;
- event_pipe_emit(PIPE_EVENT_DELETE);
+ GlobalEvents::Emit(GlobalEvents::DELETE);
g_mutex_lock(remove_mutex);
diff --git a/src/Volume.cxx b/src/Volume.cxx
index 6a71a6964..116f4aa18 100644
--- a/src/Volume.cxx
+++ b/src/Volume.cxx
@@ -21,7 +21,7 @@
#include "Volume.hxx"
#include "MixerAll.hxx"
#include "Idle.hxx"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
#include <glib.h>
@@ -41,7 +41,7 @@ static int last_hardware_volume = -1;
static GTimer *hardware_volume_timer;
/**
- * Handler for #PIPE_EVENT_MIXER.
+ * Handler for #GlobalEvents::MIXER.
*/
static void
mixer_event_callback(void)
@@ -62,7 +62,7 @@ void volume_init(void)
{
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)
diff --git a/src/Win32Main.cxx b/src/Win32Main.cxx
index 710811f47..8932e8edf 100644
--- a/src/Win32Main.cxx
+++ b/src/Win32Main.cxx
@@ -23,7 +23,7 @@
#ifdef WIN32
#include "mpd_error.h"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
#include <glib.h>
@@ -68,7 +68,7 @@ service_dispatcher(G_GNUC_UNUSED DWORD control, G_GNUC_UNUSED DWORD event_type,
switch (control) {
case SERVICE_CONTROL_SHUTDOWN:
case SERVICE_CONTROL_STOP:
- event_pipe_emit(PIPE_EVENT_SHUTDOWN);
+ GlobalEvents::Emit(GlobalEvents::SHUTDOWN);
return NO_ERROR;
default:
return NO_ERROR;
@@ -104,7 +104,7 @@ console_handler(DWORD event)
case CTRL_C_EVENT:
case CTRL_CLOSE_EVENT:
if (!ignore_console_events)
- event_pipe_emit(PIPE_EVENT_SHUTDOWN);
+ GlobalEvents::Emit(GlobalEvents::SHUTDOWN);
return TRUE;
default:
return FALSE;
diff --git a/src/mixer/AlsaMixerPlugin.cxx b/src/mixer/AlsaMixerPlugin.cxx
index f00bfcb9d..9808c6dcc 100644
--- a/src/mixer/AlsaMixerPlugin.cxx
+++ b/src/mixer/AlsaMixerPlugin.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "mixer_api.h"
#include "output_api.h"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
#include <glib.h>
#include <alsa/asoundlib.h>
@@ -211,7 +211,7 @@ static int
alsa_mixer_elem_callback(G_GNUC_UNUSED snd_mixer_elem_t *elem, unsigned mask)
{
if (mask & SND_CTL_EVENT_MASK_VALUE)
- event_pipe_emit(PIPE_EVENT_MIXER);
+ GlobalEvents::Emit(GlobalEvents::MIXER);
return 0;
}
diff --git a/src/mixer/PulseMixerPlugin.cxx b/src/mixer/PulseMixerPlugin.cxx
index 3b7937560..65dbc01fe 100644
--- a/src/mixer/PulseMixerPlugin.cxx
+++ b/src/mixer/PulseMixerPlugin.cxx
@@ -22,7 +22,7 @@
#include "mixer_api.h"
#include "output/pulse_output_plugin.h"
#include "conf.h"
-#include "EventPipe.hxx"
+#include "GlobalEvents.hxx"
#include <glib.h>
@@ -66,7 +66,7 @@ pulse_mixer_offline(struct pulse_mixer *pm)
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
pm->online = true;
pm->volume = i->volume;
- event_pipe_emit(PIPE_EVENT_MIXER);
+ GlobalEvents::Emit(GlobalEvents::MIXER);
}
static void