summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-27 17:07:43 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-27 17:07:43 +0100
commit8fe4de5ad1e933a18994ff760a4d877a0de7f322 (patch)
treec37891f2444b6888506cb39fa9cfb1ca9f58375c
parent0b38c072a5e53d0af27a208a3b561034a2345506 (diff)
reset streamer if attempted to play NULL track
-rw-r--r--plugins/gtkui/gtkplaylist.c2
-rw-r--r--plugins/gtkui/gtkui.c5
-rw-r--r--streamer.c16
3 files changed, 15 insertions, 8 deletions
diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c
index bf2a6e18..bf551e5a 100644
--- a/plugins/gtkui/gtkplaylist.c
+++ b/plugins/gtkui/gtkplaylist.c
@@ -1844,7 +1844,7 @@ gtkpl_songchanged_wrapper (int from, int to) {
ft->from = from;
ft->to = to;
g_idle_add (update_win_title_idle, ft);
- if (ft->to == -1 && ft->from != -1) {
+ if (ft->to == -1) {
// redraw seekbar
g_idle_add (redraw_seekbar_cb, NULL);
}
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 468ffcf4..85c819e7 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -27,8 +27,8 @@
#include "callbacks.h"
#include "support.h"
-#define trace(...) { fprintf(stderr, __VA_ARGS__); }
-//#define trace(fmt,...)
+//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
+#define trace(fmt,...)
static DB_gui_t plugin;
DB_functions_t *deadbeef;
@@ -186,7 +186,6 @@ on_trayicon_activate (GtkWidget *widget,
int y = deadbeef->conf_get_int ("mainwin.geometry.y", 40);
int w = deadbeef->conf_get_int ("mainwin.geometry.w", 500);
int h = deadbeef->conf_get_int ("mainwin.geometry.h", 300);
- printf ("restore: %d %d %d %d\n", x, y, w, h);
gtk_widget_show (mainwin);
gtk_window_move (mainwin, x, y);
gtk_window_resize (mainwin, w, h);
diff --git a/streamer.c b/streamer.c
index 30a639fc..88e02386 100644
--- a/streamer.c
+++ b/streamer.c
@@ -133,11 +133,9 @@ streamer_set_current (playItem_t *it) {
to = it ? pl_get_idx_of (it) : -1;
if (!orig_playing_song || p_isstopped ()) {
playlist_current_ptr = it;
+ //trace ("from=%d, to=%d\n", from, to);
+ //messagepump_push (M_SONGCHANGED, 0, from, to);
}
- trace ("from=%d, to=%d\n", from, to);
- trace ("sending songchanged\n");
-// printf ("songchanged[2] %d->%d\n", from, to);
-// messagepump_push (M_SONGCHANGED, 0, from, to);
trace ("streamer_set_current %p, buns=%d\n", it);
if(str_streaming_song.decoder) {
str_streaming_song.decoder->free ();
@@ -291,6 +289,16 @@ streamer_thread (void *ctx) {
continue;
}
playItem_t *try = pl_get_for_idx (sng);
+ if (!try) { // track is not in playlist
+ trace ("track #%d is not in playlist; stopping playback\n", sng);
+ p_stop ();
+ pl_item_free (&str_playing_song);
+ pl_item_free (&str_streaming_song);
+ orig_playing_song = NULL;
+ orig_streaming_song = NULL;
+ messagepump_push (M_SONGCHANGED, 0, -1, -1);
+ continue;
+ }
int ret = streamer_set_current (try);
if (ret < 0) {
trace ("failed to play track %s, skipping...\n", try->fname);