aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/TobiiGlassesPro2/TobiiData.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/argaze/TobiiGlassesPro2/TobiiData.py b/src/argaze/TobiiGlassesPro2/TobiiData.py
index ac24fb3..4cb4d22 100644
--- a/src/argaze/TobiiGlassesPro2/TobiiData.py
+++ b/src/argaze/TobiiGlassesPro2/TobiiData.py
@@ -37,6 +37,9 @@ class VideoTimeStamp():
value: int
"""Vts value."""
+ offset: int
+ """Primary time stamp value."""
+
@dataclass
class EventSynch():
"""Define event synch (evts) data."""
@@ -129,7 +132,7 @@ class TobiiJsonDataParser():
def parse_vts(self, status, json_data):
- return VideoTimeStamp(json_data['vts'])
+ return VideoTimeStamp(json_data['vts'], json_data['ts'])
def parse_event_synch(self, status, json_data):
@@ -208,11 +211,11 @@ class TobiiJsonDataParser():
return parse_map[first_key](status, json_data)
class TobiiDataSegment():
- """Handle Tobii Glasses Pro 2 segment data file."""
+ """Handle Tobii Glasses Pro 2 segment data file from segment directory.
+ Load, parse and store each segment data into dedicated TimeStampedBuffers considering VideoTimeStamp offset to ease data/video synchronisation."""
def __init__(self, segment_data_path, start_timestamp = 0, end_timestamp = None):
- """Load segment data from segment directory then parse and register each recorded dataflow as a TimeStampedBuffer member of the TobiiSegmentData instance."""
-
+
self.__path = segment_data_path
self.__vts_offset = 0
@@ -223,6 +226,7 @@ class TobiiDataSegment():
self.__ts_data_buffer_dict = {
'DirSig': DataStructures.TimeStampedBuffer(),
'PresentationTimeStamp': DataStructures.TimeStampedBuffer(),
+ 'VideoTimeStamp': DataStructures.TimeStampedBuffer(),
'EventSynch': DataStructures.TimeStampedBuffer(),
'Event': DataStructures.TimeStampedBuffer(),
'Accelerometer': DataStructures.TimeStampedBuffer(),
@@ -249,7 +253,8 @@ class TobiiDataSegment():
self.__vts_offset = json_data['vts']
self.__vts_ts = ts
- return True # continue
+ # store primary ts value to allow further reverse offset operation
+ json_data['ts'] = ts
except KeyError:
pass
@@ -288,7 +293,7 @@ class TobiiDataSegment():
return self.__ts_data_buffer_dict[key]
def keys(self) -> list[str]:
- """Get all registered data keys."""
+ """Get all segment data keys."""
return list(self.__ts_data_buffer_dict.keys())