1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import gst
19
20 from flumotion.common import errors, messages
21 from flumotion.common.i18n import N_, gettexter
22 from flumotion.component import feedcomponent
23 from flumotion.component.combiners.switch import basicwatchdog
24
25 __version__ = "$Rev$"
26 T_ = gettexter()
27
28
30 logCategory = "comb-av-pattern-switcher"
31
33 d = basicwatchdog.AVBasicWatchdog.do_check(self)
34
35 def checkConfig(result):
36 props = self.config['properties']
37 eaterName = props.get('eater-with-stream-markers', None)
38 if eaterName != 'video-master' and eaterName != 'video-backup':
39 warnStr = N_("The value provided for the " \
40 "eater-with-stream-markers property " \
41 "must be one of video-backup, video-master.")
42 self.warning(warnStr)
43 self.addMessage(messages.Error(T_(N_(warnStr)),
44 mid="eater-with-stream-markers-wrong"))
45 return result
46 d.addCallback(checkConfig)
47 return d
48
57
59 if event.type == gst.EVENT_CUSTOM_DOWNSTREAM:
60 evt_struct = event.get_structure()
61 if evt_struct.get_name() == 'FluStreamMark':
62 if evt_struct['action'] == 'start':
63 self.switch_to("backup")
64
65 elif evt_struct['action'] == 'stop':
66 self.switch_to("master")
67 return True
68