|
@@ -240,16 +240,17 @@ def sample(source, source_type, multiplier=1):
|
|
return data
|
|
return data
|
|
|
|
|
|
|
|
|
|
-def video2_extractor(q, data):
|
|
|
|
- data = extract_lsbs(data)
|
|
|
|
- data = whiten(data)
|
|
|
|
|
|
+def video2_extractor(q, q2):
|
|
|
|
+ while True:
|
|
|
|
+ data = extract_lsbs(q2.get())
|
|
|
|
+ data = whiten(data)
|
|
|
|
|
|
- logger.info(f"Sample ready: {len(data)}b.")
|
|
|
|
|
|
+ logger.info(f"Sample ready: {len(data)}b.")
|
|
|
|
|
|
- q.put(data)
|
|
|
|
|
|
+ q.put(data)
|
|
|
|
|
|
|
|
|
|
-def video2_sampler(q, source):
|
|
|
|
|
|
+def video2_sampler(q, q2, source):
|
|
with Device.from_id(abs(int(source))) as device:
|
|
with Device.from_id(abs(int(source))) as device:
|
|
device.set_format(
|
|
device.set_format(
|
|
1,
|
|
1,
|
|
@@ -263,9 +264,7 @@ def video2_sampler(q, source):
|
|
new = time.monotonic()
|
|
new = time.monotonic()
|
|
|
|
|
|
if new - last > 10:
|
|
if new - last > 10:
|
|
- threading.Thread(
|
|
|
|
- target=video2_extractor, args=(q, bytes(frame))
|
|
|
|
- ).start()
|
|
|
|
|
|
+ q2.put(bytes(frame))
|
|
|
|
|
|
last = new
|
|
last = new
|
|
|
|
|
|
@@ -355,7 +354,10 @@ if __name__ == "__main__":
|
|
)
|
|
)
|
|
|
|
|
|
if args.source_type == "linuxvideo":
|
|
if args.source_type == "linuxvideo":
|
|
- threading.Thread(target=video2_sampler, args=(q, args.source)).start()
|
|
|
|
|
|
+ q2 = queue.Queue()
|
|
|
|
+
|
|
|
|
+ threading.Thread(target=video2_sampler, args=(q, 12, args.source)).start()
|
|
|
|
+ threading.Thread(target=video2_extractor, args=(q, q2)).start()
|
|
else:
|
|
else:
|
|
threading.Thread(
|
|
threading.Thread(
|
|
target=puller, args=(q, args.source, args.source_type, args.multiplier)
|
|
target=puller, args=(q, args.source, args.source_type, args.multiplier)
|