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 Fluendo, S.L. (www.fluendo.com). All rights reserved. 6 7 # This file may be distributed and/or modified under the terms of 8 # the GNU General Public License version 2 as published by 9 # the Free Software Foundation. 10 # This file is distributed without any warranty; without even the implied 11 # warranty of merchantability or fitness for a particular purpose. 12 # See "LICENSE.GPL" in the source distribution for more information. 13 14 # Licensees having purchased or holding a valid Flumotion Advanced 15 # Streaming Server license may use this file in accordance with the 16 # Flumotion Advanced Streaming Server Commercial License Agreement. 17 # See "LICENSE.Flumotion" in the source distribution for more information. 18 19 # Headers in this file shall remain intact. 20 21 from flumotion.component import feedcomponent 22 from flumotion.component.effects.deinterlace import deinterlace 23 from flumotion.component.effects.videorate import videorate 24 from flumotion.component.effects.videoscale import videoscale 25 26 __version__ = "$Rev$" 27 28309432 deintMode = props.get('deinterlace-mode', 'auto') 33 deintMethod = props.get('deinterlace-method', 'ffmpeg') 34 35 if deintMode not in deinterlace.DEINTERLACE_MODE: 36 msg = messages.Error(T_(N_("Configuration error: '%s' " \ 37 "is not a valid deinterlace mode." % deintMode))) 38 addMessage(msg) 39 raise errors.ConfigError(msg) 40 41 if deintMethod not in deinterlace.DEINTERLACE_METHOD: 42 msg = messages.Error(T_(N_("Configuration error: '%s' " \ 43 "is not a valid deinterlace method." % deintMethod))) 44 self.debug("'%s' is not a valid deinterlace method", 45 deintMethod) 46 addMessage(msg) 47 raise errors.ConfigError(msg)4850 p = properties 51 device = p.get('device', '/dev/video0') 52 deinterlacer = p.get('deinterlacer', '') 53 self.is_square = p.get('is-square', False) 54 self.width = p.get('width', 0) 55 self.height = p.get('height', 0) 56 if not self.is_square and not self.height: 57 self.height = int(576 * self.width/720.) # assuming PAL 58 self.add_borders = p.get('add-borders', True) 59 self.deintMode = p.get('deinterlace-mode', 'auto') 60 self.deintMethod = p.get('deinterlace-method', 'ffmpeg') 61 62 fr = p.get('framerate', None) 63 if fr is not None: 64 self.framerate = gst.Fraction(fr[0], fr[1]) 65 else: 66 self.framerate = None 67 68 template = ("filesrc name=src location=%s" 69 " ! decodebin name=dec " 70 " dec. ! identity silent=true name=video ! @feeder:video@" 71 " dec. ! audioconvert ! audio/x-raw-int " 72 " ! @feeder:audio@" % device) 73 74 return template7577 video = pipeline.get_by_name('video') 78 vr = videorate.Videorate('videorate', 79 video.get_pad("src"), pipeline, self.framerate) 80 self.addEffect(vr) 81 vr.plug() 82 83 deinterlacer = deinterlace.Deinterlace('deinterlace', 84 vr.effectBin.get_pad("src"), pipeline, 85 self.deintMode, self.deintMethod) 86 self.addEffect(deinterlacer) 87 deinterlacer.plug() 88 89 videoscaler = videoscale.Videoscale('videoscale', self, 90 deinterlacer.effectBin.get_pad("src"), pipeline, 91 self.width, self.height, self.is_square, self.add_borders) 92 self.addEffect(videoscaler) 93 videoscaler.plug()
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu May 5 05:30:31 2011 | http://epydoc.sourceforge.net |