changeset 1362:f751510a09ff

- Corrected some bugs
author mf0102 <0102@gmx.at>
date Tue, 24 Jul 2007 22:02:17 +0200
parents f8b498451a84 (current diff) 62ba1e18d1bb (diff)
children da987606127e
files src/madplug/plugin.c
diffstat 15 files changed, 83 insertions(+), 132 deletions(-) [+]
line wrap: on
line diff
--- a/src/aac/src/libmp4.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/aac/src/libmp4.c	Tue Jul 24 22:02:17 2007 +0200
@@ -125,7 +125,8 @@
 {
     buffer_playing = TRUE;
     playback->playing = 1; //XXX should acquire lock?
-    decodeThread = g_thread_create((GThreadFunc)mp4_decode, playback, TRUE, NULL);
+    decodeThread = g_thread_self();
+    mp4_decode(playback);
 }
 
 static void mp4_stop(InputPlayback *playback)
@@ -593,8 +594,6 @@
             buffer_playing = FALSE;
             playback->playing = 0;
             g_static_mutex_unlock(&mutex);
-            g_thread_exit(NULL);
-
             return FALSE;
         }
         rc= mp4ff_read_sample(mp4file, mp4track,
@@ -675,7 +674,7 @@
         buffer_playing = FALSE;
         playback->playing = 0;
         g_static_mutex_unlock(&mutex);
-        g_thread_exit(NULL);
+        return;
     }
     if((buffervalid = vfs_fread(streambuffer, 1, BUFFER_SIZE, file))==0){
         g_print("AAC: Error reading file\n");
@@ -684,7 +683,7 @@
         playback->playing = 0;
         faacDecClose(decoder);
         g_static_mutex_unlock(&mutex);
-        g_thread_exit(NULL);
+        return;
     }
     if(!strncmp((char*)streambuffer, "ID3", 3)){
         gint size = 0;
@@ -733,7 +732,7 @@
         buffer_playing = FALSE;
         playback->playing = 0;
         g_static_mutex_unlock(&mutex);
-        g_thread_exit(NULL);
+        return;
     }
 
     mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels);
@@ -827,7 +826,6 @@
     buffer_playing = FALSE;
     playback->playing = 0;
     g_static_mutex_unlock(&mutex);
-    g_thread_exit(NULL);
 }
 
 static void *mp4_decode( void *args )
@@ -848,7 +846,7 @@
     g_static_mutex_unlock(&mutex);
 
     if (mp4fh == NULL)
-        g_thread_exit(NULL);
+        return NULL;
 
     ret = parse_aac_stream(mp4fh);
 
--- a/src/alac/plugin.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/alac/plugin.c	Tue Jul 24 22:02:17 2007 +0200
@@ -179,7 +179,8 @@
     char *filename = data->filename;
     going = 1;
     playback = data;
-    playback_thread = g_thread_create(decode_thread, filename, TRUE, NULL);
+    playback_thread = g_thread_self();
+    decode_thread(filename);
 }
 
 static void stop(InputPlayback * data)
--- a/src/cdaudio-ng/Makefile	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/cdaudio-ng/Makefile	Tue Jul 24 22:02:17 2007 +0200
@@ -10,6 +10,6 @@
 
 OBJECTS = ${SOURCES:.c=.o}
 
-CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CDIO_CFLAGS) $(CDDB_CFLAGS) -I../../intl -I../.. -Wall -g3 -ggdb
+CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CDIO_CFLAGS) $(CDDB_CFLAGS) -I../../intl -I../..
 
 include ../../mk/objective.mk
--- a/src/cdaudio-ng/cdaudio-ng.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/cdaudio-ng/cdaudio-ng.c	Tue Jul 24 22:02:17 2007 +0200
@@ -66,7 +66,8 @@
 static void				cdaudio_get_song_info(gchar *filename, gchar **title, gint *length);
 static TitleInput		*cdaudio_get_song_tuple(gchar *filename);
 
