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

Minor changes

parent a386b648
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #27418 failed
...@@ -156,9 +156,11 @@ static void run(ftl::Configurable *root) { ...@@ -156,9 +156,11 @@ static void run(ftl::Configurable *root) {
ftl::data::Pool pool(2,5); ftl::data::Pool pool(2,5);
auto creator = pool.creator<ftl::data::IntervalFrameCreator>(0, source); auto creator = pool.creator<ftl::data::IntervalFrameCreator>(0, source);
auto h = source->onFrame([](ftl::data::Frame &f) { // Listen for any flush events for frameset 0
LOG(INFO) << "Got a frame"; auto flushh = pool.group(0).onFlush([](ftl::data::Frame &f, ftl::codecs::Channel c) {
if (f.has(ftl::codecs::Channel::Colour)) { // Send to sender for encoding
if (c == ftl::codecs::Channel::Colour) {
cv::Mat tmp; cv::Mat tmp;
f.get<cv::cuda::GpuMat>(ftl::codecs::Channel::Colour).download(tmp); f.get<cv::cuda::GpuMat>(ftl::codecs::Channel::Colour).download(tmp);
cv::imshow("Image", tmp); cv::imshow("Image", tmp);
...@@ -167,6 +169,16 @@ static void run(ftl::Configurable *root) { ...@@ -167,6 +169,16 @@ static void run(ftl::Configurable *root) {
return true; return true;
}); });
// Callback for when a source has populated a frame with data
auto h = source->onFrame([](ftl::data::Frame &f) {
// Lock and send colour right now to encode in parallel
f.flush(ftl::codecs::Channel::Colour);
// Do pipeline here...
return true;
});
// Start the timed generation of frames
creator.start(); creator.start();
int stats_count = 0; int stats_count = 0;
......
...@@ -183,6 +183,7 @@ bool Source::capture(int64_t ts) { ...@@ -183,6 +183,7 @@ bool Source::capture(int64_t ts) {
} }
bool Source::retrieve(ftl::data::Frame &f) { bool Source::retrieve(ftl::data::Frame &f) {
if (is_retrieving) return false;
is_retrieving = true; is_retrieving = true;
bool status = false; bool status = false;
if (impl_) status = impl_->retrieve(f.cast<ftl::rgbd::Frame>()); if (impl_) status = impl_->retrieve(f.cast<ftl::rgbd::Frame>());
......
...@@ -19,6 +19,7 @@ class Pool { ...@@ -19,6 +19,7 @@ class Pool {
void release(Frame &f); void release(Frame &f);
ftl::data::Session &session(uint32_t id); ftl::data::Session &session(uint32_t id);
inline ftl::data::Session &group(uint32_t id) { return session(id); }
size_t size(uint32_t id); size_t size(uint32_t id);
......
...@@ -31,7 +31,9 @@ void IntervalFrameCreator::start() { ...@@ -31,7 +31,9 @@ void IntervalFrameCreator::start() {
retrieve_ = std::move(ftl::timer::add(ftl::timer::timerlevel_t::kTimerMain, [this](int64_t ts) { retrieve_ = std::move(ftl::timer::add(ftl::timer::timerlevel_t::kTimerMain, [this](int64_t ts) {
Frame f = create(ts); Frame f = create(ts);
f.store(); f.store();
src_->retrieve(f); if (!src_->retrieve(f)) {
LOG(WARNING) << "Frame was skipping";
}
return true; return true;
})); }));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment