diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-23 16:03:50 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-23 16:03:50 +0100 |
commit | b5ada7e3c038bab1dc0b60a532451c30616e981a (patch) | |
tree | 1a40faefd8f706b7c44c78ae94d71232c84d2162 | |
parent | 0ebcf8bc7dcc9f8e71ce23c608e95e23e77d66c9 (diff) | |
parent | 9be49f3f078dbe9668c8c40b7171a0d039f19682 (diff) |
Merge branch 'master' into devel
Conflicts:
Makefile.am
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | cdumb.c | 6 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | dumb/dumb-kode54/src/it/itrender.c | 3 | ||||
-rw-r--r-- | junklib.c | 7 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | playlist.c | 4 | ||||
-rw-r--r-- | plugins.c | 9 | ||||
-rw-r--r-- | plugins/alsa/alsa.c | 15 | ||||
-rw-r--r-- | plugins/ffap/ffap.c | 2 | ||||
-rw-r--r-- | plugins/ffmpeg/ffmpeg.c | 5 | ||||
-rw-r--r-- | plugins/nullout/nullout.c | 4 | ||||
-rw-r--r-- | plugins/sid/csid.cpp | 4 | ||||
-rw-r--r-- | threading_pthread.c | 16 | ||||
-rw-r--r-- | utf8.c | 2 |
15 files changed, 69 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am index e0b0fa19..10cff95d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -67,7 +67,7 @@ deadbeef_SOURCES =\ sdkdir = $(pkgincludedir) sdk_HEADERS = deadbeef.h -deadbeef_LDADD = $(LDADD) $(DEPS_LIBS) gme/Game_Music_Emu-0.5.2/gme/libgme.a dumb/libdumb.a -lstdc++ +deadbeef_LDADD = $(LDADD) $(DEPS_LIBS) gme/Game_Music_Emu-0.5.2/gme/libgme.a dumb/libdumb.a -lstdc++ -lm AM_CFLAGS = $(DEPS_CFLAGS) -I$(gmepath) -std=c99 AM_CPPFLAGS = $(DEPS_CFLAGS) @@ -694,7 +694,11 @@ static const char *convstr (const char* str, int sz) { cd = iconv_open ("utf8", "utf8"); size_t inbytesleft = sz; size_t outbytesleft = 2047; - char *pin = (char*)str; +#ifdef __linux__ + char *pin = (char*)str; +#else + const char *pin = str; +#endif char *pout = out; memset (out, 0, sizeof (out)); size_t res = iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); diff --git a/configure.ac b/configure.ac index c7b6761d..5c3af914 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,12 @@ PKG_CHECK_MODULES(ALSA_DEPS, alsa, HAVE_ALSA=1, NO_ALSA=1) PKG_CHECK_MODULES(FFMPEG_DEPS, libavcodec >= 51.0.0 libavutil libavformat >= 52.0.0, HAVE_FFMPEG=1, NO_FFMPEG=1) AC_CHECK_LIB([pthread], [main]) AC_CHECK_LIB([dl], [main]) +AC_CHECK_LIB([iconv], [main], [have_iconv=yes], [have_iconv=no]) +if test "x${have_iconv}" = "xyes" ; then +ICONV_LIB="-liconv" + AC_SUBST(ICONV_LIB) + AC_DEFINE(HAVE_LIBICONV,1,[Use libiconv instead of glibc iconv]) +fi AX_CHECK_COMPILER_FLAGS(-msse2, HAVE_SSE2=1, []) if test ${HAVE_SSE2}; then diff --git a/dumb/dumb-kode54/src/it/itrender.c b/dumb/dumb-kode54/src/it/itrender.c index 2b7d29fc..5dd8e4ef 100644 --- a/dumb/dumb-kode54/src/it/itrender.c +++ b/dumb/dumb-kode54/src/it/itrender.c @@ -3537,6 +3537,9 @@ static void process_playing(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playin }
//static float log2(float x) {return (float)log(x)/(float)log(2.0f);}
+#ifndef __linux__
+static inline float log2(float x) {return (float)log(x)/(float)log(2.0f);}
+#endif
static int delta_to_note(float delta, int base)
{
@@ -23,6 +23,13 @@ #include "playlist.h" #include "utf8.h" #include "plugins.h" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#if HAVE_LIBICONV +#define iconv_open libiconv_open +#define iconv_close libiconv_close +#endif //#define trace(...) { fprintf(stderr, __VA_ARGS__); } #define trace(fmt,...) @@ -396,7 +396,9 @@ sigterm_handler (int sig) { int main (int argc, char *argv[]) { srand (time (NULL)); +#ifdef __linux__ prctl (PR_SET_NAME, "deadbeef-main", 0, 0, 0, 0); +#endif char *homedir = getenv ("HOME"); if (!homedir) { fprintf (stderr, "unable to find home directory. stopping.\n"); @@ -26,6 +26,10 @@ #include <unistd.h> #include <assert.h> #include <time.h> +#ifndef __linux__ +#define _POSIX_C_SOURCE +#endif +#include <limits.h> #include "playlist.h" #include "codec.h" #include "streamer.h" @@ -21,7 +21,7 @@ #include <assert.h> #include <stdio.h> #include <stdlib.h> -#include <alloca.h> +//#include <alloca.h> #include <string.h> #ifndef __linux__ #define _POSIX_C_SOURCE @@ -43,6 +43,9 @@ #include "junklib.h" #include "vfs.h" +#define trace(...) { fprintf(stderr, __VA_ARGS__); } +//#define trace(fmt,...) + #ifndef PATH_MAX #define PATH_MAX 1024 /* max # of characters in a path name */ #endif @@ -347,6 +350,9 @@ plug_quit (void) { /////// non-api functions (plugin support) void plug_event_call (DB_event_t *ev) { + if (!mutex) { + trace ("plug: event passed before plugin initialization\n"); + } ev->time = time (NULL); // printf ("plug_event_call enter %d\n", ev->event); mutex_lock (mutex); @@ -464,6 +470,7 @@ plug_load_all (void) { fprintf (stderr, "\033[0;31mDISABLE_VERSIONCHECK=1! do not distribute!\033[0;m\n"); #endif const char *conf_blacklist_plugins = conf_get_str ("blacklist_plugins", ""); + trace ("plug: mutex_create\n"); mutex = mutex_create (); const char *dirname = LIBDIR "/deadbeef"; struct dirent **namelist = NULL; diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 9d6e35d8..e4c6f584 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -29,6 +29,9 @@ static DB_output_t plugin; DB_functions_t *deadbeef; +#define BUFFER_MIN 1024 +#define BUFFER_MAX 4096 + static snd_pcm_t *audio; static int bufsize = -1; static int alsa_terminate; @@ -474,13 +477,13 @@ palsa_thread (void *context) { /* deliver the data */ // FIXME: under some conditions, frames_to_deliver may become huge // like 20M. this case is not handled here. - if (frames_to_deliver < 1024) { - trace ("alsa: frames_to_deliver clipped from %d to 1024\n", frames_to_deliver); - frames_to_deliver = 1024; + if (frames_to_deliver < BUFFER_MIN) { + trace ("alsa: frames_to_deliver clipped from %d to %d\n", frames_to_deliver, BUFFER_MIN); + frames_to_deliver = BUFFER_MIN; } - else if (frames_to_deliver > 2048) { - trace ("alsa: frames_to_deliver clipped from %d to 2048\n", frames_to_deliver); - frames_to_deliver = 2048; + else if (frames_to_deliver > BUFFER_MAX) { + trace ("alsa: frames_to_deliver clipped from %d to %d\n", frames_to_deliver, BUFFER_MAX); + frames_to_deliver = BUFFER_MAX; } char buf[frames_to_deliver*4]; palsa_callback (buf, frames_to_deliver*4); diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c index 6a18ec35..0a4e3276 100644 --- a/plugins/ffap/ffap.c +++ b/plugins/ffap/ffap.c @@ -33,7 +33,7 @@ #include <string.h> #include <limits.h> #include <stdlib.h> -#include <alloca.h> +//#include <alloca.h> #include <assert.h> #include "../../deadbeef.h" diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c index fdfaf840..0aa91527 100644 --- a/plugins/ffmpeg/ffmpeg.c +++ b/plugins/ffmpeg/ffmpeg.c @@ -20,7 +20,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <alloca.h> +//#include <alloca.h> #include <errno.h> #include "../../deadbeef.h" @@ -39,7 +39,10 @@ #include <ffmpeg/avutil.h> #include <ffmpeg/avstring.h> #define AVERROR_EOF AVERROR(EPIPE) + +#if LIBAVFORMAT_VERSION_MAJOR < 53 #define av_register_protocol register_protocol +#endif #endif diff --git a/plugins/nullout/nullout.c b/plugins/nullout/nullout.c index e8da5255..8720de6d 100644 --- a/plugins/nullout/nullout.c +++ b/plugins/nullout/nullout.c @@ -17,7 +17,9 @@ */ #include <stdint.h> #include <unistd.h> +#ifdef __linux__ #include <sys/prctl.h> +#endif #include <stdio.h> #include <string.h> #include "../../deadbeef.h" @@ -164,7 +166,9 @@ pnull_get_endianness (void) { static void pnull_thread (void *context) { +#ifdef __linux__ prctl (PR_SET_NAME, "deadbeef-null", 0, 0, 0, 0); +#endif for (;;) { if (null_terminate) { break; diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp index bb0d4655..74d3423f 100644 --- a/plugins/sid/csid.cpp +++ b/plugins/sid/csid.cpp @@ -406,7 +406,11 @@ convstr (const char* str) { else { size_t inbytesleft = sz; size_t outbytesleft = 2047; +#ifdef __linux__ char *pin = (char*)str; +#else + const char *pin = str; +#endif char *pout = out; memset (out, 0, sizeof (out)); size_t res = iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); diff --git a/threading_pthread.c b/threading_pthread.c index 83341770..29362c9d 100644 --- a/threading_pthread.c +++ b/threading_pthread.c @@ -58,7 +58,7 @@ uintptr_t mutex_create (void) { pthread_mutex_t *mtx = malloc (sizeof (pthread_mutex_t)); if (pthread_mutex_init (mtx, NULL)) { - printf ("pthread_mutex_init failed!\n"); + fprintf (stderr, "pthread_mutex_init failed!\n"); } return (uintptr_t)mtx; } @@ -75,17 +75,21 @@ mutex_free (uintptr_t _mtx) { int mutex_lock (uintptr_t _mtx) { pthread_mutex_t *mtx = (pthread_mutex_t *)_mtx; - if (pthread_mutex_lock (mtx)) { - printf ("pthread_mutex_lock failed\n"); + int err = pthread_mutex_lock (mtx); + if (err < 0) { + fprintf (stderr, "pthread_mutex_lock failed (error %d)\n", err); } + return err; } int mutex_unlock (uintptr_t _mtx) { pthread_mutex_t *mtx = (pthread_mutex_t *)_mtx; - if (pthread_mutex_unlock (mtx)) { - printf ("pthread_mutex_unlock failed\n"); - }; + int err = pthread_mutex_unlock (mtx); + if (err < 0) { + printf ("pthread_mutex_unlock failed (error %d)\n", err); + } + return err; } uintptr_t @@ -23,7 +23,7 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> -#include <alloca.h> +//#include <alloca.h> #include "ctype.h" #include "utf8.h" |