diff --git a/components/streams/src/renderers/screen_render.cpp b/components/streams/src/renderers/screen_render.cpp index da685ea8888bc0620c2486cf4660ba3d962b863b..7f6c7a359ab064b29b8fe46be3122722c00371f0 100644 --- a/components/streams/src/renderers/screen_render.cpp +++ b/components/streams/src/renderers/screen_render.cpp @@ -161,7 +161,7 @@ bool ScreenRender::retrieve(ftl::data::Frame &frame_out) { shape.type = Shape3DType::CAMERA; shape.size = Eigen::Vector3f(0.2f,0.2f,0.2f); shape.pose = f.cast<ftl::rgbd::Frame>().getPose().cast<float>(); - shape.label = std::string("Camera"); + shape.label = f.name(); } } diff --git a/components/structures/include/ftl/data/new_frame.hpp b/components/structures/include/ftl/data/new_frame.hpp index 8a935688ef19ee25f1be734a348d50a3b9501c07..557984e8761fff9a19fa69edb78af74518785246 100644 --- a/components/structures/include/ftl/data/new_frame.hpp +++ b/components/structures/include/ftl/data/new_frame.hpp @@ -642,6 +642,11 @@ class Frame { void information(const std::string &msg); void information(const ftl::Formatter &msg); + /** + * Get or generate a name for this frame. + */ + std::string name() const; + // ========================================================================= protected: diff --git a/components/structures/src/new_frame.cpp b/components/structures/src/new_frame.cpp index ba79f32bf88fa131dd6d91fa4bdc39faefc1f612..ba95ba2677b3eb06ca36a8b9c594438ced4ab184 100644 --- a/components/structures/src/new_frame.cpp +++ b/components/structures/src/new_frame.cpp @@ -470,6 +470,17 @@ void Frame::information(const ftl::Formatter &msg) { information(msg.str()); } +std::string Frame::name() const { + if (has(Channel::MetaData)) { + const auto &meta = get<std::map<std::string,std::string>>(Channel::MetaData); + auto i = meta.find("name"); + if (i != meta.end()) return i->second; + } + + // Generate a name + return std::string("Frame-") + std::to_string(frameset()) + std::string("-") + std::to_string(source()); +} + // ==== Session ================================================================ ftl::Handle Session::onChange(uint32_t pid, ftl::codecs::Channel c, const std::function<bool(Frame&,ftl::codecs::Channel)> &cb) {