summaryrefslogtreecommitdiff
path: root/decoders/guess_bitrate
diff options
context:
space:
mode:
Diffstat (limited to 'decoders/guess_bitrate')
-rw-r--r--decoders/guess_bitrate/__init__.py1
-rw-r--r--decoders/guess_bitrate/pd.py9
2 files changed, 4 insertions, 6 deletions
diff --git a/decoders/guess_bitrate/__init__.py b/decoders/guess_bitrate/__init__.py
index 9c7e6a4..1b41f72 100644
--- a/decoders/guess_bitrate/__init__.py
+++ b/decoders/guess_bitrate/__init__.py
@@ -35,4 +35,3 @@ the expected bitrate/baudrate that might be used on the channel.
'''
from .pd import *
-
diff --git a/decoders/guess_bitrate/pd.py b/decoders/guess_bitrate/pd.py
index 1d7434b..250d519 100644
--- a/decoders/guess_bitrate/pd.py
+++ b/decoders/guess_bitrate/pd.py
@@ -53,7 +53,7 @@ class Decoder(srd.Decoder):
def metadata(self, key, value):
if key == srd.SRD_CONF_SAMPLERATE:
- self.samplerate = value;
+ self.samplerate = value
def decode(self, ss, es, data):
if not self.samplerate:
@@ -67,22 +67,21 @@ class Decoder(srd.Decoder):
continue
# Initialize first self.olddata with the first sample value.
- if self.olddata == None:
+ if self.olddata is None:
self.olddata = data
continue
# Get the smallest distance between two transitions
# and use that to calculate the bitrate/baudrate.
- if self.first_transition == True:
+ if self.first_transition:
self.ss_edge = self.samplenum
self.first_transition = False
else:
b = self.samplenum - self.ss_edge
- if self.bitwidth == None or b < self.bitwidth:
+ if self.bitwidth is None or b < self.bitwidth:
self.bitwidth = b
bitrate = int(float(self.samplerate) / float(b))
self.putx([0, ['%d' % bitrate]])
self.ss_edge = self.samplenum
self.olddata = data
-