From 21a883ee3ae68f05624922320b2f762ddb9bd7b7 Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 22 May 2011 19:41:09 +0200 Subject: unbreak shuffle --- playlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'playlist.c') diff --git a/playlist.c b/playlist.c index fe0414df..f339c7d4 100644 --- a/playlist.c +++ b/playlist.c @@ -109,7 +109,7 @@ static playlist_t *addfiles_playlist; // current playlist for adding files/folde void pl_set_order (int order) { - if (pl_order != order && (pl_order == PLAYBACK_ORDER_SHUFFLE_TRACKS || pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS)) { + if (pl_order != order || pl_order == PLAYBACK_ORDER_SHUFFLE_TRACKS || pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS) { pl_order = order; for (playlist_t *plt = playlists_head; plt; plt = plt->next) { plt_reshuffle (plt, NULL, NULL); -- cgit v1.2.3 From bded25b2bafd98fce08b6cdcd6276b3dcf508cbc Mon Sep 17 00:00:00 2001 From: waker Date: Tue, 7 Jun 2011 20:53:56 +0200 Subject: few fixes to make it possible to reinitialize player after complete shutdown, without restarting process --- conf.c | 3 +++ playlist.c | 1 + plugins.c | 11 +++++++++++ streamer.c | 1 + 4 files changed, 16 insertions(+) (limited to 'playlist.c') diff --git a/conf.c b/conf.c index 887ad053..f875d349 100644 --- a/conf.c +++ b/conf.c @@ -52,7 +52,10 @@ conf_free (void) { next = it->next; conf_item_free (it); } + conf_items = NULL; + changed = 0; mutex_free (mutex); + mutex = 0; } int diff --git a/playlist.c b/playlist.c index f339c7d4..390cd133 100644 --- a/playlist.c +++ b/playlist.c @@ -162,6 +162,7 @@ pl_free (void) { mutex_plt = 0; } #endif + playlist = NULL; } #if DEBUG_LOCKING diff --git a/plugins.c b/plugins.c index 70c49bc9..53436f9a 100644 --- a/plugins.c +++ b/plugins.c @@ -996,6 +996,17 @@ plug_unload_all (void) { g_gui_names[i] = NULL; } plugins_tail = NULL; + + memset (g_plugins, 0, sizeof (g_plugins)); + memset (g_gui_names, 0, sizeof (g_gui_names)); + g_num_gui_names = 0; + memset (g_decoder_plugins, 0, sizeof (g_decoder_plugins)); + memset (g_vfs_plugins, 0, sizeof (g_vfs_plugins)); + memset (g_dsp_plugins, 0, sizeof (g_dsp_plugins)); + memset (g_output_plugins, 0, sizeof (g_output_plugins)); + output_plugin = NULL; + memset (g_playlist_plugins, 0, sizeof (g_playlist_plugins)); + trace ("all plugins had been unloaded\n"); } diff --git a/streamer.c b/streamer.c index 2f137891..74398e34 100644 --- a/streamer.c +++ b/streamer.c @@ -1580,6 +1580,7 @@ streamer_dsp_init (void) { int streamer_init (void) { + streaming_terminate = 0; #if WRITE_DUMP out = fopen ("out.raw", "w+b"); #endif -- cgit v1.2.3 From 1eed84099a8ea6b7bec9167f19d865ab52d6695f Mon Sep 17 00:00:00 2001 From: Kevin van der Vlist Date: Tue, 7 Jun 2011 23:13:58 +0200 Subject: OpenIndian b148 support (and perhaps other Solaris builds). --- configure.ac | 5 +++++ main.c | 8 ++++---- playlist.c | 5 ++++- plugins.c | 2 +- plugins/artwork/albumartorg.c | 3 +++ plugins/artwork/artwork.c | 8 ++++++++ plugins/artwork/lastfm.c | 3 +++ plugins/mms/libmms/bswap.h | 11 +++++++++++ plugins/shellexec/shellexec.c | 4 +++- plugins/sndfile/sndfile.c | 3 +++ plugins/vorbis/vorbis.c | 6 +++--- plugins/wildmidi/src/wildmidi_lib.c | 5 +++-- utf8.c | 6 ++++++ 13 files changed, 57 insertions(+), 12 deletions(-) (limited to 'playlist.c') diff --git a/configure.ac b/configure.ac index 2f15a13b..64874ab7 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,11 @@ fi dnl check for libdl AC_CHECK_LIB([dl], [main], [HAVE_DL=yes;DL_LIBS="-ldl";AC_SUBST(DL_LIBS)]) +dnl check libsocket (OpenIndiana) +AC_CHECK_LIB([socket], [main], [HAVE_SOCKET=yes;DL_LIBS="-lsocket";AC_SUBST(DL_LIBS)]) +dnl check for seperate alloca.h (OpenIndiana) +AC_CHECK_HEADER([alloca.h],[],[alloca.h not found.]) + if test "x$enable_portable" != "xno" && test "x$enable_staticlink" != "xno" ; then AC_DEFINE_UNQUOTED([PORTABLE], [1], [Define if building portable version]) PORTABLE=yes diff --git a/main.c b/main.c index 2a4d220e..db8205fa 100644 --- a/main.c +++ b/main.c @@ -15,6 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include @@ -26,7 +29,7 @@ #include #endif #ifndef __linux__ -#define _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 1 #endif #include #include @@ -41,9 +44,6 @@ #ifdef __linux__ #include #endif -#ifdef HAVE_CONFIG_H -# include -#endif #include #include "gettext.h" #include "playlist.h" diff --git a/playlist.c b/playlist.c index 390cd133..9aee5540 100644 --- a/playlist.c +++ b/playlist.c @@ -18,6 +18,9 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif +#ifdef HAVE_ALLOCA_H +# include +#endif #include #include #include @@ -31,7 +34,7 @@ #include #include #ifndef __linux__ -#define _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 1 #endif #include #include diff --git a/plugins.c b/plugins.c index 53436f9a..38abace1 100644 --- a/plugins.c +++ b/plugins.c @@ -24,7 +24,7 @@ //#include #include #ifndef __linux__ -#define _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 1 #endif #include #ifdef HAVE_CONFIG_H diff --git a/plugins/artwork/albumartorg.c b/plugins/artwork/albumartorg.c index ada7179f..51ca54cb 100644 --- a/plugins/artwork/albumartorg.c +++ b/plugins/artwork/albumartorg.c @@ -16,6 +16,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index c2a8b766..7f56b870 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -1,3 +1,6 @@ +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include @@ -721,6 +724,11 @@ static const char *filter_custom_mask = NULL; static int filter_custom (const struct dirent *f) { +// FNM_CASEFOLD is not defined on solaris. On other platforms it is. +// It should be safe to define it as FNM_INGORECASE if it isn't defined. +#ifndef FNM_CASEFOLD +#define FNM_CASEFOLD FNM_IGNORECASE +#endif if (!fnmatch (filter_custom_mask, f->d_name, FNM_CASEFOLD)) { return 1; } diff --git a/plugins/artwork/lastfm.c b/plugins/artwork/lastfm.c index 2e78fd87..91972c8a 100644 --- a/plugins/artwork/lastfm.c +++ b/plugins/artwork/lastfm.c @@ -1,3 +1,6 @@ +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include diff --git a/plugins/mms/libmms/bswap.h b/plugins/mms/libmms/bswap.h index 6a6e1d10..7fe6db62 100644 --- a/plugins/mms/libmms/bswap.h +++ b/plugins/mms/libmms/bswap.h @@ -271,6 +271,17 @@ #define GINT16_TO_LE(val) (val) #endif +/* If this is not defined, we are on Solaris */ +#ifndef u_int16_t +#define u_int16_t uint16_t +#endif +#ifndef u_int32_t +#define u_int32_t uint32_t +#endif +#ifndef u_int64_t +#define u_int64_t uint64_t +#endif + #define LE_16(val) (GINT16_FROM_LE (*((u_int16_t*)(val)))) #define BE_16(val) (GINT16_FROM_BE (*((u_int16_t*)(val)))) #define LE_32(val) (GINT32_FROM_LE (*((u_int32_t*)(val)))) diff --git a/plugins/shellexec/shellexec.c b/plugins/shellexec/shellexec.c index 8ecf223e..76d31e34 100644 --- a/plugins/shellexec/shellexec.c +++ b/plugins/shellexec/shellexec.c @@ -37,7 +37,9 @@ remote - command allowed only for non-local files disabled - ignore command */ - +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c index bca91bab..eae39b86 100644 --- a/plugins/sndfile/sndfile.c +++ b/plugins/sndfile/sndfile.c @@ -16,6 +16,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +# include +#endif #ifndef __linux__ #define _LARGEFILE64_SOURCE #endif diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index c85a0c63..f12123ee 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -15,6 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include @@ -23,9 +26,6 @@ #include #include #include -#ifdef HAVE_CONFIG_H -# include -#endif #include "../../deadbeef.h" #include "vcedit.h" diff --git a/plugins/wildmidi/src/wildmidi_lib.c b/plugins/wildmidi/src/wildmidi_lib.c index 97912c50..66a2ca4a 100644 --- a/plugins/wildmidi/src/wildmidi_lib.c +++ b/plugins/wildmidi/src/wildmidi_lib.c @@ -137,7 +137,9 @@ ======================================== */ - +#ifdef HAVE_CONFIG_H +# include +#endif #include #include #include @@ -155,7 +157,6 @@ #ifdef _WIN32 # include #endif -#include "config.h" #include "wildmidi_lib.h" /* diff --git a/utf8.c b/utf8.c index 4efb2ea6..6165742e 100644 --- a/utf8.c +++ b/utf8.c @@ -19,6 +19,12 @@ by Jeff Bezanson placed in the public domain Fall 2005 */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#ifdef HAVE_ALLOCA_H +# include +#endif #include #include #include -- cgit v1.2.3 From 081386fa03e82ca64aa14a5bd5e8bd3ba8b2ba9a Mon Sep 17 00:00:00 2001 From: waker Date: Fri, 17 Jun 2011 20:54:11 +0200 Subject: medialib scanner prototype: scan folder, build index, etc --- deadbeef.h | 13 ++++++++++++- metacache.c | 12 ++++++++++++ metacache.h | 6 ++++++ playlist.c | 28 ++++++++++++++++++++++------ playlist.h | 10 ++++++++++ plugins.c | 13 ++++++++++++- 6 files changed, 74 insertions(+), 8 deletions(-) (limited to 'playlist.c') diff --git a/deadbeef.h b/deadbeef.h index 10f50422..ffc40608 100644 --- a/deadbeef.h +++ b/deadbeef.h @@ -76,7 +76,7 @@ extern "C" { // 0.1 -- deadbeef-0.2.0 #define DB_API_VERSION_MAJOR 1 -#define DB_API_VERSION_MINOR 1 +#define DB_API_VERSION_MINOR 2 #define DDB_PLUGIN_SET_API_VERSION\ .plugin.api_vmajor = DB_API_VERSION_MAJOR,\ @@ -725,6 +725,17 @@ typedef struct { int (*dsp_preset_load) (const char *fname, struct ddb_dsp_context_s **head); int (*dsp_preset_save) (const char *fname, struct ddb_dsp_context_s *head); void (*dsp_preset_free) (struct ddb_dsp_context_s *head); + + // new 1.2 APIs + ddb_playlist_t *(*plt_alloc) (const char *title); + void (*plt_free) (ddb_playlist_t *plt); + //int (*plt_insert) (ddb_playlist_t *plt, int before); + void (*plt_set_fast_mode) (ddb_playlist_t *plt, int fast); + int (*plt_is_fast_mode) (ddb_playlist_t *plt); + const char * (*metacache_add_string) (const char *str); + void (*metacache_remove_string) (const char *str); + void (*metacache_ref) (const char *str); + void (*metacache_unref) (const char *str); } DB_functions_t; enum { diff --git a/metacache.c b/metacache.c index 84acaa91..13616516 100644 --- a/metacache.c +++ b/metacache.c @@ -114,3 +114,15 @@ metacache_remove_string (const char *str) { chain = chain->next; } } + +void +metacache_ref (const char *str) { + uint32_t *refc = (uint32_t)(str-5); + *refc++; +} + +void +metacache_unref (const char *str) { + uint32_t *refc = (uint32_t *)(str-5); + *refc--; +} diff --git a/metacache.h b/metacache.h index b5187c0f..50c5cb7f 100644 --- a/metacache.h +++ b/metacache.h @@ -25,4 +25,10 @@ metacache_add_string (const char *str); void metacache_remove_string (const char *str); +void +metacache_ref (const char *str); + +void +metacache_unref (const char *str); + #endif diff --git a/playlist.c b/playlist.c index 9aee5540..bd2d1d2e 100644 --- a/playlist.c +++ b/playlist.c @@ -327,6 +327,15 @@ plt_get_sel_count (int plt) { return 0; } +playlist_t * +plt_alloc (const char *title) { + playlist_t *plt = malloc (sizeof (playlist_t)); + memset (plt, 0, sizeof (playlist_t)); + plt->refc = 1; + plt->title = strdup (title); + return plt; +} + int plt_add (int before, const char *title) { assert (before >= 0); @@ -335,10 +344,7 @@ plt_add (int before, const char *title) { fprintf (stderr, "can't create more than 100 playlists. sorry.\n"); return -1; } - playlist_t *plt = malloc (sizeof (playlist_t)); - memset (plt, 0, sizeof (playlist_t)); - plt->refc = 1; - plt->title = strdup (title); + playlist_t *plt = plt_alloc (title); plt_modified (plt); LOCK; @@ -398,7 +404,7 @@ plt_add (int before, const char *title) { conf_save (); messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0); } - return playlists_count-1; + return before; } // NOTE: caller must ensure that configuration is saved after that call @@ -980,7 +986,7 @@ plt_process_cue_track (playlist_t *playlist, playItem_t *after, const char *fnam pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKPEAK, atof (replaygain_track_peak)); } it->_flags |= DDB_IS_SUBTRACK | DDB_TAG_CUESHEET; - after = pl_insert_item (after, it); + after = plt_insert_item (playlist, after, it); pl_item_unref (it); *prev = it; return it; @@ -3897,3 +3903,13 @@ plt_init_shuffle_albums (playlist_t *plt, int r) { } pl_unlock (); } + +void +plt_set_fast_mode (playlist_t *plt, int fast) { + plt->fast_mode = (unsigned)fast; +} + +int +plt_is_fast_mode (playlist_t *plt) { + return plt->fast_mode; +} diff --git a/playlist.h b/playlist.h index 23f74459..2f9a9d6a 100644 --- a/playlist.h +++ b/playlist.h @@ -56,6 +56,7 @@ typedef struct playlist_s { int current_row[PL_MAX_ITERATORS]; // current row (cursor) struct DB_metaInfo_s *meta; // linked list storing metainfo int refc; + unsigned fast_mode : 1; } playlist_t; // global playlist control functions @@ -92,6 +93,9 @@ plt_ref (playlist_t *plt); void plt_unref (playlist_t *plt); +playlist_t * +plt_alloc (const char *title); + void plt_free (playlist_t *plt); @@ -437,4 +441,10 @@ pl_get_playlist (playItem_t *it); void plt_init_shuffle_albums (playlist_t *plt, int r); +void +plt_set_fast_mode (playlist_t *plt, int fast); + +int +plt_is_fast_mode (playlist_t *plt); + #endif // __PLAYLIST_H diff --git a/plugins.c b/plugins.c index 38abace1..23a9a1b1 100644 --- a/plugins.c +++ b/plugins.c @@ -45,6 +45,7 @@ #include "premix.h" #include "dsppreset.h" #include "pltmeta.h" +#include "metacache.h" #define trace(...) { fprintf(stderr, __VA_ARGS__); } //#define trace(fmt,...) @@ -316,7 +317,17 @@ static DB_functions_t deadbeef_api = { // dsp preset management .dsp_preset_load = dsp_preset_load, .dsp_preset_save = dsp_preset_save, - .dsp_preset_free = dsp_preset_free + .dsp_preset_free = dsp_preset_free, + // new 1.2 APIs + .plt_alloc = (ddb_playlist_t *(*)(const char *title))plt_alloc, + .plt_free = (void (*)(ddb_playlist_t *plt))plt_free, + //.plt_insert = plt_insert, + .plt_set_fast_mode = (void (*)(ddb_playlist_t *plt, int fast))plt_set_fast_mode, + .plt_is_fast_mode = (int (*)(ddb_playlist_t *plt))plt_is_fast_mode, + .metacache_add_string = metacache_add_string, + .metacache_remove_string = metacache_remove_string, + .metacache_ref = metacache_ref, + .metacache_unref = metacache_unref, }; DB_functions_t *deadbeef = &deadbeef_api; -- cgit v1.2.3