From: Uwe Hermann Date: Sat, 1 Feb 2014 17:11:40 +0000 (+0100) Subject: guess_bitrate: start() doesn't take a metadata argument anymore. X-Git-Tag: libsigrokdecode-0.3.0~126 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e2ff870ec47cc01a24d037c75d16ebaccdf1ff69;p=libsigrokdecode.git guess_bitrate: start() doesn't take a metadata argument anymore. --- diff --git a/decoders/guess_bitrate/pd.py b/decoders/guess_bitrate/pd.py index 3249b31..b88a897 100644 --- a/decoders/guess_bitrate/pd.py +++ b/decoders/guess_bitrate/pd.py @@ -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]