-static void				*dae_playing_thread_core(dae_params_t *pdae_params);
+static TitleInput		*create_tuple_from_trackinfo(char *filename);
+static void				dae_play_loop(dae_params_t *pdae_params);
 static int				calculate_track_length(int startlsn, int endlsn);
 static int				find_trackno_from_filename(char *filename);
 static void				cleanup_on_error();
@@ -475,15 +476,18 @@
 			return;
 		}
 
+		/*
 		if (debug)
 			printf("cdaudio-ng: starting dae thread...\n");
+		*/
 		pdae_params = (dae_params_t *) malloc(sizeof(dae_params_t));
 		pdae_params->startlsn = trackinfo[trackno].startlsn;
 		pdae_params->endlsn = trackinfo[trackno].endlsn;
 		pdae_params->pplayback = pinputplayback;
 		pdae_params->seektime = -1;
 		pdae_params->currlsn = trackinfo[trackno].startlsn;
-		pdae_params->thread = g_thread_create((GThreadFunc) dae_playing_thread_core, pdae_params, TRUE, NULL);
+		pdae_params->thread = g_thread_self();
+		dae_play_loop(pdae_params);
 	}
 	else {
 		if (debug)
@@ -499,17 +503,10 @@
 		}
 	}
 
-	char title[DEF_STRING_LEN];
-
-	if (strlen(trackinfo[trackno].performer) > 0) {
-		strcpy(title, trackinfo[trackno].performer);
-		strcat(title, " - ");
-	}
-	else
-		strcpy(title, "");
-	strcat(title, trackinfo[trackno].name);
+	char *title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(pinputplayback->filename));
 
 	inputplugin.set_info(title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 128000, 44100, 2);
+	free(title);
 }
 
 void cdaudio_stop(InputPlayback *pinputplayback)
@@ -709,17 +706,8 @@
 		printf("cdaudio-ng: cdaudio_get_song_info(\"%s\")\n", filename);
 
 	int trackno = find_trackno_from_filename(filename);
-	char *thetitle = (char *) malloc(DEF_STRING_LEN);
 
-	if (strlen(trackinfo[trackno].performer) > 0) {
-		strcpy(thetitle, trackinfo[trackno].performer);
-		strcat(thetitle, " - ");
-	}
-	else
-		strcpy(thetitle, "");
-	strcat(thetitle, trackinfo[trackno].name);
-
-	*title = thetitle;
+	*title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(filename));
 	*length = calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn);
 }
 
@@ -728,10 +716,17 @@
 	if (debug)
 		printf("cdaudio-ng: cdaudio_get_song_tuple(\"%s\")\n", filename);
 
-	TitleInput *tuple = bmp_title_input_new();
+	return create_tuple_from_trackinfo(filename);
+}
+
+
+	/* auxiliar functions */
 
-		/* return information about the requested track */
+TitleInput *create_tuple_from_trackinfo(char *filename)
+{
+	TitleInput *tuple = bmp_title_input_new();
 	int trackno = find_trackno_from_filename(filename);
+
 	if (trackno < firsttrackno || trackno > lasttrackno)
 		return NULL;
 
@@ -749,15 +744,12 @@
 	return tuple;
 }
 
-
-	/* auxiliar functions */
-
-void *dae_playing_thread_core(dae_params_t *pdae_params)
+void dae_play_loop(dae_params_t *pdae_params)
 {
 	unsigned char *buffer = (unsigned char *) malloc(CDDA_DAE_FRAMES * CDIO_CD_FRAMESIZE_RAW);
 
 	if (debug)
-		printf("cdaudio-ng: dae thread started\n");
+		printf("cdaudio-ng: dae started\n");
 	cdio_lseek(pcdio, pdae_params->startlsn * CDIO_CD_FRAMESIZE_RAW, SEEK_SET);
 
 	gboolean output_paused = FALSE;
@@ -829,7 +821,7 @@
 		pdae_params->currlsn += lsncount;
 	}
 	if (debug)
-		printf("cdaudio-ng: dae thread ended\n");
+		printf("cdaudio-ng: dae ended\n");
 
 	pdae_params->pplayback->playing = FALSE;
 	pdae_params->pplayback->output->close_audio();
