X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/8deb6949b9d5641d09b5c97d37672d99a4f0f5c2..0221901d960f4935240dc7d5e8e44ace748e1223:/lib/python/Components/Converter/ServiceInfo.py?ds=sidebyside diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py index f0773bf1..fa3518ce 100644 --- a/lib/python/Components/Converter/ServiceInfo.py +++ b/lib/python/Components/Converter/ServiceInfo.py @@ -18,6 +18,8 @@ class ServiceInfo(Converter, object): TSID = 12 ONID = 13 SID = 14 + FRAMERATE = 15 + TRANSFERBPS = 16 def __init__(self, type): @@ -38,15 +40,17 @@ class ServiceInfo(Converter, object): "TsId": (self.TSID, (iPlayableService.evUpdatedInfo,)), "OnId": (self.ONID, (iPlayableService.evUpdatedInfo,)), "Sid": (self.SID, (iPlayableService.evUpdatedInfo,)), + "Framerate": (self.FRAMERATE, (iPlayableService.evVideoSizeChanged,iPlayableService.evUpdatedInfo,)), + "TransferBPS": (self.TRANSFERBPS, (iPlayableService.evUpdatedInfo,)), }[type] - def getServiceInfoString(self, info, what): + def getServiceInfoString(self, info, what, convert = lambda x: "%d" % x): v = info.getInfo(what) if v == -1: return "N/A" if v == -2: return info.getInfoString(what) - return "%d" % v + return convert(v) @cached def getBoolean(self): @@ -107,7 +111,11 @@ class ServiceInfo(Converter, object): elif self.type == self.ONID: return self.getServiceInfoString(info, iServiceInformation.sONID) elif self.type == self.SID: - return self.getServiceInfoString(info, iServiceInformation.sSID) + return self.getServiceInfoString(info, iServiceInformation.sSID) + elif self.type == self.FRAMERATE: + return self.getServiceInfoString(info, iServiceInformation.sFrameRate, lambda x: "%d fps" % ((x+500)/1000)) + elif self.type == self.TRANSFERBPS: + return self.getServiceInfoString(info, iServiceInformation.sTransferBPS, lambda x: "%d kB/s" % (x/1024)) return "" text = property(getText) @@ -123,6 +131,8 @@ class ServiceInfo(Converter, object): return info.getInfo(iServiceInformation.sVideoWidth) if self.type == self.YRES: return info.getInfo(iServiceInformation.sVideoHeight) + if self.type == self.FRAMERATE: + return info.getInfo(iServiceInformation.sFrameRate) return -1