Package flumotion :: Package component :: Package converters :: Package video :: Module video
[hide private]

Source Code for Module flumotion.component.converters.video.video

 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,2008,2009 Fluendo, S.L. 
 6  # Copyright (C) 2010,2011 Flumotion Services, S.A. 
 7  # All rights reserved. 
 8  # 
 9  # This file may be distributed and/or modified under the terms of 
10  # the GNU Lesser General Public License version 2.1 as published by 
11  # the Free Software Foundation. 
12  # This file is distributed without any warranty; without even the implied 
13  # warranty of merchantability or fitness for a particular purpose. 
14  # See "LICENSE.LGPL" in the source distribution for more information. 
15  # 
16  # Headers in this file shall remain intact. 
17   
18  import gst 
19   
20  from flumotion.common import errors, messages 
21  from flumotion.common.i18n import N_, gettexter 
22  from flumotion.component import feedcomponent 
23  from flumotion.component.effects.videoscale import videoscale 
24  from flumotion.component.effects.deinterlace import deinterlace 
25   
26  __all__ = ['Converter'] 
27  __version__ = "$Rev$" 
28  T_ = gettexter() 
29   
30   
31 -class Converter(feedcomponent.ParseLaunchComponent):
32 logCategory = 'videoconvert' 33
34 - def check_properties(self, props, addMessage):
35 props = self.config['properties'] 36 deintMode = props.get('deinterlace-mode', 'auto') 37 deintMethod = props.get('deinterlace-method', 'ffmpeg') 38 39 if deintMode not in deinterlace.DEINTERLACE_MODE: 40 msg = "'%s' is not a valid deinterlace mode." % deintMode 41 raise errors.ConfigError(msg) 42 if deintMethod not in deinterlace.DEINTERLACE_METHOD: 43 msg = "'%s' is not a valid deinterlace method." % deintMethod 44 raise errors.ConfigError(msg)
45
46 - def get_pipeline_string(self, properties):
47 return 'identity silent=true name=identity'
48
49 - def configure_pipeline(self, pipeline, properties):
50 self.deintMode = properties.get('deinterlace-mode', "auto") 51 self.deintMethod = properties.get('deinterlace-method', "ffmpeg") 52 self.width = properties.get('width', None) 53 self.height = properties.get('height', None) 54 self.widthCorrection = properties.get('width-correction', 8) 55 self.heightCorrection = properties.get('height-correction', 0) 56 self.is_square = properties.get('is-square', False) 57 58 identity = pipeline.get_by_name("identity") 59 # FIXME: The deinterlace effect uses a videorate which we don't want in 60 # the middle of a flow. 61 # Add deinterlace effect. Deinterlacing must always be done 62 # before scaling. 63 #deinterlacer = deinterlace.Deinterlace('deinterlace', 64 # identity.get_pad("src"), 65 # pipeline, self.deintMode, self.deintMethod) 66 #self.addEffect(deinterlacer) 67 #deinterlacer.plug() 68 # Add videoscale effect 69 videoscaler = videoscale.Videoscale('videoscale', self, 70 identity.get_pad("src"), pipeline, 71 self.width, self.height, self.is_square, False, 72 self.widthCorrection, self.heightCorrection) 73 self.addEffect(videoscaler) 74 videoscaler.plug()
75