pyobs-aravis 2.0.0.dev12__tar.gz → 2.0.0.dev14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/PKG-INFO +1 -1
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/pyobs_aravis/aravis.py +32 -17
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/pyproject.toml +1 -1
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/uv.lock +1 -1
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/.github/dependabot.yml +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/.github/workflows/pypi.yml +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/.github/workflows/pyrefly.yml +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/.github/workflows/pytest.yml +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/.github/workflows/ruff.yml +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/.pre-commit-config.yaml +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/.readthedocs.yml +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/CHANGELOG.rst +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/LICENSE +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/README.md +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/docs/Makefile +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/docs/make.bat +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/docs/requirements.txt +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/docs/source/_static/pyobs.gif +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/docs/source/conf.py +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/docs/source/index.rst +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/pyobs_aravis/__init__.py +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/pyobs_aravis/araviscamera.py +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/pyobs_aravis/gui.py +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/tests/test_araviscamera.py +0 -0
- {pyobs_aravis-2.0.0.dev12 → pyobs_aravis-2.0.0.dev14}/tests/test_import.py +0 -0
|
@@ -6,6 +6,7 @@ Just in case the repo goes offline sometime. Some changes were applied.
|
|
|
6
6
|
|
|
7
7
|
import time
|
|
8
8
|
import logging
|
|
9
|
+
import threading
|
|
9
10
|
import numpy as np
|
|
10
11
|
import ctypes
|
|
11
12
|
import gi
|
|
@@ -52,6 +53,10 @@ class Camera(object):
|
|
|
52
53
|
raise AravisException("Error creating buffer")
|
|
53
54
|
self._frame = None
|
|
54
55
|
self._last_payload = 0
|
|
56
|
+
# guards self.stream against a shutdown() on another thread deleting it mid-access
|
|
57
|
+
# (e.g. pop_frame() polling in a background thread while the module deactivates)
|
|
58
|
+
self._lock = threading.Lock()
|
|
59
|
+
self._closed = False
|
|
55
60
|
|
|
56
61
|
def __getattr__(self, name):
|
|
57
62
|
if hasattr(
|
|
@@ -156,8 +161,11 @@ class Camera(object):
|
|
|
156
161
|
if not payload:
|
|
157
162
|
payload = self.cam.get_payload()
|
|
158
163
|
self.logger.info("Creating %s memory buffers of size %s", nb, payload)
|
|
159
|
-
|
|
160
|
-
self.
|
|
164
|
+
with self._lock:
|
|
165
|
+
if self._closed:
|
|
166
|
+
return
|
|
167
|
+
for _ in range(0, nb):
|
|
168
|
+
self.stream.push_buffer(Aravis.Buffer.new_allocate(payload))
|
|
161
169
|
|
|
162
170
|
def pop_frame(self, timestamp=False):
|
|
163
171
|
while (
|
|
@@ -180,19 +188,22 @@ class Camera(object):
|
|
|
180
188
|
"""
|
|
181
189
|
return the oldest frame in the aravis buffer
|
|
182
190
|
"""
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
self.stream.
|
|
187
|
-
if
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
with self._lock:
|
|
192
|
+
if self._closed:
|
|
193
|
+
return (None, None) if timestamp else None
|
|
194
|
+
buf = self.stream.try_pop_buffer()
|
|
195
|
+
if buf:
|
|
196
|
+
frame = self._array_from_buffer_address(buf)
|
|
197
|
+
self.stream.push_buffer(buf)
|
|
198
|
+
if timestamp:
|
|
199
|
+
return buf.get_timestamp(), frame
|
|
200
|
+
else:
|
|
201
|
+
return frame
|
|
194
202
|
else:
|
|
195
|
-
|
|
203
|
+
if timestamp:
|
|
204
|
+
return None, None
|
|
205
|
+
else:
|
|
206
|
+
return None
|
|
196
207
|
|
|
197
208
|
def _array_from_buffer_address(self, buf):
|
|
198
209
|
if not buf:
|
|
@@ -250,9 +261,13 @@ class Camera(object):
|
|
|
250
261
|
|
|
251
262
|
def shutdown(self):
|
|
252
263
|
# Delete the objects on shutdown: socket will be closed!
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
264
|
+
with self._lock:
|
|
265
|
+
if self._closed:
|
|
266
|
+
return
|
|
267
|
+
self._closed = True
|
|
268
|
+
del self.stream
|
|
269
|
+
del self.dev
|
|
270
|
+
del self.cam
|
|
256
271
|
|
|
257
272
|
|
|
258
273
|
def get_device_ids():
|
|
@@ -2320,7 +2320,7 @@ wheels = [
|
|
|
2320
2320
|
|
|
2321
2321
|
[[package]]
|
|
2322
2322
|
name = "pyobs-aravis"
|
|
2323
|
-
version = "2.0.0.
|
|
2323
|
+
version = "2.0.0.dev14"
|
|
2324
2324
|
source = { editable = "." }
|
|
2325
2325
|
dependencies = [
|
|
2326
2326
|
{ name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|