Skip to content
Snippets Groups Projects
Commit 3207d40c authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

Merge branch 'feature/use-new-frame' of gitlab.utu.fi:nicolas.pope/ftl into feature/use-new-frame

parents 6100a943 e28572db
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #27486 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,40 @@ 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);
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);
//nstream->select(0, {Channel::Colour}, true);
stream->add(nstream);
++count;
}
generators.push_back(gen);
stream->begin();
stream->select(0, Channel::Colour + Channel::Depth, true);
}
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 +148,6 @@ static void run(ftl::Configurable *root) {
return true;
})));
++i;
}
}
LOG(INFO) << "Start timer";
......
......@@ -63,10 +63,11 @@ bool Net::post(const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet
// Check if the channel has been requested recently enough. If not then disable it.
if (host_ && pkt.data.size() > 0 && spkt.frame_number == 0 && static_cast<int>(spkt.channel) >= 0 && static_cast<int>(spkt.channel) < 32) {
if (reqtally_[static_cast<int>(spkt.channel)] == 0) {
--reqtally_[static_cast<int>(spkt.channel)];
auto sel = selected(0);
sel -= spkt.channel;
select(0, sel);
LOG(INFO) << "Unselect Channel: " << (int)spkt.channel;
LOG(INFO) << "Unselect Channel: " << (int)spkt.channel << " (" << (int)spkt.streamID << ")";
} else {
--reqtally_[static_cast<int>(spkt.channel)];
}
......@@ -185,9 +186,10 @@ bool Net::begin() {
if (tally_ <= 5) {
// Yes, so send new requests
if (size() > 0) {
auto sel = selected(0);
const auto &sel = selected(0);
for (auto c : sel) {
LOG(INFO) << "DO I SEND REQ";
_sendRequest(c, kAllFramesets, kAllFrames, 30, 0);
}
}
......@@ -213,6 +215,7 @@ bool Net::begin() {
} else {
select(spkt.frameSetID(), selected(spkt.frameSetID()) + spkt.channel);
}
LOG(INFO) << "GOT REQUEST";
_processRequest(p, pkt);
} else {
// FIXME: Allow availability to change...
......@@ -266,7 +269,7 @@ void Net::reset() {
bool Net::_sendRequest(Channel c, uint8_t frameset, uint8_t frames, uint8_t count, uint8_t bitrate) {
if (!active_ || host_) return false;
//LOG(INFO) << "SENDING REQUEST FOR " << (int)c;
LOG(INFO) << "SENDING REQUEST FOR " << (int)c;
Packet pkt = {
codec_t::Any, // TODO: Allow specific codec requests
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment