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