diff options
-rw-r--r-- | callbacks.c | 4 | ||||
-rw-r--r-- | gtkplaylist.c | 37 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | streamer.c | 7 | ||||
-rw-r--r-- | streamer.h | 3 |
5 files changed, 46 insertions, 7 deletions
diff --git a/callbacks.c b/callbacks.c index bc8b8b43..7fdfe6df 100644 --- a/callbacks.c +++ b/callbacks.c @@ -449,6 +449,7 @@ on_playlist_drag_drop (GtkWidget *widget, guint time, gpointer user_data) { +#if 0 if (drag_context->targets) { GdkAtom target_type = GDK_POINTER_TO_ATOM (g_list_nth_data (drag_context->targets, TARGET_SAMEWIDGET)); if (!target_type) { @@ -457,6 +458,7 @@ on_playlist_drag_drop (GtkWidget *widget, gtk_drag_get_data (widget, drag_context, target_type, time); return TRUE; } +#endif return FALSE; } @@ -517,7 +519,7 @@ on_playlist_drag_data_received (GtkWidget *widget, uint32_t *d= (uint32_t *)ptr; gtkpl_handle_drag_drop (ps, y, d, data->length/4); } - gtk_drag_finish (drag_context, FALSE, FALSE, time); + gtk_drag_finish (drag_context, TRUE, FALSE, time); } diff --git a/gtkplaylist.c b/gtkplaylist.c index d93274ba..ab336ddb 100644 --- a/gtkplaylist.c +++ b/gtkplaylist.c @@ -27,6 +27,7 @@ #include <string.h> #include <assert.h> #include <unistd.h> +#include <ctype.h> #include "gtkplaylist.h" #include "callbacks.h" #include "interface.h" @@ -959,11 +960,36 @@ on_playlist_drag_end (GtkWidget *widget, void strcopy_special (char *dest, const char *src, int len) { while (len > 0) { - if (len >= 3 && !strncmp (src, "\%20", 3)) { - *dest = ' '; + if (*src == '%' && len >= 3) { + int charcode = 0; + int byte; + byte = tolower (src[2]); + if (byte >= '0' && byte <= '9') { + charcode = byte - '0'; + } + else if (byte >= 'a' && byte <= 'f') { + charcode = byte - 'a' + 10; + } + else { + charcode = '?'; + } + if (charcode != '?') { + byte = tolower (src[1]); + if (byte >= '0' && byte <= '9') { + charcode |= (byte - '0') << 4; + } + else if (byte >= 'a' && byte <= 'f') { + charcode |= (byte - 'a' + 10) << 4; + } + else { + charcode = '?'; + } + } + *dest = charcode; dest++; src += 3; len -= 3; + continue; } else { *dest++ = *src++; @@ -1008,9 +1034,12 @@ gtkpl_add_fm_dropped_files (gtkplaylist_t *ps, char *ptr, int length, int drop_y if (drop_before) { after = drop_before->prev[ps->iterator]; } - const gchar *p = ptr; + else { + after = playlist_tail[ps->iterator]; + } + const uint8_t *p = (const uint8_t*)ptr; while (*p) { - const gchar *pe = p+1; + const uint8_t *pe = p; while (*pe && *pe > ' ') { pe++; } @@ -71,7 +71,7 @@ update_songinfo (void) { songpos = c->info.position; codec_unlock (); - snprintf (sbtext_new, 512, "[%s] %dHz | %d bit | %s | %d:%02d / %d:%02d | %d songs total", playlist_current.filetype ? playlist_current.filetype:"-", samplerate, bitspersample, mode, minpos, secpos, mindur, secdur, pl_getcount ()); + snprintf (sbtext_new, 512, "[%s] %dHz | %d bit | %s | %d:%02d / %d:%02d | %d songs total | streambuffer: %d%%", playlist_current.filetype ? playlist_current.filetype:"-", samplerate, bitspersample, mode, minpos, secpos, mindur, secdur, pl_getcount (), streamer_get_fill_level ()); } if (strcmp (sbtext_new, sb_text)) { @@ -108,7 +108,7 @@ streamer_thread (uintptr_t ctx) { streambuffer_fill += bytesread; } streamer_unlock (); - usleep (3000); + usleep (2000); //printf ("fill: %d \r", streambuffer_fill); } @@ -290,3 +290,8 @@ streamer_read (char *bytes, int size) { streamer_unlock (); return sz; } + +int +streamer_get_fill_level (void) { + return streambuffer_fill / (STREAM_BUFFER_SIZE / 100); +} @@ -42,4 +42,7 @@ streamer_unlock (void); void streamer_set_nextsong (int song, int pstate); +int +streamer_get_fill_level (void); + #endif // __STREAMER_H |