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 gst 23 24 from flumotion.common import errors, messages 25 from flumotion.common.i18n import N_, gettexter 26 from flumotion.component import feedcomponent 27 from flumotion.component.effects.videorate import videorate 28 from flumotion.component.effects.videoscale import videoscale 29 from flumotion.component.effects.deinterlace import deinterlace 30 31 __all__ = ['Converter'] 32 __version__ = "$Rev$" 33 T_ = gettexter() 34 3537 logCategory = 'videoconvert' 388940 props = self.config['properties'] 41 deintMode = props.get('deinterlace-mode', 'auto') 42 deintMethod = props.get('deinterlace-method', 'ffmpeg') 43 is_square = props.get('is-square', False) 44 width = props.get('width', None) 45 height = props.get('height', None) 46 47 if deintMode not in deinterlace.DEINTERLACE_MODE: 48 msg = "'%s' is not a valid deinterlace mode." % deintMode 49 raise errors.ConfigError(msg) 50 if deintMethod not in deinterlace.DEINTERLACE_METHOD: 51 msg = "'%s' is not a valid deinterlace method." % deintMethod 52 raise errors.ConfigError(msg)53 5658 self.deintMode = properties.get('deinterlace-mode', "auto") 59 self.deintMethod = properties.get('deinterlace-method', "ffmpeg") 60 self.width = properties.get('width', None) 61 self.height = properties.get('height', None) 62 self.is_square = properties.get('is-square', False) 63 fr = properties.get('framerate', None) 64 self.framerate = None 65 if fr is not None: 66 self.framerate = gst.Fraction(fr[0], fr[1]) 67 68 identity = pipeline.get_by_name("identity") 69 # Add videorate effect. The videorate is usually decreased, so it's 70 # usefull to have this effect always first, because it reduces the 71 # number of frames to process. 72 vr = videorate.Videorate('videorate', 73 identity.get_pad("src"), pipeline, self.framerate) 74 self.addEffect(vr) 75 vr.plug() 76 # Add deinterlace effect. Deinterlacing must always be done 77 # before scaling. 78 deinterlacer = deinterlace.Deinterlace('deinterlace', 79 vr.effectBin.get_pad("src"), 80 pipeline, self.deintMode, self.deintMethod) 81 self.addEffect(deinterlacer) 82 deinterlacer.plug() 83 # Add videoscale effect 84 videoscaler = videoscale.Videoscale('videoscale', self, 85 deinterlacer.effectBin.get_pad("src"), pipeline, 86 self.width, self.height, self.is_square) 87 self.addEffect(videoscaler) 88 videoscaler.plug()
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Jun 17 12:32:41 2011 | http://epydoc.sourceforge.net |