diff options
author | 2010-11-20 18:12:49 +0100 | |
---|---|---|
committer | 2010-11-20 18:12:49 +0100 | |
commit | 625c61f5fd96f8d84bd2a21f5b7951f64f8f5025 (patch) | |
tree | adc0fb11fcf5f6deed9615f4805d55bf0d378828 /plugins | |
parent | d90cdb9cf2344a8891643bdaaeba091603889821 (diff) | |
parent | 38c085d04677559b5232b1ac7ae5469f6bb77e4d (diff) |
Merge branch 'static' into multichannel
Conflicts:
main.c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/artwork/artwork.c | 11 | ||||
-rw-r--r-- | plugins/cdda/cdda.c | 3 | ||||
-rw-r--r-- | plugins/gtkui/Makefile.am | 4 | ||||
-rw-r--r-- | plugins/gtkui/coverart.c | 57 | ||||
-rw-r--r-- | plugins/gtkui/ddbcellrenderertextmultiline.c | 4 | ||||
-rw-r--r-- | plugins/gtkui/ddbcellrenderertextmultiline.h | 2 | ||||
-rw-r--r-- | plugins/gtkui/ddbequalizer.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/ddbequalizer.h | 2 | ||||
-rw-r--r-- | plugins/gtkui/ddbseekbar.c | 4 | ||||
-rw-r--r-- | plugins/gtkui/ddbseekbar.h | 2 |
10 files changed, 39 insertions, 52 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index 6786b27a..34bac6dd 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -6,6 +6,7 @@ #include <dirent.h> #include <unistd.h> #include <fnmatch.h> +#include <inttypes.h> #include "../../deadbeef.h" #include "artwork.h" #include "lastfm.h" @@ -45,7 +46,7 @@ static int artwork_enable_embedded; static int artwork_enable_local; static int artwork_enable_lfm; static int artwork_enable_aao; -static int artwork_reset_time; +static time_t artwork_reset_time; static char artwork_filemask[200]; static const char *get_default_cover (void) { @@ -593,7 +594,7 @@ get_album_art (const char *fname, const char *artist, const char *album, artwork return strdup (get_default_cover ()); } - trace ("found %s in cache\n", path); +// trace ("found %s in cache, resettime %" PRId64 ", filetime %" PRId64 ", time %" PRId64 "\n", path, artwork_reset_time, stat_buf.st_mtime, tm); return strdup (path); } @@ -652,13 +653,15 @@ artwork_on_configchanged (DB_event_t *ev, uintptr_t data) { || new_artwork_enable_lfm != artwork_enable_lfm || new_artwork_enable_aao != artwork_enable_aao || strcmp (new_artwork_filemask, artwork_filemask)) { + printf ("artwork config changed, invalidating cache...\n"); artwork_enable_embedded = new_artwork_enable_embedded; artwork_enable_local = new_artwork_enable_local; artwork_enable_lfm = new_artwork_enable_lfm; artwork_enable_aao = new_artwork_enable_aao; artwork_reset_time = time (NULL); strcpy (artwork_filemask, new_artwork_filemask); - deadbeef->conf_set_int ("artwork.cache_reset_time", artwork_reset_time); + deadbeef->conf_set_int64 ("artwork.cache_reset_time", artwork_reset_time); + artwork_reset (0); deadbeef->sendmessage (M_PLAYLISTREFRESH, 0, 0, 0); } @@ -681,7 +684,7 @@ artwork_plugin_start (void) artwork_enable_local = deadbeef->conf_get_int ("artwork.enable_localfolder", 1); artwork_enable_lfm = deadbeef->conf_get_int ("artwork.enable_lastfm", 0); artwork_enable_aao = deadbeef->conf_get_int ("artwork.enable_albumartorg", 0); - artwork_reset_time = deadbeef->conf_get_int ("artwork.cache_reset_time", 0); + artwork_reset_time = deadbeef->conf_get_int64 ("artwork.cache_reset_time", 0); strncpy (artwork_filemask, deadbeef->conf_get_str ("artwork.filemask", DEFAULT_FILEMASK), sizeof (artwork_filemask)); artwork_filemask[sizeof(artwork_filemask)-1] = 0; diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c index 20d12dcf..e69adfa7 100644 --- a/plugins/cdda/cdda.c +++ b/plugins/cdda/cdda.c @@ -549,8 +549,7 @@ static int cda_action_add_cd (DB_plugin_action_t *act, DB_playItem_t *it) { deadbeef->pl_add_file ("all.cda", NULL, NULL); - //Wtf? - //playlist_refresh (); + deadbeef->plug_trigger_event_playlistchanged (); } static DB_plugin_action_t add_cd_action = { diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am index 55557ad8..cea8e94dc 100644 --- a/plugins/gtkui/Makefile.am +++ b/plugins/gtkui/Makefile.am @@ -36,7 +36,7 @@ GTKUI_SOURCES = gtkui.c gtkui.h\ EXTRA_DIST = $(gtkui_VALASOURCES) deadbeef.glade -if PORTABLE +if STATICLINK pkglib_LTLIBRARIES = gtkui.la gtkui.fallback.la else pkglib_LTLIBRARIES = gtkui.la @@ -49,7 +49,7 @@ gtkui_la_LIBADD = $(LDADD) $(GTKUI_DEPS_LIBS) gtkui_la_CFLAGS = -std=c99 $(GTKUI_DEPS_CFLAGS) # fallback lib -if PORTABLE +if STATICLINK GTK_ROOT=../../../deadbeef-deps/gtk-debian/usr gtkui_fallback_la_SOURCES = $(gtkui_VALABUILTSOURCES) $(GTKUI_SOURCES) diff --git a/plugins/gtkui/coverart.c b/plugins/gtkui/coverart.c index ffd2c2b2..0a8865a1 100644 --- a/plugins/gtkui/coverart.c +++ b/plugins/gtkui/coverart.c @@ -21,6 +21,7 @@ #include <string.h> #include <stdlib.h> #include <unistd.h> +#include <sys/stat.h> #include "coverart.h" #include "../artwork/artwork.h" #include "gtkui.h" @@ -36,6 +37,7 @@ extern DB_artwork_plugin_t *coverart_plugin; typedef struct { struct timeval tm; char *fname; + time_t filetime; int width; GdkPixbuf *pixbuf; } cached_pixbuf_t; @@ -138,7 +140,10 @@ loading_thread (void *none) { usleep (500000); continue; } - + struct stat stat_buf; + if (stat (queue->fname, &stat_buf) < 0) { + trace ("failed to stat file %s\n", queue->fname); + } // GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (queue->fname, NULL); GError *error = NULL; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale (queue->fname, queue->width, queue->width, TRUE, &error); @@ -150,6 +155,9 @@ loading_thread (void *none) { error = NULL; } const char *defpath = coverart_plugin->get_default_cover (); + if (stat (defpath, &stat_buf) < 0) { + trace ("failed to stat file %s\n", queue->fname); + } pixbuf = gdk_pixbuf_new_from_file_at_scale (defpath, queue->width, queue->width, TRUE, &error); if (!pixbuf) { fprintf (stderr, "gdk_pixbuf_new_from_file_at_scale %s %d failed, error: %s\n", defpath, queue->width, error->message); @@ -162,43 +170,16 @@ loading_thread (void *none) { if (!pixbuf) { // make default empty image pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 2, 2); + stat_buf.st_mtime = 0; } -#if 0 - else { - int w, h; - w = gdk_pixbuf_get_width (pixbuf); - h = gdk_pixbuf_get_height (pixbuf); - int width = queue->width; - if (w != width) { - int height; - if (w > h) { - height = width * h / w; - } - else if (h > w) { - height = width; - width = height * w / h; - } - else { - height = width; - } - if (width < 5 || height < 5) { - trace ("will not scale to %dx%d\n", width, height); - queue_pop (); - continue; - } - trace ("scaling %dx%d -> %dx%d\n", w, h, width, height); - GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR); - g_object_unref (pixbuf); - pixbuf = scaled; - } - } -#endif if (cache_min != -1) { deadbeef->mutex_lock (mutex); + cache[cache_min].filetime = stat_buf.st_mtime; cache[cache_min].pixbuf = pixbuf; cache[cache_min].fname = strdup (queue->fname); gettimeofday (&cache[cache_min].tm, NULL); cache[cache_min].width = queue->width; + struct stat stat_buf; deadbeef->mutex_unlock (mutex); } queue_pop (); @@ -230,11 +211,15 @@ get_pixbuf (const char *fname, int width) { for (int i = 0; i < CACHE_SIZE; i++) { if (cache[i].pixbuf) { if (!strcmp (fname, cache[i].fname) && cache[i].width == width) { - gettimeofday (&cache[i].tm, NULL); - GdkPixbuf *pb = cache[i].pixbuf; - g_object_ref (pb); - deadbeef->mutex_unlock (mutex); - return pb; + // check if cached filetime hasn't changed + struct stat stat_buf; + if (!stat (fname, &stat_buf) && stat_buf.st_mtime == cache[i].filetime) { + gettimeofday (&cache[i].tm, NULL); + GdkPixbuf *pb = cache[i].pixbuf; + g_object_ref (pb); + deadbeef->mutex_unlock (mutex); + return pb; + } } } } diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.c b/plugins/gtkui/ddbcellrenderertextmultiline.c index 867c70e4..335faf7c 100644 --- a/plugins/gtkui/ddbcellrenderertextmultiline.c +++ b/plugins/gtkui/ddbcellrenderertextmultiline.c @@ -1,4 +1,4 @@ -/* ddbcellrenderertextmultiline.c generated by valac 0.10.0, the Vala compiler +/* ddbcellrenderertextmultiline.c generated by valac 0.10.1, the Vala compiler * generated from ddbcellrenderertextmultiline.vala, do not modify */ /* @@ -213,7 +213,7 @@ static void ddb_cell_renderer_text_multiline_gtk_cell_renderer_text_editing_done buf = _g_object_ref0 (gtk_text_view_get_buffer ((GtkTextView*) entry)); gtk_text_buffer_get_iter_at_offset (buf, &begin, 0); gtk_text_buffer_get_iter_at_offset (buf, &end, -1); - new_text = g_strdup (gtk_text_buffer_get_text (buf, &begin, &end, TRUE)); + new_text = gtk_text_buffer_get_text (buf, &begin, &end, TRUE); g_signal_emit_by_name ((GtkCellRendererText*) _self_, "edited", entry->tree_path, new_text); _g_free0 (new_text); _g_object_unref0 (buf); diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.h b/plugins/gtkui/ddbcellrenderertextmultiline.h index 787beb50..aec8fc09 100644 --- a/plugins/gtkui/ddbcellrenderertextmultiline.h +++ b/plugins/gtkui/ddbcellrenderertextmultiline.h @@ -1,4 +1,4 @@ -/* ddbcellrenderertextmultiline.h generated by valac 0.10.0, the Vala compiler, do not modify */ +/* ddbcellrenderertextmultiline.h generated by valac 0.10.1, the Vala compiler, do not modify */ #ifndef __DDBCELLRENDERERTEXTMULTILINE_H__ diff --git a/plugins/gtkui/ddbequalizer.c b/plugins/gtkui/ddbequalizer.c index 201277ad..24c3a992 100644 --- a/plugins/gtkui/ddbequalizer.c +++ b/plugins/gtkui/ddbequalizer.c @@ -1,4 +1,4 @@ -/* ddbequalizer.c generated by valac 0.10.0, the Vala compiler +/* ddbequalizer.c generated by valac 0.10.1, the Vala compiler * generated from ddbequalizer.vala, do not modify */ /* diff --git a/plugins/gtkui/ddbequalizer.h b/plugins/gtkui/ddbequalizer.h index 19f98c23..8f957648 100644 --- a/plugins/gtkui/ddbequalizer.h +++ b/plugins/gtkui/ddbequalizer.h @@ -1,4 +1,4 @@ -/* ddbequalizer.h generated by valac 0.10.0, the Vala compiler, do not modify */ +/* ddbequalizer.h generated by valac 0.10.1, the Vala compiler, do not modify */ #ifndef __DDBEQUALIZER_H__ diff --git a/plugins/gtkui/ddbseekbar.c b/plugins/gtkui/ddbseekbar.c index 407b347c..44aae86f 100644 --- a/plugins/gtkui/ddbseekbar.c +++ b/plugins/gtkui/ddbseekbar.c @@ -1,4 +1,4 @@ -/* ddbseekbar.c generated by valac 0.10.0, the Vala compiler +/* ddbseekbar.c generated by valac 0.10.1, the Vala compiler * generated from ddbseekbar.vala, do not modify */ /* @@ -138,7 +138,7 @@ static gboolean ddb_seekbar_real_configure_event (GtkWidget* base, GdkEventConfi DdbSeekbar* ddb_seekbar_construct (GType object_type) { - DdbSeekbar * self; + DdbSeekbar * self = NULL; self = (DdbSeekbar*) gtk_widget_new (object_type, NULL); return self; } diff --git a/plugins/gtkui/ddbseekbar.h b/plugins/gtkui/ddbseekbar.h index f501a00c..84cf6e88 100644 --- a/plugins/gtkui/ddbseekbar.h +++ b/plugins/gtkui/ddbseekbar.h @@ -1,4 +1,4 @@ -/* ddbseekbar.h generated by valac 0.10.0, the Vala compiler, do not modify */ +/* ddbseekbar.h generated by valac 0.10.1, the Vala compiler, do not modify */ #ifndef __DDBSEEKBAR_H__ |