diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-03-11 23:42:20 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-03-11 23:42:20 +0200 |
commit | cbc6eabb9fae8e61c6c6f70365ec9134b481e7aa (patch) | |
tree | 56b6a8a118a3b217851eceb9d48fe375bb5b511d /TOOLS/matroska.py | |
parent | f4a1d6e36eb2e9a92894ea42276f9e1087c4bd57 (diff) | |
download | mpv-cbc6eabb9fae8e61c6c6f70365ec9134b481e7aa.tar.bz2 mpv-cbc6eabb9fae8e61c6c6f70365ec9134b481e7aa.tar.xz |
TOOLS/matroska.py: support 8-byte floats in parsing mode
Support parsing and printing the value of 8-byte floats when using the
script to parse and display contents of Matroska files.
Diffstat (limited to 'TOOLS/matroska.py')
-rwxr-xr-x | TOOLS/matroska.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/TOOLS/matroska.py b/TOOLS/matroska.py index 8368f35185..77268c8183 100755 --- a/TOOLS/matroska.py +++ b/TOOLS/matroska.py @@ -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') |