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

Simple viewer with net streams also

parent fc591433
Branches
Tags
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #27482 failed
......@@ -88,6 +88,8 @@ static void run(ftl::Configurable *root) {
std::list<ftl::Handle> handles;
ftl::data::Pool pool(2,10);
std::list<ftl::data::Generator*> generators;
// Check paths for FTL files to load.
auto paths = (*root->get<nlohmann::json>("paths"));
int i = 0; //groups.size();
......@@ -99,9 +101,44 @@ static void run(ftl::Configurable *root) {
// Command line path is ftl file
if (ext == "ftl") {
auto *gen = createFileGenerator(root, &pool, path);
generators.push_back(gen);
++i;
} else {
ftl::URI uri(path);
if (uri.getScheme() == ftl::URI::SCHEME_TCP || uri.getScheme() == ftl::URI::SCHEME_WS) {
net->connect(path)->waitConnection();
}
}
}
auto stream_uris = net->findAll<std::string>("list_streams");
handles.push_back(std::move(gen->onFrameSet([&](std::shared_ptr<ftl::data::FrameSet> fs) {
if (stream_uris.size() > 0) {
ftl::stream::Muxer *stream = ftl::create<ftl::stream::Muxer>(root, "muxstream");
ftl::stream::Receiver *gen = ftl::create<ftl::stream::Receiver>(root, "receiver", &pool);
gen->setStream(stream);
//sender->onRequest([stream](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
// if (spkt.channel == Channel::Colour) {
// stream->reset();
// }
//});
int count = 0;
for (auto &s : stream_uris) {
LOG(INFO) << " --- found stream: " << s;
auto *nstream = ftl::create<ftl::stream::Net>(stream, std::string("netstream")+std::to_string(count), net);
nstream->set("uri", s);
stream->add(nstream);
++count;
}
generators.push_back(gen);
stream->begin();
}
for (auto *g : generators) {
handles.push_back(std::move(g->onFrameSet([&](std::shared_ptr<ftl::data::FrameSet> fs) {
LOG(INFO) << "Got frameset: " << fs->timestamp();
for (auto &f : fs->frames) {
if (f.has(Channel::Colour)) {
......@@ -115,9 +152,6 @@ static void run(ftl::Configurable *root) {
return true;
})));
++i;
}
}
LOG(INFO) << "Start timer";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment