From ef6ab1fa3850eb7b9fdcc5012ac9442d4c0f1871 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nicolas.pope@utu.fi> Date: Tue, 10 Dec 2019 14:26:22 +0200 Subject: [PATCH] Player to output FTL stream info --- applications/player/src/main.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/applications/player/src/main.cpp b/applications/player/src/main.cpp index 7eeb6e6bf..33e146880 100644 --- a/applications/player/src/main.cpp +++ b/applications/player/src/main.cpp @@ -7,6 +7,7 @@ #include <ftl/timer.hpp> #include <fstream> +#include <bitset> #include <Eigen/Eigen> @@ -57,8 +58,23 @@ int main(int argc, char **argv) { int current_stream = 0; int current_channel = 0; - ftl::timer::add(ftl::timer::kTimerMain, [¤t_stream,¤t_channel,&r](int64_t ts) { - bool res = r.read(ts, [¤t_stream,¤t_channel,&r](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) { + int stream_mask = 0; + std::vector<std::bitset<128>> channel_mask; + + ftl::timer::add(ftl::timer::kTimerMain, [¤t_stream,¤t_channel,&r,&stream_mask,&channel_mask](int64_t ts) { + bool res = r.read(ts, [¤t_stream,¤t_channel,&r,&stream_mask,&channel_mask](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) { + if (!(stream_mask & (1 << spkt.streamID))) { + stream_mask |= 1 << spkt.streamID; + LOG(INFO) << " - Stream found (" << (int)spkt.streamID << ")"; + + channel_mask.push_back(0); + } + + if (!(channel_mask[spkt.streamID][(int)spkt.channel])) { + channel_mask[spkt.streamID].set((int)spkt.channel); + LOG(INFO) << " - Channel " << (int)spkt.channel << " found (" << (int)spkt.streamID << ")"; + } + if (spkt.streamID == current_stream) { if (pkt.codec == codec_t::POSE) { -- GitLab