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

Modified Files:
        mplayer.py xine.py 
Log Message:
Plugins now 'rate' if and how good they can play an item. Based on that
a good player will be choosen.


Index: mplayer.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/plugins/mplayer.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** mplayer.py  4 Nov 2003 17:53:23 -0000       1.38
--- mplayer.py  21 Nov 2003 17:56:50 -0000      1.39
***************
*** 10,13 ****
--- 10,17 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.39  2003/11/21 17:56:50  dischi
+ # Plugins now 'rate' if and how good they can play an item. Based on that
+ # a good player will be choosen.
+ #
  # Revision 1.38  2003/11/04 17:53:23  dischi
  # Removed the unstable bmovl part from mplayer.py and made it a plugin.
***************
*** 91,95 ****
  
      With this plugin Freevo can play all video files defined in
!     SUFFIX_VIDEO_FILES. This is the default video player for Freevo.
      """
      def __init__(self):
--- 95,99 ----
  
      With this plugin Freevo can play all video files defined in
!     SUFFIX_VIDEO_MPLAYER_FILES. This is the default video player for Freevo.
      """
      def __init__(self):
***************
*** 117,121 ****
  
          # register it as the object to play audio
!         plugin.register(mplayer, plugin.VIDEO_PLAYER)
  
  
--- 121,129 ----
  
          # register it as the object to play audio
!         plugin.register(mplayer, plugin.VIDEO_PLAYER, True)
! 
!         for i in config.SUFFIX_VIDEO_MPLAYER_FILES:
!             if not i in config.SUFFIX_VIDEO_FILES:
!                 config.SUFFIX_VIDEO_FILES.append(i)
  
  
***************
*** 126,134 ****
      
      def __init__(self, version):
          self.thread = childapp.ChildThread()
          self.thread.stop_osd = True
  
          self.mode = None
-         self.filename = None
          self.app_mode = 'video'
          self.version = version
--- 134,142 ----
      
      def __init__(self, version):
+         self.name = 'mplayer'
          self.thread = childapp.ChildThread()
          self.thread.stop_osd = True
  
          self.mode = None
          self.app_mode = 'video'
          self.version = version
***************
*** 136,166 ****
          self.seek_timer = threading.Timer(0, self.reset_seek)
  
!         
!     def play(self, filename, options, item, mode = None):
          """
          play a videoitem with mplayer
          """
  
!         self.parameter = (filename, options, item, mode)
          
!         if not mode:
!             mode = item.mode
! 
!         # Is the file streamed over the network?
!         if filename.find('://') != -1:
!             # Yes, trust the given mode
!             network_play = 1
!         else:
!             network_play = 0
!            
!         self.filename = filename
!         self.mode     = mode
  
!         _debug_('MPlayer.play(): mode=%s, filename=%s' % (mode, filename))
  
!         if mode == 'file' and not os.path.isfile(filename) and not network_play:
              # This event allows the videoitem which contains subitems to
              # try to play the next subitem
!             return '%s\nnot found' % os.path.basename(filename)
         
  
--- 144,196 ----
          self.seek_timer = threading.Timer(0, self.reset_seek)
  
! 
!     def rate(self, item):
!         """
!         How good can this player play the file:
!         2 = good
!         1 = possible, but not good
!         0 = unplayable
!         """
!         if item.mode == 'dvd' or item.mode == 'vcd':
!             if not item.filename or item.filename == '0':
!                 return 1
!             return 2
!         if os.path.splitext(item.filename)[1][1:].lower() in \
!                config.SUFFIX_VIDEO_MPLAYER_FILES:
!             return 2
!         return 0
!     
!     
!     def play(self, options, item):
          """
          play a videoitem with mplayer
          """
  
!         self.parameter = (options, item)
          
!         mode         = item.mode
!         network_play = item.network_play
!         url          = item.url
!         self.item    = item
  
!         if mode == 'file' and not network_play:
!             url = item.url[6:]
  
!         if url == 'dvd://':
!             url += '1'
!             
!         if url == 'vcd://':
!             c_len = 0
!             for i in range(len(item.info.tracks)):
!                 if item.info.tracks[i].length > c_len:
!                     c_len = item.info.tracks[i].length
!                     url = item.url + str(i+1)
!             
!         _debug_('MPlayer.play(): mode=%s, url=%s' % (mode, url))
!         print network_play
!         if mode == 'file' and not os.path.isfile(url) and not network_play:
              # This event allows the videoitem which contains subitems to
              # try to play the next subitem
