Skip to content

Commit b381e7b

Browse files
committed
Propagate capture metadata in single-camera flow
Update the single-camera pipeline to use structured capture results from backend reads, extracting `frame`, `software_timestamp`, and `timestamp_metadata` and forwarding metadata through frame emission and recording writes. Recording queue handling now expects the metadata field as well. Preview transform helpers were also switched to reuse `SingleCameraWorker` crop/rotation methods instead of `MultiCameraController`.
1 parent a9195ac commit b381e7b

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎dlclivegui/gui/camera_config/preview.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from PySide6.QtCore import QTimer
99

10+
from ...services.camera_controller import SingleCameraWorker
1011
from ...services.multi_camera_controller import MultiCameraController
1112

1213
if TYPE_CHECKING:
@@ -56,7 +57,7 @@ class PreviewSession:
5657

5758

5859
def apply_rotation(frame, rotation):
59-
return MultiCameraController.apply_rotation(frame, rotation)
60+
return SingleCameraWorker.apply_rotation(frame, rotation)
6061

6162

6263
def apply_crop(frame, x0, y0, x1, y1):
@@ -66,7 +67,7 @@ def apply_crop(frame, x0, y0, x1, y1):
6667
x1 = max(x0, min(x1, w))
6768
y1 = max(y0, min(y1, h))
6869

69-
return MultiCameraController.apply_crop(frame, (x0, y0, x1, y1))
70+
return SingleCameraWorker.apply_crop(frame, (x0, y0, x1, y1))
7071

7172

7273
def resize_to_fit(frame, max_w=400, max_h=300):

‎dlclivegui/services/camera_controller.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ def run(self) -> None:
106106
while not self._stop_event.is_set():
107107
try:
108108
with self._timing.measure("Single.read"):
109-
frame, timestamp = self._backend.read()
109+
captured = self._backend.read()
110+
frame = captured.frame
111+
timestamp = captured.software_timestamp
112+
timestamp_metadata = captured.timestamp_metadata
110113
if frame is None or frame.size == 0:
111114
consecutive_errors += 1
112115
if consecutive_errors >= self._max_consecutive_errors:
@@ -129,12 +132,12 @@ def run(self) -> None:
129132
if recording_enabled and recording_sink is not None:
130133
try:
131134
with self._timing.measure("Single.recording_sink"):
132-
recording_sink(self._camera_id, frame, timestamp)
135+
recording_sink(self._camera_id, frame, timestamp, timestamp_metadata)
133136
except Exception as exc:
134137
logger.exception(f"Failed to write frame for camera {self._camera_id}: {exc}")
135138

136139
with self._timing.measure("Single.emit"):
137-
self.frame_captured.emit(self._camera_id, frame, timestamp)
140+
self.frame_captured.emit(self._camera_id, frame, timestamp, timestamp_metadata)
138141

139142
self._timing.note_frame()
140143
self._timing.maybe_log()

‎dlclivegui/services/recording_manager.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def _dispatch_loop(self) -> None:
159159
if item is _FRAME_SENTINEL:
160160
break
161161

162-
cam_id, frame, timestamp = item
163-
self._write_frame_now(cam_id, frame, timestamp)
162+
cam_id, frame, timestamp, timestamp_metadata = item
163+
self._write_frame_now(cam_id, frame, timestamp, timestamp_metadata)
164164

165165
finally:
166166
try:

0 commit comments

Comments
 (0)