Support duo4kse.
authorhschang <chang@dev3>
Fri, 18 Sep 2020 06:27:50 +0000 (15:27 +0900)
committerhschang <chang@dev3>
Mon, 21 Sep 2020 02:15:37 +0000 (11:15 +0900)
lib/python/Components/SystemInfo.py
lib/python/Plugins/SystemPlugins/RemoteControlCode/plugin.py
lib/python/Plugins/SystemPlugins/TransCodingSetup/plugin.py
lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py

index d66437e..de9bbe2 100755 (executable)
@@ -29,14 +29,14 @@ SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
 SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0")
 SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0")
 SystemInfo["DeepstandbySupport"] = HardwareInfo().get_device_name() != "dm800"
-SystemInfo["HdmiInSupport"] = HardwareInfo().get_vu_device_name() in ("ultimo4k", "uno4kse", "duo4k")
+SystemInfo["HdmiInSupport"] = HardwareInfo().get_vu_device_name() in ("ultimo4k", "uno4kse", "duo4k", "duo4kse")
 SystemInfo["WOWLSupport"] = HardwareInfo().get_vu_device_name() in ("ultimo4k", "duo4k")
 SystemInfo["ScrambledPlayback"] = "PVR" in open("/proc/stb/tsmux/ci0_input_choices").read()
 SystemInfo["FastChannelChange"] =  fileExists("/proc/stb/frontend/fbc/fcc")
 SystemInfo["MiniTV"] = fileExists("/proc/stb/lcd/live_enable")
-SystemInfo["DisableUsbRecord"] = HardwareInfo().get_vu_device_name() in ("solo4k", "uno4kse", "zero4k", "duo4k")
+SystemInfo["DisableUsbRecord"] = HardwareInfo().get_vu_device_name() in ("solo4k", "uno4kse", "zero4k", "duo4k", "duo4kse")
 SystemInfo["DefaultAniSpeed"] = HardwareInfo().get_vu_device_name() in ("uno4k", "uno4kse", "zero4k", "duo4k") and 25 or 20
-SystemInfo["DefaultFullHDSkin"] = HardwareInfo().get_vu_device_name() in ("solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k")
+SystemInfo["DefaultFullHDSkin"] = HardwareInfo().get_vu_device_name() in ("solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k", "duo4kse")
 SystemInfo["PVRSupport"] = HardwareInfo().get_vu_device_name() not in ["solose", "zero", "uno4k"]
 
 SystemInfo["CommonInterface"] = eDVBCIInterfaces.getInstance().getNumOfSlots()
index 3f2bb99..a583331 100755 (executable)
@@ -19,7 +19,7 @@ def getModel():
        return ret
 
 def getRcuDefaultType():
-       if getModel() in ["uno4kse", "zero4k", "duo4k"]:
+       if getModel() in ["uno4kse", "zero4k", "duo4k", "duo4kse"]:
                return "new"
        return "legacy"
 
index dc34490..c65dfa2 100755 (executable)
@@ -53,6 +53,14 @@ def getProcPath(encoder, configName):
                "profile"               :       "profile",
                "width"                 :       "width",
                "height"                :       "height",
+               "framerate_choices"             :       "framerate_choices",
+               "resolution_choices"    :       "resolution_choices",
+               "aspectratio_choices"   :       "aspectratio_choices",
+               "resolution_choices"    :       "display_format_choices",
+               "audiocodec_choices"    :       "audio_codec_choices",
+               "videocodec_choices"    :       "video_codec_choices",
+               "level_choices"         :       "level_choices",
+               "profile_choices"       :       "profile_choices",
        }.get(configName)
        return "/proc/stb/encoder/%s/%s" % (encoder, _configName)
 
@@ -61,6 +69,36 @@ def checkSupportAdvanced():
                return True
        return False
 
