Skip to content
Snippets Groups Projects
Commit 5c301da9 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Add channel_count to stream

parent 87939ee4
No related branches found
No related tags found
1 merge request!127Implements #196 stream capturing
Pipeline #15286 passed
...@@ -166,6 +166,8 @@ static void run(ftl::Configurable *root) { ...@@ -166,6 +166,8 @@ static void run(ftl::Configurable *root) {
ftl::codecs::Writer writer(fileout); ftl::codecs::Writer writer(fileout);
auto recorder = [&writer](ftl::rgbd::Source *src, const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) { auto recorder = [&writer](ftl::rgbd::Source *src, const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
LOG(INFO) << "About to write"; 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); writer.write(spkt, pkt);
}; };
...@@ -180,6 +182,9 @@ static void run(ftl::Configurable *root) { ...@@ -180,6 +182,9 @@ static void run(ftl::Configurable *root) {
fileout.open(std::string(timestamp) + ".ftl"); fileout.open(std::string(timestamp) + ".ftl");
writer.begin(); writer.begin();
// TODO: Write pose+calibration packets
group.addRawCallback(std::function(recorder)); group.addRawCallback(std::function(recorder));
} else { } else {
group.removeRawCallback(recorder); group.removeRawCallback(recorder);
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
namespace ftl { namespace ftl {
namespace codecs { namespace codecs {
/**
* First bytes of our file format.
*/
struct Header { struct Header {
const char magic[4] = {'F','T','L','F'}; const char magic[4] = {'F','T','L','F'};
uint8_t version; uint8_t version;
...@@ -27,7 +29,7 @@ struct Packet { ...@@ -27,7 +29,7 @@ struct Packet {
ftl::codecs::definition_t definition; ftl::codecs::definition_t definition;
uint8_t block_total; // Packets expected per frame uint8_t block_total; // Packets expected per frame
uint8_t block_number; // This packets number within a 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; std::vector<uint8_t> data;
MSGPACK_DEFINE(codec, definition, block_total, block_number, flags, data); MSGPACK_DEFINE(codec, definition, block_total, block_number, flags, data);
...@@ -41,9 +43,10 @@ struct Packet { ...@@ -41,9 +43,10 @@ struct Packet {
struct StreamPacket { struct StreamPacket {
int64_t timestamp; int64_t timestamp;
uint8_t streamID; // Source number... uint8_t streamID; // Source number...
uint8_t channel; // first bit = channel, second bit indicates second channel being sent 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);
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment