Package flumotion :: Package component :: Package combiners :: Package composite :: Module composite
[hide private]

Source Code for Module flumotion.component.combiners.composite.composite

 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.component import feedcomponent 
19   
20  __version__ = "$Rev$" 
21   
22   
23 -class Composite(feedcomponent.MultiInputParseLaunchComponent):
24 logCategory = 'comb-composite' 25
26 - def init(self):
27 self._pad_names = {} 28 self._stream_props = {}
29
30 - def _parse_stream_props(self, properties):
31 props = self._stream_props 32 config = properties.get('input', []) 33 34 for fp in config: 35 fname = fp['feeder-alias'] 36 props[fname] = dict(xpos=fp.get('position-left', 0), 37 ypos=fp.get('position-top', 0), 38 zorder=fp.get('z-order', None), 39 alpha=fp.get('alpha', 1.0))
40
41 - def get_pipeline_string(self, properties):
42 self._parse_stream_props(properties) 43 44 # naming ffmpegcsp elements so we can easier identify mixer pads 45 etmpl = '@ eater:%s @ ! ffmpegcolorspace name=csc-%s ! mixer. ' 46 pipeline = ('videomixer name=mixer %s mixer.' % 47 ' '.join([etmpl % (a, a) for a in self.eaters])) 48 return pipeline
49
50 - def configure_pipeline(self, pipeline, properties):
51 mixer = pipeline.get_by_name('mixer') 52 53 for p in mixer.sink_pads(): 54 # get the coresponding ffmpegcsp's name and strip the 55 # 'csc-' prefix 56 peername = p.get_peer().get_parent().get_name()[4:] 57 if peername in self.eaters: 58 self._pad_names[peername] = p.get_name() 59 60 cfg = self._stream_props.get(peername, None) 61 if cfg: 62 for k, v in cfg.items(): 63 if v is not None: 64 p.set_property(k, v)
65