+def getChoices(configName):
+       choices = []
+       proc_path = getProcPath(encoder, configName)
+       if fileExists(proc_path):
+               data = getProcValue(proc_path)
+               if data is not None:
+                       for choice in data.split(' '):
+                               choices.append( (choice, _(choice)) )
+       return choices
+
+def getDefault(choices, value):
+       for choice in choices:
+               if choice[0] == value:
+                       return value
+       return choices[0][0]
+
+def getAspectratioChoices():
+       choices = []
+       proc_path = getProcPath(encoder, "aspectratio_choices")
+       if fileExists(proc_path):
+               data = getProcValue(proc_path)
+               if data is not None:
+                       for choice in data.split(' '):
+                               try:
+                                       k,v = choice.split(':')
+                                       choices.append( (k, _(v)) )
+                               except:
+                                       continue
+       return choices
+
 config.plugins.transcodingsetup = ConfigSubsection()
 config.plugins.transcodingsetup.transcoding = ConfigSelection(default = "enable", choices = [ ("enable", _("enable")), ("disable", _("disable"))] )
 config.plugins.transcodingsetup.port = ConfigSelection(default = "8002", choices = [ ("8001", "8001"), ("8002", "8002")] )
@@ -84,7 +122,10 @@ def createTransCodingConfig(encoder):
                setAttr("bitrate", encoder, choice)
 
        if fileExists( getProcPath(encoder ,"framerate") ):
-               choice = TconfigSelection(encoder, default = "30000", choices = [ ("23976", _("23976")), ("24000", _("24000")), ("25000", _("25000")), ("29970", _("29970")), ("30000", _("30000")), ("50000", _("50000")), ("59940", _("59940")), ("60000", _("60000"))] )
+               framerate_choices = getChoices("framerate_choices")
+               if (len(framerate_choices) == 0):
+                       framerate_choices = [ ("23976", _("23976")), ("24000", _("24000")), ("25000", _("25000")), ("29970", _("29970")), ("30000", _("30000")), ("50000", _("50000")), ("59940", _("59940")), ("60000", _("60000"))]
+               choice = TconfigSelection(encoder, default = getDefault(framerate_choices, "30000"), choices = framerate_choices )
                setAttr("framerate", encoder, choice)
 
        if checkSupportAdvanced() and (hasAttr("bitrate", encoder) or hasAttr("framerate", encoder)):
@@ -92,23 +133,31 @@ def createTransCodingConfig(encoder):
                setAttr("automode", encoder, choice)
 
        if fileExists( getProcPath(encoder, "resolution") ):
-               resolutaion_choices = [ ("480p", _("480p")), ("576p", _("576p")), ("720p", _("720p")), ("320x240", _("320x240")), ("160x120", _("160x120")) ]
-               if vumodel in ("solo4k"):
-                       resolutaion_choices.insert(3, ("1080p", _("1080p")))
-
-               choice = TconfigSelection(encoder, default = "480p", choices = resolutaion_choices )
+               resolutaion_choices = getChoices("resolution_choices")
+               if (len(resolutaion_choices) == 0):
+                       resolutaion_choices = [ ("480p", _("480p")), ("576p", _("576p")), ("720p", _("720p")), ("320x240", _("320x240")), ("160x120", _("160x120")) ]
+               choice = TconfigSelection(encoder, default = getDefault(resolutaion_choices, "480p"), choices = resolutaion_choices )
                setAttr("resolution", encoder, choice)
 
        if fileExists( getProcPath(encoder, "aspectratio") ):
-               choice = TconfigSelection(encoder, default = "1", choices = [ ("0", _("auto")), ("1", _("4x3")), ("2", _("16x9")) ] )
+               aspectratio_choices = getAspectratioChoices()
+               if len(aspectratio_choices) == 0:
+                       aspectratio_choices = [ ("0", _("auto")), ("1", _("4x3")), ("2", _("16x9")) ]
+               choice = TconfigSelection(encoder, default = "1", choices = aspectratio_choices )
                setAttr("aspectratio", encoder, choice)
 
        if fileExists( getProcPath(encoder, "audiocodec") ):
-               choice = TconfigSelection(encoder, default = "aac", choices = [("mpg", _("mpg")), ("mp3", _("mp3")), ("aac", _("aac")), ("aac+", _("aac+")), ("aac+loas", _("aac+loas")), ("aac+adts", _("aac+adts")), ("ac3", _("ac3"))] )
+               audiocodec_choices = getChoices("audiocodec_choices")
+               if len(audiocodec_choices) == 0:
+                       audiocodec_choices = [("mpg", _("mpg")), ("mp3", _("mp3")), ("aac", _("aac")), ("aac+", _("aac+")), ("aac+loas", _("aac+loas")), ("aac+adts", _("aac+adts")), ("ac3", _("ac3"))]
+               choice = TconfigSelection(encoder, default = getDefault(audiocodec_choices, "aac"), choices = audiocodec_choices )
                setAttr("audiocodec", encoder, choice)
 
        if fileExists( getProcPath(encoder, "videocodec") ):
