summaryrefslogtreecommitdiff
path: root/decoders/spdif
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-08-30 00:09:50 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2014-08-30 00:36:39 +0200
commitcc16130e89911cae694c5245df9fd223750c47d3 (patch)
tree97a299d2de48f4c7bbc2aa3d20fa4f832c8937c4 /decoders/spdif
parenteb148e7a78ed4c3b9615b41d9c967cb5f403fa0f (diff)
downloadlibsigrokdecode-cc16130e89911cae694c5245df9fd223750c47d3.tar.gz
libsigrokdecode-cc16130e89911cae694c5245df9fd223750c47d3.zip
spdif: Add another annotation helper.
Diffstat (limited to 'decoders/spdif')
-rw-r--r--decoders/spdif/pd.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/decoders/spdif/pd.py b/decoders/spdif/pd.py
index 83cc338..71de285 100644
--- a/decoders/spdif/pd.py
+++ b/decoders/spdif/pd.py
@@ -55,6 +55,9 @@ class Decoder(srd.Decoder):
def putx(self, ss, es, data):
self.put(ss, es, self.out_ann, data)
+ def puty(self, data):
+ self.put(self.ss_edge, self.samplenum, self.out_ann, data)
+
def __init__(self, **kwargs):
self.state = 0
self.olddata = None
@@ -116,9 +119,8 @@ class Decoder(srd.Decoder):
spdif_bitrate = int(self.samplerate / (self.clocks[2] / 1.5))
self.ss_edge = 0
- self.putx(self.ss_edge, self.samplenum, [0, \
- ['Signal Bitrate: %d Mbit/s (=> %d kHz)' % \
- (spdif_bitrate, (spdif_bitrate/ (2 * 32)))]])
+ self.puty([0, ['Signal Bitrate: %d Mbit/s (=> %d kHz)' % \
+ (spdif_bitrate, (spdif_bitrate/ (2 * 32)))]])
clock_period_nsec = 1000000000 / spdif_bitrate
@@ -202,13 +204,13 @@ class Decoder(srd.Decoder):
self.preamble_state = 0
self.state = 3
if self.preamble == [2, 0, 1, 0]:
- self.putx(self.ss_edge, self.samplenum, [1, ['Preamble W', 'W']])
+ self.puty([1, ['Preamble W', 'W']])
elif self.preamble == [2, 2, 1, 1]:
- self.putx(self.ss_edge, self.samplenum, [1, ['Preamble M', 'M']])
+ self.puty([1, ['Preamble M', 'M']])
elif self.preamble == [2, 1, 1, 2]:
- self.putx(self.ss_edge, self.samplenum, [1, ['Preamble B', 'B']])
+ self.puty([1, ['Preamble B', 'B']])
else:
- self.putx(self.ss_edge, self.samplenum, [1, ['Unknown Preamble', 'Unkown Prea.', 'U']])
+ self.puty([1, ['Unknown Preamble', 'Unkown Prea.', 'U']])
self.preamble = []
self.seen_preamble = True
self.bitcount = 0