From c828ee3b7ad0037896e2d8e3154f44bba0e1da20 Mon Sep 17 00:00:00 2001 From: waker Date: Sat, 9 Apr 2011 13:25:03 +0200 Subject: added SEEKED event, so that plugins can update their status --- deadbeef.h | 9 ++++++++- streamer.c | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/deadbeef.h b/deadbeef.h index 31d36ca7..0dc55fab 100644 --- a/deadbeef.h +++ b/deadbeef.h @@ -207,6 +207,12 @@ typedef struct { int state; } DB_event_state_t; +typedef struct { + DB_event_t ev; + DB_playItem_t *track; + float playpos; +} ddb_event_playpos_t; + typedef struct DB_conf_item_s { char *key; char *value; @@ -218,7 +224,7 @@ typedef int (*DB_callback_t)(DB_event_t *, uintptr_t data); // events enum { - DB_EV_SONGCHANGED = 1, // triggers when song was just changed + DB_EV_SONGCHANGED = 1, // triggers when current song changed from one to another, see DB_event_trackchange_t, both pointers can be NULL DB_EV_SONGSTARTED = 2, // triggers when song started playing (for scrobblers and such) DB_EV_SONGFINISHED = 3, // triggers when song finished playing (for scrobblers and such) DB_EV_CONFIGCHANGED = 5, // configuration option changed @@ -229,6 +235,7 @@ enum { DB_EV_VOLUMECHANGED = 10, // volume was changed DB_EV_OUTPUTCHANGED = 11, // sound output plugin changed DB_EV_PLAYLISTSWITCH = 13, // playlist switch occured + DB_EV_SEEKED = 14, // seek happened, see ddb_event_playpos_t DB_EV_MAX }; diff --git a/streamer.c b/streamer.c index e2c1f1b0..4c19850a 100644 --- a/streamer.c +++ b/streamer.c @@ -1124,6 +1124,12 @@ streamer_thread (void *ctx) { avg_bitrate = -1; streamer_unlock(); } + ddb_event_playpos_t tp; + tp.ev.event = DB_EV_SEEKED; + tp.ev.time = time (NULL); + tp.track = playing_track; + tp.playpos = playpos; + plug_event_call (DB_EVENT (&tp)); } // read ahead at 2x speed of output samplerate, in 4k blocks -- cgit v1.2.3