Update of /cvsroot/freevo/freevo/src/gui/displays
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29181/displays
Modified Files:
bmovl.py
Log Message:
o make it possible to use bmovl as primary display:
- use util.popen and not childapp to avoid circular imports
- start mplayer without audio
o make it possible to start the display without knowing the size
Index: bmovl.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/displays/bmovl.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** bmovl.py 5 Dec 2004 13:01:10 -0000 1.7
--- bmovl.py 18 Dec 2004 13:33:27 -0000 1.8
***************
*** 1,36 ****
# -*- coding: iso-8859-1 -*-
! # -----------------------------------------------------------------------
# bmovl.py - Bmovl output display over mplayer
! # -----------------------------------------------------------------------
# $Id$
#
! # Note: This output plugin is work in progress
! #
! # -----------------------------------------------------------------------
! # $Log$
! # Revision 1.7 2004/12/05 13:01:10 dischi
! # delete old tv variables, rename some and fix detection
! #
! # Revision 1.6 2004/11/20 18:23:01 dischi
! # use python logger module for debug
! #
! # Revision 1.5 2004/10/06 19:14:36 dischi
! # use new childapp interface
! #
! # Revision 1.4 2004/08/23 20:33:39 dischi
! # smaller bugfixes, restart has some problems
! #
! # Revision 1.3 2004/08/23 14:29:46 dischi
! # displays have information about animation support now
! #
! # Revision 1.2 2004/08/23 12:36:50 dischi
! # cleanup, add doc
! #
! #
! # -----------------------------------------------------------------------
#
# Freevo - A Home Theater PC framework
#
! # Copyright (C) 2002 Krister Lagerstrom, et al.
#
# This program is free software; you can redistribute it and/or modify
--- 1,22 ----
# -*- coding: iso-8859-1 -*-
! #
-----------------------------------------------------------------------------
# bmovl.py - Bmovl output display over mplayer
! #
-----------------------------------------------------------------------------
# $Id$
#
! # This file defines a Freevo display using mplayer and the bmovl filter.
! # It is based on bmovlcanvas from mevas and adds the basic functions Freevo
! # needs. When used as primary display, a background mplayer will be started.
! # The fifo communication is wrapped around a non blocking version for
! # pyNotifier.
#
+ #
-----------------------------------------------------------------------------
# Freevo - A Home Theater PC framework
+ # Copyright (C) 2002-2004 Krister Lagerstrom, Dirk Meyer, et al.
#
! # First Edition: Dirk Meyer <[EMAIL PROTECTED]>
! # Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
! #
! # Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
***************
*** 48,66 ****
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
! # ----------------------------------------------------------------------
# python imports
! import os
# mevas imports
- import mevas
from mevas.displays.bmovlcanvas import BmovlCanvas
# freevo imports
import config
! import logging
log = logging.getLogger('gui')
class Display(BmovlCanvas):
"""
--- 34,56 ----
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
! #
-----------------------------------------------------------------------------
!
! __all__ = [ 'Display' ]
# python imports
! import logging
# mevas imports
from mevas.displays.bmovlcanvas import BmovlCanvas
# freevo imports
import config
+ import util.popen
+ import util.fsocket
! # the logging object
log = logging.getLogger('gui')
+
class Display(BmovlCanvas):
"""
***************
*** 70,86 ****
self.animation_possible = False
self.start_video = default
if default:
! print
! print 'Activating skin bmovl output'
! print 'THIS IS A TEST, DO NOT USE ANYTHING EXCEPT MENUS'
! print
! self.mplayer_args = "-subfont-text-scale 15 -sws 2 -vf
scale=%s:-2,"\
! "expand=%s:%s,bmovl=1:0:/tmp/bmovl-%s "\
! "-loop 0 -font /usr/share/mplayer/fonts/"\
! "font-arial-28-iso-8859-2/font.desc" % \
! ( config.CONF.width, config.CONF.width,
! config.CONF.height, os.getpid() )
! if not os.path.exists('/tmp/bmovl-%s' % os.getpid()):
! os.mkfifo('/tmp/bmovl-%s' % os.getpid())
self.child = None
self.restart()
--- 60,71 ----
self.animation_possible = False
self.start_video = default
+ self.running = True
if default:
! self.cmd = [ config.MPLAYER_CMD, "-loop", "0", "-vf",
! "scale=%s:-2,expand=%s:%s,bmovl=1:0:%s"\
! % ( config.CONF.width, config.CONF.width,
! config.CONF.height, self.get_fname() ),
! '-vo', config.MPLAYER_VO_DEV, '-ao', 'null',
! config.OSD_BACKGROUND_VIDEO ]
self.child = None
self.restart()
***************
*** 93,106 ****
make the canvas work.
"""
if self.start_video and not self.child:
! import childapp
! arg = [config.MPLAYER_CMD] + self.mplayer_args.split(' ') + \
! [config.OSD_BACKGROUND_VIDEO]
! self.child = childapp.Instance( arg, stop_osd = 0 )
if hasattr(self, 'fifo') and not self.fifo:
! self.fifo = os.open('/tmp/bmovl-%s' % os.getpid(),
os.O_WRONLY)
log.info('rebuild bmovl')
self.rebuild()
def stop(self):
"""
--- 78,115 ----
make the canvas work.
"""
+ if not self.running:
+ self.thaw()
+ self.running = True
if self.start_video and not self.child:
! self.child = util.popen.Process( self.cmd )
! self.child.stdout.close()
! self.child.stderr.close()
if hasattr(self, 'fifo') and not self.fifo:
! # this is a previous working display
! self.open_fifo()
log.info('rebuild bmovl')
self.rebuild()
+
+ def open_fifo(self):
+ """
+ Create and open the fifo and create notifier aware fd wrapper
+ """
+ BmovlCanvas.open_fifo(self)
+ self.nbsocket = util.fsocket.Socket(self.fifo)
+ self.send = self.nbsocket.write
+
+
+ def close_fifo(self):
+ """
+ Close and remove the fifo
+ """
+ if self.nbsocket:
+ self.nbsocket.close()
+ self.nbsocket = None
+ self.send = None
+ BmovlCanvas.close_fifo(self)
+
+
def stop(self):
"""
***************
*** 110,121 ****
self.child.stop('quit')
self.child = None
! if not self.fifo:
! return
! try:
! os.close(self.fifo)
! except (IOError, OSError):
! print 'IOError on bmovl.fifo'
! self.fifo = None
!
def hide(self):
"""
--- 119,128 ----
self.child.stop('quit')
self.child = None
! self.close_fifo()
! if self.running:
! self.freeze()
! self.running = False
!
!
def hide(self):
"""
***************
*** 132,135 ****
"""
self.restart()
-
-
--- 139,140 ----
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog