mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 12:27:52 +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
41
configure.in
41
configure.in
@ -90,17 +90,42 @@ AC_ARG_ENABLE(xmms,
|
|||||||
|
|
||||||
case x$want_xmms in
|
case x$want_xmms in
|
||||||
xauto)
|
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)
|
xyes)
|
||||||
echo "Sorry, xmms isn't supported yet"
|
## its ok to favor the glib 2.0 headers over 1.2 for our purposes ##
|
||||||
exit -1
|
PKG_CHECK_MODULES([XMMS], [glib-2.0], [], [PKG_CHECK_MODULES([XMMS], [glib-1.2])])
|
||||||
AC_DEFINE(XMMS, 1, [Define for XMMS Version 1 support])
|
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)
|
xno)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Error: invalid bmp parameter specified: $want_bmp"
|
echo "Error: invalid xmms parameter specified: $want_xmms"
|
||||||
exit -1
|
exit -1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -118,7 +143,7 @@ AC_ARG_ENABLE(bmp,
|
|||||||
case x$want_bmp in
|
case x$want_bmp in
|
||||||
xauto)
|
xauto)
|
||||||
want_bmp=yes
|
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
|
if test x$want_bmp = xyes; then
|
||||||
AC_CHECK_HEADERS([dlfcn.h], [], [want_bmp=no])
|
AC_CHECK_HEADERS([dlfcn.h], [], [want_bmp=no])
|
||||||
if test x$want_bmp = xyes; then
|
if test x$want_bmp = xyes; then
|
||||||
@ -165,7 +190,7 @@ AC_ARG_ENABLE(audacious,
|
|||||||
case x$want_audacious in
|
case x$want_audacious in
|
||||||
xauto)
|
xauto)
|
||||||
want_audacious=yes
|
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
|
if test x$want_audacious = xyes; then
|
||||||
AC_CHECK_HEADERS([dlfcn.h], [], [want_audacious=no])
|
AC_CHECK_HEADERS([dlfcn.h], [], [want_audacious=no])
|
||||||
if test x$want_audacious = xyes; then
|
if test x$want_audacious = xyes; then
|
||||||
@ -181,7 +206,7 @@ case x$want_audacious in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
xyes)
|
xyes)
|
||||||
PKG_CHECK_MODULES([AUDACIOUS], [glib-2.0 >= 2.0])
|
PKG_CHECK_MODULES([AUDACIOUS], [glib-2.0])
|
||||||
CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS"
|
CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS"
|
||||||
LIBS="$LIBS $AUDACIOUS_LIBS"
|
LIBS="$LIBS $AUDACIOUS_LIBS"
|
||||||
AC_CHECK_HEADERS([dlfcn.h], [],
|
AC_CHECK_HEADERS([dlfcn.h], [],
|
||||||
|
29
src/xmms.c
29
src/xmms.c
@ -99,7 +99,7 @@ int create_xmms_thread(void)
|
|||||||
{
|
{
|
||||||
/* Was an an available project requested? */
|
/* Was an an available project requested? */
|
||||||
if (!TEST_XMMS_PROJECT_AVAILABLE(info.xmms.project_mask, info.xmms.current_project)) {
|
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);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,8 +182,7 @@ void check_dlerror(void)
|
|||||||
* ------------------------------------------------------------ */
|
* ------------------------------------------------------------ */
|
||||||
void *xmms_thread_func_dynamic(void *pvoid)
|
void *xmms_thread_func_dynamic(void *pvoid)
|
||||||
{
|
{
|
||||||
void *handle;
|
void *handle,*glib_v1_2_handle;
|
||||||
const char *error;
|
|
||||||
int runnable;
|
int runnable;
|
||||||
static xmms_t items;
|
static xmms_t items;
|
||||||
gint session,playpos,frames,length;
|
gint session,playpos,frames,length;
|
||||||
@ -191,6 +190,7 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
|||||||
gchar *psong,*pfilename;
|
gchar *psong,*pfilename;
|
||||||
|
|
||||||
/* Function pointers for the functions we load dynamically */
|
/* 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_running)(gint session);
|
||||||
gboolean (*xmms_remote_is_paused)(gint session);
|
gboolean (*xmms_remote_is_paused)(gint session);
|
||||||
gboolean (*xmms_remote_is_playing)(gint session);
|
gboolean (*xmms_remote_is_playing)(gint session);
|
||||||
@ -206,10 +206,25 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
|||||||
session=0;
|
session=0;
|
||||||
psong=NULL;
|
psong=NULL;
|
||||||
pfilename=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) {
|
switch(info.xmms.current_project) {
|
||||||
|
|
||||||
case (PROJECT_XMMS) :
|
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);
|
handle = dlopen("libxmms.so", RTLD_LAZY);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
ERR("unable to open libxmms.so");
|
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);
|
psong = (*xmms_remote_get_playlist_title)(session, playpos);
|
||||||
if (psong) {
|
if (psong) {
|
||||||
strncpy(items[XMMS_TITLE],psong,sizeof(items[XMMS_TITLE])-1);
|
strncpy(items[XMMS_TITLE],psong,sizeof(items[XMMS_TITLE])-1);
|
||||||
g_free(psong);
|
G_FREE(psong);
|
||||||
psong=NULL;
|
psong=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +350,7 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
|||||||
pfilename = (*xmms_remote_get_playlist_file)(session,playpos);
|
pfilename = (*xmms_remote_get_playlist_file)(session,playpos);
|
||||||
if (pfilename) {
|
if (pfilename) {
|
||||||
strncpy(items[XMMS_FILENAME],pfilename,sizeof(items[XMMS_FILENAME])-1);
|
strncpy(items[XMMS_FILENAME],pfilename,sizeof(items[XMMS_FILENAME])-1);
|
||||||
g_free(pfilename);
|
G_FREE(pfilename);
|
||||||
pfilename=NULL;
|
pfilename=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +377,11 @@ void *xmms_thread_func_dynamic(void *pvoid)
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (handle)
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
|
if (glib_v1_2_handle)
|
||||||
|
dlclose(glib_v1_2_handle);
|
||||||
|
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user