# HG changeset patch # User nenolod # Date 1147468337 25200 # Node ID aa0559a5fee1a614d1ee929050d8fce12595a48c # Parent c9e641ff4a286ff986043429e8fb8877a4eea2ab [svn] - hackhackhack workaround for the fact that joins will fail at times, inspired by the hackhack in WMA diff -r c9e641ff4a28 -r aa0559a5fee1 Plugins/Input/aac/src/libmp4.c --- a/Plugins/Input/aac/src/libmp4.c Fri May 12 14:03:50 2006 -0700 +++ b/Plugins/Input/aac/src/libmp4.c Fri May 12 14:12:17 2006 -0700 @@ -78,6 +78,7 @@ void audmp4_file_info_box(gchar *); gboolean buffer_playing; +gint doExit; InputPlugin mp4_ip = { @@ -172,6 +173,7 @@ static void mp4_play(char *filename) { buffer_playing = TRUE; + doExit = 0; decodeThread = g_thread_create((GThreadFunc)mp4Decode, g_strdup(filename), TRUE, NULL); return; } @@ -182,6 +184,17 @@ buffer_playing = FALSE; mp4_ip.output->close_audio(); } + + /* + * The problem is, we can't just go try to reap the thread, it probably + * won't work. This hint gives us points where the thread can just quit. + * Which basically serves the same function... + * + * - nenolod + */ + g_static_mutex_lock(&mutex); + doExit = 1; + g_static_mutex_unlock(&mutex); } static int mp4_IsOurFile(char *filename) @@ -420,9 +433,21 @@ /* Finish playing before we close the output. */ while ( mp4_ip.output->buffer_playing() ) { + if (doExit) + { + doExit = 0; + g_thread_exit(NULL); + } + xmms_usleep(10000); } + if (doExit) + { + doExit = 0; + g_thread_exit(NULL); + } + mp4_ip.output->flush(seekPosition*1000); mp4_ip.output->close_audio(); faacDecClose(decoder); @@ -452,6 +477,12 @@ return FALSE; } + if (doExit) + { + doExit = 0; + g_thread_exit(NULL); + } + sampleBuffer= faacDecDecode(decoder, &frameInfo, buffer,