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.yuvenabled = configElementBoolean("config.av.yuvenabled", 0)
70 colorformat_choices = ( ("cvbs", _("CVBS")), ("rgb", _("RGB")), ("svideo", _("S-Video")), ("yuv", _("YPbPr")) )
72 # when YUV is not enabled, don't let the user select it
73 if not config.av.yuvenabled.value:
74 colorformat_choices = colorformat_choices[:3]
76 config.av.colorformat = configElement("config.av.colorformat", configSelection, 1, colorformat_choices)
77 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"))) )
78 #config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, ("PAL", "PAL + PAL60", "Multi", "NTSC") )
79 config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, (("pal", _("PAL")), ("ntsc", _("NTSC"))) )
80 config.av.wss = configElement("config.av.wss", configSelection, 0, (("off", _("Off")), ("on", _("On"))) )
81 config.av.defaultac3 = configElement("config.av.defaultac3", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))))
82 config.av.vcrswitch = configElement("config.av.vcrswitch", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))))
84 iAVSwitch = AVSwitch()
86 def setColorFormat(configElement):
87 iAVSwitch.setColorFormat(configElement.value)
89 def setAspectRatio(configElement):
90 iAVSwitch.setAspectRatio(configElement.value)
92 def setSystem(configElement):
93 iAVSwitch.setSystem(configElement.value)
95 def setWSS(configElement):
96 iAVSwitch.setAspectWSS()
98 # this will call the "setup-val" initial
99 config.av.colorformat.addNotifier(setColorFormat)
100 config.av.aspectratio.addNotifier(setAspectRatio)
101 config.av.tvsystem.addNotifier(setSystem)
102 config.av.wss.addNotifier(setWSS)
104 iAVSwitch.setInput("ENCODER") # init on startup