@@ -837,9 +829,6 @@
 
 	pdae_params->pplayback->output->close_audio();
 	free(buffer);
-
-	g_thread_exit(NULL);
-	return NULL;
 }
 
 int calculate_track_length(int startlsn, int endlsn)
--- a/src/console/Audacious_Driver.cxx	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/console/Audacious_Driver.cxx	Tue Jul 24 22:02:17 2007 +0200
@@ -310,8 +310,6 @@
 	playback->output->close_audio();
 	console_ip_is_going = 0;
 	g_static_mutex_unlock( &playback_mutex );
-	// TODO: should decode_thread be cleared here?
-	g_thread_exit( NULL );
 	return NULL;
 }
 
@@ -396,7 +394,8 @@
 	
 	pending_seek = -1;
 	console_ip_is_going = 1;
-	decode_thread = g_thread_create( play_loop_track, playback, TRUE, NULL );
+	decode_thread = g_thread_self();
+        play_loop_track( playback );
 }
 
 static void seek( InputPlayback * data, gint time )
--- a/src/flacng/plugin.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/flacng/plugin.c	Tue Jul 24 22:02:17 2007 +0200
@@ -541,8 +541,6 @@
      */
     g_mutex_unlock(flac_pl_mutex);
 
-    g_thread_exit(NULL);
-
     _LEAVE NULL;
 }
 
@@ -600,7 +598,8 @@
 
     flac_ip.set_info(get_title(input->filename, main_info), l, -1, main_info->stream.samplerate, main_info->stream.channels);
 
-    thread = g_thread_create(flac_play_loop, input, TRUE, NULL);
+    thread = g_thread_self();
+    flac_play_loop(input);
 
     _LEAVE;
 }
--- a/src/lastfm/lastfm.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/lastfm/lastfm.c	Tue Jul 24 22:02:17 2007 +0200
@@ -103,7 +103,7 @@
         }
 }
 
-void lastfm_store(gchar *var_name,gchar* var)  /*mowgli storage wrapper, for storing global data*/
+void lastfm_store(gchar * var_name, gchar * var)  /*mowgli storage wrapper, for storing global data*/
 {
         if (mowgli_global_storage_get(var_name))
                 mowgli_global_storage_free(var_name);
@@ -156,40 +156,25 @@
         return g_strdup(strchr(input_string, '=') + 1);
 }
 
-gint lastfm_adjust(LastFM * handle,const gchar * uri)  /*tunes into a channel*/
+static gpointer lastfm_adjust(gpointer uri)  /*tunes into a channel*/
 {
-        gint status, i,ret = LASTFM_ADJUST_FAILED;
         gchar *fetch_url=NULL,
-              *session_id,
-              **split = NULL;
-        GString *res;        
-        session_id=mowgli_global_storage_get("lastfm_session_id");
+              *session_id = g_strdup(mowgli_global_storage_get("lastfm_session_id"));
+        GString *res=NULL;        
         if (!session_id)
         {
 #if DEBUG
                 g_print("LASTFM: (adjust) Adjust failed! Session ID not set.\n");
 #endif
-                return LASTFM_SESSION_MISSING;
+                return NULL ;
         }
-        fetch_url=g_strdup_printf(LASTFM_ADJUST_URL, session_id, uri);
+        fetch_url=g_strdup_printf(LASTFM_ADJUST_URL, session_id, (char*)uri);
         res= g_string_new(NULL);
-        status = lastfm_get_data_from_uri(fetch_url, res);
-
-        if (status == CURLE_OK)
-        {
-                split = g_strsplit(res->str, "\n", 2);
-                for (i = 0; split && split[i]; i++)
-                {
-                        if (g_str_has_prefix(split[i], "response=OK"))
-                                ret = LASTFM_ADJUST_OK;
-                }
-#if DEBUG
-                g_print("LASTFM: (adjust) Adjust to '%s' has completed successfully.\n",uri);
-#endif
-        }
+        lastfm_get_data_from_uri(fetch_url, res);      /*the output doesn't matter*/
         g_string_erase(res, 0, -1);
-        g_strfreev(split);
-        return ret;
+        g_free(session_id);
+        g_free(fetch_url);
+        return NULL ;
 }
 
 gboolean parse_metadata(LastFM * handle,GString * metadata_strings)
