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 gstreamer 25 26 from flumotion.component import feedcomponent 27 28 from flumotion.component.effects.colorbalance import colorbalance 29317833 device = properties['device'] 34 35 # v4l or v4l2? 36 factory_name = properties.get('element-factory', 'v4lsrc') 37 38 # Filtered caps 39 mime = properties.get('mime', 'video/x-raw-yuv') 40 format = properties.get('format', 'I420') 41 width = properties.get('width', None) 42 height = properties.get('height', None) 43 44 string = mime 45 if mime == 'video/x-raw-yuv': 46 string += ",format=(fourcc)%s" % format 47 if width: 48 string += ",width=%d" % width 49 if height: 50 string += ",height=%d" % height 51 if 'framerate' in properties: 52 f = properties['framerate'] 53 string += ",framerate=(fraction)%d/%d" % (f[0], f[1]) 54 55 if factory_name == 'v4lsrc': 56 factory_name += ' autoprobe=false autoprobe-fps=false copy-mode=1' 57 # v4l2src automatically copies 58 59 # FIXME: ffmpegcolorspace in the pipeline causes bad negotiation. 60 # hack in 0.9 to work around, not in 0.8 61 # correct solution would be to find the colorspaces, see halogen 62 # pipeline = 'v4lsrc name=source %s copy-mode=1 device=%s ! ' \ 63 # 'ffmpegcolorspace ! "%s" ! videorate ! "%s"' \ 64 # % (autoprobe, device, caps, caps) 65 return ('%s name=source device=%s ! %s ! videorate' 66 % (factory_name, device, string))6769 # create and add colorbalance effect 70 source = pipeline.get_by_name('source') 71 hue = properties.get('hue', None) 72 saturation = properties.get('saturation', None) 73 brightness = properties.get('brightness', None) 74 contrast = properties.get('contrast', None) 75 cb = colorbalance.Colorbalance('outputColorbalance', source, 76 hue, saturation, brightness, contrast, pipeline) 77 self.addEffect(cb)
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Aug 7 15:03:01 2008 | http://epydoc.sourceforge.net |