Author: remi
Date: 2009-09-22 11:22:12 +0200 (Tue, 22 Sep 2009)
New Revision: 5474

Modified:
   
software_suite_v3/smart-core/smart-server/trunk/util/player/mplayer/Mplayer.py
Log:
* Added mms format support
* Improved radio stream stability

Modified: 
software_suite_v3/smart-core/smart-server/trunk/util/player/mplayer/Mplayer.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/util/player/mplayer/Mplayer.py  
    2009-09-22 07:46:26 UTC (rev 5473)
+++ 
software_suite_v3/smart-core/smart-server/trunk/util/player/mplayer/Mplayer.py  
    2009-09-22 09:22:12 UTC (rev 5474)
@@ -148,12 +148,11 @@
             "-slave",
             "-ao",
             self.__device,
-            #"-nocache",
             "-playlist",
             uri,
         ]
         if uri.lower().find(".m3u") == -1:
-            if uri.lower().find("http") == 0:
+            if (uri.lower().find("http") == 0) or (uri.lower().find("mms") == 
0):
                 cmd.pop(4)
         try:
             self.__process = subprocess.Popen(
@@ -171,39 +170,9 @@
             try:
                 buffer = self.__process.stdout.read(100)
             except:
-                buffer = ""
-            if len(buffer) == 0:
-                pass
-                # No data from mplayer indicates that the program is closed.
-                # Then stop the module.
-                #if self.onStreamLoosedCallback != None:
-                #    self.onStreamLoosedCallback()
-                #self.stop()
-            else:
-                buffer = buffer.replace("\r", "\n")
-                buffer = incompleteLine + buffer
-                bufferLines = buffer.split("\n")
-                if len(bufferLines) == 1:
-                    incompleteLine = bufferLines[0]
-                else:
-                    incompleteLine = bufferLines[-1]
-                    for line in bufferLines[:-1]:
-                        line = line[:-1]
-                        if len(line) == 0:
-                            continue
-                        if line[0] == "A":
-                            matchedIdx = line.rfind("%")
-                            if matchedIdx != -1:
-                                bs = line[matchedIdx - 2 : matchedIdx]
-                                try:
-                                    audioBufferState = int(bs)
-                                except:
-                                    continue
-                                if audioBufferState < 5:
-                                    # Audio buffer is underflow.
-                                    # Then restart the module.
-                                    #print "BUFFER UNDERFLOW"
-                                    self.restart()
+                time.sleep(0.1)
+                self.stop()
+                break
 
     # 
--------------------------------------------------------------------------
     # Send a command to mplayer.


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to