Musepack Forums

Musepack Forums (https://forum.musepack.net/index.php)
-   MPC for UNIX (https://forum.musepack.net/forumdisplay.php?f=9)
-   -   XMMS 1.1.2 plugin on FreeBSD (https://forum.musepack.net/showthread.php?t=168)

Olev 27 March 2005 11:58 pm

XMMS 1.1.2 plugin on FreeBSD
 
libmusepack 0.9.6 and xmms plugin 1.1.1 had no problems workin on FreeBSD 5.3 but then came libmusepack 1.1 and a new xmms plugin version 1.1.2.

There is a port for libmusepack that is the latest 1.1 (more information http://www.freshports.org/audio/libmusepack/) but the xmms plugin in the ports tree is REALLY old http://www.freshports.org/audio/xmms-musepack/. Well I had used xmms plugin with libmusepack 0.9.6 and xmms plugin 1.1 and now that there was a new libmusepack I was off to test xmms plugin 1.1.2 and it did not work. After some debugging it was clear that the problem was threading related, so off I was chatting with my friend who has experiance with FreeBSD and threading issues. So long story short, this patch will enable xmms plugin 1.1.2 be used on Freebsd 5.3 (tested). It fixes iconv problems with bad type casting and increased the stack size (the FORCED_THREAD_STACKSIZE number is not based on any scientific methods, it just works with this ... I bet it will work with a smaller stack size but I did not test when the size gets too small).

To get this to work just install libmusepack from the ports tree and then extract the source for xmms plugin 1.1.2, go to xmms-musepack-1.1.2/src/ copy this patch with some filename there, patch it with "patch <filename" and do a "./configure CFLAGS=-I/usr/local/include" in xmms-musepack-1.1.2/ then "make" and copy xmms-musepack-1.1.2/src/.libs/libmpc.so to /usr/X11R6/lib/xmms/Input

Code:


--- libmpc.cpp.orig        Wed Dec 29 23:20:14 2004

+++ libmpc.cpp        Mon Mar 28 00:40:28 2005

@@ -20,6 +20,10 @@

 #define M_LN10 2.3025850929940456840179914546843642

 #endif

 

+#ifdef __FreeBSD__

+#define FORCED_THREAD_STACKSIZE 1024*1024

+#endif

+

 extern "C" InputPlugin * get_iplugin_info(void);

 static void mpc_load_config();

 static void mpc_configure();

@@ -126,7 +130,7 @@

  char *out = buf;

 

  memset(buf, 0, out_left);

- size_t err = iconv(idesc, &in, &in_left, &out, &out_left);

+ size_t err = iconv(idesc, (const char **)&in, &in_left, &out, &out_left);

  iconv_close(idesc);

  return buf;

 }

@@ -332,11 +336,21 @@

 static void

 mpc_play(char *filename)

 {

+#ifdef __FreeBSD__

+ pthread_attr_t ptattr;

+#endif

+

  paused = 0;

  isSeek = -1;

  killDecodeThread = false;

  AudioError = false;

+#ifdef __FreeBSD__

+ pthread_attr_init(&ptattr);

+ pthread_attr_setstacksize(&ptattr, FORCED_THREAD_STACKSIZE);

+ pthread_create(&thread_handle, &ptattr, DecodeThread, (void *) filename);

+#else

  pthread_create(&thread_handle, NULL, DecodeThread, (void *) filename);

+#endif

  return;

 }

Credits go to hadara and dh (thank you guys).

Lefungus 28 March 2005 05:13 pm

Thanks for the patch.
I thought this bug was fixed though :(


All times are GMT. The time now is 06:15 am.

Powered by vBulletin® Version 3.8.11 Beta 2
Copyright ©2000 - 2020, vBulletin Solutions Inc.