changeset 8536:ff192e1b018f

xmp hangign I noticed too, and is fixed with this patch, seeking works now witch xmp too. patch by Balatoni Denes <pnis@coder.hu>
author arpi
date Mon, 23 Dec 2002 12:09:31 +0000
parents bc7bd163fff9
children e9304bd973f8
files libmpdemux/demux_xmms.c
diffstat 1 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_xmms.c	Mon Dec 23 01:54:58 2002 +0000
+++ b/libmpdemux/demux_xmms.c	Mon Dec 23 12:09:31 2002 +0000
@@ -38,6 +38,7 @@
 static int xmms_length;
 static char *xmms_title=NULL;
 static uint32_t xmms_audiopos=0;
+static int xmms_playing=0;
 
 static uint64_t written = 0;
 
@@ -140,9 +141,13 @@
 //static void input_update_vis(gint time){}
 //static gchar *input_get_info_text(void){return NULL;}
 static void input_set_info_text(char * text){}
-static void input_set_info(char* ha,int a, int b, int c, int d){};
+
 /* Dummy functions  END*/
 
+static void input_set_info(char* title,int length, int rate, int freq, int nch){
+    xmms_length=length;
+}
+
 static void init_plugins(){
     DIR *dir;
     struct dirent *ent;
@@ -226,12 +231,11 @@
   sh_audio->ds = demuxer->audio;
 
   xmms_output_plugin.init();
+  ip->output = &xmms_output_plugin;
+  ip->play_file(demuxer->stream->url);
+  xmms_playing=1;
   ip->get_song_info(demuxer->stream->url,&xmms_title,&xmms_length);
   if (xmms_length<=0) demuxer->seekable=0;
-//  printf("XMMS song title='%s' length=%d\n",xmms_title,xmms_length);
-//  input_play(demuxer->stream->url);
-  ip->output = &xmms_output_plugin;
-  ip->play_file(demuxer->stream->url);
 
   mp_msg(MSGT_DEMUX,MSGL_INFO,"Waiting for the XMMS plugin to start playback of '%s'...\n",demuxer->stream->url);
   while (xmms_channels==0) {
@@ -263,9 +267,15 @@
   sh_audio_t *sh_audio = demuxer->audio->sh;
   xmms_priv_t *priv=demuxer->priv;
   demux_packet_t*  dp;
+  
+  if (xmms_length<=0) demuxer->seekable=0;
+  else demuxer->seekable=1;
 
   while (xmms_audiopos<XMMS_PACKETSIZE/2) {
-    if(priv->ip->get_time()<0) return 0;
+    if((priv->ip->get_time()<0) || !xmms_playing) {
+	xmms_audiopos=0;  // xmp on exit waits until buffer is freed somewhat
+	return 0;
+    }
     usleep(1000);    
   }
 
@@ -307,6 +317,7 @@
 
 int demux_close_xmms(demuxer_t* demuxer) {
   xmms_priv_t *priv=demuxer->priv;
+  xmms_playing=0;
   priv->ip->stop();
   free(priv); demuxer->priv=NULL;
   cleanup_plugins();