Update of /cvsroot/freevo/freevo/src/tv/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv8863

Modified Files:
        mplayer.py 
Log Message:
convert to new thread system

Index: mplayer.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/plugins/mplayer.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** mplayer.py  12 Oct 2003 09:54:27 -0000      1.21
--- mplayer.py  28 Oct 2003 16:08:14 -0000      1.22
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.22  2003/10/28 16:08:14  mikeruelle
+ # convert to new thread system
+ #
  # Revision 1.21  2003/10/12 09:54:27  dischi
  # BSD patches from Lars
***************
*** 96,106 ****
      
      def __init__(self):
!         self.thread = MPlayer_Thread()
!         self.thread.setDaemon(1)
!         self.thread.start()
          self.tuner_chidx = 0    # Current channel, index into config.TV_CHANNELS
          self.app_mode = 'tv'
  
- 
      def TunerSetChannel(self, tuner_channel):
          for pos in range(len(config.TV_CHANNELS)):
--- 99,107 ----
      
      def __init__(self):
!         self.thread = childapp.ChildThread()
!         self.thread.stop_osd = True
          self.tuner_chidx = 0    # Current channel, index into config.TV_CHANNELS
          self.app_mode = 'tv'
  
      def TunerSetChannel(self, tuner_channel):
          for pos in range(len(config.TV_CHANNELS)):
***************
*** 239,245 ****
  
          # Start up the TV task
!         self.thread.mode = 'play'
!         self.thread.command = command
!         self.thread.mode_flag.set()
          
          self.prev_app = rc.app()
--- 240,244 ----
  
          # Start up the TV task
!         self.thread.start(MPlayerApp, (command))        
          
          self.prev_app = rc.app()
***************
*** 274,279 ****
              mixer.setIgainVolume(0) # Input on emu10k cards.
  
!         self.thread.mode = 'stop'
!         self.thread.mode_flag.set()
  
          rc.app(self.prev_app)
--- 273,277 ----
              mixer.setIgainVolume(0) # Input on emu10k cards.
  
!         self.thread.stop('quit\n')
  
          rc.app(self.prev_app)
***************
*** 281,286 ****
              osd.focused_app().show()
  
-         while self.thread.mode == 'stop':
-             time.sleep(0.05)
          print 'stopped %s app' % self.mode
          if os.path.exists('/tmp/freevo.wid'): os.unlink('/tmp/freevo.wid')
--- 279,282 ----
***************
*** 385,437 ****
              except ValueError:
                  pass # File closed
- 
- 
- # ======================================================================
- class MPlayer_Thread(threading.Thread):
- 
-     def __init__(self):
-         threading.Thread.__init__(self)
-         
-         self.mode      = 'idle'
-         self.mode_flag = threading.Event()
-         self.command   = ''
-         self.app       = None
-         self.audioinfo = None              # Added to enable update of GUI
- 
-     def run(self):
-         while 1:
-             if self.mode == 'idle':
-                 self.mode_flag.wait()
-                 self.mode_flag.clear()
-                 
-             elif self.mode == 'play':
-                 if config.STOP_OSD_WHEN_PLAYING:
-                     osd.stopdisplay()                 
- 
-                 if DEBUG:
-                     print 'MPlayer_Thread.run(): Started, cmd=%s' % self.command
-                     
-                 self.app = MPlayerApp(self.command)
-                 
-                 while self.mode == 'play' and self.app.isAlive():
-                     if self.audioinfo: 
-                         if not self.audioinfo.pause:
-                             self.audioinfo.draw()        
-                     time.sleep(0.1)
- 
-                 self.app.kill()
- 
-                 # Ok, we can use the OSD again.
-                 if config.STOP_OSD_WHEN_PLAYING:
-                     osd.restartdisplay()
-                     osd.update()
- 
-                 if self.mode == 'play':
-                     if DEBUG: print 'posting play_end'
-                     rc.post_event(em.PLAY_END)
- 
-                 self.mode = 'idle'
-                 
-             else:
-                 self.mode = 'idle'
- 
--- 381,382 ----




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to