summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--deadbeef.h25
-rw-r--r--gtkplaylist.c1
-rw-r--r--main.c14
-rw-r--r--messages.h41
-rw-r--r--palsa.c1
-rw-r--r--plugins.c3
-rw-r--r--search.c2
8 files changed, 44 insertions, 45 deletions
diff --git a/Makefile.am b/Makefile.am
index 2c23dcb8..ff98f2cd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,7 +31,7 @@ deadbeef_SOURCES =\
streamer.c streamer.h\
progress.c progress.h\
codec.c codec.h\
- messagepump.c messagepump.h messages.h\
+ messagepump.c messagepump.h\
conf.c conf.h\
search.c search.h\
cgme.c cdumb.c csid.cpp\
diff --git a/deadbeef.h b/deadbeef.h
index 9c4f7af4..f9c8084a 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -112,6 +112,28 @@ enum {
DB_EV_MAX
};
+// message ids for communicating with player
+enum {
+ M_SONGFINISHED,
+ M_NEXTSONG,
+ M_PREVSONG,
+ M_PLAYSONG,
+ M_PLAYSONGNUM,
+ M_STOPSONG,
+ M_PAUSESONG,
+ M_PLAYRANDOM,
+ M_SONGCHANGED, // p1=from, p2=to
+ M_ADDDIR, // ctx = pointer to string, which must be freed by g_free
+ M_ADDFILES, // ctx = GSList pointer, must be freed with g_slist_free
+ M_ADDDIRS, // ctx = GSList pointer, must be freed with g_slist_free
+ M_OPENFILES, // ctx = GSList pointer, must be freed with g_slist_free
+ M_FMDRAGDROP, // ctx = char* ptr, must be freed with standard free, p1 is length of data, p2 is drop_y
+ M_TERMINATE, // must be sent to player thread to terminate
+ M_PLAYLISTREFRESH,
+ M_REINIT_SOUND,
+ M_TRACKCHANGED, // p1=tracknumber
+};
+
// typecasting macros
#define DB_PLUGIN(x) ((DB_plugin_t *)(x))
#define DB_CALLBACK(x) ((DB_callback_t)(x))
@@ -167,6 +189,7 @@ typedef struct {
void (*pl_item_free) (DB_playItem_t *it);
void (*pl_item_copy) (DB_playItem_t *out, DB_playItem_t *in);
DB_playItem_t *(*pl_insert_item) (DB_playItem_t *after, DB_playItem_t *it);
+ int (*pl_get_idx_of) (DB_playItem_t *it);
// metainfo
void (*pl_add_meta) (DB_playItem_t *it, const char *key, const char *value);
const char *(*pl_find_meta) (DB_playItem_t *song, const char *meta);
@@ -192,6 +215,8 @@ typedef struct {
int64_t (*ftell) (DB_FILE *stream);
void (*rewind) (DB_FILE *stream);
int64_t (*fgetlength) (DB_FILE *stream);
+ // message passing
+ int (*sendmessage) (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2);
} DB_functions_t;
// base plugin interface
diff --git a/gtkplaylist.c b/gtkplaylist.c
index 2c97a3f5..50fe7b3e 100644
--- a/gtkplaylist.c
+++ b/gtkplaylist.c
@@ -43,6 +43,7 @@
#include "progress.h"
#include "drawing.h"
#include "session.h"
+#include "deadbeef.h"
//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
#define trace(fmt,...)
diff --git a/main.c b/main.c
index 273dea8c..040f701d 100644
--- a/main.c
+++ b/main.c
@@ -388,11 +388,21 @@ player_thread (uintptr_t ctx) {
break;
case M_PLAYSONG:
gtkpl_playsong (&main_playlist);
- GDK_THREADS_ENTER();
if (playlist_current_ptr) {
+ GDK_THREADS_ENTER();
gtkpl_redraw_pl_row (&main_playlist, pl_get_idx_of (playlist_current_ptr), playlist_current_ptr);
+ GDK_THREADS_LEAVE();
+ }
+ break;
+ case M_TRACKCHANGED:
+ {
+ playItem_t *it = pl_get_for_idx (p1);
+ if (it) {
+ GDK_THREADS_ENTER();
+ gtkpl_redraw_pl_row (&main_playlist, p1, it);
+ GDK_THREADS_LEAVE();
+ }
}
- GDK_THREADS_LEAVE();
break;
case M_PLAYSONGNUM:
GDK_THREADS_ENTER();
diff --git a/messages.h b/messages.h
deleted file mode 100644
index f0bfcb49..00000000
--- a/messages.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- DeaDBeeF - ultimate music player for GNU/Linux systems with X11
- Copyright (C) 2009 Alexey Yakovenko
-
- 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, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef __MESSAGES_H
-#define __MESSAGES_H
-
-enum {
- M_SONGFINISHED,
- M_NEXTSONG,
- M_PREVSONG,
- M_PLAYSONG,
- M_PLAYSONGNUM,
- M_STOPSONG,
- M_PAUSESONG,
- M_PLAYRANDOM,
- M_SONGCHANGED, // p1=from, p2=to
- M_ADDDIR, // ctx = pointer to string, which must be freed by f_free
- M_ADDFILES, // ctx = GSList pointer, must be freed with g_slist_free
- M_ADDDIRS, // ctx = GSList pointer, must be freed with g_slist_free
- M_OPENFILES, // ctx = GSList pointer, must be freed with g_slist_free
- M_FMDRAGDROP, // ctx = char* ptr, must be freed with standard free, p1 is length of data, p2 is drop_y
- M_TERMINATE, // must be sent to player thread to terminate
- M_PLAYLISTREFRESH,
- M_REINIT_SOUND,
-};
-
-#endif // __MESSAGES_H
diff --git a/palsa.c b/palsa.c
index e2c21cc8..11de1179 100644
--- a/palsa.c
+++ b/palsa.c
@@ -30,6 +30,7 @@
#include "volume.h"
#include "messagepump.h"
#include "messages.h"
+#include "deadbeef.h"
#define trace(...) { fprintf(stderr, __VA_ARGS__); }
//#define trace(fmt,...)
diff --git a/plugins.c b/plugins.c
index 641f34ea..932167d0 100644
--- a/plugins.c
+++ b/plugins.c
@@ -82,6 +82,7 @@ static DB_functions_t deadbeef_api = {
.pl_item_free = (void (*)(DB_playItem_t *))pl_item_free,
.pl_item_copy = (void (*)(DB_playItem_t *, DB_playItem_t *))pl_item_copy,
.pl_insert_item = (DB_playItem_t *(*) (DB_playItem_t *after, DB_playItem_t *it))pl_insert_item,
+ .pl_get_idx_of = (int (*) (DB_playItem_t *it))pl_get_idx_of,
// metainfo
.pl_add_meta = (void (*) (DB_playItem_t *, const char *, const char *))pl_add_meta,
.pl_find_meta = (const char *(*) (DB_playItem_t *, const char *))pl_find_meta,
@@ -107,6 +108,8 @@ static DB_functions_t deadbeef_api = {
.ftell = vfs_ftell,
.rewind = vfs_rewind,
.fgetlength = vfs_fgetlength,
+ // message passing
+ .sendmessage = messagepump_push,
};
DB_functions_t *deadbeef = &deadbeef_api;
diff --git a/search.c b/search.c
index a1bf4665..8cb6ffa0 100644
--- a/search.c
+++ b/search.c
@@ -34,8 +34,8 @@
#include "gtkplaylist.h"
#include "messagepump.h"
#include "messages.h"
-
#include "utf8.h"
+#include "deadbeef.h"
extern GtkWidget *searchwin;
struct playItem_s *search_current = NULL;