|
@@ -6,6 +6,7 @@ import queue
|
|
|
import argparse
|
|
|
import tempfile
|
|
|
import threading
|
|
|
+from itertools import groupby
|
|
|
|
|
|
import cv2
|
|
|
import requests
|
|
@@ -18,9 +19,9 @@ except ImportError:
|
|
|
logger.warning("RdRand is not available.")
|
|
|
|
|
|
try:
|
|
|
- from v4l2py.device import Device, VideoCapture
|
|
|
+ from linuxpy.video.device import Device, VideoCapture
|
|
|
except ImportError:
|
|
|
- logger.warning("v4l2py is not available.")
|
|
|
+ logger.warning("linuxpy is not available.")
|
|
|
|
|
|
tmp_dir = None
|
|
|
push_timeout = 10
|
|
@@ -134,10 +135,10 @@ def extract_lsbs(data):
|
|
|
|
|
|
buffer = []
|
|
|
|
|
|
- if len(data) % 2 != 0:
|
|
|
- data = data[:-1]
|
|
|
-
|
|
|
- for chunk in chunks(data, 4):
|
|
|
+ data = chunks(data, 4)
|
|
|
+ data = [k for k, _ in groupby(data)]
|
|
|
+
|
|
|
+ for chunk in data:
|
|
|
if len(chunk) != 4:
|
|
|
break
|
|
|
|
|
@@ -260,7 +261,7 @@ def video2_sampler(q, source):
|
|
|
for frame in device:
|
|
|
new = time.monotonic()
|
|
|
|
|
|
- if new - last >= 1:
|
|
|
+ if new - last > 1:
|
|
|
data = extract_lsbs(bytes(frame))
|
|
|
data = whiten(data)
|
|
|
|