build.rs: use the streamindex to write the correct data, instead of hand-crafted binary bits

This commit is contained in:
2026-03-09 10:27:58 +01:00
parent d942561900
commit 4eafbde5a9

View File

@@ -205,12 +205,13 @@ fn write_sim_data() {
let segments = [(StreamType::IMU, motion_output), (StreamType::GPS, gps_output), (StreamType::Annotations, annotation_output)]; let segments = [(StreamType::IMU, motion_output), (StreamType::GPS, gps_output), (StreamType::Annotations, annotation_output)];
// Write out the stream index header // Write out the stream index header
rmp::encode::write_array_len(&mut unified_fd, segments.len() as u32).unwrap(); StreamIndex { count: segments.len() }.write_rmp(&mut unified_fd).unwrap();
// Then the streams // Then the streams
for (stream_type, stream_path) in segments { for (stream_type, stream_path) in segments {
let mut fd = File::open(stream_path).unwrap(); let mut fd = File::open(stream_path).unwrap();
rmp::encode::write_ext_meta(&mut unified_fd, fd.metadata().unwrap().len() as u32, stream_type.into()).unwrap(); // FIXME: Replace this with the actual rmp types in simdata
StreamHeader { id: stream_type, size: fd.metadata().unwrap().len() as usize }.write_rmp(&mut unified_fd).unwrap();
let mut buf = Vec::new(); let mut buf = Vec::new();
fd.read_to_end(&mut buf).unwrap(); fd.read_to_end(&mut buf).unwrap();
unified_fd.write_all(buf.as_slice()).unwrap(); unified_fd.write_all(buf.as_slice()).unwrap();