changeset 1390:095595555e7b

Fix WMA playback.
author William Pitcock <nenolod@atheme-project.org>
date Fri, 27 Jul 2007 16:20:08 -0500
parents 85ffec632924
children 58f74efbe943
files src/wma/wma.c
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/wma/wma.c	Wed Jul 25 16:48:53 2007 -0500
+++ b/src/wma/wma.c	Fri Jul 27 16:20:08 2007 -0500
@@ -364,8 +364,8 @@
     AVPacket pkt;
     
     g_static_mutex_lock(&wma_mutex);
-    while(wma_decode){
-
+    while(playback->playing)
+    {
 	if(wma_seekpos != -1)
 	{
 	    av_seek_frame(ic, wma_idx, wma_seekpos * 1000000LL);
@@ -394,8 +394,7 @@
             if(pkt.data) av_free_packet(&pkt);
         }
     }
-    while(wma_decode && playback->output->buffer_playing()) xmms_usleep(30000);
-    wma_decode = 0;
+    while(playback->playing && playback->output->buffer_playing()) xmms_usleep(30000);
     playback->playing = 0;
     if(wma_s_outbuf) g_free(wma_s_outbuf);
     if(wma_outbuf) g_free(wma_outbuf);
@@ -403,7 +402,6 @@
     if(c) avcodec_close(c);
     if(ic) av_close_input_file(ic);
     g_static_mutex_unlock(&wma_mutex);
-    g_thread_exit(NULL);
     return(NULL);
 }
 
@@ -412,7 +410,7 @@
     char *filename = playback->filename;
     AVCodec *codec;
     
-    if(av_open_input_file(&ic, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return;
+    if(av_open_input_file(&ic, filename, NULL, 0, NULL) < 0) return;
 
     for(wma_idx = 0; wma_idx < ic->nb_streams; wma_idx++) {
         c = &ic->streams[wma_idx]->codec;
@@ -443,7 +441,8 @@
     wma_seekpos = -1;
     wma_decode = 1;
     playback->playing = 1;
-    wma_decode_thread = g_thread_create((GThreadFunc)wma_play_loop, playback, TRUE, NULL);
+    wma_decode_thread = g_thread_self();
+    wma_play_loop(playback);
 }
 
 static void wma_stop(InputPlayback *playback)