!             return '%s\nnot found' % os.path.basename(url)
         
  
***************
*** 173,191 ****
          additional_args = ''
  
!         if mode == 'file':
!             try:
!                 mode = os.path.splitext(filename)[1]
!                 mode = mode[1:]
!             except:
!                 pass
! 
!         elif mode == 'vcd':
!             # Filename is VCD title
!             filename = 'vcd://%s' % filename  
! 
!         elif mode == 'dvd':
!             # Filename is DVD title
!             filename = 'dvd://%s' % filename  
! 
              if config.DVD_LANG_PREF:
                  # There are some bad mastered DVDs out there. E.g. the specials on
--- 203,207 ----
          additional_args = ''
  
!         if mode == 'dvd':
              if config.DVD_LANG_PREF:
                  # There are some bad mastered DVDs out there. E.g. the specials on
***************
*** 203,213 ****
                  additional_args += ' -slang %s' % config.DVD_SUBTITLE_PREF
  
!         else:
!             print "Don't know what do play!"
!             print "What is:      " + str(filename)
!             print "What is mode: " + mode
!             print "What is:      " + mpl
!             return 'Unknown media: %s' % os.path.basename(filename)
  
          if not config.MPLAYER_ARGS.has_key(mode):
              mode = 'default'
--- 219,243 ----
                  additional_args += ' -slang %s' % config.DVD_SUBTITLE_PREF
  
!             additional_args += ' -dvd-device %s' % item.media.devicename
! 
!         if item.media:
!             additional_args += ' -cdrom-device %s ' % item.media.devicename
! 
!         if item.selected_subtitle == -1:
!             additional_args += ' -noautosub'
! 
!         elif item.selected_subtitle and item.mode == 'file':
!             additional_args += ' -vobsubid %s' % item.selected_subtitle
! 
!         elif item.selected_subtitle:
!             additional_args += ' -sid %s' % item.selected_subtitle
!             
!         if item.selected_audio:
!             additional_args += ' -aid %s' % item.selected_audio
! 
!         if item.deinterlace:
!             additional_args += ' -vop pp=fd'
  
+         mode = item.mime_type
          if not config.MPLAYER_ARGS.has_key(mode):
              mode = 'default'
***************
*** 218,222 ****
  
          # make the options a list
!         mpl = mpl.split(' ') + [ filename ] + additional_args.split(' ')
  
          if options:
--- 248,252 ----
  
          # make the options a list
!         mpl = mpl.split(' ') + [ url ] + additional_args.split(' ')
  
          if options:
***************
*** 226,229 ****
--- 256,260 ----
          if '-nosws' in mpl:
              mpl.remove('-nosws')
+ 
          elif not '-framedrop' in mpl:
              mpl += config.MPLAYER_SOFTWARE_SCALER.split(' ')
***************
*** 264,270 ****
              child.wait()
  
-         self.file        = item
-         self.item        = item
- 
          self.plugins = plugin.get('mplayer_video')
  
--- 295,298 ----
***************
*** 338,343 ****
          if event == 'AUDIO_ERROR_START_AGAIN':
              self.stop()
!             self.play(self.parameter[0], self.parameter[1], self.parameter[2],
!                       self.parameter[3])
              return True
          
--- 366,370 ----
          if event == 'AUDIO_ERROR_START_AGAIN':
              self.stop()
!             self.play(self.parameter[0], self.parameter[1])
              return True
          

Index: xine.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/plugins/xine.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** xine.py     9 Nov 2003 12:01:00 -0000       1.20
--- xine.py     21 Nov 2003 17:56:50 -0000      1.21
***************
*** 29,32 ****
--- 29,36 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.21  2003/11/21 17:56:50  dischi
+ # Plugins now 'rate' if and how good they can play an item. Based on that
+ # a good player will be choosen.
+ #
  # Revision 1.20  2003/11/09 12:01:00  dischi
  # add subtitle selection and osd info support for xine (needs current xine-ui cvs
***************
*** 104,108 ****
              config.XINE_COMMAND
          except:
