Update of /cvsroot/freevo/freevo/src/video/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7878/plugins

Modified Files:
        mplayer.py 
Log Message:
bmovl updates, remove mplayer 0.90 support

Index: mplayer.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/plugins/mplayer.py,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -d -r1.87 -r1.88
*** mplayer.py  13 Sep 2004 19:40:02 -0000      1.87
--- mplayer.py  14 Sep 2004 20:05:44 -0000      1.88
***************
*** 5,13 ****
  # $Id$
  #
! # Notes:
! # Todo:        
  #
  # -----------------------------------------------------------------------
  # $Log$
  # Revision 1.87  2004/09/13 19:40:02  dischi
  # fix non vobsub subtitle handling
--- 5,17 ----
  # $Id$
  #
! # Notes: 
! #
! # Todo:  Copy some stuff in an application for mplayer video and tv      
  #
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.88  2004/09/14 20:05:44  dischi
+ # bmovl updates, remove mplayer 0.90 support
+ #
  # Revision 1.87  2004/09/13 19:40:02  dischi
  # fix non vobsub subtitle handling
***************
*** 78,126 ****
      """
      def __init__(self):
!         mplayer_version = 0
! 
!         # Detect version of mplayer. Possible values are
!         # 0.9 (for 0.9.x series), 1.0 (for 1.0preX series) and 9999 for cvs
!         if not hasattr(config, 'MPLAYER_VERSION'):
!             child = popen2.Popen3( "%s -v" % config.MPLAYER_CMD, 1, 100)
!             data  = True
!             while data:
!                 data = child.fromchild.readline()
!                 if data:
!                     res = re.search( "^MPlayer (?P<version>\S+)", data )
!                     if res:
!                         data = res
!                         break
! 
!             if data:                
!                 _debug_("MPlayer version is: %s" % data.group( "version" ))
!                 data = data.group( "version" )
!                 if data[ 0 ] == "1":
!                     config.MPLAYER_VERSION = 1.0
!                 elif data[ 0 ] == "0":
!                     config.MPLAYER_VERSION = 0.9
!                 elif data[ 0 : 7 ] == "dev-CVS":
!                     config.MPLAYER_VERSION = 9999
!             else:
!                 config.MPLAYER_VERSION = None
!             _debug_("MPlayer version set to: %s" % config.MPLAYER_VERSION)
!             child.wait()
  
-         if not config.MPLAYER_VERSION:
-             print
-             print 'Failed to detect mplayer version. Please set MPLAYER_VERSION in 
your'
-             print 'local_conf.py to 0.9  (for 0.9.x series), 1.0 (for 1.0preX 
series)'
-             print 'or 9999 for cvs.'
-             print
-             self.reason = 'failed to detect mplayer version'
-             return
-         
          # create plugin structure
          plugin.Plugin.__init__(self)
  
          # register mplayer as the object to play video
!         plugin.register(MPlayer(config.MPLAYER_VERSION), plugin.VIDEO_PLAYER, True)
! 
! 
  
  
--- 82,94 ----
      """
      def __init__(self):
!         # XXX Removed the version detection code. Mplayer 0.90 is too old,
!         # XXX even the mplayer people don't support it anymore. 
!         # XXX Removing the check also removes some strange startup problems
  
          # create plugin structure
          plugin.Plugin.__init__(self)
  
          # register mplayer as the object to play video
!         plugin.register(MPlayer(), plugin.VIDEO_PLAYER, True)
  
  
***************
*** 130,134 ****
      the main class to control mplayer
      """
!     def __init__(self, version):
          """
          init the mplayer object
--- 98,102 ----
      the main class to control mplayer
      """
!     def __init__(self):
          """
          init the mplayer object
***************
*** 136,144 ****
          Application.__init__(self, 'mplayer', 'video', True)
          self.name       = 'mplayer'
-         self.version    = version
          self.seek       = 0
          self.app        = None
          self.plugins    = []
          self.hide_osd_cb = False
  
      def rate(self, item):
--- 104,112 ----
          Application.__init__(self, 'mplayer', 'video', True)
          self.name       = 'mplayer'
          self.seek       = 0
          self.app        = None
          self.plugins    = []
          self.hide_osd_cb = False
+         self.use_bmovl  = True
  
      def rate(self, item):
***************
*** 211,219 ****
          if mode == 'dvd':
              if config.DVD_LANG_PREF:
!                 # There are some bad mastered DVDs out there. E.g. the specials on
!                 # the German Babylon 5 Season 2 disc claim they have more than one
!                 # audio track, even more then on en. But only the second en works,
!                 # mplayer needs to be started without -alang to find the track
!                 if hasattr(item, 'mplayer_audio_broken') and 
item.mplayer_audio_broken:
                      print '*** dvd audio broken, try without alang ***'
                  else:
