summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-04-14 21:24:23 +0200
committerGravatar waker <wakeroid@gmail.com>2011-04-14 21:24:23 +0200
commit665c42a1675dc450b56052ee664b01ee650f8658 (patch)
treec82c8c6544c000ef01f13993a3bed9460640fb00
parent4e3bdbb0bc8649208400b9eb63751db15bc9bcda (diff)
more unification work on event system
-rw-r--r--deadbeef.h55
-rw-r--r--main.c53
-rw-r--r--messagepump.c3
-rw-r--r--playlist.c12
-rw-r--r--plugins.c1
-rw-r--r--plugins/alsa/alsa.c4
-rw-r--r--plugins/artwork/artwork.c2
-rw-r--r--plugins/gtkui/callbacks.c28
-rw-r--r--plugins/gtkui/fileman.c2
-rw-r--r--plugins/gtkui/gtkui.c8
-rw-r--r--plugins/gtkui/mainplaylist.c2
-rw-r--r--plugins/gtkui/pluginconf.c4
-rw-r--r--plugins/gtkui/prefwin.c46
-rw-r--r--plugins/gtkui/search.c4
-rw-r--r--plugins/hotkeys/hotkeys.c20
-rw-r--r--plugins/oss/oss.c2
-rw-r--r--streamer.c2
17 files changed, 123 insertions, 125 deletions
diff --git a/deadbeef.h b/deadbeef.h
index 774c2fc7..49971f30 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -222,38 +222,34 @@ typedef struct DB_conf_item_s {
// event callback type
typedef int (*DB_callback_t)(ddb_event_t *, uintptr_t data);
-// message ids for communicating with player
-enum {
- M_SONGFINISHED,
- M_NEXT,
- M_PREV,
- M_PLAY_CURRENT,
- M_PLAY_NUM,
- M_STOP,
- M_PAUSE,
- M_PLAY_RANDOM,
- M_TERMINATE, // must be sent to player thread to terminate
- M_PLAYLIST_REFRESH, // means
- M_REINIT_SOUND,
- M_CONFIG_CHANGED, // no arguments
- M_TOGGLE_PAUSE,
-};
-
// events
enum {
+ DB_EV_NEXT = 1, // switch to next track
+ DB_EV_PREV = 2, // switch to prev track
+ DB_EV_PLAY_CURRENT = 3, // play current track (will start/unpause if stopped or paused)
+ DB_EV_PLAY_NUM = 4, // play track nr. p1
+ DB_EV_STOP = 5, // stop current track
+ DB_EV_PAUSE = 6, // pause playback
+ DB_EV_PLAY_RANDOM = 7, // play random track
+ DB_EV_TERMINATE = 8, // must be sent to player thread to terminate
+ DB_EV_PLAYLIST_REFRESH = 9, // save and redraw current playlist
+ DB_EV_REINIT_SOUND = 10, // reinitialize sound output with current output_plugin config value
+ DB_EV_CONFIGCHANGED = 11, // one or more config options were changed
+ DB_EV_TOGGLE_PAUSE = 12,
+ DB_EV_ACTIVATED = 13, // will be fired every time player is activated
+ DB_EV_PAUSED = 14, // player was paused or unpaused
+ DB_EV_PLAYLISTCHANGED = 15, // playlist contents were changed
+ DB_EV_VOLUMECHANGED = 16, // volume was changed
+ DB_EV_OUTPUTCHANGED = 17, // sound output plugin changed
+ DB_EV_PLAYLISTSWITCHED = 18, // playlist switch occured
+ DB_EV_SEEK = 19, // seek current track to position p1 (ms)
+
DB_EV_FIRST = 1000,
- DB_EV_SONGCHANGED = 1000, // triggers when current song changed from one to another, see ddb_event_trackchange_t, both pointers can be NULL
- DB_EV_SONGSTARTED = 1001, // triggers when song started playing (for scrobblers and such)
- DB_EV_SONGFINISHED = 1002, // triggers when song finished playing (for scrobblers and such)
- DB_EV_CONFIGCHANGED = 1003, // configuration option changed
- DB_EV_ACTIVATE = 1004, // will be fired every time player is activated
- DB_EV_TRACKINFOCHANGED = 1005, // notify plugins that trackinfo was changed
- DB_EV_PAUSED = 1006, // player was paused or unpaused
- DB_EV_PLAYLISTCHANGED = 1007, // playlist contents were changed
- DB_EV_VOLUMECHANGED = 1008, // volume was changed
- DB_EV_OUTPUTCHANGED = 1009, // sound output plugin changed
- DB_EV_PLAYLISTSWITCH = 1010, // playlist switch occured
- DB_EV_SEEKED = 1011, // seek happened, see ddb_event_playpos_t
+ DB_EV_SONGCHANGED = 1000, // current song changed from one to another, ctx=ddb_event_trackchange_t
+ DB_EV_SONGSTARTED = 1001, // song started playing, ctx=ddb_event_track_t
+ DB_EV_SONGFINISHED = 1002, // song finished playing, ctx=ddb_event_track_t
+ DB_EV_TRACKINFOCHANGED = 1004, // trackinfo was changed (included medatata and playback status), ctx=ddb_event_track_t
+ DB_EV_SEEKED = 1005, // seek happened, ctx=ddb_event_playpos_t
DB_EV_MAX
};
@@ -324,7 +320,6 @@ typedef struct {
DB_playItem_t *(*streamer_get_playing_track) (void);
DB_playItem_t *(*streamer_get_streaming_track) (void);
float (*streamer_get_playpos) (void);
- void (*streamer_seek) (float time);
int (*streamer_ok_to_read) (int len);
void (*streamer_reset) (int full);
int (*streamer_read) (char *bytes, int size);
diff --git a/main.c b/main.c
index c0ae2efd..cf9f9f85 100644
--- a/main.c
+++ b/main.c
@@ -179,38 +179,38 @@ server_exec_command_line (const char *cmdline, int len, char *sendback, int sbsi
}
}
else if (!strcmp (parg, "--next")) {
- messagepump_push (M_NEXT, 0, 0, 0);
+ messagepump_push (DB_EV_NEXT, 0, 0, 0);
return 0;
}
else if (!strcmp (parg, "--prev")) {
- messagepump_push (M_PREV, 0, 0, 0);
+ messagepump_push (DB_EV_PREV, 0, 0, 0);
return 0;
}
else if (!strcmp (parg, "--play")) {
- messagepump_push (M_PLAY_CURRENT, 0, 0, 0);
+ messagepump_push (DB_EV_PLAY_CURRENT, 0, 0, 0);
return 0;
}
else if (!strcmp (parg, "--stop")) {
- messagepump_push (M_STOP, 0, 0, 0);
+ messagepump_push (DB_EV_STOP, 0, 0, 0);
return 0;
}
else if (!strcmp (parg, "--pause")) {
- messagepump_push (M_PAUSE, 0, 0, 0);
+ messagepump_push (DB_EV_PAUSE, 0, 0, 0);
return 0;
}
else if (!strcmp (parg, "--toggle-pause")) {
- messagepump_push (M_TOGGLE_PAUSE, 0, 0, 0);
+ messagepump_push (DB_EV_TOGGLE_PAUSE, 0, 0, 0);
return 0;
}
else if (!strcmp (parg, "--random")) {
- messagepump_push (M_PLAY_RANDOM, 0, 0, 0);
+ messagepump_push (DB_EV_PLAY_RANDOM, 0, 0, 0);
return 0;
}
else if (!strcmp (parg, "--queue")) {
queue = 1;
}
else if (!strcmp (parg, "--quit")) {
- messagepump_push (M_TERMINATE, 0, 0, 0);
+ messagepump_push (DB_EV_TERMINATE, 0, 0, 0);
}
else if (parg[0] != '-') {
break; // unknown option is filename
@@ -258,9 +258,9 @@ server_exec_command_line (const char *cmdline, int len, char *sendback, int sbsi
}
deadbeef->pl_add_files_end ();
}
- messagepump_push (M_PLAYLIST_REFRESH, 0, 0, 0);
+ messagepump_push (DB_EV_PLAYLIST_REFRESH, 0, 0, 0);
if (!queue) {
- messagepump_push (M_PLAY_CURRENT, 0, 1, 0);
+ messagepump_push (DB_EV_PLAY_CURRENT, 0, 1, 0);
return 2; // don't reload playlist at startup
}
}
@@ -341,7 +341,7 @@ server_update (void) {
if ((size = recv (s2, str, 2048, 0)) >= 0) {
if (size == 1 && str[0] == 0) {
// FIXME: that should be called right after activation of gui plugin
- plug_trigger_event (DB_EV_ACTIVATE, 0);
+ plug_trigger_event (DB_EV_ACTIVATED, 0);
}
else {
server_exec_command_line (str, size, sendback, sizeof (sendback));
@@ -378,7 +378,7 @@ server_loop (void *ctx) {
}
if (ret > 0) {
if (server_update () < 0) {
- messagepump_push (M_TERMINATE, 0, 0, 0);
+ messagepump_push (DB_EV_TERMINATE, 0, 0, 0);
}
}
}
@@ -403,14 +403,15 @@ player_mainloop (void) {
}
DB_output_t *output = plug_get_output ();
switch (msg) {
- case M_REINIT_SOUND:
+ case DB_EV_REINIT_SOUND:
plug_reinit_sound ();
conf_save ();
break;
- case M_TERMINATE:
+ case DB_EV_TERMINATE:
+ printf ("terminate received\n");
term = 1;
break;
- case M_PLAY_CURRENT:
+ case DB_EV_PLAY_CURRENT:
if (p1) {
output->stop ();
pl_playqueue_clear ();
@@ -420,29 +421,29 @@ player_mainloop (void) {
streamer_play_current_track ();
}
break;
- case M_PLAY_NUM:
+ case DB_EV_PLAY_NUM:
output->stop ();
pl_playqueue_clear ();
streamer_set_nextsong (p1, 1);
break;
- case M_STOP:
+ case DB_EV_STOP:
streamer_set_nextsong (-2, 0);
break;
- case M_NEXT:
+ case DB_EV_NEXT:
output->stop ();
streamer_move_to_nextsong (1);
break;
- case M_PREV:
+ case DB_EV_PREV:
output->stop ();
streamer_move_to_prevsong ();
break;
- case M_PAUSE:
+ case DB_EV_PAUSE:
if (output->state () != OUTPUT_STATE_PAUSED) {
output->pause ();
plug_trigger_event_paused (1);
}
break;
- case M_TOGGLE_PAUSE:
+ case DB_EV_TOGGLE_PAUSE:
if (output->state () == OUTPUT_STATE_PAUSED) {
output->unpause ();
plug_trigger_event_paused (0);
@@ -452,18 +453,20 @@ player_mainloop (void) {
plug_trigger_event_paused (1);
}
break;
- case M_PLAY_RANDOM:
+ case DB_EV_PLAY_RANDOM:
output->stop ();
streamer_move_to_randomsong ();
break;
- case M_PLAYLIST_REFRESH:
+ case DB_EV_PLAYLIST_REFRESH:
pl_save_current ();
plug_trigger_event_playlistchanged ();
break;
- case M_CONFIG_CHANGED:
+ case DB_EV_CONFIGCHANGED:
conf_save ();
streamer_configchanged ();
- plug_trigger_event (DB_EV_CONFIGCHANGED, 0);
+ break;
+ case DB_EV_SEEK:
+ streamer_set_seek (p1 / 1000.f);
break;
}
if (msg >= DB_EV_FIRST && ctx) {
diff --git a/messagepump.c b/messagepump.c
index d58623ea..77c563f7 100644
--- a/messagepump.c
+++ b/messagepump.c
@@ -106,10 +106,11 @@ messagepump_wait (void) {
int
messagepump_pop (uint32_t *id, uintptr_t *ctx, uint32_t *p1, uint32_t *p2) {
+ mutex_lock (mutex);
if (!mqueue) {
+ mutex_unlock (mutex);
return -1;
}
- mutex_lock (mutex);
*id = mqueue->id;
*ctx = mqueue->ctx;
*p1 = mqueue->p1;
diff --git a/playlist.c b/playlist.c
index 2d8231cd..5b1443a1 100644
--- a/playlist.c
+++ b/playlist.c
@@ -311,7 +311,7 @@ plt_add (int before, const char *title) {
if (!plt_loading) {
pl_save_n (before);
conf_save ();
- messagepump_push (DB_EV_PLAYLISTSWITCH, 0, 0, 0);
+ messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0);
}
return playlists_count-1;
}
@@ -360,7 +360,7 @@ plt_remove (int plt) {
plt_gen_conf ();
conf_save ();
pl_save_n (0);
- messagepump_push (DB_EV_PLAYLISTSWITCH, 0, 0, 0);
+ messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0);
return;
}
if (i != plt) {
@@ -404,7 +404,7 @@ plt_remove (int plt) {
plt_gen_conf ();
conf_save ();
if (!plt_loading) {
- messagepump_push (DB_EV_PLAYLISTSWITCH, 0, 0, 0);
+ messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0);
}
}
@@ -431,7 +431,7 @@ plt_set_curr (int plt) {
if (p != playlist) {
playlist = p;
if (!plt_loading) {
- messagepump_push (DB_EV_PLAYLISTSWITCH, 0, 0, 0);
+ messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0);
conf_set_int ("playlist.current", plt_get_curr ());
conf_save ();
}
@@ -496,7 +496,7 @@ plt_set_title (playlist_t *p, const char *title) {
UNLOCK;
conf_save ();
if (!plt_loading) {
- messagepump_push (DB_EV_PLAYLISTSWITCH, 0, 0, 0);
+ messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0);
}
return 0;
}
@@ -2501,7 +2501,7 @@ pl_load_all (void) {
plt_set_curr (0);
plt_loading = 0;
plt_gen_conf ();
- messagepump_push (DB_EV_PLAYLISTSWITCH, 0, 0, 0);
+ messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0);
UNLOCK;
trace ("pl_load_all finished\n");
return err;
diff --git a/plugins.c b/plugins.c
index eb7fc9f2..55eef068 100644
--- a/plugins.c
+++ b/plugins.c
@@ -74,7 +74,6 @@ static DB_functions_t deadbeef_api = {
.streamer_get_playing_track = (DB_playItem_t *(*) (void))streamer_get_playing_track,
.streamer_get_streaming_track = (DB_playItem_t *(*) (void))streamer_get_streaming_track,
.streamer_get_playpos = streamer_get_playpos,
- .streamer_seek = streamer_set_seek,
.streamer_ok_to_read = streamer_ok_to_read,
.streamer_reset = streamer_reset,
.streamer_read = streamer_read,
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 04a14bdd..7c39cb2c 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -662,7 +662,7 @@ palsa_thread (void *context) {
exit (-1);
}
}
- // deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
+ // deadbeef->sendmessage (DB_EV_REINIT_SOUND, 0, 0, 0);
// break;
}
else {
@@ -697,7 +697,7 @@ alsa_configchanged (void) {
|| buffer != req_buffer_size
|| period != req_period_size)) {
trace ("alsa: config option changed, restarting\n");
- deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_REINIT_SOUND, 0, 0, 0);
}
deadbeef->conf_unlock ();
return 0;
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c
index a86b83a7..82b677dd 100644
--- a/plugins/artwork/artwork.c
+++ b/plugins/artwork/artwork.c
@@ -745,7 +745,7 @@ artwork_configchanged (void) {
strcpy (artwork_filemask, new_artwork_filemask);
deadbeef->conf_set_int64 ("artwork.cache_reset_time", artwork_reset_time);
artwork_reset (0);
- deadbeef->sendmessage (M_PLAYLIST_REFRESH, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0);
}
return 0;
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index 3c775f16..1cbbe523 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -272,7 +272,7 @@ on_quit_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
progress_abort ();
- deadbeef->sendmessage (M_TERMINATE, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_TERMINATE, 0, 0, 0);
}
@@ -298,7 +298,7 @@ void
on_stopbtn_clicked (GtkButton *button,
gpointer user_data)
{
- deadbeef->sendmessage (M_STOP, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_STOP, 0, 0, 0);
}
@@ -306,7 +306,7 @@ void
on_playbtn_clicked (GtkButton *button,
gpointer user_data)
{
- deadbeef->sendmessage (M_PLAY_CURRENT, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0);
}
@@ -314,7 +314,7 @@ void
on_pausebtn_clicked (GtkButton *button,
gpointer user_data)
{
- deadbeef->sendmessage (M_TOGGLE_PAUSE, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_TOGGLE_PAUSE, 0, 0, 0);
}
@@ -322,7 +322,7 @@ void
on_prevbtn_clicked (GtkButton *button,
gpointer user_data)
{
- deadbeef->sendmessage (M_PREV, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PREV, 0, 0, 0);
}
@@ -330,7 +330,7 @@ void
on_nextbtn_clicked (GtkButton *button,
gpointer user_data)
{
- deadbeef->sendmessage (M_NEXT, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_NEXT, 0, 0, 0);
}
@@ -338,7 +338,7 @@ void
on_playrand_clicked (GtkButton *button,
gpointer user_data)
{
- deadbeef->sendmessage (M_PLAY_RANDOM, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PLAY_RANDOM, 0, 0, 0);
}
gboolean
@@ -349,7 +349,7 @@ on_mainwin_key_press_event (GtkWidget *widget,
uint32_t maskedstate = (event->state &~ (GDK_LOCK_MASK | GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD5_MASK)) & 0xfff;
if ((maskedstate == GDK_MOD1_MASK || maskedstate == 0) && event->keyval == GDK_n) {
// button for that one is not in toolbar anymore, so handle it manually
- deadbeef->sendmessage (M_PLAY_RANDOM, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PLAY_RANDOM, 0, 0, 0);
}
else if ((maskedstate == GDK_MOD1_MASK || maskedstate == 0) && event->keyval >= GDK_1 && event->keyval <= GDK_9) {
int pl = event->keyval - GDK_1;
@@ -370,7 +370,7 @@ on_order_linear_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
deadbeef->conf_set_int ("playback.order", PLAYBACK_ORDER_LINEAR);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
@@ -379,7 +379,7 @@ on_order_shuffle_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
deadbeef->conf_set_int ("playback.order", PLAYBACK_ORDER_SHUFFLE_TRACKS);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
void
@@ -387,7 +387,7 @@ on_order_shuffle_albums_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
deadbeef->conf_set_int ("playback.order", PLAYBACK_ORDER_SHUFFLE_ALBUMS);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
void
@@ -395,7 +395,7 @@ on_order_random_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
deadbeef->conf_set_int ("playback.order", PLAYBACK_ORDER_RANDOM);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
@@ -611,7 +611,7 @@ on_seekbar_button_release_event (GtkWidget *widget,
if (time < 0) {
time = 0;
}
- deadbeef->streamer_seek (time);
+ deadbeef->sendmessage (DB_EV_SEEK, 0, time * 1000, 0);
deadbeef->pl_item_unref (trk);
}
gtk_widget_queue_draw (widget);
@@ -636,7 +636,7 @@ on_mainwin_delete_event (GtkWidget *widget,
gtk_widget_hide (widget);
}
else {
- deadbeef->sendmessage (M_TERMINATE, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_TERMINATE, 0, 0, 0);
}
return TRUE;
}
diff --git a/plugins/gtkui/fileman.c b/plugins/gtkui/fileman.c
index 3b5db560..6ff981b4 100644
--- a/plugins/gtkui/fileman.c
+++ b/plugins/gtkui/fileman.c
@@ -95,7 +95,7 @@ open_files_worker (void *data) {
extern GtkWidget *mainwin;
DdbListview *pl = DDB_LISTVIEW (lookup_widget (mainwin, "playlist"));
ddb_listview_set_cursor (pl, 0);
- deadbeef->sendmessage (M_PLAY_CURRENT, 0, 1, 0);
+ deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 1, 0);
}
void
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 22570b87..66658c95 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -314,7 +314,7 @@ on_trayicon_button_press_event (GtkWidget *widget,
mainwin_toggle_visible ();
}
else if (event->button == 2) {
- deadbeef->sendmessage (M_TOGGLE_PAUSE, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_TOGGLE_PAUSE, 0, 0, 0);
}
return FALSE;
}
@@ -942,7 +942,7 @@ gtkui_setup_gui_refresh (void) {
int
gtkui_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
switch (id) {
- case DB_EV_ACTIVATE:
+ case DB_EV_ACTIVATED:
g_idle_add (activate_cb, NULL);
break;
case DB_EV_SONGCHANGED:
@@ -975,7 +975,7 @@ gtkui_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
case DB_EV_OUTPUTCHANGED:
g_idle_add (outputchanged_cb, NULL);
break;
- case DB_EV_PLAYLISTSWITCH:
+ case DB_EV_PLAYLISTSWITCHED:
g_idle_add (playlistswitch_cb, NULL);
break;
}
@@ -1100,7 +1100,7 @@ gtkui_set_progress_text_idle (gpointer data) {
gboolean
gtkui_progress_hide_idle (gpointer data) {
progress_hide ();
- //deadbeef->sendmessage (M_PLAYLIST_REFRESH, 0, 0, 0);
+ //deadbeef->sendmessage (DB_EV_PLAYLIST_REFRESH, 0, 0, 0);
return FALSE;
}
diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c
index 0c736150..9c4c5877 100644
--- a/plugins/gtkui/mainplaylist.c
+++ b/plugins/gtkui/mainplaylist.c
@@ -143,7 +143,7 @@ main_col_sort (int col, int sort_order, void *user_data) {
deadbeef->pl_sort (PL_MAIN, c->id, c->format, sort_order-1);
}
void main_handle_doubleclick (DdbListview *listview, DdbListviewIter iter, int idx) {
- deadbeef->sendmessage (M_PLAY_NUM, 0, idx, 0);
+ deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, idx, 0);
}
void main_selection_changed (DdbListviewIter it, int idx) {
diff --git a/plugins/gtkui/pluginconf.c b/plugins/gtkui/pluginconf.c
index c7c73ae8..04f73084 100644
--- a/plugins/gtkui/pluginconf.c
+++ b/plugins/gtkui/pluginconf.c
@@ -52,7 +52,7 @@ on_prop_browse_file (GtkButton *button, gpointer user_data) {
if (folder) {
deadbeef->conf_set_str ("filechooser.lastdir", folder);
g_free (folder);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
if (response == GTK_RESPONSE_OK) {
gchar *file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg));
@@ -183,7 +183,7 @@ static void apply_conf (GtkWidget *w, ddb_dialog_t *conf) {
break;
}
}
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
static void
diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c
index 9883fc96..c697307f 100644
--- a/plugins/gtkui/prefwin.c
+++ b/plugins/gtkui/prefwin.c
@@ -656,7 +656,7 @@ on_pref_soundcard_changed (GtkComboBox *combobox,
const char *soundcard = deadbeef->conf_get_str_fast ("alsa_soundcard", "default");
if (strcmp (soundcard, alsa_device_names[active])) {
deadbeef->conf_set_str ("alsa_soundcard", alsa_device_names[active]);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
deadbeef->conf_unlock ();
}
@@ -690,7 +690,7 @@ on_pref_output_plugin_changed (GtkComboBox *combobox,
else {
if (prev != new) {
deadbeef->conf_set_str ("output_plugin", new->plugin.name);
- deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_REINIT_SOUND, 0, 0, 0);
}
}
}
@@ -701,7 +701,7 @@ on_pref_replaygain_mode_changed (GtkComboBox *combobox,
{
int active = gtk_combo_box_get_active (combobox);
deadbeef->conf_set_int ("replaygain_mode", active == -1 ? 0 : active);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
void
@@ -710,7 +710,7 @@ on_pref_replaygain_scale_clicked (GtkButton *button,
{
int active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
deadbeef->conf_set_int ("replaygain_scale", active);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
void
@@ -719,7 +719,7 @@ on_replaygain_preamp_value_changed (GtkRange *range,
{
float val = gtk_range_get_value (range);
deadbeef->conf_set_float ("replaygain_preamp", val);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
@@ -729,7 +729,7 @@ on_pref_close_send_to_tray_clicked (GtkButton *button,
{
int active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
deadbeef->conf_set_int ("close_send_to_tray", active);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
void
@@ -738,7 +738,7 @@ on_hide_tray_icon_toggled (GtkToggleButton *togglebutton,
{
int active = gtk_toggle_button_get_active (togglebutton);
deadbeef->conf_set_int ("gtkui.hide_tray_icon", active);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
void
@@ -850,7 +850,7 @@ on_tabstrip_light_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.tabstrip_light", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
redraw_headers ();
tabstrip_redraw ();
@@ -866,7 +866,7 @@ on_tabstrip_mid_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.tabstrip_mid", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
redraw_headers ();
tabstrip_redraw ();
@@ -882,7 +882,7 @@ on_tabstrip_dark_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.tabstrip_dark", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
redraw_headers ();
tabstrip_redraw ();
@@ -897,7 +897,7 @@ on_tabstrip_base_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.tabstrip_base", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
redraw_headers ();
tabstrip_redraw ();
@@ -912,7 +912,7 @@ on_tabstrip_text_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.tabstrip_text", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
redraw_headers ();
tabstrip_redraw ();
@@ -927,7 +927,7 @@ on_bar_foreground_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.bar_foreground", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
seekbar_redraw ();
volumebar_redraw ();
@@ -944,7 +944,7 @@ on_bar_background_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.bar_background", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
seekbar_redraw ();
volumebar_redraw ();
@@ -958,7 +958,7 @@ on_override_listview_colors_toggled (GtkToggleButton *togglebutton,
int active = gtk_toggle_button_get_active (togglebutton);
deadbeef->conf_set_int ("gtkui.override_listview_colors", active);
gtk_widget_set_sensitive (lookup_widget (prefwin, "listview_colors_group"), active);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
prefwin_init_theme_colors ();
playlist_refresh ();
@@ -974,7 +974,7 @@ on_listview_even_row_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.listview_even_row", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
playlist_refresh ();
}
@@ -988,7 +988,7 @@ on_listview_odd_row_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.listview_odd_row", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
playlist_refresh ();
}
@@ -1002,7 +1002,7 @@ on_listview_selected_row_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.listview_selection", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
playlist_refresh ();
}
@@ -1016,7 +1016,7 @@ on_listview_text_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.listview_text", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
playlist_refresh ();
}
@@ -1031,7 +1031,7 @@ on_listview_selected_text_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.listview_selected_text", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
playlist_refresh ();
}
@@ -1045,7 +1045,7 @@ on_listview_cursor_color_set (GtkColorButton *colorbutton,
char str[100];
snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
deadbeef->conf_set_str ("gtkui.color.listview_cursor", str);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
playlist_refresh ();
}
@@ -1058,7 +1058,7 @@ on_override_bar_colors_toggled (GtkToggleButton *togglebutton,
int active = gtk_toggle_button_get_active (togglebutton);
deadbeef->conf_set_int ("gtkui.override_bar_colors", active);
gtk_widget_set_sensitive (lookup_widget (prefwin, "bar_colors_group"), active);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
prefwin_init_theme_colors ();
seekbar_redraw ();
@@ -1073,7 +1073,7 @@ on_override_tabstrip_colors_toggled (GtkToggleButton *togglebutton,
int active = gtk_toggle_button_get_active (togglebutton);
deadbeef->conf_set_int ("gtkui.override_tabstrip_colors", active);
gtk_widget_set_sensitive (lookup_widget (prefwin, "tabstrip_colors_group"), active);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
gtkui_init_theme_colors ();
prefwin_init_theme_colors ();
redraw_headers ();
diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c
index 9baf18f3..6f5bf544 100644
--- a/plugins/gtkui/search.c
+++ b/plugins/gtkui/search.c
@@ -159,7 +159,7 @@ on_searchwin_key_press_event (GtkWidget *widget,
int row = deadbeef->pl_get_cursor (PL_SEARCH);
DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (max (row, 0), PL_SEARCH);
if (it) {
- deadbeef->sendmessage (M_PLAY_NUM, 0, deadbeef->pl_get_idx_of (it), 0);
+ deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, deadbeef->pl_get_idx_of (it), 0);
deadbeef->pl_item_unref (it);
}
}
@@ -310,7 +310,7 @@ void search_col_free_user_data (void *data) {
}
void search_handle_doubleclick (DdbListview *listview, DdbListviewIter iter, int idx) {
- deadbeef->sendmessage (M_PLAY_NUM, 0, deadbeef->pl_get_idx_of ((DB_playItem_t *)iter), 0);
+ deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, deadbeef->pl_get_idx_of ((DB_playItem_t *)iter), 0);
}
void search_selection_changed (DdbListviewIter it, int idx) {
diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c
index ec8f2e96..5b9c96ee 100644
--- a/plugins/hotkeys/hotkeys.c
+++ b/plugins/hotkeys/hotkeys.c
@@ -111,7 +111,7 @@ cmd_stop_after_current (void *unused) {
int var = deadbeef->conf_get_int ("playlist.stop_after_current", 0);
var = 1 - var;
deadbeef->conf_set_int ("playlist.stop_after_current", var);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
}
/*
@@ -507,31 +507,31 @@ hotkeys_reset (void) {
int
action_play_cb (struct DB_plugin_action_s *action, DB_playItem_t *it) {
- deadbeef->sendmessage (M_PLAY_CURRENT, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0);
return 0;
}
int
action_prev_cb (struct DB_plugin_action_s *action, DB_playItem_t *it) {
- deadbeef->sendmessage (M_PREV, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PREV, 0, 0, 0);
return 0;
}
int
action_next_cb (struct DB_plugin_action_s *action, DB_playItem_t *it) {
- deadbeef->sendmessage (M_NEXT, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_NEXT, 0, 0, 0);
return 0;
}
int
action_stop_cb (struct DB_plugin_action_s *action, DB_playItem_t *it) {
- deadbeef->sendmessage (M_STOP, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_STOP, 0, 0, 0);
return 0;
}
int
action_toggle_pause_cb (struct DB_plugin_action_s *action, DB_playItem_t *it) {
- deadbeef->sendmessage (M_TOGGLE_PAUSE, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_TOGGLE_PAUSE, 0, 0, 0);
return 0;
}
@@ -539,17 +539,17 @@ int
action_play_pause_cb (struct DB_plugin_action_s *action, DB_playItem_t *it) {
int state = deadbeef->get_output ()->state ();
if (state == OUTPUT_STATE_PLAYING) {
- deadbeef->sendmessage (M_PAUSE, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PAUSE, 0, 0, 0);
}
else {
- deadbeef->sendmessage (M_PLAY_CURRENT, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0);
}
return 0;
}
int
action_play_random_cb (struct DB_plugin_action_s *action, DB_playItem_t *it) {
- deadbeef->sendmessage (M_PLAY_RANDOM, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_PLAY_RANDOM, 0, 0, 0);
return 0;
}
@@ -582,7 +582,7 @@ action_toggle_stop_after_current_cb (struct DB_plugin_action_s *action, DB_playI
int var = deadbeef->conf_get_int ("playlist.stop_after_current", 0);
var = 1 - var;
deadbeef->conf_set_int ("playlist.stop_after_current", var);
- deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0);
return 0;
}
diff --git a/plugins/oss/oss.c b/plugins/oss/oss.c
index e64e1fc0..f1b3e7c9 100644
--- a/plugins/oss/oss.c
+++ b/plugins/oss/oss.c
@@ -321,7 +321,7 @@ oss_configchanged (void) {
if (strcmp (dev, oss_device)) {
strncpy (oss_device, dev, sizeof (oss_device)-1);
trace ("oss: config option changed, restarting\n");
- deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
+ deadbeef->sendmessage (DB_EV_REINIT_SOUND, 0, 0, 0);
}
deadbeef->conf_unlock ();
return 0;
diff --git a/streamer.c b/streamer.c
index e957033e..5a5de02c 100644
--- a/streamer.c
+++ b/streamer.c
@@ -1928,6 +1928,6 @@ streamer_set_dsp_chain (ddb_dsp_context_t *chain) {
mutex_unlock (decodemutex);
DB_output_t *output = plug_get_output ();
if (playing_track && output->state () != OUTPUT_STATE_STOPPED) {
- deadbeef->streamer_seek (playpos);
+ streamer_set_seek (playpos);
}
}