diff --git a/applications/reconstruct/src/main.cpp b/applications/reconstruct/src/main.cpp index 5684858874d28e9f0375ff0fb27acffb1b14babf..34150aeb78895881f825b101dd8d4b24d4d40aaf 100644 --- a/applications/reconstruct/src/main.cpp +++ b/applications/reconstruct/src/main.cpp @@ -166,6 +166,8 @@ static void run(ftl::Configurable *root) { ftl::codecs::Writer writer(fileout); auto recorder = [&writer](ftl::rgbd::Source *src, const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) { LOG(INFO) << "About to write"; + // TODO: Patch spkt with correct streamID + // TODO: Also adapt timestamp inside writer to be file relative writer.write(spkt, pkt); }; @@ -180,6 +182,9 @@ static void run(ftl::Configurable *root) { fileout.open(std::string(timestamp) + ".ftl"); writer.begin(); + + // TODO: Write pose+calibration packets + group.addRawCallback(std::function(recorder)); } else { group.removeRawCallback(recorder); diff --git a/components/codecs/include/ftl/codecs/packet.hpp b/components/codecs/include/ftl/codecs/packet.hpp index bca68530a20c1f6c2bba8228ee8c1bbadf41d71e..3c04008143945b094bfb3b7c558ea9e6b275a37f 100644 --- a/components/codecs/include/ftl/codecs/packet.hpp +++ b/components/codecs/include/ftl/codecs/packet.hpp @@ -10,7 +10,9 @@ namespace ftl { namespace codecs { - +/** + * First bytes of our file format. + */ struct Header { const char magic[4] = {'F','T','L','F'}; uint8_t version; @@ -27,7 +29,7 @@ struct Packet { ftl::codecs::definition_t definition; uint8_t block_total; // Packets expected per frame uint8_t block_number; // This packets number within a frame - uint8_t flags; // Codec dependent flags + uint8_t flags; // Codec dependent flags (eg. I-Frame or P-Frame) std::vector<uint8_t> data; MSGPACK_DEFINE(codec, definition, block_total, block_number, flags, data); @@ -40,10 +42,11 @@ struct Packet { */ struct StreamPacket { int64_t timestamp; - uint8_t streamID; // Source number... - uint8_t channel; // first bit = channel, second bit indicates second channel being sent + uint8_t streamID; // Source number... + uint8_t channel_count; // Number of channels to expect (usually 1 or 2) + uint8_t channel; // Actual channel of this current set of packets - MSGPACK_DEFINE(timestamp, streamID, channel); + MSGPACK_DEFINE(timestamp, streamID, channel_count, channel); }; }