-               choice = TconfigSelection(encoder, default = "h264", choices = [ ("h264", _("h264")) ] )
+               videocodec_choices = getChoices("videocodec_choices")
+               if len(videocodec_choices) == 0:
+                       _choices = [ ("h264", _("h264")) ]
+               choice = TconfigSelection(encoder, default = getDefault(videocodec_choices, "h264"), choices = videocodec_choices )
                setAttr("videocodec", encoder, choice)
 
        if fileExists( getProcPath(encoder, "gopframeb") ):
@@ -120,14 +169,20 @@ def createTransCodingConfig(encoder):
                setAttr("gopframep", encoder, choice)
 
        if fileExists( getProcPath(encoder, "level") ):
-               choice = TconfigSelection(encoder, default = "3.1", choices = [("1.0", _("1.0")), ("2.0", _("2.0")),
-                       ("2.1", _("2.1")), ("2.2", _("2.2")), ("3.0", _("3.0")), ("3.1", _("3.1")),
-                       ("3.2", _("3.2")), ("4.0", _("4.0")), ("4.1", _("4.1")), ("4.2", _("4.2")),
-                       ("5.0", _("5.0")), ("low", _("low")), ("main", _("main")), ("high", _("high"))] )
+               level_choices = getChoices("level_choices")
+               if (len(level_choices) == 0):
+                       level_choices = [("1.0", _("1.0")), ("2.0", _("2.0")),
+                               ("2.1", _("2.1")), ("2.2", _("2.2")), ("3.0", _("3.0")), ("3.1", _("3.1")),
+                               ("3.2", _("3.2")), ("4.0", _("4.0")), ("4.1", _("4.1")), ("4.2", _("4.2")),
+                               ("5.0", _("5.0")), ("low", _("low")), ("main", _("main")), ("high", _("high"))]
+               choice = TconfigSelection(encoder, default = getDefault(level_choices, "3.1"), choices = level_choices )
                setAttr("level", encoder, choice)
 
        if fileExists( getProcPath(encoder, "profile") ):
-               choice = TconfigSelection(encoder, default = "baseline", choices = [("baseline", _("baseline")), ("simple", _("simple")), ("main", _("main")), ("high", _("high")), ("advanced simple", _("advancedsimple"))] )
+               profile_choices = getChoices("profile_choices")
+               if (len(profile_choices) == 0):
+                       profile_choices = [("baseline", _("baseline")), ("simple", _("simple")), ("main", _("main")), ("high", _("high")), ("advanced simple", _("advancedsimple"))]
+               choice = TconfigSelection(encoder, default = getDefault(profile_choices, "baseline"), choices = profile_choices )
                setAttr("profile", encoder, choice)
 
 # check encoders
index 8425f42..52b9f17 100644 (file)
@@ -62,10 +62,10 @@ class VideoHardware:
        }
 
        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"])
+       hdmi_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k", "duo4kse"])
+       hdmi_pc_hw_types = set(["dm500", "dm800se", "dm7020hd", "bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k", "duo4kse"])
+       noscart_hw_types = set(["zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k", "duo4kse"])
+       noypbpr_hw_types = set(["solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k", "duo4kse"])
 
        def getDeviceName(self):
                device_name = "unknown"
@@ -80,10 +80,10 @@ class VideoHardware:
                return device_name
 
        def isVumodel(self, hw_type):
-               return hw_type in set(["bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+               return hw_type in set(["bm750", "solo", "uno", "ultimo", "solo2", "duo2", "solose", "zero", "solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k", "duo4kse"])
 
        def isVumodel4K(self, hw_type):
-               return hw_type in set(["solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k"])
+               return hw_type in set(["solo4k", "ultimo4k", "uno4k", "uno4kse", "zero4k", "duo4k", "duo4kse"])
 
        # re-define AVSwitch.getOutputAspect
        def getOutputAspect(self):