-from Components.config import config, ConfigSubDict, ConfigSelection
+from Components.config import config, ConfigSubDict, ConfigSelection, ConfigNothing, NoSave
from Tools.CList import CList
from Tools.HardwareInfo import HardwareInfo
+import os
# VideoHardware is the interface to /proc/stb/video.
class VideoHardware:
"60Hz" : {60: "1080p"},
"multi": {50: "1080p50", 60: "1080p"}
},
+ "2160p": {
+ "50Hz" : {50: "2160p50"},
+ "60Hz" : {60: "2160p"},
+ "multi": {50: "2160p50", 60: "2160p"}
+ },
"PC": {
"1024x768": {60: "1024x768"},
"800x600" : {60: "800x600"},
}
}
- widescreen_modes = set(["720p", "1080i", "1080p"])
- hdmi_hw_types = set(["dm500", "dm800se", "dm7020hd", "duo", "solo", "uno", "ultimo", "solo2", "duo2"])
- hdmi_pc_hw_types = set(["dm500", "dm800se", "dm7020hd", "duo", "solo", "uno", "ultimo", "solo2", "duo2"])
+ widescreen_modes = set(["720p", "1080i", "1080p", "2160p"])
+ hdmi_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+ hdmi_pc_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+ noscart_hw_types = set(["zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+ noypbpr_hw_types = set(["solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
def getDeviceName(self):
device_name = "unknown"
return device_name
def isVumodel(self, hw_type):
- return hw_type in set(["duo", "solo", "uno", "ultimo", "solo2", "duo2"])
+ return hw_type in set(["bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+
+ def isVumodel4K(self, hw_type):
+ return hw_type in set(["solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
# re-define AVSwitch.getOutputAspect
def getOutputAspect(self):
print "remove DVI-PC because it does not exist."
del self.modes["DVI-PC"]
+ if self.isNoScart(self.getDeviceName()):
+ if self.modes.has_key("Scart"):
+ print "remove Scart because it does not exist."
+ del self.modes["Scart"]
+
+ if self.isNoYPbPr(self.getDeviceName()):
+ if self.modes.has_key("YPbPr"):
+ print "remove YPbPr because it does not exist."
+ del self.modes["YPbPr"]
+
self.createConfig()
self.readPreferredModes()
config.av.videorate[mode[0]].addNotifier(self.changedVideomode)
self.is_init = False
-
+
def readAvailableModes(self):
try:
modes = open("/proc/stb/video/videomode_choices").read()[:-1]
self.last_modes_preferred = self.modes_preferred
print "hotplug on DVI"
self.on_hotplug("DVI") # must be DVI
-
+
# check if HDMI is available
def isHDMIAvailable(self, hw_type):
return hw_type in self.hdmi_hw_types
def isWidescreenMode(self, mode):
return mode in self.widescreen_modes
+ # check if Scart is not available
+ def isNoScart(self, hw_type):
+ return hw_type in self.noscart_hw_types
+
+ # check if YPbPr is not available
+ def isNoYPbPr(self, hw_type):
+ return hw_type in self.noypbpr_hw_types
+
# check if rate is available for mode
def isModeAvailable(self, port, mode, rate):
rate = self.rates[mode][rate]
# vu+ support 1080p
if self.isVumodel(hw_type):
self.modes["DVI"].insert(self.modes["DVI"].index("1080i")+1, "1080p")
+ # 4K support 2160p
+ if self.isVumodel4K(hw_type):
+ self.modes["DVI"].insert(self.modes["DVI"].index("1080p")+1, "2160p")
portlist = [ ]
port_choices = self.getPortList()
config.av.videorate[mode[0]] = ConfigSelection(choices = ratelist)
config.av.videomode[port] = ConfigSelection(choices = modelist)
config.av.videoport = ConfigSelection(choices = portlist)
-
+
+ if os.path.exists("/proc/stb/video/hdmi_colorspace"):
+ def setHdmiColorspace(config):
+ try:
+ print "set HDMI Colorspace : ",config.value
+ f = open("/proc/stb/video/hdmi_colorspace", "w")
+ f.write(config.value)
+ f.close()
+ except IOError:
+ print "set HDMI Colorspace failed!"
+ hdmicolorspace_choices = {}
+ hdmicolorspace_choices["Edid(Auto)"] = _("Auto")
+ hdmicolorspace_choices["Hdmi_Rgb"] = _("RGB")
+ hdmicolorspace_choices["444"] = _("YCbCr444")
+ hdmicolorspace_choices["422"] = _("YCbCr422")
+ hdmicolorspace_choices["420"] = _("YCbCr420")
+ config.av.hdmicolorspace = ConfigSelection(choices = hdmicolorspace_choices, default = "Edid(Auto)")
+ config.av.hdmicolorspace.addNotifier(setHdmiColorspace)
+ else:
+ config.av.hdmicolorspace = NoSave(ConfigNothing())
+
+ if os.path.exists("/proc/stb/video/hdmi_colordepth"):
+ def setHdmiColordepth(config):
+ try:
+ print "set HDMI Colordepth : ",config.value
+ f = open("/proc/stb/video/hdmi_colordepth", "w")
+ f.write(config.value)
+ f.close()
+ except IOError:
+ print "set HDMI Colordepth failed!"
+ hdmicolordepth_choices = {}
+ hdmicolordepth_choices["auto"] = _("Auto")
+ hdmicolordepth_choices["8bit"] = _("8bit")
+ hdmicolordepth_choices["10bit"] = _("10bit")
+ hdmicolordepth_choices["12bit"] = _("12bit")
+ config.av.hdmicolordepth = ConfigSelection(choices = hdmicolordepth_choices, default = "auto")
+ config.av.hdmicolordepth.addNotifier(setHdmiColordepth)
+ else:
+ config.av.hdmicolordepth = NoSave(ConfigNothing())
+
def changedVideomode(self, configElement):
if self.is_init:
return
open("/proc/stb/video/videomode", "w").write(mode_50)
except IOError:
print "cannot open /proc/stb/vide/videomode"
-
+
self.changedAspect(None)
-
+
def changedAspect(self, configElement):
if self.is_init:
return
policy2 = {"letterbox": "letterbox", "panscan": "panscan", "scale": "bestfit"}[config.av.policy_169.value]
elif valstr == "auto":
aspect = "any"
- policy = "bestfit"
+ policy = "bestfit"
else:
aspect = "4:3"
policy = {"letterbox": "letterbox", "panscan": "panscan", "scale": "bestfit"}[config.av.policy_169.value]
open("/proc/stb/video/policy2", "w").write(policy2)
except IOError:
pass
-
+
def isPortUsed(self, port):
if port == "DVI":
self.readPreferredModes()
return len(self.modes_preferred) != 0
else:
return True
-
+
def saveVideomode(self, port, mode, rate):
print "save Videomode", port, mode, rate
config.av.videoport.value = port
def saveMode(self, port, mode, rate):
self.saveVideomode(port, mode, rate)
-
+
def updateAspect(self, configElement):
self.changedAspect(configElement)
-
+
video_hw = VideoHardware()
video_hw.setConfiguredMode()