[videomode] enabled Scart for soloSE
[vuplus_dvbapp] / lib / python / Plugins / SystemPlugins / Videomode / VideoHardware.py
index c192395..0120f40 100644 (file)
@@ -56,8 +56,10 @@ class VideoHardware:
        }
 
        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"])
+       hdmi_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose"])
+       hdmi_pc_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose"])
+       noscart_hw_types = set()
+       noypbpr_hw_types = set(["solose"])
 
        def getDeviceName(self):
                device_name = "unknown"
@@ -72,7 +74,7 @@ class VideoHardware:
                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"])
 
        # re-define AVSwitch.getOutputAspect
        def getOutputAspect(self):
@@ -110,6 +112,16 @@ class VideoHardware:
                        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()
@@ -131,10 +143,10 @@ class VideoHardware:
                for port in self.getPortList():
                        config.av.videomode[port].addNotifier(self.changedVideomode)
                        for mode in self.getModeList(port):
-                               config.av.videorate[mode].addNotifier(self.changedVideomode)
+                               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]
@@ -155,7 +167,7 @@ class VideoHardware:
                        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
@@ -168,6 +180,14 @@ class VideoHardware:
        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]
@@ -180,7 +200,7 @@ class VideoHardware:
        # check isModeAvailable in this port
        def isPortAvailable(self, port):
                for mode in self.getModeList(port):
-                       if len(self.getRateList(port, mode)):
+                       if len(self.getRateList(port, mode[0])):
                                return True
 
                return False
@@ -196,7 +216,7 @@ class VideoHardware:
                        rates = self.getRateList(port, mode)
 
                        if len(rates):
-                               modelist.append(mode)
+                               modelist.append( (mode, rates))
 
                return modelist
 
@@ -229,19 +249,19 @@ class VideoHardware:
                        mode_choices = self.getModeList(port)
 
                        for mode in mode_choices:
-                               modelist.append( (mode, mode))
+                               modelist.append( (mode[0], mode[0]))
 
                                # create list of available rates
                                ratelist = [ ]
-                               rate_choices = self.getRateList(port, mode)
+                               rate_choices = self.getRateList(port, mode[0])
 
                                for rate in rate_choices:
                                        ratelist.append( (rate, rate))
 
-                               config.av.videorate[mode] = ConfigSelection(choices = ratelist)
+                               config.av.videorate[mode[0]] = ConfigSelection(choices = ratelist)
                        config.av.videomode[port] = ConfigSelection(choices = modelist)
                config.av.videoport = ConfigSelection(choices = portlist)
-       
+
        def changedVideomode(self, configElement):
                if self.is_init:
                        return
@@ -266,7 +286,7 @@ class VideoHardware:
 
                if mode is None:
                        modelist = self.getModeList(port)
-                       mode = modelist[0]
+                       mode = modelist[0][0]
 
                        ratelist = self.getRateList(port, mode)
                        rate = ratelist[0]
@@ -303,13 +323,9 @@ class VideoHardware:
                                open("/proc/stb/video/videomode", "w").write(mode_50)
                        except IOError:
                                print "cannot open /proc/stb/vide/videomode"
-               
+
                self.changedAspect(None)
-       
-       # autoresolution depend on this.
-       def setMode(self, port, mode, rate):
-               self.setVideomode(port, mode, rate)
-       
+
        def changedAspect(self, configElement):
                if self.is_init:
                        return
@@ -348,7 +364,7 @@ class VideoHardware:
                        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]
@@ -370,14 +386,14 @@ class VideoHardware:
                        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
@@ -389,6 +405,16 @@ class VideoHardware:
                        config.av.videorate[mode].value = rate
                        config.av.videorate[mode].save()
 
+       # for dependency
+       def setMode(self, port, mode, rate):
+               self.setVideomode(port, mode, rate)
+
+       def saveMode(self, port, mode, rate):
+               self.saveVideomode(port, mode, rate)
+
+       def updateAspect(self, configElement):
+               self.changedAspect(configElement)
+
 video_hw = VideoHardware()
 video_hw.setConfiguredMode()