6 INPUT = { "ENCODER": (0, 4), "SCART": (1, 3), "AUX": (2, 4) }
8 def setInput(self, input):
9 eAVSwitch.getInstance().setInput(self.INPUT[input][0])
10 if self.INPUT[input][1] == 4:
11 aspect = self.getAspectRatioSetting()
12 self.setAspectWSS(aspect)
13 self.setAspectSlowBlank(aspect)
15 eAVSwitch.getInstance().setSlowblank(self.INPUT[input][1])
16 # FIXME why do we have to reset the colorformat? bug in avs-driver?
17 eAVSwitch.getInstance().setColorFormat(config.av.colorformat.value)
19 def setColorFormat(self, value):
20 eAVSwitch.getInstance().setColorFormat(value)
22 def setAspectRatio(self, value):
23 eAVSwitch.getInstance().setAspectRatio(value)
24 self.setAspectWSS(value)
25 self.setAspectSlowBlank(value)
27 def setSystem(self, value):
28 eAVSwitch.getInstance().setVideomode(value)
30 def getAspectRatioSetting(self):
31 valstr = currentConfigSelectionElement(config.av.aspectratio)
32 if valstr == "4_3_letterbox":
34 elif valstr == "4_3_panscan":
36 elif valstr == "16_9":
38 elif valstr == "16_9_always":
42 def setAspectWSS(self, aspect=None):
44 aspect = self.getAspectRatioSetting()
45 if aspect == 0 or aspect == 1: # letterbox or panscan
46 value = 3 # 4:3_full_format
47 elif aspect == 2: # 16:9
48 if currentConfigSelectionElement(config.av.wss) == "off":
49 value = 2 # auto(4:3_off)
52 elif aspect == 3: # always 16:9
53 value = 4 # 16:9_full_format
54 eAVSwitch.getInstance().setWSS(value)
56 def setAspectSlowBlank(self, aspect=None):
58 aspect = self.getAspectRatioSetting()
59 if aspect == 0 or aspect == 1: # letterbox or panscan
61 elif aspect == 2: # 16:9
63 elif aspect == 3: # always 16:9
65 eAVSwitch.getInstance().setSlowblank(value)
68 config.av = ConfigSubsection();
69 config.av.colorformat = configElement("config.av.colorformat", configSelection, 1, (("cvbs", _("CVBS")), ("rgb", _("RGB")), ("svideo", _("S-Video")) ))
70 config.av.aspectratio = configElement("config.av.aspectratio", configSelection, 0, (("4_3_letterbox", _("4:3 Letterbox")), ("4_3_panscan", _("4:3 PanScan")), ("16_9", _("16:9")), ("16_9_always", _("16:9 always"))) )
71 #config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, ("PAL", "PAL + PAL60", "Multi", "NTSC") )
72 config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, (("pal", _("PAL")), ("ntsc", _("NTSC"))) )
73 config.av.wss = configElement("config.av.wss", configSelection, 0, (("off", _("Off")), ("on", _("On"))) )
74 config.av.defaultac3 = configElement("config.av.defaultac3", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))))
75 config.av.vcrswitch = configElement("config.av.vcrswitch", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))))
77 iAVSwitch = AVSwitch()
79 def setColorFormat(configElement):
80 iAVSwitch.setColorFormat(configElement.value)
82 def setAspectRatio(configElement):
83 iAVSwitch.setAspectRatio(configElement.value)
85 def setSystem(configElement):
86 iAVSwitch.setSystem(configElement.value)
88 def setWSS(configElement):
89 iAVSwitch.setAspectWSS()
91 # this will call the "setup-val" initial
92 config.av.colorformat.addNotifier(setColorFormat)
93 config.av.aspectratio.addNotifier(setAspectRatio)
94 config.av.tvsystem.addNotifier(setSystem)
95 config.av.wss.addNotifier(setWSS)
97 iAVSwitch.setInput("ENCODER") # init on startup