[1e781ba] | 1 | import struct
|
---|
| 2 | import numpy as np
|
---|
| 3 | from AmmosAudioDataHeader import AmmosAudioDataHeader
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | class AmmosExtendedAudioDataHeader():
|
---|
| 7 |
|
---|
| 8 | @classmethod
|
---|
| 9 | def from_bytes(cls, bytes):
|
---|
| 10 | standard_header = AmmosAudioDataHeader.from_bytes(bytes[0:36])
|
---|
| 11 | extended_header_elements = struct.unpack('Q', bytes[36:])
|
---|
| 12 | timestamp = extended_header_elements[0]
|
---|
| 13 | sample_rate = standard_header.sample_rate
|
---|
| 14 | status = standard_header.status
|
---|
| 15 | frequency = standard_header.frequency
|
---|
| 16 | demod_bandwidth = standard_header.demod_bandwidth
|
---|
| 17 | demod_type = standard_header.demod_type
|
---|
| 18 | sample_count = standard_header.sample_count
|
---|
| 19 | channel_count = standard_header.channel_count
|
---|
| 20 | sample_size = standard_header.sample_size
|
---|
| 21 | return AmmosExtendedAudioDataHeader(sample_rate, status, frequency, demod_bandwidth, demod_type,
|
---|
| 22 | sample_count, channel_count, sample_size, timestamp)
|
---|
| 23 |
|
---|
| 24 | def __init__(self, sample_rate, status, frequency, demod_bandwidth, demod_type,
|
---|
| 25 | sample_count, channel_count, sample_size, timestamp):
|
---|
| 26 | self.sample_rate = sample_rate
|
---|
| 27 | self.status = status
|
---|
| 28 | self.frequency = frequency
|
---|
| 29 | self.demod_bandwidth = demod_bandwidth
|
---|
| 30 | self.demod_type = demod_type
|
---|
| 31 | self.sample_count = sample_count
|
---|
| 32 | self.channel_count = channel_count
|
---|
| 33 | self.sample_size = sample_size
|
---|
| 34 | self.timestamp = timestamp
|
---|