--- 179,189 ----
          if mode == 'dvd':
              if config.DVD_LANG_PREF:
!                 # There are some bad mastered DVDs out there. E.g. the specials
!                 # on the German Babylon 5 Season 2 disc claim they have more
!                 # than one audio track, even more then on en. But only the
!                 # second on works, mplayer needs to be started without -alang
!                 # to find the track
!                 if hasattr(item, 'mplayer_audio_broken') and \
!                        item.mplayer_audio_broken:
                      print '*** dvd audio broken, try without alang ***'
                  else:
***************
*** 250,258 ****
              additional_args += [ '-aid', str(item.selected_audio) ]
  
!         if self.version >= 1 and item['deinterlace']:
!             additional_args += [ '-vf',  'pp=de/fd' ]
!         elif item['deinterlace']:
!             additional_args += [ '-vop', 'pp=fd' ]
!         elif self.version >= 1:
              additional_args += [ '-vf',  'pp=de' ]
                  
--- 220,226 ----
              additional_args += [ '-aid', str(item.selected_audio) ]
  
!         if item['deinterlace']:
!             additional_args += [ '-vf-pre',  'pp=de/fd' ]
!         else:
              additional_args += [ '-vf',  'pp=de' ]
                  
***************
*** 280,284 ****
              command += options
  
!         # use software scaler?
          if '-nosws' in command:
              command.remove('-nosws')
--- 248,254 ----
              command += options
  
!         # Use software scaler? If not, we also deactivate
!         # bmovl because resizing doesn't work
!         self.use_bmovl = False
          if '-nosws' in command:
              command.remove('-nosws')
***************
*** 286,289 ****
--- 256,260 ----
          elif not '-framedrop' in command:
              command += config.MPLAYER_SOFTWARE_SCALER.split(' ')
+             self.use_bmovl = True
  
          # correct avi delay based on mmpython settings
***************
*** 297,307 ****
  
          # autocrop
!         if config.MPLAYER_AUTOCROP and str(' ').join(command).find('crop=') == -1:
              _debug_('starting autocrop')
              (x1, y1, x2, y2) = (1000, 1000, 0, 0)
!             crop_cmd = command[1:] + ['-ao', 'null', '-vo', 'null', '-ss', '60',
!                                       '-frames', '20', '-vop', 'cropdetect' ]
!             child = popen2.Popen3(self.sort_filter(crop_cmd), 1, 100)
!             exp = re.compile('^.*-vop crop=([0-9]*):([0-9]*):([0-9]*):([0-9]*).*')
              while(1):
                  data = child.fromchild.readline()
--- 268,281 ----
  
          # autocrop
!         if config.MPLAYER_AUTOCROP and \
!                str(' ').join(command).find('crop=') == -1:
              _debug_('starting autocrop')
              (x1, y1, x2, y2) = (1000, 1000, 0, 0)
!             crop_cmd = command[1:] + ['-ao', 'null', '-vo', 'null', '-ss',
!                                       '60', '-frames', '20', '-vf',
!                                       'cropdetect' ]
!             child = popen2.Popen3(self.vf_chain(crop_cmd), 1, 100)
!             crop = '^.*-vf crop=([0-9]*):([0-9]*):([0-9]*):([0-9]*).*'
!             exp = re.compile(crop)
              while(1):
                  data = child.fromchild.readline()
***************
*** 316,320 ****
          
              if x1 < 1000 and x2 < 1000:
!                 command = command + [ '-vop' , 'crop=%s:%s:%s:%s' % (x2-x1, y2-y1, 
x1, y1) ]
              
              child.wait()
--- 290,295 ----
          
              if x1 < 1000 and x2 < 1000:
!                 command = command + [ '-vf' , 'crop=%s:%s:%s:%s' % \
!                                       (x2-x1, y2-y1, x1, y1) ]
              
              child.wait()
***************
*** 330,338 ****
              command += ['-audiofile', f]
  
!         if config.MPLAYER_BMOVL2_POSSIBLE:
!             self.overlay = MPlayerOverlay()
!             command += [ '-vf', 'bmovl2=%s' % self.overlay.fifo_fname ]
!         else:
!             command += [ '-vf', 'bmovl=1:0:/tmp/bmovl' ]
  
          self.plugins = plugin.get('mplayer_video')
--- 305,316 ----
              command += ['-audiofile', f]
  
