From b756d6ba938a24f8615af9ba07ecb3dbe5e36f0e Mon Sep 17 00:00:00 2001 From: Michael Schwendt Date: Nov 17 2009 11:49:41 +0000 Subject: - More cleanup in musepack plugin. --- diff --git a/audacious-plugins-1.5.1-musepack.patch b/audacious-plugins-1.5.1-musepack.patch index 54efb7e..7947c50 100644 --- a/audacious-plugins-1.5.1-musepack.patch +++ b/audacious-plugins-1.5.1-musepack.patch @@ -1,23 +1,27 @@ -diff -Nur audacious-plugins-fedora-1.5.1-orig/src/musepack/libmpc.cxx audacious-plugins-1.5.1-musepack/src/musepack/libmpc.cxx +diff -Nur audacious-plugins-fedora-1.5.1-orig/src/musepack/libmpc.cxx audacious-plugins-fedora-1.5.1-musepack/src/musepack/libmpc.cxx --- audacious-plugins-fedora-1.5.1-orig/src/musepack/libmpc.cxx 2008-06-08 10:37:44.000000000 +0200 -+++ audacious-plugins-1.5.1-musepack/src/musepack/libmpc.cxx 2009-11-13 17:28:25.000000000 +0100 -@@ -52,7 +52,6 @@ ++++ audacious-plugins-fedora-1.5.1-musepack/src/musepack/libmpc.cxx 2009-11-17 12:43:47.459927692 +0100 +@@ -52,8 +52,7 @@ static MpcDecoder mpcDecoder = {0}; static TrackInfo track = {0}; -static GThread *threadHandle; - GStaticMutex threadMutex = G_STATIC_MUTEX_INIT; +-GStaticMutex threadMutex = G_STATIC_MUTEX_INIT; ++/* GStaticMutex threadMutex = G_STATIC_MUTEX_INIT; */ /* -@@ -305,7 +304,6 @@ + * VFS callback implementation, adapted from mpc_reader.c. +@@ -305,24 +304,21 @@ mpcDecoder.isAlive = true; mpcDecoder.isOutput = false; mpcDecoder.isPause = false; - threadHandle = g_thread_self(); ++ data->playing = TRUE; data->set_pb_ready(data); decodeStream(data); ++ data->playing = FALSE; } -@@ -313,16 +311,12 @@ + static void mpcStop(InputPlayback *data) { setAlive(false); @@ -34,25 +38,58 @@ diff -Nur audacious-plugins-fedora-1.5.1-orig/src/musepack/libmpc.cxx audacious- } static void mpcPause(InputPlayback *data, short p_Pause) -@@ -837,8 +831,7 @@ +@@ -827,7 +823,7 @@ + lockRelease(); + + gint counter = 2 * track.sampleFreq / 3; +- while (isAlive()) ++ while (isAlive() && data->playing) + { + if (getOffset() != -1) + { +@@ -836,18 +832,19 @@ + } lockAcquire(); - short iPlaying = MpcPlugin.output->buffer_playing()? 1 : 0; +- short iPlaying = MpcPlugin.output->buffer_playing()? 1 : 0; - gint iFree = MpcPlugin.output->buffer_free(); - if (!mpcDecoder.isPause && iFree >= ((1152 * 4) << iPlaying)) + if (!mpcDecoder.isPause) { - unsigned status = processBuffer(data, sampleBuffer, xmmsBuffer, decoder); - if (status == (unsigned) (-1)) -@@ -864,7 +857,6 @@ - else - { +- unsigned status = processBuffer(data, sampleBuffer, xmmsBuffer, decoder); +- if (status == (unsigned) (-1)) ++ guint status = processBuffer(data, sampleBuffer, xmmsBuffer, decoder); ++ if (status == (guint)(-1)) + { + mpcDecoder.isError = g_strdup_printf("[xmms-musepack] error from internal decoder on %s", filename); + return endThread(filename, input, true); + } +- if (status == 0 && iPlaying == 0) ++ if (status == 0) { ++ data->eof = TRUE; ++ data->playing = FALSE; + return endThread(filename, input, true); ++ } + lockRelease(); -- g_usleep(10000); - } - } + +@@ -870,13 +867,13 @@ return endThread(filename, input, false); -@@ -915,12 +907,12 @@ + } + +-static int processBuffer(InputPlayback *playback, ++static gint processBuffer(InputPlayback *playback, + MPC_SAMPLE_FORMAT* sampleBuffer, char* xmmsBuffer, mpc_decoder& decoder) + { + mpc_uint32_t vbrAcc = 0; + mpc_uint32_t vbrUpd = 0; + +- unsigned status = mpc_decoder_decode(&decoder, sampleBuffer, &vbrAcc, &vbrUpd); ++ guint status = mpc_decoder_decode(&decoder, sampleBuffer, &vbrAcc, &vbrUpd); + copyBuffer(sampleBuffer, xmmsBuffer, status); + + if (pluginConfig.dynamicBitrate) +@@ -915,12 +912,12 @@ inline static void lockAcquire() { @@ -67,3 +104,15 @@ diff -Nur audacious-plugins-fedora-1.5.1-orig/src/musepack/libmpc.cxx audacious- } inline static bool isAlive() +diff -Nur audacious-plugins-fedora-1.5.1-orig/src/musepack/libmpc.h audacious-plugins-fedora-1.5.1-musepack/src/musepack/libmpc.h +--- audacious-plugins-fedora-1.5.1-orig/src/musepack/libmpc.h 2008-06-08 10:37:44.000000000 +0200 ++++ audacious-plugins-fedora-1.5.1-musepack/src/musepack/libmpc.h 2009-11-17 12:42:28.035927069 +0100 +@@ -123,7 +123,7 @@ + static void lockAcquire(); + static void lockRelease(); + static void* decodeStream(InputPlayback*); +-static int processBuffer(InputPlayback*, MPC_SAMPLE_FORMAT*, char*, mpc_decoder&); ++static guint processBuffer(InputPlayback*, MPC_SAMPLE_FORMAT*, char*, mpc_decoder&); + //static void* endThread(char*, FILE*, bool); + static bool isAlive(); + static void setAlive(bool); diff --git a/audacious-plugins.spec b/audacious-plugins.spec index e760343..fbedc0a 100644 --- a/audacious-plugins.spec +++ b/audacious-plugins.spec @@ -4,7 +4,7 @@ Name: audacious-plugins Version: 1.5.1 -Release: 16%{?dist} +Release: 17%{?dist} Summary: Plugins for the Audacious media player Group: Applications/Multimedia @@ -287,6 +287,9 @@ update-desktop-database &> /dev/null || : %changelog +* Tue Nov 17 2009 Michael Schwendt - 1.5.1-17 +- More cleanup in musepack plugin. + * Fri Nov 13 2009 Michael Schwendt - 1.5.1-16 - Patch musepack plugin to remove old cruft and fix playback. - Patch modplug plugin to remove old cruft and fix playback.