@@ -219,11 +204,6 @@
                 g_free(handle->lastfm_album);
                 handle->lastfm_album=NULL;
         }
-        if (handle->lastfm_cover)
-        {
-                g_free(handle->lastfm_cover);
-                handle->lastfm_cover=NULL;
-        }
         if (handle->lastfm_station_name)
         {
                 g_free(handle->lastfm_station_name);
@@ -249,11 +229,11 @@
                         handle->lastfm_title  = parse(split[i],"track=");
 
                 if (g_str_has_prefix(split[i], "album="))
-                        handle->lastfm_album  = parse(split[i],"album=" );
+                        lastfm_store("lastfm_album", parse(split[i],"album=" ));
 
                 if (g_str_has_prefix(split[i], "albumcover_medium="))
-                        handle->lastfm_cover  = parse(split[i],"albumcover_medium=");
-
+                        lastfm_store("lastfm_cover", parse(split[i],"albumcover_medium=")); 
+                        
                 if (g_str_has_prefix(split[i], "station="))
                         handle->lastfm_station_name = parse(split[i],"station=");
 
@@ -281,7 +261,7 @@
         gint status,res=METADATA_FETCH_FAILED;
         if(!handle)
                 return res;
-        handle->lastfm_session_id=mowgli_global_storage_get("lastfm_session_id");
+        handle->lastfm_session_id=g_strdup(mowgli_global_storage_get("lastfm_session_id"));
         if (handle->lastfm_session_id == NULL)
                 return res;  
         uri=g_strdup_printf(LASTFM_METADATA_URL, handle->lastfm_session_id);
@@ -313,6 +293,9 @@
                 err=0;
         gboolean track_end_expected=FALSE,track_beginning=TRUE;
         LastFM *handle = (LastFM *)arg;
+        /*get it right after opened the stream, so it doesnt need the mutex */
+         fetch_metadata(handle); 
+
         /* metadata is fetched 1 second after the stream is opened, 
          * and again after 2 seconds.
          * if metadata was fetched ok i'm waiting for 
@@ -324,16 +307,15 @@
         {
                 if(count%sleep_duration==0)
                 {    
-                        if(t0->tv_usec==-1)
-                                g_get_current_time (t0);
                         g_mutex_lock(metadata_mutex);
                         if(handle==NULL)
                                 break;
+                        if(t0->tv_usec==-1)
+                                g_get_current_time (t0);
 #if DEBUG
                         g_print("LASTFM: (thread) Fetching metadata:\n");
 #endif
                         status=fetch_metadata(handle);
-                        g_mutex_unlock(metadata_mutex);
                         g_get_current_time (t1);
                         if(status==METADATA_FETCH_SUCCEEDED)
                         {        
@@ -401,18 +383,14 @@
 #if DEBUG
                         g_print("LASTFM: (thread) Thread_count: %d\n",thread_count);
                         g_print("LASTFM: (thread) sleepping for %d seconds. ",err? sleep_duration/2 :sleep_duration);
-
-
-                        if((handle!= NULL))
-                                g_print("Track length = %d sec\n",handle->lastfm_duration);
+                        g_print("Track length = %d sec\n",handle->lastfm_duration);
 #endif
-
+                        g_mutex_unlock(metadata_mutex);
                 }
                 sleep(1);
                 count++;
-
         }
-        while ((g_thread_self()==metadata_thread )&& (err<7) && (handle != NULL));
+        while ((g_thread_self()==metadata_thread )&& (err<7));
 
 #if DEBUG
         g_print("LASTFM: (thread) Exiting thread, ID = %p\n", (void *)g_thread_self());
@@ -428,12 +406,11 @@
         handle->lastfm_artist=NULL;
         handle->lastfm_title=NULL;
         handle->lastfm_album=NULL;
-        handle->lastfm_cover=NULL;
         handle->lastfm_session_id=NULL;
         handle->lastfm_mp3_stream_url=NULL;
-        handle->lastfm_station_name=NULL;
+        handle->lastfm_station_name=g_strdup(path);
         int login_count = 0;
-
+        gchar * temp_path=g_strdup(path);
         if(!mowgli_global_storage_get("lastfm_session_id")) /*login only if really needed*/
         {
                 while((login_count++ <= 3)&&(lastfm_login()!= LASTFM_LOGIN_OK))
@@ -445,16 +422,14 @@
                         return NULL;
                 }
         }
