2c8c7db616559726ad7532da424a0d6687b8f648
[enigma2.git] / lib / python / Components / AVSwitch.py
1 from config import *
2 import os
3 from enigma import *
4
5 class AVSwitch:
6         INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 }
7         def __init__(self):
8                 pass
9
10         def setColorFormat(self, value):
11                 eAVSwitch.getInstance().setColorFormat(value)
12                 
13         def setAspectRatio(self, value):
14                 eAVSwitch.getInstance().setAspectRatio(value)
15
16         def setSystem(self, value):
17                 eAVSwitch.getInstance().setVideomode(value)
18
19         def setWSS(self, value):
20                 #print "wss:" + str(value)
21                 pass
22         
23         def setInput(self, input):
24                 eAVSwitch.getInstance().setInput(self.INPUT[input])
25                 # FIXME why do we have to reset the colorformat? bug in avs-driver?
26                 eAVSwitch.getInstance().setColorFormat(config.av.colorformat.value)
27
28 def InitAVSwitch():
29         config.av = ConfigSubsection();
30         config.av.colorformat = configElement("config.av.colorformat", configSelection, 1, (("cvbs", _("CVBS")), ("rgb", _("RGB")), ("svideo", _("S-Video")) ));
31         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"))) );
32         #config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, ("PAL", "PAL + PAL60", "Multi", "NTSC") );
33         config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, (("pal", _("PAL")), ("ntsc", _("NTSC"))) );
34         config.av.wss = configElement("config.av.wss", configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))) );
35         config.av.defaultac3 = configElement("config.av.defaultac3", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))));
36         config.av.vcrswitch = configElement("config.av.vcrswitch", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))));
37
38         iAVSwitch = AVSwitch()
39
40         def setColorFormat(configElement):
41                 iAVSwitch.setColorFormat(configElement.value);
42         def setAspectRatio(configElement):
43                 iAVSwitch.setAspectRatio(configElement.value);
44         def setSystem(configElement):
45                 iAVSwitch.setSystem(configElement.value);
46         def setWSS(configElement):
47                 iAVSwitch.setWSS(configElement.value);
48
49         # this will call the "setup-val" initial
50         config.av.colorformat.addNotifier(setColorFormat);
51         config.av.aspectratio.addNotifier(setAspectRatio);
52         config.av.tvsystem.addNotifier(setSystem);
53         config.av.wss.addNotifier(setWSS);
54         
55         iAVSwitch.setInput("ENCODER") # init on startup