diff --git a/applications/gui2/src/modules/calibration/extrinsic.cpp b/applications/gui2/src/modules/calibration/extrinsic.cpp index d9f60cc1315b4718d6e25bab65d7c4b662a8bd15..3228fd2c0fd9a1e17ee5a664503c76f683c582ee 100644 --- a/applications/gui2/src/modules/calibration/extrinsic.cpp +++ b/applications/gui2/src/modules/calibration/extrinsic.cpp @@ -224,10 +224,11 @@ std::vector<std::pair<std::string, unsigned int>> ExtrinsicCalibration::listFram std::vector<std::pair<std::string, ftl::data::FrameID>> ExtrinsicCalibration::listSources(unsigned int fsid, bool all) { std::vector<std::pair<std::string, FrameID>> cameras; + auto fs = io->feed()->getFrameSet(fsid); for (auto id : io->feed()->listFrames()) { if (id.frameset() != fsid) { continue; } if (all || io->feed()->availableChannels(id).count(Channel::CalibrationData)) { - auto name = io->feed()->getURI(id.frameset()) + "#" + std::to_string(id.source()); + std::string name = (*fs)[id.source()].name(); cameras.push_back({name, id}); } } diff --git a/applications/gui2/src/modules/calibration/intrinsic.cpp b/applications/gui2/src/modules/calibration/intrinsic.cpp index 43c08485d0ebc55f7a5636cbd63dc6e4a0625880..ba754184b06488c9bd41224507573ab2d7fe59cd 100644 --- a/applications/gui2/src/modules/calibration/intrinsic.cpp +++ b/applications/gui2/src/modules/calibration/intrinsic.cpp @@ -367,9 +367,9 @@ std::vector<std::pair<std::string, FrameID>> IntrinsicCalibration::listSources(b std::vector<std::pair<std::string, FrameID>> cameras; for (auto id : io->feed()->listFrames()) { auto channels = io->feed()->availableChannels(id); - // TODO: doesn't work if (all || (channels.count(Channel::CalibrationData) == 1)) { - auto name = io->feed()->getURI(id.frameset()) + "#" + std::to_string(id.source()); + auto name = (*(io->feed()->getFrameSet(id.frameset())))[id.source()].name(); + //auto name = io->feed()->getURI(id.frameset()) + "#" + std::to_string(id.source()); cameras.push_back({name, id}); } } diff --git a/components/streams/include/ftl/streams/feed.hpp b/components/streams/include/ftl/streams/feed.hpp index 72075b74fe786a3803ce6dc2d9616cba3ed10013..53bdffa2345dd4f792be76fab00f2f1375ba5449 100644 --- a/components/streams/include/ftl/streams/feed.hpp +++ b/components/streams/include/ftl/streams/feed.hpp @@ -89,6 +89,9 @@ public: uint32_t getID(const std::string &source); std::string getURI(uint32_t fsid); + /** Get current frameset (cached) */ + ftl::data::FrameSetPtr getFrameSet(uint32_t); + /** * Get the configurable ID that corresponds to the original source. For * net stream sources this may be a remote configurable. diff --git a/components/streams/src/feed.cpp b/components/streams/src/feed.cpp index defe19720ee5cfb0204477123b7bb0c8c911f733..b6c15f2b9c7edaae7ec2e9d1c2fc696fa35d697a 100644 --- a/components/streams/src/feed.cpp +++ b/components/streams/src/feed.cpp @@ -512,7 +512,7 @@ void Feed::_updateNetSources(ftl::net::Peer *p, bool autoadd) { // Peer may not have a list_streams binding yet try { auto peerstreams = p->call<std::vector<std::string>>("list_streams"); - + UNIQUE_LOCK(mtx_, lk); //netcams_ = std::move(netcams); @@ -532,7 +532,7 @@ void Feed::_updateNetSources(ftl::net::Peer *p, bool autoadd) { }); } catch (const ftl::exception &e) { - + } /* done by add() @@ -779,7 +779,7 @@ uint32_t Feed::add(const std::string &path) { uint32_t Feed::add(const ftl::URI &uri) { UNIQUE_LOCK(mtx_, lk); - + //if (!uri.isValid()) throw FTL_Error("Invalid URI: " << path); if (fsid_lookup_.count(uri.getBaseURI()) > 0) return fsid_lookup_[uri.getBaseURI()]; @@ -1140,3 +1140,10 @@ bool Feed::isRecording() { bool Feed::_isRecording() { return record_stream_->streams().size() != 0; } + +ftl::data::FrameSetPtr Feed::getFrameSet(uint32_t fsid) { + if (latest_.count(fsid) == 0) { + throw ftl::exception("No FrameSet with given ID"); + } + return std::atomic_load(&latest_[fsid]); +}