-        handle->lastfm_mp3_stream_url = mowgli_global_storage_get("lastfm_stream_uri");
-        handle->proxy_fd = vfs_fopen(handle->lastfm_mp3_stream_url, mode);
-
-        handle->lastfm_session_id = mowgli_global_storage_get("lastfm_session_id");
-        lastfm_adjust(handle,path);
-        file->handle = handle;
+        handle->lastfm_session_id = g_strdup(mowgli_global_storage_get("lastfm_session_id"));
+        handle->lastfm_mp3_stream_url = g_strdup(mowgli_global_storage_get("lastfm_stream_uri"));
         g_get_current_time(t0);
+        g_thread_create(lastfm_adjust,temp_path,FALSE,NULL);
         metadata_thread = g_thread_create(lastfm_metadata_thread_func, handle, FALSE, NULL);
         thread_count++;
-        fetch_metadata(handle);
+        handle->proxy_fd = vfs_fopen(handle->lastfm_mp3_stream_url, mode);
+        file->handle = handle;
 #if DEBUG
         g_print("LASTFM: (fopen) Thread_count: %d\n",thread_count);
 #endif
@@ -473,7 +448,7 @@
                 ret = vfs_fclose(handle->proxy_fd);
                 if (!ret)
                         handle->proxy_fd = NULL;
-                g_free(handle);
+                g_free(file->handle);
                 file->handle = NULL;
                 g_mutex_unlock(metadata_mutex);
         }
@@ -501,7 +476,6 @@
 gint lastfm_vfs_ungetc_impl(gint c, VFSFile * stream)
 {
         LastFM *handle = stream->handle;
-
         return vfs_ungetc(c, handle->proxy_fd);
 }
 
@@ -541,7 +515,11 @@
 
 gchar *lastfm_vfs_metadata_impl(VFSFile * file, const gchar * field)
 {
-        LastFM *handle = file->handle;
+        LastFM * handle;
+        if(file->handle!= NULL)
+                handle = file->handle;
+        else 
+                return NULL;
 
         if (!g_ascii_strncasecmp(field, "stream-name", 11) && (handle->lastfm_station_name != NULL))
                 return g_strdup_printf("last.fm radio: %s", handle->lastfm_station_name);
@@ -577,8 +555,6 @@
                 metadata_mutex = g_mutex_new ();
         t0=g_new0(GTimeVal,1);
         t1=g_new0(GTimeVal,1);
-
-
 }
 
 static void cleanup(void)
--- a/src/madplug/decoder.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/madplug/decoder.c	Tue Jul 24 22:02:17 2007 +0200
@@ -711,6 +711,5 @@
     g_mutex_lock(mad_mutex);
     info->playback->playing = 0;
     g_mutex_unlock(mad_mutex);
-    g_thread_exit(0);
     return NULL; /* dummy */
 }
--- a/src/madplug/plugin.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/madplug/plugin.c	Tue Jul 24 22:02:17 2007 +0200
@@ -468,7 +468,8 @@
     info.playback->playing = 1;
     g_mutex_unlock(pb_mutex);
 
-    decode_thread = g_thread_create(decode_loop, (void *) &info, TRUE, NULL);
+    decode_thread = g_thread_self();
+    decode_loop(&info);
 }
 
 static void audmad_pause(InputPlayback *playback, short paused)
--- a/src/metronom/metronom.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/metronom/metronom.c	Tue Jul 24 22:02:17 2007 +0200
@@ -150,7 +150,6 @@
 	/* Make sure the output plugin stops prebuffering */
 	playback->output->buffer_free();
 	playback->output->buffer_free();
