Skip to content

Commit

Permalink
TOOLS/matroska.py: support 8-byte floats in parsing mode
Browse files Browse the repository at this point in the history
Support parsing and printing the value of 8-byte floats when using the
script to parse and display contents of Matroska files.
  • Loading branch information
Uoti Urpala committed Mar 11, 2010
1 parent f4a1d6e commit cbc6eab
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions TOOLS/matroska.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,13 @@ def read_float(s, length):
f = ldexp((i & 0x7fffff) + (1 << 23), (i >> 23 & 0xff) - 150)
if i & (1 << 31):
f = -f
return f
raise SyntaxError
elif length == 8:
f = ldexp((i & ((1 << 52) - 1)) + (1 << 52), (i >> 52 & 0x7ff) - 1075)
if i & (1 << 63):
f = -f
else:
raise SyntaxError
return f

def parse_one(s, depth, parent, maxlen):
elid = read_id(s).encode('hex')
Expand Down

0 comments on commit cbc6eab

Please sign in to comment.