# HG changeset patch # User William Pitcock # Date 1192780743 18000 # Node ID 2f0a350c0f7834281033958f1d96043c1934d37e # Parent 9084e2e05f4acbb1fa92348ba7e5132e9a64ab30 port to Audacious 1.4 component API. diff -r 9084e2e05f4a -r 2f0a350c0f78 src/jack/jack.c --- a/src/jack/jack.c Tue Oct 16 02:06:46 2007 -0500 +++ b/src/jack/jack.c Fri Oct 19 02:59:03 2007 -0500 @@ -6,6 +6,7 @@ * This code maps xmms calls into the jack translation library */ +#include #include #include #include @@ -15,7 +16,6 @@ #include "config.h" #include "bio2jack.h" /* includes for the bio2jack library */ #include "jack.h" -#include "xconvert.h" /* xmms rate conversion header file */ #include @@ -58,12 +58,6 @@ static convert_freq_func_t freq_convert; /* rate convert function */ static struct xmms_convert_buffers *convertb; /* convert buffer */ -#define MAKE_FUNCPTR(f) static typeof(f) * fp_##f = NULL; -MAKE_FUNCPTR(xmms_convert_buffers_new); -MAKE_FUNCPTR(xmms_convert_buffers_destroy); -MAKE_FUNCPTR(xmms_convert_get_frequency_func); -void *xmmslibhandle; /* handle to the dlopen'ed libxmms.so */ - static int isXmmsFrequencyAvailable = 0; static gboolean output_opened; /* true if we have a connection to jack */ @@ -88,8 +82,7 @@ /* only clean this up if we have the function to call */ if(isXmmsFrequencyAvailable) { - fp_xmms_convert_buffers_destroy(convertb); /* clean up the rate conversion buffers */ - dlclose(xmmslibhandle); + aud_convert_buffers_destroy(convertb); /* clean up the rate conversion buffers */ } return; @@ -234,52 +227,13 @@ /* set the port connection mode */ jack_set_port_connection_mode(); - /* XXX unportable to 2.x */ - xmmslibhandle = dlopen("libaudacious.so", RTLD_NOW); - if(xmmslibhandle) - { - fp_xmms_convert_buffers_new = dlsym(xmmslibhandle, "xmms_convert_buffers_new"); - fp_xmms_convert_buffers_destroy = dlsym(xmmslibhandle, "xmms_convert_buffers_destroy"); - fp_xmms_convert_get_frequency_func = dlsym(xmmslibhandle, "xmms_convert_get_frequency_func"); - - if(!fp_xmms_convert_buffers_new) - { - TRACE("fp_xmms_convert_buffers_new couldn't be dlsym'ed\n"); - TRACE("dlerror: %s\n", dlerror()); - } - - if(!fp_xmms_convert_buffers_destroy) - { - TRACE("fp_xmms_convert_buffers_destroy couldn't be dlsym'ed\n"); - TRACE("dlerror: %s\n", dlerror()); - } - - if(!fp_xmms_convert_get_frequency_func) - { - TRACE("fp_xmms_get_frequency_func couldn't be dlsym'ed\n"); - TRACE("dlerror: %s\n", dlerror()); - } - - if(!fp_xmms_convert_buffers_new || !fp_xmms_convert_buffers_destroy || - !fp_xmms_convert_get_frequency_func) - { - dlclose(xmmslibhandle); /* close the library, no need to keep it open */ - TRACE("One or more frequency convertion functions are missing, upgrade to xmms >=1.2.8\n"); - } else - { - TRACE("Found frequency convertion functions, setting isXmmsFrequencyAvailable to 1\n"); - isXmmsFrequencyAvailable = 1; - } - } else - { - TRACE("unable to dlopen '%s'\n", "libaudacious.so"); - } + isXmmsFrequencyAvailable = 1; /* only initialize this stuff if we have the functions available */ if(isXmmsFrequencyAvailable) { - convertb = fp_xmms_convert_buffers_new (); - freq_convert = fp_xmms_convert_get_frequency_func(FMT_S16_LE, 2); + convertb = aud_convert_buffers_new (); + freq_convert = aud_convert_get_frequency_func(FMT_S16_LE, 2); } output_opened = FALSE; diff -r 9084e2e05f4a -r 2f0a350c0f78 src/jack/xconvert.h --- a/src/jack/xconvert.h Tue Oct 16 02:06:46 2007 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2003 Haavard Kvaalen - * - * Licensed under GNU LGPL version 2. - */ - - - -#include - -void convert_free_buffer(void); - -struct xmms_convert_buffers; - -struct xmms_convert_buffers* xmms_convert_buffers_new(void); -/* - * Free the data assosiated with the buffers, without destroying the - * context. The context can be reused. - */ -void xmms_convert_buffers_free(struct xmms_convert_buffers* buf); -void xmms_convert_buffers_destroy(struct xmms_convert_buffers* buf); - - -typedef int (*convert_func_t)(struct xmms_convert_buffers* buf, void **data, int length); -typedef int (*convert_channel_func_t)(struct xmms_convert_buffers* buf, void **data, int length); -typedef int (*convert_freq_func_t)(struct xmms_convert_buffers* buf, void **data, int length, int ifreq, int ofreq); - - -convert_func_t xmms_convert_get_func(AFormat output, AFormat input); -convert_channel_func_t xmms_convert_get_channel_func(AFormat fmt, int output, int input); -convert_freq_func_t xmms_convert_get_frequency_func(AFormat fmt, int channels);