diff options
-rw-r--r-- | playlist.h | 1 | ||||
-rw-r--r-- | plugins/gtkui/plcommon.c | 6 | ||||
-rw-r--r-- | streamer.c | 15 |
3 files changed, 18 insertions, 4 deletions
@@ -25,7 +25,6 @@ typedef struct playItem_s { char *fname; // full pathname -// struct DB_decoder_s *decoder; // codec to use with this file const char *decoder_id; int tracknum; // used for stuff like sid, nsf, cue (will be ignored by most codecs) int startsample; diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index ca08d8ac..6c1cf8f6 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -77,6 +77,7 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview if (res == -1) { return; } + DB_playItem_t *playing_track = deadbeef->streamer_get_playing_track (); if (cinf->id == DB_COLUMN_ALBUM_ART) { gtk_paint_flat_box (theme_treeview->style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, theme_treeview, "cell_even_ruled", x, y, width, height); int art_width = width - ART_PADDING_HORZ * 2; @@ -115,7 +116,7 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview } } } - else if (it && it == deadbeef->streamer_get_playing_track () && cinf->id == DB_COLUMN_PLAYING) { + else if (it && it == playing_track && cinf->id == DB_COLUMN_PLAYING) { int paused = deadbeef->get_output ()->state () == OUTPUT_STATE_PAUSED; int buffering = !deadbeef->streamer_ok_to_read (-1); GdkPixbuf *pixbuf; @@ -150,6 +151,9 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview draw_text (x + 5, y + height/2 - draw_get_font_size ()/2 - 2, cwidth-10, 0, text); } } + if (playing_track) { + deadbeef->pl_item_unref (playing_track); + } } void @@ -99,7 +99,7 @@ streamer_get_streaming_track (void) { playItem_t * streamer_get_playing_track (void) { - playItem_t *it = playing_track ? playing_track : playlist_track; + playItem_t *it = playing_track;// ? playing_track : playlist_track; if (it) { pl_item_ref (it); } @@ -402,6 +402,13 @@ streamer_set_current (playItem_t *it) { //trace ("from=%d, to=%d\n", from, to); //messagepump_push (M_SONGCHANGED, 0, from, to); } + if (playing_track) { + pl_item_unref (playing_track); + } + playing_track = it; + if (playing_track) { + pl_item_ref (playing_track); + } trace ("streamer_set_current %p, buns=%d\n", it); mutex_lock (decodemutex); if (fileinfo) { @@ -415,6 +422,7 @@ streamer_set_current (playItem_t *it) { goto success; } if (to != -1) { + trace ("draw before init: %d->%d, playing_track=%p, playlist_track=%p\n", from, to, playing_track, playlist_track); messagepump_push (M_TRACKCHANGED, 0, to, 0); } if (from != -1) { @@ -462,6 +470,7 @@ streamer_set_current (playItem_t *it) { trace ("decoder->init returned %p\n", info); streamer_buffering = 0; if (playlist_track == it) { + trace ("redraw track %d; playing_track=%p; playlist_track=%p\n", to, playing_track, playlist_track); messagepump_push (M_TRACKCHANGED, 0, to, 0); } return -1; @@ -1003,6 +1012,7 @@ mono_int16_to_stereo_int16 (int16_t *in, int16_t *out, int nsamples) { } } +#if 0 static void int16_to_float32 (int16_t *in, float *out, int nsamples) { while (nsamples > 0) { @@ -1030,6 +1040,7 @@ mono_float32_to_stereo_float32 (float *in, float *out, int nsamples) { nsamples--; } } +#endif static void float32_to_int16 (float *in, int16_t *out, int nsamples) { @@ -1126,7 +1137,7 @@ streamer_decode_src_libsamplerate (uint8_t *bytes, int size) { if (!samplerate) { return 0; } - float ratio = (float)p_get_rate ()/samplerate; + float ratio = p_get_rate ()/(float)samplerate; while (size > 0) { int n_output_frames = size / sizeof (int16_t) / 2; int n_input_frames = n_output_frames * samplerate / p_get_rate () + 100; |