def durationWin64(field): """ Convert Windows 64-bit duration to string. The timestamp format is a 64-bit number: number of 100ns. See also timestampWin64(). >>> durationWin64(type("", (), dict(value=2146280000, size=64))) u'3 min 34 sec 628 ms' >>> durationWin64(type("", (), dict(value=(1 << 64)-1, size=64))) u'58494 years 88 days 5 hours' """ assert hasattr(field, "value") and hasattr(field, "size") assert field.size == 64 delta = doDurationWin64(field.value) return humanDuration(delta)
def createDescription(self): tag = self["type"].value if tag == "AVI ": desc = u"Microsoft AVI video" if "headers/avi_hdr" in self: header = self["headers/avi_hdr"] desc += ": %ux%u pixels" % (header["width"].value, header["height"].value) microsec = header["microsec_per_frame"].value if microsec: desc += ", %.1f fps" % (1000000.0 / microsec) if "total_frame" in header and header["total_frame"].value: delta = timedelta(seconds=float(header["total_frame"].value) * microsec) desc += ", " + humanDuration(delta) return desc else: try: return self.VALID_TYPES[tag][2] except KeyError: return u"Microsoft RIFF container"
def diff(field): return humanDuration(field.value * 1000)
def computeLength(self, field): try: ms = int(field.value) return humanDuration(ms) except: return field.value
def diff(field): return humanDuration(field.value*1000)
def createDisplay(self): return humanDuration(self.value)
def formatJiffie(field): sec = float(field.value) / 60 return humanDuration(timedelta(seconds=sec))
def postMaxTime(self, chunk): return humanDuration(chunk.value * 1000)