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 29 30 __version__ = "$Rev: 6125 $" 31 32348136 device = properties['device'] 37 38 # v4l or v4l2? 39 factory_name = properties.get('element-factory', 'v4lsrc') 40 41 # Filtered caps 42 mime = properties.get('mime', 'video/x-raw-yuv') 43 format = properties.get('format', 'I420') 44 width = properties.get('width', None) 45 height = properties.get('height', None) 46 47 string = mime 48 if mime == 'video/x-raw-yuv': 49 string += ",format=(fourcc)%s" % format 50 if width: 51 string += ",width=%d" % width 52 if height: 53 string += ",height=%d" % height 54 if 'framerate' in properties: 55 f = properties['framerate'] 56 string += ",framerate=(fraction)%d/%d" % (f[0], f[1]) 57 58 if factory_name == 'v4lsrc': 59 factory_name += ' autoprobe=false autoprobe-fps=false copy-mode=1' 60 # v4l2src automatically copies 61 62 # FIXME: ffmpegcolorspace in the pipeline causes bad negotiation. 63 # hack in 0.9 to work around, not in 0.8 64 # correct solution would be to find the colorspaces, see halogen 65 # pipeline = 'v4lsrc name=source %s copy-mode=1 device=%s ! ' \ 66 # 'ffmpegcolorspace ! "%s" ! videorate ! "%s"' \ 67 # % (autoprobe, device, caps, caps) 68 return ('%s name=source device=%s ! %s ! videorate' 69 % (factory_name, device, string))7072 # create and add colorbalance effect 73 source = pipeline.get_by_name('source') 74 hue = properties.get('hue', None) 75 saturation = properties.get('saturation', None) 76 brightness = properties.get('brightness', None) 77 contrast = properties.get('contrast', None) 78 cb = colorbalance.Colorbalance('outputColorbalance', source, 79 hue, saturation, brightness, contrast, pipeline) 80 self.addEffect(cb)
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Jan 27 19:59:15 2011 | http://epydoc.sourceforge.net |