def parse self bytes codelen len bytes assert codelen data 14 code 0L

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
def parse(self, bytes):
codelen = len(bytes)
assert codelen % 3 == 0
data = [0.] * (2 << 14)
code = [0L] * (2 << 14)
for framenum, i in enumerate(xrange(0, codelen, 12)):
s = bytes[i:i+12]
odd = framenum % 2
if odd:
c,d = struct.unpack(_dataformat_odd, s)
else:
d,c = struct.unpack(_dataformat_even, s)
print d, c
data[framenum] = d
code[framenum] = c
print data