-if fileExists( g_procPath["aspectratio"] ):
- config.plugins.transcodingsetup.aspectratio = ConfigSelection(default = "1", choices = [ ("0", _("auto")), ("1", _("4x3")), ("2", _("16x9")) ] )
-
-if fileExists( g_procPath["audiocodec"] ):
- config.plugins.transcodingsetup.audiocodec = ConfigSelection(default = "aac", choices = [("mpg", _("mpg")), ("mp3", _("mp3")), ("aac", _("aac")), ("aac+", _("aac+")), ("aac+loas", _("aac+loas")), ("aac+adts", _("aac+adts")), ("ac3", _("ac3"))] )
-
-if fileExists( g_procPath["videocodec"] ):
- config.plugins.transcodingsetup.videocodec = ConfigSelection(default = "h264", choices = [ ("h264", _("h264")), ("mpeg2", _("mpeg2")), ("mpeg4p2", _("mpeg4p2"))] )
-
-if fileExists( g_procPath["gopframeb"] ):
- config.plugins.transcodingsetup.gopframeb = ConfigInteger(default = 0, limits = (0, 60))
-
-if fileExists( g_procPath["gopframep"] ):
- config.plugins.transcodingsetup.gopframep = ConfigInteger(default = 29, limits = (0, 60))
-
-if fileExists( g_procPath["level"] ):
- config.plugins.transcodingsetup.level = ConfigSelection(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"))] )
-
-if fileExists( g_procPath["profile"] ):
- config.plugins.transcodingsetup.profile = ConfigSelection(default = "baseline", choices = [("baseline", _("baseline")), ("simple", _("simple")), ("main", _("main")), ("high", _("high")), ("advanced simple", _("advanced simple"))] )
+def createTransCodingConfig(encoder):
+ if fileExists( getProcPath(encoder ,"bitrate") ):
+ if getModel() == "solo2":
+ choice = TconfigInteger(encoder, default = 400000, limits = (50000, 1000000))
+ else:
+ choice = TconfigInteger(encoder, default = 2000000, limits = (100000, 5000000))
+ 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"))] )
+ setAttr("framerate", encoder, choice)
+
+ if checkSupportAdvanced() and (hasAttr("bitrate", encoder) or hasAttr("framerate", encoder)):
+ choice = TconfigSelection(encoder, default = "Off", choices = [ ("On", _("On")), ("Off", _("Off")) ] )
+ setAttr("automode", encoder, choice)
+
+ if fileExists( getProcPath(encoder, "resolution") ):
+ choice = TconfigSelection(encoder, default = "480p", choices = [ ("480p", _("480p")), ("576p", _("576p")), ("720p", _("720p")), ("320x240", _("320x240")), ("160x120", _("160x120")) ] )
+ setAttr("resolution", encoder, choice)
+
+ if fileExists( getProcPath(encoder, "aspectratio") ):
+ choice = TconfigSelection(encoder, default = "1", choices = [ ("0", _("auto")), ("1", _("4x3")), ("2", _("16x9")) ] )
+ 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"))] )
+ setAttr("audiocodec", encoder, choice)
+
+ if fileExists( getProcPath(encoder, "videocodec") ):
+ choice = TconfigSelection(encoder, default = "h264", choices = [ ("h264", _("h264")), ("mpeg2", _("mpeg2")), ("mpeg4p2", _("mpeg4p2"))] )
+ setAttr("videocodec", encoder, choice)
+
+ if fileExists( getProcPath(encoder, "gopframeb") ):
+ choice = TconfigInteger(encoder, default = 0, limits = (0, 60))
+ setAttr("gopframeb", encoder, choice)
+
+ if fileExists( getProcPath(encoder, "gopframep") ):
+ choice = TconfigInteger(encoder, default = 29, limits = (0, 60))
+ 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"))] )
+ 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"))] )
+ setAttr("profile", encoder, choice)
+
+# check encoders
+encoders = []
+encoderPath = "/proc/stb/encoder"
+for encoder in os_listdir(encoderPath):
+ encPath = os_path.join(encoderPath, encoder)
+ if not os_path.isdir(encPath):
+ continue
+ if fileExists(os_path.join(encPath, "bitrate")):
+ encoders.append(encoder)
+ createTransCodingConfig(encoder)
+
+if len(encoders) > 1:
+ encoders.sort()
+ choices = []
+ for encoder in encoders:
+ choices.append((encoder, encoder))
+ config.plugins.transcodingsetup.encoder = ConfigSelection(default = '0', choices = choices )