VRS
A file format for sensor data.
Loading...
Searching...
No Matches
TagConventions.h
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19// clang-format off
20
21/*
22 These tag names are pure conventions VRS users may want to follow when creating their VRS files.
23*/
24
25#include <vrs/RecordFileWriter.h>
26#include <vrs/VrsExport.h>
27
28namespace vrs {
29
31namespace tag_conventions {
32
33// Overall identification, HW & SW independent
34
35 // Project name: overarching project name.
36 constexpr const char* kProjectName = "project_name";
37 // EPOCH time in seconds since Jan 1, 1970, associated with the capture.
38 constexpr const char* kCaptureTimeEpoch = "capture_time_epoch";
39 // Origin of kCaptureTimeEpoch: supplied by the caller or the source recording, or the host time
40 // when the file was written, built offline, or merged from other recordings.
41 constexpr const char* kCaptureTimeSource = "capture_time_source";
42 constexpr const char* kCaptureTimeSourceExplicit = "explicit";
43 constexpr const char* kCaptureTimeSourceHostWriterTime = "host_writer_time";
44 constexpr const char* kCaptureTimeSourceHostBuildTime = "host_build_time";
45 constexpr const char* kCaptureTimeSourceHostMergeTime = "host_merge_time";
46 // Session ID: unique identifier which can be used to recognize the session
47 constexpr const char* kSessionId = "session_id";
48 // Capture type: description of the recording session context
49 // Ex: "calibration", "data_collection", "test"
50 constexpr const char* kCaptureType = "capture_type";
51 // A set of tags.
52 constexpr const char* kTagSet = "tag_set";
53
57 VRS_API string addUniqueSessionId(RecordFileWriter& writer);
60 VRS_API void addCaptureTime(RecordFileWriter& writer);
64 VRS_API void addTagSet(RecordFileWriter& writer, const vector<string>& tags);
65
66// Hardware components
67// For dependent devices with their own id/serial (controllers?), tag at the stream level
68
69 // Device Type: device type, maybe the code name of the device/prototype
70 constexpr const char* kDeviceType = "device_type";
71 // Device version: device version name. Ex: "proto0", "EVT2"
72 constexpr const char* kDeviceVersion = "device_version";
73 // Device Serial: serial number of the main HW (in case of multi part HW)
74 constexpr const char* kDeviceSerial = "device_serial";
75 // Device ID: user code identification of the device
76 constexpr const char* kDeviceId = "device_id";
77 // Hardware configuration: description of the hardware setup
78 constexpr const char* kHardwareConfiguration = "hardware_configuration";
79
85 template <class T> inline // vrs::RecordFileWriter or vrs::Recordable
86 void addDevice(T& writer, const string& type, const string& serialNumber, const string& version) {
87 writer.setTag(kDeviceType, type);
88 writer.setTag(kDeviceSerial, serialNumber);
89 writer.setTag(kDeviceVersion, version);
90 }
94 template <class T> inline // vrs::RecordFileWriter or vrs::Recordable
95 void addDeviceId(T& writer, const string& id) {
96 writer.setTag(kDeviceId, id);
97 }
98
99// Software components
100// For dependent devices with their own SW/FW (controllers?), tag at the stream level
101
102 // OS fingerprint: Operating system build signature
103 constexpr const char* kOsFingerprint = "os_fingerprint";
104 // OS version: Operating system version
105 constexpr const char* kOsBuildVersion = "os_build_version";
106 // OS build number: Operating system build number
107 constexpr const char* kOsBranch = "os_branch";
108 // Name of the software that produced the file or stream.
109 constexpr const char* kSoftwareName = "software_name";
110 // SW compile time: when the recording software was compiled
111 constexpr const char* kSoftwareCompileDate = "software_compile_date";
112 // SW revision: source control revision of the software
113 constexpr const char* kSoftwareRevision = "software_revision";
114 // FW compile time: when the recording firmware was compiled
115 constexpr const char* kFirmwareCompileDate = "firmware_compile_date";
116 // FW revision: source control revision of the firmware
117 constexpr const char* kFirmwareRevision = "firmware_revision";
118
121 VRS_API void addOsFingerprint(RecordFileWriter& writer);
126 inline
127 void addSoftwareDetails(RecordFileWriter& writer, const string& compileDate, const string& rev) {
128 writer.setTag(kSoftwareCompileDate, compileDate);
129 writer.setTag(kSoftwareRevision, rev);
130 }
135 template <class T> // vrs::RecordFileWriter or vrs::Recordable
136 inline void addFirmwareDetails(T& writer, const string& fwCompileDate, const string& fwRevision) {
137 writer.setTag(kFirmwareCompileDate, fwCompileDate);
138 writer.setTag(kFirmwareRevision, fwRevision);
139 }
140
141// For streams which may have multiple instances in the same recording
142
143 // Device role: which "role" has this device in the system.
144 // Ex: "top-right camera", "left controller"
145 constexpr const char* kDeviceRole = "device_role"; // When relevant
146
147// Key configuration/settings (when relevant, never required)
148
149 // Intensity target used by dynamic exposure control. How to fill it:
150 // * Do not fill it or fill it with -1 when unknown.
151 // * Fill it with 0 when using fixed exposure settings.
152 // * Fill it with the right intensity target when using dynamic exposure
153 constexpr const char* kDynamicExposureTarget = "iot_dynamic_exposure_target";
154
155// Stream semantic conventions
156
158 constexpr const char* kImageSemantic = "image_semantic";
159
161 constexpr const char* kImageSemanticCamera = "image_semantic_camera";
162 constexpr const char* kImageSemanticDepth = "image_semantic_depth";
164 "image_semantic_object_class_segmentation";
166 "image_semantic_object_id_segmentation";
167
171 constexpr const char* kRenderDepthImagesRangeMin = "render_depth_images_range_min";
172 constexpr const char* kRenderDepthImagesRangeMax = "render_depth_images_range_max";
173
174// Helper functions
178 VRS_API string makeTagSet(const vector<string>& tags);
183 VRS_API bool parseTagSet(const string& jsonTagSet, vector<string>& outVectorTagSet);
184
185/*
186 * Sample: Santa Cruz + controllers
187 *
188 * File tags:
189 * kProjectName = "Santa Cruz"
190 * kCaptureTimeEpoch = "1520364293"
191 * kSessionId = "5584bdc43"
192 * kCaptureType = "calibration" <- other use case: "INSIDE_OUT_TRACKER_RECORDING"...
193 *
194 * kDeviceType = "Santa Cruz"
195 * kDeviceVersion = "EVT3" <- main device (HMD for Santa Cruz)
196 * kDeviceSerial = "0ba3602ffbee80b9" <- of HMD
197 * kHardwareConfiguration = "hmd + 2 hand controllers"
198 *
199 * kOsFingerprint = "oculus/vr_santa_cruz_proto1/proto1:7.1.1/N9F27L/863:userdev/dev-keys"
200 * kSoftwareCompileDate = "Sep 26 2017 19:06:45"
201 * kSoftwareRevision = "185ea53a5584bdc43640ba3602ccbee80b91d33e"
202 * kFirmwareCompileDate = "Sep 20 2017 15:26:25"
203 * kFirmwareRevision = "265ea53b5584bdc43640ba3602ffbee80b91d43a"
204 *
205 * Controller stream tags (for each stream)
206 * kDeviceType = "Santa Cruz Controller"
207 * kDeviceVersion = "EVT0"
208 * kDeviceSerial = "bee80b91d3"
209 * kDeviceId = "left controller"
210 * kFirmwareCompileDate = "Sep 20 2017 15:26:25"
211 * kFirmwareRevision = "265ea53b5584bdc43640ba3602ffbee80b91d43a"
212 */
213
214} // namespace tag_conventions
215} // namespace vrs
The class to create VRS files.
Definition RecordFileWriter.h:91
void setTag(const string &tagName, const string &tagValue)
Definition RecordFileWriter.cpp:677
VRS_API string makeTagSet(const vector< string > &tags)
Definition TagConventions.cpp:47
constexpr const char * kImageSemantic
Tag name to hint how to normalize a stream's images.
Definition TagConventions.h:158
VRS_API void addOsFingerprint(RecordFileWriter &writer)
Definition TagConventions.cpp:35
VRS_API string addUniqueSessionId(RecordFileWriter &writer)
Definition TagConventions.cpp:67
VRS_API void addTagSet(RecordFileWriter &writer, const vector< string > &tags)
Definition TagConventions.cpp:39
void addSoftwareDetails(RecordFileWriter &writer, const string &compileDate, const string &rev)
Definition TagConventions.h:127
VRS_API bool parseTagSet(const string &jsonTagSet, vector< string > &outVectorTagSet)
Definition TagConventions.cpp:55
constexpr const char * kRenderDepthImagesRangeMin
Definition TagConventions.h:171
constexpr const char * kImageSemanticObjectClassSegmentation
Object class segmentation.
Definition TagConventions.h:163
constexpr const char * kImageSemanticDepth
Depth camera.
Definition TagConventions.h:162
VRS_API void addCaptureTime(RecordFileWriter &writer)
Definition TagConventions.cpp:28
void addDevice(T &writer, const string &type, const string &serialNumber, const string &version)
Definition TagConventions.h:86
void addFirmwareDetails(T &writer, const string &fwCompileDate, const string &fwRevision)
Definition TagConventions.h:136
constexpr const char * kImageSemanticObjectIdSegmentation
Object ID segmentation.
Definition TagConventions.h:165
void addDeviceId(T &writer, const string &id)
Definition TagConventions.h:95
constexpr const char * kImageSemanticCamera
Possible values for kImageSemantic.
Definition TagConventions.h:161
Definition Compressor.cpp:130