Package flumotion :: Package component :: Package encoders :: Package dirac :: Module dirac
[hide private]

Source Code for Module flumotion.component.encoders.dirac.dirac

 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 gstreamer, messages 
19  from flumotion.common.i18n import N_, gettexter 
20  from flumotion.worker.checks import check 
21  from flumotion.component import feedcomponent 
22   
23   
24  T_ = gettexter() 
25   
26   
27 -class Dirac(feedcomponent.EncoderComponent):
28 checkTimestamp = True 29 checkOffset = True 30
31 - def do_check(self):
32 d = check.do_check(self, check.checkPlugin, 'schro', 'gst-plugins-bad') 33 34 def check_schroenc_bug(result, component): 35 if gstreamer.get_plugin_version('schro') == (1, 0, 7, 0): 36 m = messages.Warning( 37 T_(N_("Version %s of the '%s' GStreamer plug-in " 38 "contains a bug.\n"), '1.0.7', 'schroenc')) 39 m.add(T_(N_("The downstream components might stay hungry.\n"))) 40 m.add(T_(N_("The bug has been fixed during the transition of " 41 "'%s' to the '%s' plug-ins set. " 42 "Please upgrade '%s' to version %s, " 43 "which contains the fixed plug-in."), 44 'schroenc', 'gst-plugins-bad', 'schroenc', '0.10.14')) 45 component.addMessage(m) 46 return result
47 return d.addCallback(check_schroenc_bug, self)
48
49 - def get_pipeline_string(self, properties):
50 return "ffmpegcolorspace ! schroenc name=encoder"
51
52 - def configure_pipeline(self, pipeline, properties):
53 element = pipeline.get_by_name('encoder') 54 55 bitrate = properties.get('bitrate', None) 56 if bitrate: 57 self.debug('Setting GStreamer property bitrate to %r' % bitrate) 58 element.set_property("bitrate", int(bitrate))
59