build.rs: use the streamindex to write the correct data, instead of hand-crafted binary bits
This commit is contained in:
5
build.rs
5
build.rs
@@ -205,12 +205,13 @@ fn write_sim_data() {
|
||||
let segments = [(StreamType::IMU, motion_output), (StreamType::GPS, gps_output), (StreamType::Annotations, annotation_output)];
|
||||
|
||||
// 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
|
||||
for (stream_type, stream_path) in segments {
|
||||
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();
|
||||
fd.read_to_end(&mut buf).unwrap();
|
||||
unified_fd.write_all(buf.as_slice()).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user