-	g_thread_exit(NULL);
 }
 
 static void metronom_play(InputPlayback *playback)
@@ -199,7 +198,8 @@
 	metronom_ip.set_info(name, -1, 16 * 44100, 44100, 1);
 	g_free(name);
 	playback->data = pmetronom;
-	play_thread = g_thread_create((GThreadFunc)play_loop, playback, TRUE, NULL);
+	play_thread = g_thread_self();
+	play_loop(playback);
 }
 
 static void metronom_stop(InputPlayback *playback)
--- a/src/modplug/modplugbmp.cxx	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/modplug/modplugbmp.cxx	Tue Jul 24 22:02:17 2007 +0200
@@ -221,12 +221,6 @@
 	return false;
 }
 
-void* ModplugXMMS::PlayThread(void* arg)
-{
-	((ModplugXMMS*)arg)->PlayLoop();
-	return NULL;
-}
-
 void ModplugXMMS::PlayLoop()
 {
 	uint32 lLength;
@@ -316,8 +310,6 @@
 
 	mPaused = false;
 	mStopped = true;
-
-	g_thread_exit(NULL);
 }
 
 void ModplugXMMS::PlayFile(const string& aFilename)
@@ -453,12 +445,8 @@
 		mModProps.mChannels
 	);
 
-	mDecodeThread = g_thread_create(
-		(GThreadFunc)PlayThread,
-		this,
-		TRUE,
-		NULL
-	);
+	mDecodeThread = g_thread_self();
+	this->PlayLoop();
 }
 
 void ModplugXMMS::Stop(void)
--- a/src/musepack/libmpc.cxx	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/musepack/libmpc.cxx	Tue Jul 24 22:02:17 2007 +0200
@@ -304,7 +304,8 @@
     mpcDecoder.isAlive  = true;
     mpcDecoder.isOutput = false;
     mpcDecoder.isPause  = false;
-    threadHandle = g_thread_create(GThreadFunc(decodeStream), (void *) g_strdup(data->filename), TRUE, NULL);
+    threadHandle = g_thread_self();
+    decodeStream((void *) g_strdup(data->filename));
 }
 
 static void mpcStop(InputPlayback *data)
@@ -763,7 +764,6 @@
         free(track.display);
         track.display = NULL;
     }
-    g_thread_exit(NULL);
     return 0;
 }
 
--- a/src/sexypsf/plugin.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/sexypsf/plugin.c	Tue Jul 24 22:02:17 2007 +0200
@@ -53,7 +53,6 @@
     return 0;
 }
 
-
 void sexypsf_update(unsigned char *buffer, long count)
 {
     const int mask = ~((((16 / 8) * 2)) - 1);
@@ -157,8 +156,8 @@
         g_free(name);
 
         playing = 1;
-        dethread = g_thread_create((GThreadFunc)sexypsf_playloop,
-                                   NULL, TRUE, NULL);
+        dethread = g_thread_self();
+        sexypsf_playloop(NULL);
     }
 }
 
--- a/src/vorbis/vorbis.c	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/vorbis/vorbis.c	Tue Jul 24 22:02:17 2007 +0200
@@ -583,7 +583,8 @@
     playback->eof = 0;
     playback->error = FALSE;
 
-    thread = g_thread_create(vorbis_play_loop, playback, TRUE, NULL);
+    thread = g_thread_self();
+    vorbis_play_loop(playback);
 }
 
 static void
--- a/src/wavpack/libwavpack.cxx	Tue Jul 24 21:50:17 2007 +0200
+++ b/src/wavpack/libwavpack.cxx	Tue Jul 24 22:02:17 2007 +0200
@@ -349,7 +349,8 @@
     isSeek = -1;
     killDecodeThread = false;
     AudioError = false;
-    thread_handle = g_thread_create(DecodeThread, (void *) data->filename, TRUE, NULL);
+    thread_handle = g_thread_self();
+    DecodeThread((void *) data->filename);
     return;
 }