Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with the 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 import os 23 24 from twisted.internet import defer 25 26 from flumotion.common import log 27 28 from flumotion.component import feedcomponent 29 from flumotion.component.converters.overlay import genimg 30 31 import tempfile 3234 checkTimestamp = True 35 checkOffset = True 36 _filename = None 379539 # due to createComponent entry pointism, we have to import inside our 40 # function. PLEASE MAKE THE PAIN GO AWAY ? <- might not be 41 # necessary still 42 43 # we need an element that does RGBA -> AYUV so we can overlay png 44 # this got added to ffmpegcolorspace in 0.8.5 45 addalpha = 'ffmpegcolorspace' 46 47 source = self.config['source'][0] 48 eater = '@ eater:%s @' % source 49 50 # the order here is important; to have our eater be the reference 51 # stream for videomixer it needs to be specified last 52 pipeline = ( 53 'filesrc name=source blocksize=100000 ! pngdec ! alphacolor ! ' 54 'videomixer name=mix ! @ feeder:: @ ' 55 '%(eater)s ! %(addalpha)s ! mix.' % locals()) 56 57 return pipeline5860 self.fixRenamedProperties(properties, [ 61 ('show_text', 'show-text'), 62 ('fluendo_logo', 'fluendo-logo'), 63 ('cc_logo', 'cc-logo'), 64 ('xiph_logo', 'xiph-logo') 65 ]) 66 67 # create temp file 68 (fd, self._filename) = tempfile.mkstemp('flumotion.png') 69 os.close(fd) 70 71 text = None 72 if properties.get('show-text', False): 73 text = properties.get('text', 'set the "text" property') 74 genimg.generate_overlay(self._filename, 75 text, 76 properties.get('fluendo-logo', False), 77 properties.get('cc-logo', False), 78 properties.get('xiph-logo', False), 79 properties['width'], 80 properties['height']) 81 82 source = self.get_element('source') 83 source.set_property('location', self._filename)8486 # clean up our temp file 87 if self._filename: 88 self.debug('Removing temporary overlay file %s' % self._filename) 89 os.unlink(self._filename) 90 self._filename = None 91 else: 92 self.debug("Temporary overlay already gone, " \ 93 "did we not start up correctly ?") 94 return feedcomponent.ParseLaunchComponent.do_stop(self)
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Apr 11 07:40:34 2008 | http://epydoc.sourceforge.net |