From d78c38b33247a6ba153847ee720c7786109f00f9 Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 14 Nov 2010 18:52:57 +0100 Subject: rebuilt vala code with valac-0.10.1 --- plugins/gtkui/ddbcellrenderertextmultiline.c | 4 ++-- plugins/gtkui/ddbcellrenderertextmultiline.h | 2 +- plugins/gtkui/ddbequalizer.c | 2 +- plugins/gtkui/ddbequalizer.h | 2 +- plugins/gtkui/ddbseekbar.c | 4 ++-- plugins/gtkui/ddbseekbar.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'plugins') 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__ -- cgit v1.2.3 From e99691495ae098275ba7a3029960d2156ed28537 Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 14 Nov 2010 19:15:52 +0100 Subject: album art cache fixes --- conf.c | 14 ++++++++++++ conf.h | 6 +++++ deadbeef.h | 2 ++ plugins.c | 2 ++ plugins/artwork/artwork.c | 15 ++++++++----- plugins/gtkui/coverart.c | 57 +++++++++++++++++------------------------------ 6 files changed, 54 insertions(+), 42 deletions(-) (limited to 'plugins') diff --git a/conf.c b/conf.c index b86e0836..c59cc92d 100644 --- a/conf.c +++ b/conf.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "conf.h" static DB_conf_item_t *conf_items; @@ -133,6 +134,12 @@ conf_get_int (const char *key, int def) { return v ? atoi (v) : def; } +int64_t +conf_get_int64 (const char *key, int64_t def) { + const char *v = conf_get_str (key, NULL); + return v ? atoll (v) : def; +} + DB_conf_item_t * conf_find (const char *group, DB_conf_item_t *prev) { int l = strlen (group); @@ -185,6 +192,13 @@ conf_set_int (const char *key, int val) { conf_set_str (key, s); } +void +conf_set_int64 (const char *key, int64_t val) { + char s[20]; + snprintf (s, sizeof (s), PRId64, val); + conf_set_str (key, s); +} + void conf_set_float (const char *key, float val) { char s[10]; diff --git a/conf.h b/conf.h index 771c3a6b..0e96f336 100644 --- a/conf.h +++ b/conf.h @@ -44,12 +44,18 @@ conf_get_float (const char *key, float def); int conf_get_int (const char *key, int def); +int64_t +conf_get_int64 (const char *key, int64_t def); + void conf_set_str (const char *key, const char *val); void conf_set_int (const char *key, int val); +void +conf_set_int64 (const char *key, int64_t val); + void conf_set_float (const char *key, float val); diff --git a/deadbeef.h b/deadbeef.h index 556ef1b6..76ff1551 100644 --- a/deadbeef.h +++ b/deadbeef.h @@ -498,8 +498,10 @@ typedef struct { const char * (*conf_get_str) (const char *key, const char *def); float (*conf_get_float) (const char *key, float def); int (*conf_get_int) (const char *key, int def); + int64_t (*conf_get_int64) (const char *key, int64_t def); void (*conf_set_str) (const char *key, const char *val); void (*conf_set_int) (const char *key, int val); + void (*conf_set_int64) (const char *key, int64_t val); void (*conf_set_float) (const char *key, float val); DB_conf_item_t * (*conf_find) (const char *group, DB_conf_item_t *prev); void (*conf_remove_items) (const char *key); diff --git a/plugins.c b/plugins.c index 331baab9..33da5ee1 100644 --- a/plugins.c +++ b/plugins.c @@ -237,8 +237,10 @@ static DB_functions_t deadbeef_api = { .conf_get_str = conf_get_str, .conf_get_float = conf_get_float, .conf_get_int = conf_get_int, + .conf_get_int64 = conf_get_int64, .conf_set_str = conf_set_str, .conf_set_int = conf_set_int, + .conf_set_int64 = conf_set_int64, .conf_set_float = conf_set_float, .conf_find = conf_find, .conf_remove_items = conf_remove_items, diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index fbbe71d9..952b018a 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "../../deadbeef.h" #include "artwork.h" #include "lastfm.h" @@ -13,8 +14,8 @@ #define min(x,y) ((x)<(y)?(x):(y)) -//#define trace(...) { fprintf(stderr, __VA_ARGS__); } -#define trace(...) +#define trace(...) { fprintf(stderr, __VA_ARGS__); } +//#define trace(...) #define DEFAULT_COVER_PATH (PREFIX "/share/deadbeef/pixmaps/noartwork.jpg") #define DEFAULT_FILEMASK "*cover*.jpg;*front*.jpg" @@ -45,7 +46,7 @@ int artwork_enable_embedded; int artwork_enable_local; int artwork_enable_lfm; int artwork_enable_aao; -int artwork_reset_time; +time_t artwork_reset_time; char artwork_filemask[200]; void @@ -589,7 +590,7 @@ get_album_art (const char *fname, const char *artist, const char *album, artwork return strdup (DEFAULT_COVER_PATH); } - 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); } @@ -648,13 +649,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); } @@ -670,7 +673,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/gtkui/coverart.c b/plugins/gtkui/coverart.c index 7fb50554..9a42172a 100644 --- a/plugins/gtkui/coverart.c +++ b/plugins/gtkui/coverart.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "coverart.h" #include "../artwork/artwork.h" #include "gtkui.h" @@ -38,6 +39,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; @@ -140,7 +142,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); @@ -151,6 +156,9 @@ loading_thread (void *none) { g_error_free (error); error = NULL; } + if (stat (DEFAULT_COVER_PATH, &stat_buf) < 0) { + trace ("failed to stat file %s\n", queue->fname); + } pixbuf = gdk_pixbuf_new_from_file_at_scale (DEFAULT_COVER_PATH, queue->width, queue->width, TRUE, &error); if (!pixbuf) { fprintf (stderr, "gdk_pixbuf_new_from_file_at_scale %s %d failed, error: %s\n", DEFAULT_COVER_PATH, queue->width, error->message); @@ -163,43 +171,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 (); @@ -231,11 +212,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; + } } } } -- cgit v1.2.3 From 66ba08512d156c4eba0ebdd8e173cb53540d3ec3 Mon Sep 17 00:00:00 2001 From: Robert Y Date: Sat, 23 Oct 2010 17:43:40 -0400 Subject: Use 'replaces_id' parameter instead of queueing up new notifications Signed-off-by: Robert Y --- plugins/notify/notify.c | 71 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/notify/notify.c b/plugins/notify/notify.c index ba7daa92..5667b6fe 100644 --- a/plugins/notify/notify.c +++ b/plugins/notify/notify.c @@ -30,8 +30,60 @@ DB_functions_t *deadbeef; DB_misc_t plugin; +static dbus_uint32_t replaces_id = 0; + #define NOTIFY_DEFAULT_FORMAT "%a - %t" +static void +notify_thread (void *ctx) { + + DBusMessage *msg = (DBusMessage*) ctx; + DBusMessage *reply = NULL; + + DBusError error; + dbus_error_init (&error); + DBusConnection *conn = dbus_bus_get (DBUS_BUS_SESSION, &error); + if(dbus_error_is_set (&error)) { + fprintf(stderr, "connection failed: %s",error.message); + dbus_error_free(&error); + dbus_message_unref (msg); + pthread_exit(); + } + + reply = dbus_connection_send_with_reply_and_block (conn, msg, -1, &error); + if (dbus_error_is_set (&error)) { + fprintf(stderr, "send_with_reply_and_block error: (%s)\n", error.message); + dbus_error_free(&error); + dbus_message_unref (msg); + pthread_exit(); + } + + if (reply != NULL) { + // Process the reply message + DBusMessageIter args; + + dbus_uint32_t id = 0; + if (dbus_message_iter_init(reply, &args)) { + if (DBUS_TYPE_UINT32 == dbus_message_iter_get_arg_type(&args)) { + dbus_message_iter_get_basic(&args, &id); + if (id != replaces_id) { + replaces_id = id; + } + dbus_message_unref (reply); + } else { + fprintf(stderr, "Argument is not uint32\n"); + } + } else { + fprintf(stderr, "Reply has no arguments\n"); + } + } + + dbus_message_unref (msg); + dbus_connection_unref (conn); + pthread_exit(); + +} + #if 0 static void notify_marshal_dict_byte(DBusMessageIter *iter, const char *key, char value) @@ -122,7 +174,7 @@ on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) { } } *dst = 0; - +/* DBusError error; dbus_error_init (&error); DBusConnection *conn = dbus_bus_get (DBUS_BUS_SESSION, &error); @@ -130,6 +182,7 @@ on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) { printf("connection failed: %s",error.message); exit(1); } +*/ DBusMessage *msg = dbus_message_new_method_call (E_NOTIFICATION_BUS_NAME, E_NOTIFICATION_PATH, E_NOTIFICATION_INTERFACE, "Notify"); const char *v_appname = "DeaDBeeF"; @@ -141,7 +194,8 @@ on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) { dbus_message_append_args (msg , DBUS_TYPE_STRING, &v_appname - , DBUS_TYPE_UINT32, &v_id +// , DBUS_TYPE_UINT32, &v_id + , DBUS_TYPE_UINT32, &replaces_id , DBUS_TYPE_STRING, &v_iconname , DBUS_TYPE_STRING, &v_summary , DBUS_TYPE_STRING, &v_body @@ -159,9 +213,16 @@ on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) { dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &v_timeout); - int serial; - dbus_bool_t retval = dbus_connection_send(conn,msg,&serial); - dbus_connection_flush (conn); + //int serial; + //dbus_bool_t retval = dbus_connection_send(conn,msg,&serial); + //dbus_connection_flush (conn); + //dbus_message_unref (msg); + + intptr_t tid = NULL; + if ((tid=deadbeef->thread_start(notify_thread, msg)) != 0) { + dbus_message_ref (msg); + pthread_detach (tid); + } dbus_message_unref (msg); } } -- cgit v1.2.3 From 2c2b62a0f140221dec44d31d6d04816f3cea4f3f Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 24 Oct 2010 09:45:37 +0200 Subject: fixed notify plugin to use deadbeef threading API --- plugins/notify/notify.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/notify/notify.c b/plugins/notify/notify.c index 5667b6fe..196a0e76 100644 --- a/plugins/notify/notify.c +++ b/plugins/notify/notify.c @@ -47,7 +47,7 @@ notify_thread (void *ctx) { fprintf(stderr, "connection failed: %s",error.message); dbus_error_free(&error); dbus_message_unref (msg); - pthread_exit(); + deadbeef->thread_exit(NULL); } reply = dbus_connection_send_with_reply_and_block (conn, msg, -1, &error); @@ -55,7 +55,7 @@ notify_thread (void *ctx) { fprintf(stderr, "send_with_reply_and_block error: (%s)\n", error.message); dbus_error_free(&error); dbus_message_unref (msg); - pthread_exit(); + deadbeef->thread_exit(NULL); } if (reply != NULL) { @@ -80,7 +80,7 @@ notify_thread (void *ctx) { dbus_message_unref (msg); dbus_connection_unref (conn); - pthread_exit(); + deadbeef->thread_exit(NULL); } @@ -221,7 +221,7 @@ on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) { intptr_t tid = NULL; if ((tid=deadbeef->thread_start(notify_thread, msg)) != 0) { dbus_message_ref (msg); - pthread_detach (tid); + deadbeef->thread_detach (tid); } dbus_message_unref (msg); } -- cgit v1.2.3 From 1d5b08d893bccb83d2bd03f0d76c670e1df8474f Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 18 Nov 2010 21:57:00 +0100 Subject: fix playlist redraw after adding audio cd --- plugins/cdda/cdda.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c index 2ed54b51..b83dc5bb 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 = { -- cgit v1.2.3 From 4f4cf2190aef650ad6e93a9ad86ed0207101f0a7 Mon Sep 17 00:00:00 2001 From: waker Date: Sat, 20 Nov 2010 11:35:45 +0100 Subject: disable artwork tracing --- plugins/artwork/artwork.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index 952b018a..3257f619 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -14,8 +14,8 @@ #define min(x,y) ((x)<(y)?(x):(y)) -#define trace(...) { fprintf(stderr, __VA_ARGS__); } -//#define trace(...) +//#define trace(...) { fprintf(stderr, __VA_ARGS__); } +#define trace(...) #define DEFAULT_COVER_PATH (PREFIX "/share/deadbeef/pixmaps/noartwork.jpg") #define DEFAULT_FILEMASK "*cover*.jpg;*front*.jpg" -- cgit v1.2.3 From 38c085d04677559b5232b1ac7ae5469f6bb77e4d Mon Sep 17 00:00:00 2001 From: waker Date: Sat, 20 Nov 2010 16:36:31 +0100 Subject: portable-0.4.4-r1 --- PORTABLE_BUILD | 2 +- PORTABLE_VERSION | 2 +- configure.ac | 52 +++++++++++++++++++------------- deadbeef.h | 5 ++-- main.c | 59 ++++++++++++++++++++++++------------- plugins/gtkui/Makefile.am | 4 +-- scripts/portable_build.sh | 4 +-- scripts/portable_package.sh | 2 +- scripts/portable_package_partial.sh | 36 ++++++++++++++++++++++ threading_pthread.c | 2 +- 10 files changed, 117 insertions(+), 51 deletions(-) create mode 100755 scripts/portable_package_partial.sh (limited to 'plugins') diff --git a/PORTABLE_BUILD b/PORTABLE_BUILD index 00750edc..d00491fd 100644 --- a/PORTABLE_BUILD +++ b/PORTABLE_BUILD @@ -1 +1 @@ -3 +1 diff --git a/PORTABLE_VERSION b/PORTABLE_VERSION index 17b2ccd9..6f2743d6 100644 --- a/PORTABLE_VERSION +++ b/PORTABLE_VERSION @@ -1 +1 @@ -0.4.3 +0.4.4 diff --git a/configure.ac b/configure.ac index 2a364423..36f5b1b1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([deadbeef], [0.4.3]) +AC_INIT([deadbeef], [0.4.4]) AC_CONFIG_HEADER(config.h) @@ -94,12 +94,25 @@ AC_ARG_ENABLE(aac, [AS_HELP_STRING([--disable-aac ], [disable AAC decod AC_ARG_ENABLE(mms, [AS_HELP_STRING([--disable-mms ], [disable MMS streaming vfs plugin (default: enabled)])], [enable_mms=$enableval], [enable_mms=yes]) AC_ARG_ENABLE(shn, [AS_HELP_STRING([--disable-shn ], [disable shorten plugin (default: enabled)])], [enable_shn=$enableval], [enable_shn=yes]) AC_ARG_ENABLE(ao, [AS_HELP_STRING([--disable-ao ], [disable audio overload plugin (default: enabled)])], [enable_ao=$enableval], [enable_ao=yes]) -AC_ARG_ENABLE(mpris, [ --enable-mpris enable Ubuntu Sound Menu plugin (default: disabled)], [enable_mpris=$enableval], [enable_mpris=no]) -AC_ARG_ENABLE(portable, [ --enable-portable make portable static build (default: disabled)], [enable_portable=$enableval], [enable_portable=no]) +AC_ARG_ENABLE(mpris, [AS_HELP_STRING([ --enable-mpris enable Ubuntu Sound Menu plugin (default: disabled)])], [enable_mpris=$enableval], [enable_mpris=no]) +AC_ARG_ENABLE(staticlink, [AS_HELP_STRING([ --enable-staticlink link everything statically (default: disabled)])], [enable_staticlink=$enableval], [enable_staticlink=no]) +AC_ARG_ENABLE(portable, [AS_HELP_STRING([ --enable-portable make portable build (default: disabled, opts: yes,no,full)])], [enable_portable=$enableval], [enable_portable=no]) -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then + AC_DEFINE_UNQUOTED([STATICLINK], [1], [Define if building static version]) + STATICLINK=yes +fi + +if test "x$enable_portable" != "xno" && test "x$enable_staticlink" != "xno" ; then AC_DEFINE_UNQUOTED([PORTABLE], [1], [Define if building portable version]) PORTABLE=yes + + + if test "x$enable_portable" == "xfull" ; then + AC_DEFINE_UNQUOTED([PORTABLE_FULL], [1], [Define if portable version should keep configs in app folder]) + PORTABLE_FULL=yes + fi + PREFIXFLAGS="-DPREFIX=donotuse -DLIBDIR=donotuse -DDOCDIR=donotuse -I./include -I../../include" else PREFIXFLAGS=" -DLIBDIR=\\\"$libdir\\\" -DPREFIX=\\\"$prefix\\\" -DDOCDIR=\\\"$docdir\\\"" @@ -109,7 +122,7 @@ CXXFLAGS="$CXXFLAGS $INSANE_CXXFLAGS -D_GNU_SOURCE $PREFIXFLAGS" CFLAGS="$CFLAGS $INSANE_CFLAGS -D_GNU_SOURCE $PREFIXFLAGS" PKG_CHECK_MODULES(DEPS, samplerate) -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then DEPS_LIBS="$LIB/libsamplerate.a -lpthread -ldl" AC_SUBST(DEPS_LIBS) else @@ -131,7 +144,7 @@ if test "x$enable_alsa" != "xno" ; then fi if test "x$enable_ffmpeg" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then FFMPEG_DEPS_LIBS="../../$LIB/libavcodec.a -lpthread ../../$LIB/libavformat.a ../../$LIB/libavcodec.a ../../$LIB/libavutil.a ../../$LIB/libavcore.a -lm ../../$LIB/libz.a " AC_SUBST(FFMPEG_DEPS_LIBS) HAVE_FFMPEG=yes @@ -144,9 +157,6 @@ if test "x$enable_pulse" != "xno" ; then PKG_CHECK_MODULES(PULSE_DEPS, libpulse-simple, HAVE_PULSE=yes, HAVE_PULSE=no) fi -dnl AC_CHECK_LIB([pthread], [main]) -dnl AC_CHECK_LIB([dl], [main]) - AC_CHECK_HEADER([iconv.h],[],[iconv.h not found.]) AC_CHECK_LIB([iconv], [main], [have_iconv=yes], [have_iconv=no]) @@ -162,7 +172,7 @@ if test ${HAVE_SSE2}; then fi dnl curl lib -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_CURL=yes CURL_LIBS="../../$LIB/libcurl.a -lrt" AC_SUBST(CURL_LIBS) @@ -172,7 +182,7 @@ else AC_SUBST(CURL_LIBS) fi -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_DBUS=yes DBUS_DEPS_LIBS="../../$LIB/libdbus-1.a ../../$LIB/libexpat.a -lrt" DBUS_DEPS_CFLAGS="-I../../include/dbus-1" @@ -184,7 +194,7 @@ fi dnl mpgmad plugin if test "x$enable_mpgmad" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_MPGMAD=yes MAD_LIBS="../../$LIB/libmad.a" AC_SUBST(MAD_LIBS) @@ -200,7 +210,7 @@ fi dnl vorbis plugin if test "x$enable_vorbis" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_VORBISPLUGIN=yes VORBIS_LIBS="../../$LIB/libogg.a ../../$LIB/libvorbis.a ../../$LIB/libvorbisenc.a ../../$LIB/libvorbisfile.a" AC_SUBST(VORBIS_LIBS) @@ -217,7 +227,7 @@ fi dnl flac plugin if test "x$enable_flac" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_FLACPLUGIN=yes FLAC_LIBS="../../$LIB/libFLAC.a ../../$LIB/libogg.a" AC_SUBST(FLAC_LIBS) @@ -233,7 +243,7 @@ fi dnl wavpack plugin if test "x$enable_wavpack" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_WAVPACKPLUGIN=yes WAVPACK_LIBS="../../$LIB/libwavpack.a" AC_SUBST(WAVPACK_LIBS) @@ -249,7 +259,7 @@ fi dnl libsndfile plugin if test "x$enable_sndfile" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_SNDFILEPLUGIN=yes SNDFILE_LIBS="../../$LIB/libsndfile.a" AC_SUBST(SNDFILE_LIBS) @@ -274,7 +284,7 @@ fi dnl cdda plugin if test "x$enable_cdda" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_CDDAPLUGIN=yes CDDA_LIBS="../../$LIB/libcdio.a ../../$LIB/libudf.a ../../$LIB/libiso9660.a ../../$LIB/libcddb.a" AC_SUBST(CDDA_LIBS) @@ -303,7 +313,7 @@ if test "x$enable_alsa" != "xno" ; then fi if test "x$enable_ffmpeg" != "xno" ; then -if test "x$enable_portable" = "xno" ; then +if test "x$enable_staticlink" = "xno" ; then if test "x$HAVE_FFMPEG" = "xyes" ; then HAVE_FFMPEGPLUGIN=yes AC_CHECK_HEADER([ffmpeg/avformat.h], FFMPEG_DEPS_CFLAGS="$FFMPEG_DEPS_CFLAGS -D FFMPEG_OLD") @@ -442,7 +452,7 @@ if test "x$enable_dca" != "xno" ; then fi if test "x$enable_aac" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then FAAD2_LIBS="../../$LIB/libfaad.a" AC_SUBST(FAAD2_LIBS) HAVE_AAC=yes @@ -467,7 +477,7 @@ if test "x$enable_shn" != "xno" ; then fi if test "x$enable_ao" != "xno" ; then -if test "x$enable_portable" != "xno" ; then +if test "x$enable_staticlink" != "xno" ; then HAVE_ZLIB=yes ZLIB_LIBS="../../$LIB/libz.a" else @@ -520,7 +530,9 @@ AM_CONDITIONAL(HAVE_MMS, test "x$HAVE_MMS" = "xyes") AM_CONDITIONAL(HAVE_SHN, test "x$HAVE_SHN" = "xyes") AM_CONDITIONAL(HAVE_AO, test "x$HAVE_AO" = "xyes") AM_CONDITIONAL(HAVE_MPRIS, test "x$HAVE_MPRIS" = "xyes") +AM_CONDITIONAL(STATICLINK, test "x$STATICLINK" = "xyes") AM_CONDITIONAL(PORTABLE, test "x$PORTABLE" = "xyes") +AM_CONDITIONAL(PORTABLE_FULL, test "x$PORTABLE_FULL" = "xyes") AC_SUBST(PLUGINS_DIRS) diff --git a/deadbeef.h b/deadbeef.h index 30b09ef2..2826502e 100644 --- a/deadbeef.h +++ b/deadbeef.h @@ -2,7 +2,7 @@ deadbeef.h -- plugin API of the DeaDBeeF audio player http://deadbeef.sourceforge.net - Copyright (C) 2009 Alexey Yakovenko + Copyright (C) 2009-2010 Alexey Yakovenko This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,6 +55,7 @@ extern "C" { // api version history: // 9.9 -- devel +// 0.10 -- deadbeef-0.4.4-portable-r1 // 0.9 -- deadbeef-0.4.3-portable-build3 // 0.8 -- deadbeef-0.4.2 // 0.7 -- deabdeef-0.4.0 @@ -66,7 +67,7 @@ extern "C" { // 0.1 -- deadbeef-0.2.0 #define DB_API_VERSION_MAJOR 0 -#define DB_API_VERSION_MINOR 9 +#define DB_API_VERSION_MINOR 10 #define DB_PLUGIN_SET_API_VERSION\ .plugin.api_vmajor = DB_API_VERSION_MAJOR,\ diff --git a/main.c b/main.c index 9e9bb6b7..b71f456f 100644 --- a/main.c +++ b/main.c @@ -534,8 +534,18 @@ main (int argc, char *argv[]) { bindtextdomain (PACKAGE, LOCALEDIR); bind_textdomain_codeset (PACKAGE, "UTF-8"); textdomain (PACKAGE); -#endif - fprintf (stderr, "starting deadbeef " VERSION "%s\n", PORTABLE ? " [portable build]" : ""); +#endif + + int staticlink = 0; + int portable = 0; +#if STATICLINK + staticlink = 1; +#endif +#if PORTABLE + portable = 1; +#endif + + fprintf (stderr, "starting deadbeef " VERSION "%s%s\n", staticlink ? " [static]" : "", portable ? " [portable]" : ""); srand (time (NULL)); #ifdef __linux__ prctl (PR_SET_NAME, "deadbeef-main", 0, 0, 0, 0); @@ -548,31 +558,15 @@ main (int argc, char *argv[]) { e--; } *e = 0; +#endif + +#if PORTABLE_FULL if (snprintf (confdir, sizeof (confdir), "%s/config", dbinstalldir) > sizeof (confdir)) { fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); return -1; } strcpy (dbconfdir, confdir); - - if (snprintf (dbdocdir, sizeof (dbdocdir), "%s/doc", dbinstalldir) > sizeof (dbdocdir)) { - fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); - return -1; - } - if (snprintf (dbplugindir, sizeof (dbplugindir), "%s/plugins", dbinstalldir) > sizeof (dbplugindir)) { - fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); - return -1; - } - if (snprintf (dbpixmapdir, sizeof (dbpixmapdir), "%s/pixmaps", dbinstalldir) > sizeof (dbpixmapdir)) { - fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); - return -1; - } - trace ("installdir: %s\n", dbinstalldir); - trace ("confdir: %s\n", confdir); - trace ("docdir: %s\n", dbdocdir); - trace ("plugindir: %s\n", dbplugindir); - mkdir (dbplugindir, 0755); - trace ("pixmapdir: %s\n", dbpixmapdir); #else char *homedir = getenv ("HOME"); if (!homedir) { @@ -598,6 +592,24 @@ main (int argc, char *argv[]) { return -1; } mkdir (confdir, 0755); +#endif + + +#if PORTABLE + if (snprintf (dbdocdir, sizeof (dbdocdir), "%s/doc", dbinstalldir) > sizeof (dbdocdir)) { + fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); + return -1; + } + if (snprintf (dbplugindir, sizeof (dbplugindir), "%s/plugins", dbinstalldir) > sizeof (dbplugindir)) { + fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); + return -1; + } + if (snprintf (dbpixmapdir, sizeof (dbpixmapdir), "%s/pixmaps", dbinstalldir) > sizeof (dbpixmapdir)) { + fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); + return -1; + } + mkdir (dbplugindir, 0755); +#else if (snprintf (dbdocdir, sizeof (dbdocdir), "%s", DOCDIR) > sizeof (dbdocdir)) { fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); return -1; @@ -611,6 +623,11 @@ main (int argc, char *argv[]) { return -1; } #endif + trace ("installdir: %s\n", dbinstalldir); + trace ("confdir: %s\n", confdir); + trace ("docdir: %s\n", dbdocdir); + trace ("plugindir: %s\n", dbplugindir); + trace ("pixmapdir: %s\n", dbpixmapdir); mkdir (dbconfdir, 0755); 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/scripts/portable_build.sh b/scripts/portable_build.sh index e973993b..4259c845 100755 --- a/scripts/portable_build.sh +++ b/scripts/portable_build.sh @@ -3,7 +3,7 @@ VERSION=`cat PORTABLE_VERSION | perl -ne 'chomp and print'` ORIGIN=`pwd | perl -ne 'chomp and print'` export APBUILD_STATIC_LIBGCC=1 -CC=$ORIGIN/tools/apbuild/apgcc CXX=$ORIGIN/tools/apbuild/apgcc ./configure --enable-portable --disable-pulse --disable-mpris --enable-maintainer-mode --disable-nls +CC=$ORIGIN/tools/apbuild/apgcc CXX=$ORIGIN/tools/apbuild/apgcc ./configure --enable-staticlink --enable-portable=yes --disable-pulse --disable-mpris --enable-maintainer-mode --disable-nls sed -i 's/-lstdc++ -lm -lgcc_s -lc -lgcc_s/-lm -lc/g' libtool make clean make -j9 @@ -13,5 +13,5 @@ cd tools/pluginfo make cd ../../ -./portable_postbuild.sh +./scripts/portable_postbuild.sh diff --git a/scripts/portable_package.sh b/scripts/portable_package.sh index bf292789..fc6e09b6 100755 --- a/scripts/portable_package.sh +++ b/scripts/portable_package.sh @@ -14,7 +14,7 @@ mkdir -p portable_out/build 2>/dev/null rm portable_out/* 2>/dev/null rm portable_out/build/* 2>/dev/null -tar jcvf portable_out/build/deadbeef-$VERSION-portable-build$BUILD.tar.bz2\ +tar jcvf portable_out/build/deadbeef-$VERSION-portable-r$BUILD.tar.bz2\ $SRCDIR/deadbeef\ $SRCDIR/deadbeef.png\ $DOCDIR\ diff --git a/scripts/portable_package_partial.sh b/scripts/portable_package_partial.sh new file mode 100755 index 00000000..d3d63396 --- /dev/null +++ b/scripts/portable_package_partial.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# package for distribution +VERSION=`cat PORTABLE_VERSION | perl -ne 'chomp and print'` +BUILD=`cat PORTABLE_BUILD | perl -ne 'chomp and print'` + +# main distro +SRCDIR=deadbeef-$VERSION-portable +PLUGDIR=$SRCDIR/plugins +DOCDIR=$SRCDIR/doc +PIXMAPDIR=$SRCDIR/pixmaps + +tar jcvf portable_out/build/deadbeef-$VERSION-portable-partial-r$BUILD.tar.bz2\ + $SRCDIR/deadbeef\ + $SRCDIR/deadbeef.png\ + $DOCDIR\ + $PLUGDIR/alsa.so\ + $PLUGDIR/oss.so\ + $PLUGDIR/vfs_curl.so\ + $PLUGDIR/artwork.so\ + $PLUGDIR/gtkui.so\ + $PLUGDIR/gtkui.fallback.so\ + $PLUGDIR/hotkeys.so\ + $PLUGDIR/cdda.so\ + $PLUGDIR/mpgmad.so\ + $PLUGDIR/vorbis.so\ + $PLUGDIR/wavpack.so\ + $PLUGDIR/flac.so\ + $PLUGDIR/ffap.so\ + $PLUGDIR/musepack.so\ + $PLUGDIR/notify.so\ + $PLUGDIR/sndfile.so\ + $PLUGDIR/supereq.so\ + $PLUGDIR/tta.so\ + $PIXMAPDIR + diff --git a/threading_pthread.c b/threading_pthread.c index 0705128c..cb80fcb1 100644 --- a/threading_pthread.c +++ b/threading_pthread.c @@ -72,7 +72,7 @@ thread_start_low_priority (void (*fn)(void *ctx), void *ctx) { fprintf (stderr, "pthread_create failed: %s\n", strerror (s)); return 0; } -#if !PORTABLE +#if !STATICLINK s = pthread_setschedprio (tid, minprio); if (s != 0) { fprintf (stderr, "pthread_setschedprio failed: %s\n", strerror (s)); -- cgit v1.2.3