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,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 from flumotion.common import messages, errors, gstreamer 19 from flumotion.common.i18n import N_, gettexter 20 from flumotion.component import feedcomponent 21 from flumotion.worker.checks import check 22 23 24 __version__ = "$Rev$" 25 T_ = gettexter() 26 2729 checkTimestamp = True 30 checkOffset = True 319833 self.debug('running Theora check') 34 from flumotion.worker.checks import encoder 35 return check.do_check(self, encoder.checkTheora)3638 props = self.config['properties'] 39 speed = props.get('speed', 3) 40 41 if speed > 3: 42 msg = messages.Error(T_(N_( 43 "The configuration property 'speed' can only take " 44 "values from 0 to 3")), mid='speed') 45 addMessage(msg) 46 raise errors.ConfigError(msg)47 5052 element = pipeline.get_by_name('encoder') 53 54 for p in ['sharpness', 'quick-compress', 'noise-sensitivity']: 55 if properties.get(p, None) is not None: 56 self.warnDeprecatedProperties([p]) 57 58 props = ('bitrate', 59 'quality', 60 ('speed', 'speed-level'), 61 ('keyframe-mindistance', 'keyframe-freq'), 62 ('keyframe-maxdistance', 'keyframe-force')) 63 64 for p in props: 65 if isinstance(p, tuple): 66 pproperty, eproperty = p 67 else: 68 pproperty = eproperty = p 69 70 if not pproperty in properties: 71 continue 72 73 value = properties[pproperty] 74 self.debug('Setting GStreamer property %s to %r' % ( 75 eproperty, value)) 76 77 # FIXME: GStreamer 0.10 has bitrate in kbps, inconsistent 78 # with all other elements, so fix it up 79 if pproperty == 'bitrate': 80 value = int(value/1000) 81 # Check for the speed-level property, introduced in 82 # gst-plugins-base-0.10.24 83 if eproperty == 'speed-level': 84 if not gstreamer.element_has_property(element, 'speed-level'): 85 self.warning("Trying to set the 'speed-level' property " 86 "in a old version of gstreamer's theora " 87 "encoder element") 88 self.warning("We will fallback to the 'quick' property") 89 eproperty = 'quick' 90 value = value > 0 and True or False 91 element.set_property(eproperty, value)9294 if not self.checkPropertyType('bitrate', value, int): 95 return False 96 self.modify_element_property('encoder', 'bitrate', value/1000) 97 return True
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Aug 13 06:17:31 2013 | http://epydoc.sourceforge.net |