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

Modified Files:
        xine.py 
Log Message:
support different versions of xine, check version at startup

Index: xine.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/plugins/xine.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** xine.py     1 Aug 2003 17:55:45 -0000       1.4
--- xine.py     2 Aug 2003 09:08:14 -0000       1.5
***************
*** 29,32 ****
--- 29,35 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.5  2003/08/02 09:08:14  dischi
+ # support different versions of xine, check version at startup
+ #
  # Revision 1.4  2003/08/01 17:55:45  dischi
  # Make xine_cvs the normal xine plugin. We don't support older versions
***************
*** 65,68 ****
--- 68,72 ----
  import time, os
  import threading, signal
+ import popen2, re
  
  import config     # Configuration handler. reads config file.
***************
*** 88,93 ****
  class PluginInterface(plugin.Plugin):
      """
!     Xine plugin for the video player. Use xine to play all video
!     files.
      """
      def __init__(self, dvd=TRUE, vcd=FALSE):
--- 92,96 ----
  class PluginInterface(plugin.Plugin):
      """
!     Xine plugin for the video player.
      """
      def __init__(self, dvd=TRUE, vcd=FALSE):
***************
*** 96,108 ****
          plugin.Plugin.__init__(self)
  
          try:
              config.XINE_COMMAND
          except:
!             print 'XINE_COMMAND not defined, plugin deactivated'
!             print 'please check the xine section in freevo_config.py'
              return
  
          # create the xine object
!         xine = util.SynchronizedObject(Xine())
  
          # register it as the object to play
--- 99,145 ----
          plugin.Plugin.__init__(self)
  
+         if xine:
+             return
+ 
          try:
              config.XINE_COMMAND
          except:
!             print '\nERROR:\nXINE_COMMAND not defined, plugin deactivated'
!             print 'please check the xine section in freevo_config.py\n'
              return
  
+         if config.XINE_COMMAND.find('fbxine') >= 0:
+             type = 'fb'
+         else:
+             type = 'X'
+ 
+         xine_version = 0
+         xine_cvs     = 0
+         
+         x = popen2.Popen3('%s --version' % config.XINE_COMMAND, 1, 100)
+         while(1):
+             data = x.fromchild.readline()
+             if not data:
+                 break
+             m = re.match('^.* v?([0-9])\.([0-9]+)\.([0-9]*).*', data)
+             if m:
+                 if data.find('cvs') >= 0:
+                     xine_cvs = 1
+                 xine_version =int('%02d%02d%02d' % (int(m.group(1)), int(m.group(2)),
+                                                     int(m.group(3))))
+ 
+         if xine_cvs:
+             xine_version += 1
+             
+         if xine_version < 922:
+             if type == 'fb':
+                 print '\nERROR:\nfbxine version to old, plugin deactivated'
+                 print 'You need xine-ui > 0.9.21\n'
+                 return
+             print '\nWARNING:\nxine version to old, plugin in fallback mode'
+             print 'You need xine-ui > 0.9.21 to use all features of the xine 
plugin\n'
+             
          # create the xine object
!         xine = util.SynchronizedObject(Xine(type, xine_version))
  
          # register it as the object to play
***************
*** 117,121 ****
      """
      
!     def __init__(self):
          self.thread = Xine_Thread()
          self.thread.setDaemon(1)
--- 154,158 ----
      """
      
!     def __init__(self, type, version):
          self.thread = Xine_Thread()
          self.thread.setDaemon(1)
***************
*** 123,127 ****
          self.mode = None
          self.app_mode = ''
!             
      def play(self, item):
          """
--- 160,174 ----
          self.mode = None
          self.app_mode = ''
!         self.xine_type    = type
!         self.xine_version = version
! 
!         command = config.XINE_COMMAND
!         if self.xine_version > 921:
!             if self.xine_type == 'X':
!                 command = '%s --no-splash' % config.XINE_COMMAND
!             command = '%s --no-lirc --stdctl' % command
!         self.command = '%s -V %s -A %s' % (command, config.XINE_VO_DEV, 
config.XINE_AO_DEV)
! 
!         
      def play(self, item):
          """
***************
*** 141,149 ****
          rc.app(self)
  
!         command = '%s -V %s -A %s --no-lirc --stdctl' % \
!                   (config.XINE_COMMAND, config.XINE_VO_DEV, config.XINE_AO_DEV)
! 
          if item.deinterlace:
!             if self.command.find('vidix') > 0 or self.command.find('fbxine') >= 0:
                  command = '%s --post tvtime' % command
              else:
--- 188,196 ----
          rc.app(self)
  
!         command = self.command
!         
          if item.deinterlace:
!             if (config.XINE_VO_DEV == 'vidix' or self.xine_type == 'fb') and \
!                    self.version > 021:
                  command = '%s --post tvtime' % command
              else:
***************
*** 184,187 ****
--- 231,242 ----
          function it will be passed over to the items eventhandler
          """
+         if event in ( PLAY_END, USER_END ):
+             self.stop()
+             return self.item.eventhandler(event)
+ 
+         # fallback for older versions of xine
+         if self.xine_version < 922:
+             return TRUE
+         
          if event == PAUSE or event == PLAY:
              self.thread.app.write('pause\n')
***************
*** 265,269 ****
              else:
                  # bad hack to warp around
!                 if self.command.find('fbxine'):
                      self.thread.app.write('AudioChannelDefault\n')
                      time.sleep(0.1)
--- 320,324 ----
              else:
                  # bad hack to warp around
!                 if self.xine_type == 'fb':
                      self.thread.app.write('AudioChannelDefault\n')
                      time.sleep(0.1)
***************
*** 274,281 ****
              return TRUE
              
-         if event in ( PLAY_END, USER_END ):
-             self.stop()
-             return self.item.eventhandler(event)
- 
          # nothing found? Try the eventhandler of the object who called us
          return self.item.eventhandler(event)
--- 329,332 ----




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to