[hbbtv] upgraded.
[vuplus_dvbapp] / lib / python / Components / AVSwitch.py
old mode 100644 (file)
new mode 100755 (executable)
index 8f4255b..8b7e8b7
@@ -1,7 +1,9 @@
 from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, \
-       ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigNumber
+       ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigSelectionNumber, ConfigNothing, NoSave
 from enigma import eAVSwitch, getDesktop
 from SystemInfo import SystemInfo
+from os import path as os_path
+from os import access, W_OK
 
 class AVSwitch:
        def setInput(self, input):
@@ -73,7 +75,7 @@ def InitAVSwitch():
        if config.av.yuvenabled.value:
                colorformat_choices["yuv"] = _("YPbPr")
 
-       config.av.colorformat = ConfigSelection(choices=colorformat_choices, default="rgb")
+       config.av.colorformat = ConfigSelection(choices=colorformat_choices, default="cvbs")
        config.av.aspectratio = ConfigSelection(choices={
                        "4_3_letterbox": _("4:3 Letterbox"),
                        "4_3_panscan": _("4:3 PanScan"), 
@@ -111,8 +113,8 @@ def InitAVSwitch():
        config.av.tvsystem = ConfigSelection(choices = {"pal": _("PAL"), "ntsc": _("NTSC"), "multinorm": _("multinorm")}, default="pal")
        config.av.wss = ConfigEnableDisable(default = True)
        config.av.defaultac3 = ConfigYesNo(default = False)
-       config.av.generalAC3delay = ConfigNumber(default = 0)
-       config.av.generalPCMdelay = ConfigNumber(default = 0)
+       config.av.generalAC3delay = ConfigSelectionNumber(-1000, 1000, 25, default = 0)
+       config.av.generalPCMdelay = ConfigSelectionNumber(-1000, 1000, 25, default = 0)
        config.av.vcrswitch = ConfigEnableDisable(default = False)
 
        iAVSwitch = AVSwitch()
@@ -142,6 +144,19 @@ def InitAVSwitch():
        SystemInfo["ScartSwitch"] = eAVSwitch.getInstance().haveScartSwitch()
 
        try:
+               can_pcm_multichannel = access("/proc/stb/audio/multichannel_pcm", W_OK)
+       except:
+               can_pcm_multichannel = False
+
+       SystemInfo["supportPcmMultichannel"] = can_pcm_multichannel
+
+       if can_pcm_multichannel:
+               def setPCMMultichannel(configElement):
+                       open("/proc/stb/audio/multichannel_pcm", "w").write(configElement.value and "enable" or "disable")
+               config.av.pcm_multichannel = ConfigYesNo(default = False)
+               config.av.pcm_multichannel.addNotifier(setPCMMultichannel)
+
+       try:
                can_downmix = open("/proc/stb/audio/ac3_choices", "r").read()[:-1].find("downmix") != -1
        except:
                can_downmix = False
@@ -150,10 +165,27 @@ def InitAVSwitch():
        if can_downmix:
                def setAC3Downmix(configElement):
                        open("/proc/stb/audio/ac3", "w").write(configElement.value and "downmix" or "passthrough")
+                       if SystemInfo.get("supportPcmMultichannel", False) and (not configElement.value) :
+                               SystemInfo["CanPcmMultichannel"] = True
+                       else:
+                               SystemInfo["CanPcmMultichannel"] = False
+
                config.av.downmix_ac3 = ConfigYesNo(default = True)
                config.av.downmix_ac3.addNotifier(setAC3Downmix)
 
        try:
+               can_downmix_aac = open("/proc/stb/audio/aac_choices", "r").read()[:-1].find("downmix") != -1
+       except:
+               can_downmix_aac = False
+
+       SystemInfo["CanDownmixAAC"] = can_downmix_aac
+       if can_downmix_aac:
+               def setAACDownmix(configElement):
+                       open("/proc/stb/audio/aac", "w").write(configElement.value and "downmix" or "passthrough")
+               config.av.downmix_aac = ConfigYesNo(default = True)
+               config.av.downmix_aac.addNotifier(setAACDownmix)
+
+       try:
                can_osd_alpha = open("/proc/stb/video/alpha", "r") and True or False
        except:
                can_osd_alpha = False
@@ -166,3 +198,19 @@ def InitAVSwitch():
        if can_osd_alpha:
                config.av.osd_alpha = ConfigSlider(default=255, limits=(0,255))
                config.av.osd_alpha.addNotifier(setAlpha)
+
+       if os_path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):
+               def setScaler_sharpness(config):
+                       myval = int(config.value)
+                       try:
+                               print "--> setting scaler_sharpness to: %0.8X" % myval
+                               open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w").write("%0.8X" % myval)
+                               open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
+                       except IOError:
+                               print "couldn't write pep_scaler_sharpness"
+
+               config.av.scaler_sharpness = ConfigSlider(default=13, limits=(0,26))
+               config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
+       else:
+               config.av.scaler_sharpness = NoSave(ConfigNothing())
+