]> sigrok.org Git - libsigrokdecode.git/commitdiff
guess_bitrate: start() doesn't take a metadata argument anymore.
authorUwe Hermann <redacted>
Sat, 1 Feb 2014 17:11:40 +0000 (18:11 +0100)
committerUwe Hermann <redacted>
Sat, 1 Feb 2014 17:11:40 +0000 (18:11 +0100)
decoders/guess_bitrate/pd.py

index 3249b31427f1b421037719680dc39bd3e0a87b9b..b88a8977a9b948cfaf6be965e1df66acb147e974 100644 (file)
@@ -47,12 +47,17 @@ class Decoder(srd.Decoder):
         self.first_transition = True
         self.bitwidth = None
 
-    def start(self, metadata):
-        self.samplerate = metadata['samplerate']
+    def start(self):
         # self.out_python = self.register(srd.OUTPUT_PYTHON)
         self.out_ann = self.register(srd.OUTPUT_ANN)
 
+    def metadata(self, key, value):
+        if key == srd.SRD_CONF_SAMPLERATE:
+            self.samplerate = value;
+
     def decode(self, ss, es, data):
+        if self.samplerate is None:
+            raise Exception("Cannot decode without samplerate.")
         for (self.samplenum, pins) in data:
 
             data = pins[0]