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":
40 elif valstr == "16_10_letterbox":
42 elif valstr == "16_10_panscan":
46 def setAspectWSS(self, aspect=None):
48 aspect = self.getAspectRatioSetting()
49 if aspect == 0 or aspect == 1: # letterbox or panscan
50 value = 3 # 4:3_full_format
51 elif aspect == 2: # 16:9
52 if currentConfigSelectionElement(config.av.wss) == "off":
53 value = 2 # auto(4:3_off)
56 elif aspect == 3: # always 16:9
57 value = 4 # 16:9_full_format
58 elif aspect == 4 or aspect == 5: # 16:10
59 value = 10 # 14:9_full_format
60 eAVSwitch.getInstance().setWSS(value)
62 def setAspectSlowBlank(self, aspect=None):
64 aspect = self.getAspectRatioSetting()
65 if aspect == 0 or aspect == 1: # letterbox or panscan
67 elif aspect == 2: # 16:9
69 elif aspect == 3 or aspect == 4 or aspect == 5: # always 16:9
71 eAVSwitch.getInstance().setSlowblank(value)
74 config.av = ConfigSubsection();
75 config.av.yuvenabled = configElementBoolean("config.av.yuvenabled", 0)
76 colorformat_choices = ( ("cvbs", _("CVBS")), ("rgb", _("RGB")), ("svideo", _("S-Video")), ("yuv", _("YPbPr")) )
78 # when YUV is not enabled, don't let the user select it
79 if not config.av.yuvenabled.value:
80 colorformat_choices = colorformat_choices[:3]
82 config.av.colorformat = configElement("config.av.colorformat", configSelection, 1, colorformat_choices)
83 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")), ("16_10_letterbox", _("16:10 Letterbox")), ("16_10_panscan", _("16:10 PanScan"))) )
84 #config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, ("PAL", "PAL + PAL60", "Multi", "NTSC") )
85 config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, (("pal", _("PAL")), ("ntsc", _("NTSC"))) )
86 config.av.wss = configElement("config.av.wss", configSelection, 0, (("off", _("Off")), ("on", _("On"))) )
87 config.av.defaultac3 = configElement("config.av.defaultac3", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))))
88 config.av.vcrswitch = configElement("config.av.vcrswitch", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))))
90 iAVSwitch = AVSwitch()
92 def setColorFormat(configElement):
93 iAVSwitch.setColorFormat(configElement.value)
95 def setAspectRatio(configElement):
96 iAVSwitch.setAspectRatio(configElement.value)
98 def setSystem(configElement):
99 iAVSwitch.setSystem(configElement.value)
101 def setWSS(configElement):
102 iAVSwitch.setAspectWSS()
104 # this will call the "setup-val" initial
105 config.av.colorformat.addNotifier(setColorFormat)
106 config.av.aspectratio.addNotifier(setAspectRatio)
107 config.av.tvsystem.addNotifier(setSystem)
108 config.av.wss.addNotifier(setWSS)
110 iAVSwitch.setInput("ENCODER") # init on startup