diff options
author | Théo de la Hogue | 2022-11-09 16:54:33 +0100 |
---|---|---|
committer | Théo de la Hogue | 2022-11-09 16:54:33 +0100 |
commit | 018e50b24c4fe5e6b5f2b32f7d2edd924f640ec1 (patch) | |
tree | ec8db4bc09107dd3f151a1b5baf2fdc506c3fbbf | |
parent | d56194d29c792a375abf306f22254e2ab51f11f6 (diff) | |
download | argaze-018e50b24c4fe5e6b5f2b32f7d2edd924f640ec1.zip argaze-018e50b24c4fe5e6b5f2b32f7d2edd924f640ec1.tar.gz argaze-018e50b24c4fe5e6b5f2b32f7d2edd924f640ec1.tar.bz2 argaze-018e50b24c4fe5e6b5f2b32f7d2edd924f640ec1.tar.xz |
Loading VideoTimeStamp and storing primary time stamp for further reverse offset operations.
-rw-r--r-- | src/argaze/TobiiGlassesPro2/TobiiData.py | 17 |
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()) |