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

Add frame callback

parent 625e9886
Branches
Tags
1 merge request!70Implements #58 rgbd groups
......@@ -191,6 +191,10 @@ class Source : public ftl::Configurable {
SHARED_MUTEX &mutex() { return mutex_; }
std::function<void(int64_t, const cv::Mat &, const cv::Mat &)> &callback() { return callback_; }
void setCallback(std::function<void(int64_t, const cv::Mat &, const cv::Mat &)> cb) { callback_ = cb; }
private:
detail::Source *impl_;
cv::Mat rgb_;
......@@ -205,6 +209,7 @@ class Source : public ftl::Configurable {
channel_t channel_;
cudaStream_t stream_;
int64_t timestamp_;
std::function<void(int64_t, const cv::Mat &, const cv::Mat &)> callback_;
detail::Source *_createImplementation();
detail::Source *_createFileImpl(const ftl::URI &uri);
......
......@@ -153,6 +153,13 @@ void NetSource::_recvChunk(int64_t frame, int chunk, bool delta, const vector<un
timestamp_ = current_frame_*40; // FIXME: Don't hardcode 40ms
current_frame_ = frame;
if (host_->callback()) {
//ftl::pool.push([this](id) {
// UNIQUE_LOCK(host_->mutex(),lk);
host_->callback()(timestamp_, rgb_, depth_);
//});
}
} else if (frame < current_frame_) {
LOG(WARNING) << "Chunk dropped";
if (chunk == 0) N_--;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment