mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +00:00
xmms version 1 player support added
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@500 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
2bb28251ba
commit
aaaa1a0ccc
43
configure.in
43
configure.in
@ -90,17 +90,42 @@ AC_ARG_ENABLE(xmms,
|
||||
|
||||
case x$want_xmms in
|
||||
xauto)
|
||||
want_xmms=no
|
||||
want_xmms=yes
|
||||
## its ok to favor the glib 2.0 headers over 1.2 for our purposes ##
|
||||
PKG_CHECK_MODULES([XMMS], [glib-2.0], [], [PKG_CHECK_MODULES([XMMS], [glib-1.2], [], [want_xmms=no])])
|
||||
|
||||
if test x$want_xmms = xyes; then
|
||||
AC_CHECK_HEADERS([dlfcn.h], [], [want_xmms=no])
|
||||
if test x$want_xmms = xyes; then
|
||||
AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"],
|
||||
[AC_CHECK_FUNCS(dlopen,[],
|
||||
[want_xmms=no])])
|
||||
if test x$want_xmms = xyes; then
|
||||
CFLAGS="$CFLAGS $XMMS_CFLAGS"
|
||||
### do not link to glib 1.2 ###
|
||||
### LIBS="$LIBS $XMMS_LIBS"
|
||||
AC_DEFINE(XMMS, 1, [Define for XMMS Ver. 1 support])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
xyes)
|
||||
echo "Sorry, xmms isn't supported yet"
|
||||
exit -1
|
||||
AC_DEFINE(XMMS, 1, [Define for XMMS Version 1 support])
|
||||
;;
|
||||
## its ok to favor the glib 2.0 headers over 1.2 for our purposes ##
|
||||
PKG_CHECK_MODULES([XMMS], [glib-2.0], [], [PKG_CHECK_MODULES([XMMS], [glib-1.2])])
|
||||
CFLAGS="$CFLAGS $XMMS_CFLAGS"
|
||||
### do not link to glib 1.2 ###
|
||||
### LIBS="$LIBS $XMMS_LIBS" ###
|
||||
AC_CHECK_HEADERS([dlfcn.h], [],
|
||||
[AC_MSG_ERROR(["dlfcn.h not found: dynamic library loading not supported"])])
|
||||
AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"],
|
||||
[AC_CHECK_FUNCS(dlopen,[],
|
||||
[AC_MSG_ERROR([dlopen() not available])])])
|
||||
AC_DEFINE(XMMS, 1, [Define for XMMS Ver. 1 support])
|
||||
;;
|
||||
xno)
|
||||
;;
|
||||
*)
|
||||
echo "Error: invalid bmp parameter specified: $want_bmp"
|
||||
echo "Error: invalid xmms parameter specified: $want_xmms"
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
@ -118,7 +143,7 @@ AC_ARG_ENABLE(bmp,
|
||||
case x$want_bmp in
|
||||
xauto)
|
||||
want_bmp=yes
|
||||
PKG_CHECK_MODULES([BMP], [glib-2.0 >= 2.0], [], [want_bmp=no])
|
||||
PKG_CHECK_MODULES([BMP], [glib-2.0], [], [want_bmp=no])
|
||||
if test x$want_bmp = xyes; then
|
||||
AC_CHECK_HEADERS([dlfcn.h], [], [want_bmp=no])
|
||||
if test x$want_bmp = xyes; then
|
||||
@ -165,7 +190,7 @@ AC_ARG_ENABLE(audacious,
|
||||
case x$want_audacious in
|
||||
xauto)
|
||||
want_audacious=yes
|
||||
PKG_CHECK_MODULES([AUDACIOUS], [glib-2.0 >= 2.0], [], [want_audacious=no])
|
||||
PKG_CHECK_MODULES([AUDACIOUS], [glib-2.0], [], [want_audacious=no])
|
||||
if test x$want_audacious = xyes; then
|
||||
AC_CHECK_HEADERS([dlfcn.h], [], [want_audacious=no])
|
||||
if test x$want_audacious = xyes; then
|
||||
@ -181,7 +206,7 @@ case x$want_audacious in
|
||||
fi
|
||||
;;
|
||||
xyes)
|
||||
PKG_CHECK_MODULES([AUDACIOUS], [glib-2.0 >= 2.0])
|
||||
PKG_CHECK_MODULES([AUDACIOUS], [glib-2.0])
|
||||
CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS"
|
||||
LIBS="$LIBS $AUDACIOUS_LIBS"
|
||||
AC_CHECK_HEADERS([dlfcn.h], [],
|
||||
|
31
src/xmms.c
31
src/xmms.c
@ -99,7 +99,7 @@ int create_xmms_thread(void)
|
||||
{
|
||||
/* Was an an available project requested? */
|
||||
if (!TEST_XMMS_PROJECT_AVAILABLE(info.xmms.project_mask, info.xmms.current_project)) {
|
||||
fprintf(stderr, "xmms_player '%s' not configured\n", xmms_project_name[info.xmms.current_project]);
|
||||
ERR("xmms_player '%s' not configured", xmms_project_name[info.xmms.current_project]);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -182,8 +182,7 @@ void check_dlerror(void)
|
||||
* ------------------------------------------------------------ */
|
||||
void *xmms_thread_func_dynamic(void *pvoid)
|
||||
{
|
||||
void *handle;
|
||||
const char *error;
|
||||
void *handle,*glib_v1_2_handle;
|
||||
int runnable;
|
||||
static xmms_t items;
|
||||
gint session,playpos,frames,length;
|
||||
@ -191,6 +190,7 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
||||
gchar *psong,*pfilename;
|
||||
|
||||
/* Function pointers for the functions we load dynamically */
|
||||
void (*g_free_v1_2)(gpointer mem);
|
||||
gboolean (*xmms_remote_is_running)(gint session);
|
||||
gboolean (*xmms_remote_is_paused)(gint session);
|
||||
gboolean (*xmms_remote_is_playing)(gint session);
|
||||
@ -206,10 +206,25 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
||||
session=0;
|
||||
psong=NULL;
|
||||
pfilename=NULL;
|
||||
handle=NULL;
|
||||
glib_v1_2_handle=NULL;
|
||||
g_free_v1_2=NULL;
|
||||
|
||||
/* If g_char *'s are coming from libglib-1.2.so, we need to free them with the g_free()
|
||||
* function from that library. This macro selects the g_free() from the correct lib. */
|
||||
#define G_FREE(mem) (info.xmms.current_project==PROJECT_XMMS ? (*g_free_v1_2)(mem) : g_free(mem))
|
||||
|
||||
switch(info.xmms.current_project) {
|
||||
|
||||
case (PROJECT_XMMS) :
|
||||
glib_v1_2_handle = dlopen("libglib-1.2.so.0", RTLD_LAZY);
|
||||
if (!glib_v1_2_handle) {
|
||||
ERR("unable to open libglib-1.2.so");
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
g_free_v1_2=dlsym(glib_v1_2_handle, "g_free");
|
||||
check_dlerror();
|
||||
|
||||
handle = dlopen("libxmms.so", RTLD_LAZY);
|
||||
if (!handle) {
|
||||
ERR("unable to open libxmms.so");
|
||||
@ -297,7 +312,7 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
||||
psong = (*xmms_remote_get_playlist_title)(session, playpos);
|
||||
if (psong) {
|
||||
strncpy(items[XMMS_TITLE],psong,sizeof(items[XMMS_TITLE])-1);
|
||||
g_free(psong);
|
||||
G_FREE(psong);
|
||||
psong=NULL;
|
||||
}
|
||||
|
||||
@ -335,7 +350,7 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
||||
pfilename = (*xmms_remote_get_playlist_file)(session,playpos);
|
||||
if (pfilename) {
|
||||
strncpy(items[XMMS_FILENAME],pfilename,sizeof(items[XMMS_FILENAME])-1);
|
||||
g_free(pfilename);
|
||||
G_FREE(pfilename);
|
||||
pfilename=NULL;
|
||||
}
|
||||
|
||||
@ -362,7 +377,11 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
dlclose(handle);
|
||||
if (handle)
|
||||
dlclose(handle);
|
||||
if (glib_v1_2_handle)
|
||||
dlclose(glib_v1_2_handle);
|
||||
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user