[Videomode] support HDMI colorspace. (Currently, this option is effective only solo4k)
authorhschang <chang@dev3>
Tue, 3 Nov 2015 03:14:03 +0000 (12:14 +0900)
committerhschang <chang@dev3>
Tue, 3 Nov 2015 03:14:32 +0000 (12:14 +0900)
lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
lib/python/Plugins/SystemPlugins/Videomode/plugin.py

index 802c0b6..c423bc5 100644 (file)
@@ -1,6 +1,7 @@
-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:
@@ -273,6 +274,23 @@ class VideoHardware:
                        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")
+                       config.av.hdmicolorspace = ConfigSelection(choices = hdmicolorspace_choices, default = "Edid(Auto)")
+                       config.av.hdmicolorspace.addNotifier(setHdmiColorspace)
+               else:
+                       config.av.hdmicolorspace = NoSave(ConfigNothing())
+
        def changedVideomode(self, configElement):
                if self.is_init:
                        return
index 7c646b3..abe93df 100755 (executable)
@@ -21,6 +21,7 @@ class avSetupScreen(ConfigListScreen, Screen):
                {"idx":7, "level":0, "text":"Color Format", "item":"config.av.colorformat"},
                {"idx":8, "level":1, "text":"WSS on 4:3", "item":"config.av.wss"},
                {"idx":9, "level":1, "text":"Auto scart switching", "requires":"ScartSwitch", "item":"config.av.vcrswitch"},
+               {"idx":10, "level":1, "text":"HDMI Colorspace", "item":"config.av.hdmicolorspace"},
                {"idx":0, "level":1, "text":"Dolby Digital default", "item":"config.av.defaultac3"},
                {"idx":0, "level":1, "text":"Dolby Digital / DTS downmix", "requires":"CanDownmixAC3", "item":"config.av.downmix_ac3"},
                {"idx":0, "level":1, "text":"PCM Multichannel", "requires":"CanPcmMultichannel", "item":"config.av.pcm_multichannel"},
@@ -130,6 +131,8 @@ class avSetupScreen(ConfigListScreen, Screen):
                                # Color Format, WSS on 4:3, Auto scart switching
                                elif (idx == 7 or idx == 8 or idx == 9) and not current_port == "Scart":
                                        continue
+                               elif (idx == 10) and not current_port == "DVI": # HDMI Colorspace
+                                       continue
                        if idx == 0 and item_level == 1: # audio
                                self.audio_cfg.append(item_text)