!             print _( 'ERROR' ) + ': ' + _("'XINE_COMMAND' not defined, plugin 'xine' 
deactivated")
              print _( 'please check the xine section in freevo_config.py' )
              return
--- 108,113 ----
              config.XINE_COMMAND
          except:
!             print _( 'ERROR' ) + ': ' + \
!                   _("'XINE_COMMAND' not defined, plugin 'xine' deactivated")
              print _( 'please check the xine section in freevo_config.py' )
              return
***************
*** 135,143 ****
          if xine_version < 922:
              if type == 'fb':
!                 print _( 'ERROR' ) + ': ' + _( "'fbxine' version too old, plugin 
'xine' deactivated" )
                  print _( 'You need software %s' ) % 'xine-ui > 0.9.21'
                  return
!             print _( 'WARNING' ) + ': ' + _( "'xine' version too old, plugin in 
fallback mode" )
!             print _( "You need %s to use all features of the '%s' plugin" ) % ( 
'xine-ui > 0.9.21', 'xine' )
              
          # create the xine object
--- 140,151 ----
          if xine_version < 922:
              if type == 'fb':
!                 print _( 'ERROR' ) + ': ' + \
!                       _( "'fbxine' version too old, plugin 'xine' deactivated" )
                  print _( 'You need software %s' ) % 'xine-ui > 0.9.21'
                  return
!             print _( 'WARNING' ) + ': ' + \
!                   _( "'xine' version too old, plugin in fallback mode" )
!             print _( "You need %s to use all features of the '%s' plugin" ) % \
!                   ( 'xine-ui > 0.9.21', 'xine' )
              
          # create the xine object
***************
*** 145,151 ****
  
          # register it as the object to play
!         plugin.register(xine, plugin.DVD_PLAYER)
!         if config.XINE_USE_VCDNAV:
!             plugin.register(xine, plugin.VCD_PLAYER)
  
  
--- 153,161 ----
  
          # register it as the object to play
!         plugin.register(xine, plugin.VIDEO_PLAYER, True)
! 
!         for i in config.SUFFIX_VIDEO_XINE_FILES:
!             if not i in config.SUFFIX_VIDEO_FILES:
!                 config.SUFFIX_VIDEO_FILES.append(i)
  
  
***************
*** 156,159 ****
--- 166,171 ----
      
      def __init__(self, type, version):
+         self.name = 'xine'
+ 
          # start the thread
          self.thread = childapp.ChildThread()
***************
*** 175,180 ****
          self.command = '%s -V %s -A %s' % (command, config.XINE_VO_DEV, 
config.XINE_AO_DEV)
  
!         
!     def play(self, item):
          """
          play a dvd with xine
--- 187,214 ----
          self.command = '%s -V %s -A %s' % (command, config.XINE_VO_DEV, 
config.XINE_AO_DEV)
  
! 
!     def rate(self, item):
!         """
!         How good can this player play the file:
!         2 = good
!         1 = possible, but not good
!         0 = unplayable
!         """
!         if item.mode == 'dvd':
!             return 2
!         if item.mode == 'vcd':
!             if self.xine_version > 922:
!                 if not item.filename or item.filename == '0':
!                     return 2
!                 return 0
!             else:
!                 return 0
!         if os.path.splitext(item.filename)[1][1:].lower() in \
!                config.SUFFIX_VIDEO_XINE_FILES:
!             return 2
!         return 0
!     
!     
!     def play(self, options, item):
          """
          play a dvd with xine
***************
*** 197,200 ****
--- 231,236 ----
                  command = '%s -D' % command
  
+         command = command.split(' ')
+ 
          self.max_audio = 0
          self.current_audio = -1
***************
*** 211,218 ****
  
          if item.mode == 'dvd':
!             command = '%s dvd://' % command
!         else:
!             command = '%s vcd://%s' % (command, item.media.devicename)
  
          _debug_('Xine.play(): Starting thread, cmd=%s' % command)
  
--- 247,267 ----
  
          if item.mode == 'dvd':
!             # dvd:///dev/dvd/2
!             if not item.filename or item.filename == '0':
!                 track = ''
!             else:
!                 track = item.filename
!             command.append('dvd://%s/%s' % (item.media.devicename, track))
! 
!         elif item.mode == 'vcd':
!             # vcd:///dev/cdrom -- NO track support (?)
!             command.append('vcd://%s' % item.media.devicename)
  
+         elif item.mime_type == 'cue':
+             command.append('vcd://%s' % item.filename)
+ 
+         else:
+             command.append(item.url)
+             
          _debug_('Xine.play(): Starting thread, cmd=%s' % command)
  




-------------------------------------------------------
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