!         if self.use_bmovl:
!             if config.MPLAYER_BMOVL2_POSSIBLE:
!                 self.overlay = MPlayerOverlay()
!                 command += [ '-vf', 'bmovl2=%s' % self.overlay.fifo_fname ]
!             else:
!                 if not os.path.exists('/tmp/bmovl-%s' % os.getpid()):
!                     os.mkfifo('/tmp/bmovl-%s' % os.getpid())
!                 command += [ '-vf', 'bmovl=1:0:/tmp/bmovl-%s' % os.getpid() ]
  
          self.plugins = plugin.get('mplayer_video')
***************
*** 341,350 ****
              command = p.play(command, self)
  
!         command=self.sort_filter(command)
  
          if plugin.getbyname('MIXER'):
              plugin.getbyname('MIXER').reset()
  
-         
          self.app = MPlayerApp(command, self)
          self.osd_visible = False
--- 319,327 ----
              command = p.play(command, self)
  
!         command=self.vf_chain(command)
  
          if plugin.getbyname('MIXER'):
              plugin.getbyname('MIXER').reset()
  
          self.app = MPlayerApp(command, self)
          self.osd_visible = False
***************
*** 365,368 ****
--- 342,347 ----
          self.app.stop('quit\n')
          self.app = None
+         if os.path.exists('/tmp/bmovl-%s' % os.getpid()):
+             os.unlink('/tmp/bmovl-%s' % os.getpid())
  
  
***************
*** 411,422 ****
  
          if event == TOGGLE_OSD:
              self.osd_visible = not self.osd_visible
              if self.osd_visible:
-                 #plugin.getbyname('idlebar').show()
                  self.app.area_handler.display_style['video'] = 1
                  self.app.area_handler.draw(self.item)
                  self.app.area_handler.show()
              else:
-                 #plugin.getbyname('idlebar').hide()
                  self.app.area_handler.hide()
                  gui.get_display().update()
--- 390,408 ----
  
          if event == TOGGLE_OSD:
+             if not self.use_bmovl:
+                 # We don't use bmovl so we use the normal mplayer osd
+                 self.app.write('osd\n')
+                 return True
+ 
+             if not self.app.area_handler:
+                 # Bmovl not ready yet
+                 return True
+             
              self.osd_visible = not self.osd_visible
              if self.osd_visible:
                  self.app.area_handler.display_style['video'] = 1
                  self.app.area_handler.draw(self.item)
                  self.app.area_handler.show()
              else:
                  self.app.area_handler.hide()
                  gui.get_display().update()
***************
*** 430,434 ****
  
          if event == SEEK:
!             if event.arg > 0 and self.item_length != -1 and 
self.dynamic_seek_control:
                  # check if the file is growing
                  if self.item_info.get_endpos() == self.item_length:
--- 416,421 ----
  
          if event == SEEK:
!             if event.arg > 0 and self.item_length != -1 and \
!                    self.dynamic_seek_control:
                  # check if the file is growing
                  if self.item_info.get_endpos() == self.item_length:
***************
*** 445,461 ****
  
                  # check if seek is allowed
!                 if self.item_length <= self.item.elapsed + event.arg + 
seek_safety_time:
                      # get new length
                      self.item_length = self.item_info.get_endpos()
                      
                  # check again if seek is allowed
!                 if self.item_length <= self.item.elapsed + event.arg + 
seek_safety_time:
                      _debug_('unable to seek %s secs at time %s, length %s' % \
                              (event.arg, self.item.elapsed, self.item_length))
-                     # FIXME:
-                     # self.app.write('osd_show_text "%s"\n' % _('Seeking not 
possible'))
                      return False
                  
!             if not self.osd_visible:
                  if self.hide_osd_cb:
                      rc.unregister(self.hide_osd)
--- 432,448 ----
  
                  # check if seek is allowed
!                 if self.item_length <= self.item.elapsed + event.arg + \
!                        seek_safety_time:
                      # get new length
                      self.item_length = self.item_info.get_endpos()
                      
                  # check again if seek is allowed
!                 if self.item_length <= self.item.elapsed + event.arg + \
!                        seek_safety_time:
                      _debug_('unable to seek %s secs at time %s, length %s' % \
                              (event.arg, self.item.elapsed, self.item_length))
                      return False
                  
!             if self.use_bmovl and not self.osd_visible:
                  if self.hide_osd_cb:
                      rc.unregister(self.hide_osd)
***************
*** 473,499 ****
  
  
!     def sort_filter(self, command):
          """
!         Change a mplayer command to support more than one -vop
!         parameter. This function will grep all -vop parameter from
!         the command and add it at the end as one vop argument
          """
          ret = []
!         vop = ''
!         next_is_vop = False
!     
          for arg in command:
