summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-04-14 20:50:40 +0200
committerGravatar waker <wakeroid@gmail.com>2011-04-14 20:50:40 +0200
commit4e3bdbb0bc8649208400b9eb63751db15bc9bcda (patch)
tree3bfc597a6255a652ce774558bda4bf65c6b6252a /plugins
parenta0116d4496107e368b791d86295834c6e844a6e8 (diff)
new event passing system
Diffstat (limited to 'plugins')
-rw-r--r--plugins/alsa/alsa.c15
-rw-r--r--plugins/artwork/artwork.c16
-rw-r--r--plugins/ffmpeg/ffmpeg.c11
-rw-r--r--plugins/gtkui/ddblistview.c9
-rw-r--r--plugins/gtkui/gtkui.c119
-rw-r--r--plugins/lastfm/lastfm.c25
-rw-r--r--plugins/notify/notify.c15
-rw-r--r--plugins/oss/oss.c15
-rw-r--r--plugins/sid/csid.cpp14
-rw-r--r--plugins/sid/csid.h1
-rw-r--r--plugins/sid/plugin.c1
-rw-r--r--plugins/sndfile/sndfile.c12
12 files changed, 137 insertions, 116 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 07b0c869..04a14bdd 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -687,7 +687,7 @@ palsa_callback (char *stream, int len) {
}
static int
-palsa_configchanged (DB_event_t *ev, uintptr_t data) {
+alsa_configchanged (void) {
deadbeef->conf_lock ();
const char *alsa_soundcard = deadbeef->conf_get_str_fast ("alsa_soundcard", "default");
int buffer = deadbeef->conf_get_int ("alsa.buffer", DEFAULT_BUFFER_SIZE);
@@ -738,14 +738,22 @@ palsa_get_state (void) {
}
static int
+alsa_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ case DB_EV_CONFIGCHANGED:
+ alsa_configchanged ();
+ break;
+ }
+ return 0;
+}
+
+static int
alsa_start (void) {
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (palsa_configchanged), 0);
return 0;
}
static int
alsa_stop (void) {
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (palsa_configchanged), 0);
return 0;
}
@@ -791,6 +799,7 @@ static DB_output_t plugin = {
.plugin.start = alsa_start,
.plugin.stop = alsa_stop,
.plugin.configdialog = settings_dlg,
+ .plugin.message = alsa_message,
.init = palsa_init,
.free = palsa_free,
.setformat = palsa_setformat,
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c
index b29db8f2..a86b83a7 100644
--- a/plugins/artwork/artwork.c
+++ b/plugins/artwork/artwork.c
@@ -722,7 +722,7 @@ artwork_reset (int fast) {
}
static int
-artwork_on_configchanged (DB_event_t *ev, uintptr_t data) {
+artwork_configchanged (void) {
int new_artwork_enable_embedded = deadbeef->conf_get_int ("artwork.enable_embedded", 1);
int new_artwork_enable_local = deadbeef->conf_get_int ("artwork.enable_localfolder", 1);
int new_artwork_enable_lfm = deadbeef->conf_get_int ("artwork.enable_lastfm", 0);
@@ -752,6 +752,16 @@ artwork_on_configchanged (DB_event_t *ev, uintptr_t data) {
}
static int
+artwork_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ case DB_EV_CONFIGCHANGED:
+ artwork_configchanged ();
+ break;
+ }
+ return 0;
+}
+
+static int
artwork_plugin_start (void)
{
deadbeef->conf_lock ();
@@ -777,8 +787,6 @@ artwork_plugin_start (void)
artwork_filemask[sizeof(artwork_filemask)-1] = 0;
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (artwork_on_configchanged), 0);
-
mutex = deadbeef->mutex_create_nonrecursive ();
imlib_mutex = deadbeef->mutex_create_nonrecursive ();
cond = deadbeef->cond_create ();
@@ -790,7 +798,6 @@ artwork_plugin_start (void)
static int
artwork_plugin_stop (void)
{
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (artwork_on_configchanged), 0);
if (current_file) {
deadbeef->fabort (current_file);
}
@@ -861,6 +868,7 @@ static DB_artwork_plugin_t plugin = {
.plugin.plugin.start = artwork_plugin_start,
.plugin.plugin.stop = artwork_plugin_stop,
.plugin.plugin.configdialog = settings_dlg,
+ .plugin.plugin.message = artwork_message,
.get_album_art = get_album_art,
.reset = artwork_reset,
.get_default_cover = get_default_cover,
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index 020f2a1c..8082b1d2 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -693,15 +693,18 @@ ffmpeg_init_exts (void) {
}
static int
-ffmpeg_on_configchanged (DB_event_t *ev, uintptr_t data) {
- ffmpeg_init_exts ();
+ffmpeg_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ case DB_EV_CONFIGCHANGED:
+ ffmpeg_init_exts ();
+ break;
+ }
return 0;
}
static int
ffmpeg_start (void) {
ffmpeg_init_exts ();
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (ffmpeg_on_configchanged), 0);
avcodec_init ();
av_register_all ();
av_register_protocol (&vfswrapper);
@@ -710,7 +713,6 @@ ffmpeg_start (void) {
static int
ffmpeg_stop (void) {
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (ffmpeg_on_configchanged), 0);
for (int i = 0; exts[i]; i++) {
free (exts[i]);
}
@@ -806,6 +808,7 @@ static DB_decoder_t plugin = {
.plugin.start = ffmpeg_start,
.plugin.stop = ffmpeg_stop,
.plugin.configdialog = settings_dlg,
+ .plugin.message = ffmpeg_message,
.open = ffmpeg_open,
.init = ffmpeg_init,
.free = ffmpeg_free,
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c
index c50dd9df..1406e95b 100644
--- a/plugins/gtkui/ddblistview.c
+++ b/plugins/gtkui/ddblistview.c
@@ -607,7 +607,6 @@ ddb_listview_list_render (DdbListview *listview, int x, int y, int w, int h) {
ddb_listview_groupcheck (listview);
// find 1st group
DdbListviewGroup *grp = listview->groups;
- printf ("starting to render listview, groups=%p, num_items=%d\n", grp, grp?grp->num_items : 0);
int grp_y = 0;
while (grp && grp_y + grp->height < y + listview->scrollpos) {
grp_y += grp->height;
@@ -919,7 +918,6 @@ ddb_listview_list_drag_data_received (GtkWidget *widget,
guint time,
gpointer user_data)
{
- printf ("target_type: %d, format: %d\n", target_type, data->format);
DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner"));
ps->scroll_direction = 0; // interrupt autoscrolling, if on
ps->scroll_active = 0;
@@ -2907,7 +2905,6 @@ ddb_listview_build_groups (DdbListview *listview) {
memset (grp, 0, sizeof (DdbListviewGroup));
grp->head = it;
grp->num_items = listview->binding->count ();
- printf ("numitems: %d\n", grp->num_items);
listview->grouptitle_height = 0;
grp->height = listview->grouptitle_height + grp->num_items * listview->rowheight;
// if (grp->height < min_height) {
@@ -2953,12 +2950,6 @@ ddb_listview_build_groups (DdbListview *listview) {
}
listview->fullheight += grp->height;
}
- if (!listview->groups) {
- printf ("empty!\n");
- }
- else {
- printf ("groupsize: %d!\n", listview->groups->num_items);
- }
deadbeef->pl_unlock ();
if (old_height != listview->fullheight) {
ddb_listview_refresh (listview, DDB_REFRESH_VSCROLL);
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 0a268a52..22570b87 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -337,12 +337,6 @@ activate_cb (gpointer nothing) {
return FALSE;
}
-static int
-gtkui_on_activate (DB_event_t *ev, uintptr_t data) {
- g_idle_add (activate_cb, NULL);
- return 0;
-}
-
void
redraw_queued_tracks (DdbListview *pl, int list) {
DB_playItem_t *it;
@@ -386,12 +380,6 @@ gtkpl_songchanged_wrapper (DB_playItem_t *from, DB_playItem_t *to) {
g_idle_add (redraw_queued_tracks_cb, NULL);
}
-static int
-gtkui_on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) {
- gtkpl_songchanged_wrapper (ev->from, ev->to);
- return 0;
-}
-
void
gtkui_set_titlebar (DB_playItem_t *it) {
if (!it) {
@@ -450,15 +438,6 @@ trackinfochanged_cb (gpointer data) {
return FALSE;
}
-static int
-gtkui_on_trackinfochanged (DB_event_track_t *ev, uintptr_t data) {
- if (ev->track) {
- deadbeef->pl_item_ref (ev->track);
- }
- g_idle_add (trackinfochanged_cb, ev->track);
- return 0;
-}
-
static gboolean
paused_cb (gpointer nothing) {
DB_playItem_t *curr = deadbeef->streamer_get_playing_track ();
@@ -471,12 +450,6 @@ paused_cb (gpointer nothing) {
return FALSE;
}
-static int
-gtkui_on_paused (DB_event_state_t *ev, uintptr_t data) {
- g_idle_add (paused_cb, NULL);
- return 0;
-}
-
void
playlist_refresh (void) {
DdbListview *ps = DDB_LISTVIEW (lookup_widget (mainwin, "playlist"));
@@ -495,13 +468,6 @@ gtkui_playlist_changed (void) {
g_idle_add (playlistchanged_cb, NULL);
}
-static int
-gtkui_on_playlistchanged (DB_event_t *ev, uintptr_t data) {
- printf ("gtkui_on_playlistchanged\n");
- gtkui_playlist_changed ();
- return 0;
-}
-
static gboolean
playlistswitch_cb (gpointer none) {
GtkWidget *tabstrip = lookup_widget (mainwin, "tabstrip");
@@ -529,12 +495,6 @@ playlistswitch_cb (gpointer none) {
return FALSE;
}
-static int
-gtkui_on_playlistswitch (DB_event_t *ev, uintptr_t data) {
- g_idle_add (playlistswitch_cb, NULL);
- return 0;
-}
-
static gboolean
gtkui_on_frameupdate (gpointer data) {
update_songinfo (NULL);
@@ -549,13 +509,6 @@ gtkui_volumechanged_cb (gpointer ctx) {
return FALSE;
}
-static int
-gtkui_on_volumechanged (DB_event_t *ev, uintptr_t data) {
- g_idle_add (gtkui_volumechanged_cb, NULL);
-
- return 0;
-}
-
static gboolean
gtkui_update_status_icon (gpointer unused) {
int hide_tray_icon = deadbeef->conf_get_int ("gtkui.hide_tray_icon", 0);
@@ -630,7 +583,7 @@ gtkui_get_curr_playlist_modtime (void) {
}
static int
-gtkui_on_configchanged (DB_event_t *ev, uintptr_t data) {
+gtkui_on_configchanged (ddb_event_t *ev, uintptr_t data) {
// order and looping
const char *w;
@@ -669,12 +622,6 @@ outputchanged_cb (gpointer nothing) {
return FALSE;
}
-static int
-gtkui_on_outputchanged (DB_event_t *ev, uintptr_t nothing) {
- g_idle_add (outputchanged_cb, NULL);
- return 0;
-}
-
char last_playlist_save_name[1024] = "";
void
@@ -992,6 +939,49 @@ gtkui_setup_gui_refresh (void) {
refresh_timeout = g_timeout_add (tm, gtkui_on_frameupdate, NULL);
}
+int
+gtkui_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ case DB_EV_ACTIVATE:
+ g_idle_add (activate_cb, NULL);
+ break;
+ case DB_EV_SONGCHANGED:
+ {
+ ddb_event_trackchange_t *ev = (ddb_event_trackchange_t *)ctx;
+ gtkpl_songchanged_wrapper (ev->from, ev->to);
+ }
+ break;
+ case DB_EV_TRACKINFOCHANGED:
+ {
+ ddb_event_track_t *ev = (ddb_event_track_t *)ctx;
+ if (ev->track) {
+ deadbeef->pl_item_ref (ev->track);
+ }
+ g_idle_add (trackinfochanged_cb, ev->track);
+ }
+ break;
+ case DB_EV_PAUSED:
+ g_idle_add (paused_cb, NULL);
+ break;
+ case DB_EV_PLAYLISTCHANGED:
+ gtkui_playlist_changed ();
+ break;
+ case DB_EV_VOLUMECHANGED:
+ g_idle_add (gtkui_volumechanged_cb, NULL);
+ break;
+ case DB_EV_CONFIGCHANGED:
+ gtkui_on_configchanged ((ddb_event_t *)ctx, 0);
+ break;
+ case DB_EV_OUTPUTCHANGED:
+ g_idle_add (outputchanged_cb, NULL);
+ break;
+ case DB_EV_PLAYLISTSWITCH:
+ g_idle_add (playlistswitch_cb, NULL);
+ break;
+ }
+ return 0;
+}
+
void
gtkui_thread (void *ctx) {
// let's start some gtk
@@ -1072,16 +1062,6 @@ gtkui_thread (void *ctx) {
gtk_widget_show (mainwin);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_ACTIVATE, DB_CALLBACK (gtkui_on_activate), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (gtkui_on_songchanged), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_TRACKINFOCHANGED, DB_CALLBACK (gtkui_on_trackinfochanged), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PAUSED, DB_CALLBACK (gtkui_on_paused), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTCHANGED, DB_CALLBACK (gtkui_on_playlistchanged), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_VOLUMECHANGED, DB_CALLBACK (gtkui_on_volumechanged), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (gtkui_on_configchanged), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_OUTPUTCHANGED, DB_CALLBACK (gtkui_on_outputchanged), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTSWITCH, DB_CALLBACK (gtkui_on_playlistswitch), 0);
-
gtkui_setup_gui_refresh ();
char fmt[500];
@@ -1269,16 +1249,6 @@ gtkui_stop (void) {
coverart_plugin->plugin.plugin.stop ();
coverart_plugin = NULL;
}
- trace ("unsubscribing events\n");
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_ACTIVATE, DB_CALLBACK (gtkui_on_activate), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (gtkui_on_songchanged), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_TRACKINFOCHANGED, DB_CALLBACK (gtkui_on_trackinfochanged), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_PAUSED, DB_CALLBACK (gtkui_on_paused), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTCHANGED, DB_CALLBACK (gtkui_on_playlistchanged), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_VOLUMECHANGED, DB_CALLBACK (gtkui_on_volumechanged), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (gtkui_on_configchanged), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_OUTPUTCHANGED, DB_CALLBACK (gtkui_on_outputchanged), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTSWITCH, DB_CALLBACK (gtkui_on_playlistswitch), 0);
trace ("quitting gtk\n");
g_idle_add (quit_gtk_cb, NULL);
trace ("waiting for gtk thread to finish\n");
@@ -1342,6 +1312,7 @@ static ddb_gtkui_t plugin = {
.gui.plugin.stop = gtkui_stop,
.gui.plugin.connect = gtkui_connect,
.gui.plugin.configdialog = settings_dlg,
+ .gui.plugin.message = gtkui_message,
.gui.run_dialog = gtkui_run_dialog_root,
.get_mainwin = gtkui_get_mainwin,
};
diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c
index 14299a54..45e37489 100644
--- a/plugins/lastfm/lastfm.c
+++ b/plugins/lastfm/lastfm.c
@@ -488,7 +488,7 @@ lfm_format_uri (int subm, DB_playItem_t *song, char *out, int outl) {
}
static int
-lastfm_songstarted (DB_event_track_t *ev, uintptr_t data) {
+lastfm_songstarted (ddb_event_track_t *ev, uintptr_t data) {
trace ("lfm songstarted %s\n", ev->track->fname);
if (!deadbeef->conf_get_int ("lastfm.enable", 0)) {
return 0;
@@ -507,7 +507,7 @@ lastfm_songstarted (DB_event_track_t *ev, uintptr_t data) {
}
static int
-lastfm_songfinished (DB_event_track_t *ev, uintptr_t data) {
+lastfm_songfinished (ddb_event_track_t *ev, uintptr_t data) {
trace ("lfm songfinished %s\n", ev->track->fname);
if (!deadbeef->conf_get_int ("lastfm.enable", 0)) {
return 0;
@@ -798,6 +798,19 @@ auth_v2 (void) {
#endif
// }}}
+static int
+lfm_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ // subscribe to frameupdate event
+ case DB_EV_SONGSTARTED:
+ lastfm_songstarted ((ddb_event_track_t *)ctx, 0);
+ break;
+ case DB_EV_SONGCHANGED:
+ lastfm_songfinished ((ddb_event_track_t *)ctx, 0);
+ break;
+ }
+ return 0;
+}
static int
lastfm_start (void) {
@@ -809,9 +822,6 @@ lastfm_start (void) {
lfm_mutex = deadbeef->mutex_create_nonrecursive ();
lfm_cond = deadbeef->cond_create ();
lfm_tid = deadbeef->thread_start (lfm_thread, NULL);
- // subscribe to frameupdate event
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGSTARTED, DB_CALLBACK (lastfm_songstarted), 0);
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (lastfm_songfinished), 0);
return 0;
}
@@ -821,8 +831,6 @@ lastfm_stop (void) {
trace ("lastfm_stop\n");
if (lfm_mutex) {
lfm_stopthread = 1;
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGSTARTED, DB_CALLBACK (lastfm_songstarted), 0);
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (lastfm_songfinished), 0);
trace ("lfm_stop signalling cond\n");
deadbeef->cond_signal (lfm_cond);
@@ -937,5 +945,6 @@ static DB_misc_t plugin = {
.plugin.start = lastfm_start,
.plugin.stop = lastfm_stop,
.plugin.configdialog = settings_dlg,
- .plugin.get_actions = lfm_get_actions
+ .plugin.get_actions = lfm_get_actions,
+ .plugin.message = lfm_message,
};
diff --git a/plugins/notify/notify.c b/plugins/notify/notify.c
index 7896baf9..a273a3a1 100644
--- a/plugins/notify/notify.c
+++ b/plugins/notify/notify.c
@@ -243,7 +243,7 @@ static void show_notification (DB_playItem_t *track) {
}
static int
-on_songstarted (DB_event_track_t *ev, uintptr_t data) {
+on_songstarted (ddb_event_track_t *ev) {
if (ev->track && deadbeef->conf_get_int ("notify.enable", 0)) {
DB_playItem_t *track = ev->track;
if (track) {
@@ -253,15 +253,23 @@ on_songstarted (DB_event_track_t *ev, uintptr_t data) {
return 0;
}
+static int
+notify_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ case DB_EV_SONGSTARTED:
+ on_songstarted ((ddb_event_track_t *)ctx);
+ break;
+ }
+ return 0;
+}
+
int
notify_start (void) {
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGSTARTED, DB_CALLBACK (on_songstarted), 0);
return 0;
}
int
notify_stop (void) {
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGSTARTED, DB_CALLBACK (on_songstarted), 0);
return 0;
}
@@ -316,6 +324,7 @@ DB_misc_t plugin = {
.plugin.connect = notify_connect,
.plugin.disconnect = notify_disconnect,
.plugin.configdialog = settings_dlg,
+ .plugin.message = notify_message,
};
DB_plugin_t *
diff --git a/plugins/oss/oss.c b/plugins/oss/oss.c
index 953398af..e64e1fc0 100644
--- a/plugins/oss/oss.c
+++ b/plugins/oss/oss.c
@@ -315,7 +315,7 @@ oss_get_state (void) {
}
static int
-oss_configchanged (DB_event_t *ev, uintptr_t data) {
+oss_configchanged (void) {
deadbeef->conf_lock ();
const char *dev = deadbeef->conf_get_str_fast ("oss.device", "/dev/dsp");
if (strcmp (dev, oss_device)) {
@@ -328,15 +328,23 @@ oss_configchanged (DB_event_t *ev, uintptr_t data) {
}
static int
+oss_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ case DB_EV_CONFIGCHANGED:
+ oss_configchanged ();
+ break;
+ }
+ return 0;
+}
+
+static int
oss_plugin_start (void) {
deadbeef->conf_get_str ("oss.device", "/dev/dsp", oss_device, sizeof (oss_device));
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (oss_configchanged), 0);
return 0;
}
static int
oss_plugin_stop (void) {
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (oss_configchanged), 0);
return 0;
}
@@ -379,6 +387,7 @@ static DB_output_t plugin = {
.plugin.start = oss_plugin_start,
.plugin.stop = oss_plugin_stop,
.plugin.configdialog = settings_dlg,
+ .plugin.message = oss_message,
.init = oss_init,
.free = oss_free,
.setformat = oss_setformat,
diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp
index ffdd4548..20293812 100644
--- a/plugins/sid/csid.cpp
+++ b/plugins/sid/csid.cpp
@@ -605,7 +605,7 @@ csid_mutevoice (DB_fileinfo_t *_info, int voice, int mute) {
#endif
static int
-csid_on_configchanged (DB_event_t *ev, uintptr_t data) {
+sid_configchanged (void) {
int conf_hvsc_enable = deadbeef->conf_get_int ("hvsc_enable", 0);
int disable = !conf_hvsc_enable;
if (disable != sldb_disable) {
@@ -623,14 +623,22 @@ csid_on_configchanged (DB_event_t *ev, uintptr_t data) {
}
int
+sid_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ case DB_EV_CONFIGCHANGED:
+ sid_configchanged ();
+ break;
+ }
+ return 0;
+}
+
+int
csid_start (void) {
- deadbeef->ev_subscribe (DB_PLUGIN (&sid_plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (csid_on_configchanged), 0);
return 0;
}
int
csid_stop (void) {
- deadbeef->ev_unsubscribe (DB_PLUGIN (&sid_plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (csid_on_configchanged), 0);
if (sldb) {
free (sldb);
sldb = NULL;
diff --git a/plugins/sid/csid.h b/plugins/sid/csid.h
index c35be3d7..66ad0ff5 100644
--- a/plugins/sid/csid.h
+++ b/plugins/sid/csid.h
@@ -33,6 +33,7 @@ int csid_numvoices (DB_fileinfo_t *);
void csid_mutevoice (DB_fileinfo_t *, int voice, int mute);
int csid_start (void);
int csid_stop (void);
+int sid_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2);
#ifdef __cplusplus
}
diff --git a/plugins/sid/plugin.c b/plugins/sid/plugin.c
index c8f1f7b0..ff350da6 100644
--- a/plugins/sid/plugin.c
+++ b/plugins/sid/plugin.c
@@ -63,6 +63,7 @@ DB_decoder_t sid_plugin = {
.plugin.stop = csid_stop,
.plugin.configdialog = settings_dlg,
.plugin.id = "stdsid",
+ .plugin.message = sid_message,
.open = csid_open,
.init = csid_init,
.free = csid_free,
diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c
index 3af4616f..bc7eaf1a 100644
--- a/plugins/sndfile/sndfile.c
+++ b/plugins/sndfile/sndfile.c
@@ -411,23 +411,24 @@ sndfile_init_exts (void) {
exts[n] = NULL;
}
-
static int
-sndfile_on_configchanged (DB_event_t *ev, uintptr_t data) {
- sndfile_init_exts ();
+sndfile_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
+ switch (id) {
+ case DB_EV_CONFIGCHANGED:
+ sndfile_init_exts ();
+ break;
+ }
return 0;
}
static int
sndfile_start (void) {
sndfile_init_exts ();
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (sndfile_on_configchanged), 0);
return 0;
}
static int
sndfile_stop (void) {
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_CONFIGCHANGED, DB_CALLBACK (sndfile_on_configchanged), 0);
for (int i = 0; exts[i]; i++) {
free (exts[i]);
}
@@ -479,6 +480,7 @@ static DB_decoder_t plugin = {
.plugin.start = sndfile_start,
.plugin.stop = sndfile_stop,
.plugin.configdialog = settings_dlg,
+ .plugin.message = sndfile_message,
};
DB_plugin_t *