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: 6695 $"
30 T_ = gettexter()
31
32
34 logCategory = "comb-av-pattern-switcher"
35
37 d = basicwatchdog.AVBasicWatchdog.do_check(self)
38 def checkConfig(result):
39 props = self.config['properties']
40 eaterName = props.get('eater-with-stream-markers', None)
41 if eaterName != 'video-master' and eaterName != 'video-backup':
42 warnStr = N_("The value provided for the " \
43 "eater-with-stream-markers property " \
44 "must be one of video-backup, video-master.")
45 self.warning(warnStr)
46 self.addMessage(messages.Error(T_(N_(warnStr)),
47 mid="eater-with-stream-markers-wrong"))
48 return result
49 d.addCallback(checkConfig)
50 return d
51
60
62 if event.type == gst.EVENT_CUSTOM_DOWNSTREAM:
63 evt_struct = event.get_structure()
64 if evt_struct.get_name() == 'FluStreamMark':
65 if evt_struct['action'] == 'start':
66 self.switch_to("backup")
67
68 elif evt_struct['action'] == 'stop':
69 self.switch_to("master")
70 return True
71