!             if next_is_vop:
!                 vop += ',%s' % arg
!                 next_is_vop = False
              elif (arg == '-vop' or arg == '-vf'):
!                 next_is_vop=True
              else:
!                 ret += [ arg ]
! 
!         if vop:
!             if self.version >= 1:
!                 return ret + [ '-vf', vop[1:] ]
!             return ret + [ '-vop', vop[1:] ]
          return ret
  
--- 460,482 ----
  
  
!     def vf_chain(self, command):
          """
!         Change a mplayer command to support more than one -vf
!         parameter. This function will grep all -vf parameter from
!         the command and add it at the end as one vf argument
          """
          ret = []
!         vf = ''
!         next_is_vf = False
          for arg in command:
!             if next_is_vf:
!                 vf += ',%s' % arg
!                 next_is_vf = False
              elif (arg == '-vop' or arg == '-vf'):
!                 next_is_vf=True
              else:
!                 ret.append(arg)
!         if vf:
!             return ret + [ '-vf-add', vf[1:] ]
          return ret
  
***************
*** 508,513 ****
          Area.__init__(self, 'content')
          self.content = []
!         self.bar_border   = gui.theme_engine.Rectangle(bgcolor=(255, 255, 255, 95), 
radius=4)
!         self.bar_position = gui.theme_engine.Rectangle(bgcolor=(0, 0, 150), radius=4)
          self.bar          = None
          self.last_width   = 0
--- 491,497 ----
          Area.__init__(self, 'content')
          self.content = []
!         Rectangle = gui.theme_engine.Rectangle
!         self.bar_border   = Rectangle(bgcolor=(255, 255, 255, 95), radius=4)
!         self.bar_position = Rectangle(bgcolor=(0, 0, 150), radius=4)
          self.bar          = None
          self.last_width   = 0
***************
*** 532,547 ****
          content = self.calc_geometry(self.layout.content, copy_object=True)
  
!         if self.last_layout != (content.x, content.y, content.width, content.height):
!             _debug_('layout change')
              for c in self.content:
                  c.unparent()
              self.content = []
!             self.last_layout = content.x, content.y, content.width, content.height
              self.last_width = 0
              
          if not self.content:
!             self.content.append(self.drawbox(content.x, content.y, content.width,
!                                              content.height, self.bar_border))
! 
          try:
              length = int(self.infoitem.info['length'])
--- 516,532 ----
          content = self.calc_geometry(self.layout.content, copy_object=True)
  
!         if self.last_layout != (content.x, content.y, content.width,
!                                 content.height):
              for c in self.content:
                  c.unparent()
              self.content = []
!             self.last_layout = content.x, content.y, content.width, \
!                                content.height
              self.last_width = 0
              
          if not self.content:
!             self.content.append(self.drawbox(content.x, content.y,
!                                              content.width, content.height,
!                                              self.bar_border))
          try:
              length = int(self.infoitem.info['length'])
***************
*** 591,595 ****
          # DVD items also store mplayer_audio_broken to check if you can
          # start them with -alang or not
!         if hasattr(self.item, 'mplayer_audio_broken') or self.item.mode != 'dvd':
              self.check_audio = 0
          else:
--- 576,581 ----
          # DVD items also store mplayer_audio_broken to check if you can
          # start them with -alang or not
!         if hasattr(self.item, 'mplayer_audio_broken') or \
!                self.item.mode != 'dvd':
              self.check_audio = 0
          else:
***************
*** 643,647 ****
          self.area_handler = gui.AreaHandler('video', ['screen', 'view', 'info',
                                                        Progressbar()])
-         self.area_handler.screen.frames_per_fade = 10
          self.area_handler.hide(False)
          self.area_handler.draw(self.item)
--- 629,632 ----
***************
*** 668,674 ****
          #         self.osd.clearscreen(self.osd.COL_BLACK)
          #         self.osd.drawstringframed(line, config.OSD_OVERSCAN_X+10,
!         #                                   config.OSD_OVERSCAN_Y+10,
!         #                                   self.osd.width - 2 * 
(config.OSD_OVERSCAN_X+10),
!         #                                   -1, self.osdfont, self.osd.COL_WHITE)
          #         self.osd.update()
  
--- 653,659 ----
          #         self.osd.clearscreen(self.osd.COL_BLACK)
          #         self.osd.drawstringframed(line, config.OSD_OVERSCAN_X+10,
!         #              config.OSD_OVERSCAN_Y+10,
!         #              self.osd.width - 2 * (config.OSD_OVERSCAN_X+10),
!         #              -1, self.osdfont, self.osd.COL_WHITE)
          #         self.osd.update()
  



-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to