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

Merge branch 'master' into bug/83/netfps

parents b57a5234 1c88d656
No related branches found
No related tags found
1 merge request!37Resolves #83 net performance, partially
Checking pipeline status
......@@ -4,8 +4,8 @@
#include <loguru.hpp>
#include "ftl/rgbd/source.hpp"
#include "ftl/rgbd/snapshot.hpp"
#include <ftl/rgbd/source.hpp>
#include <ftl/rgbd/snapshot.hpp>
namespace ftl {
namespace rgbd {
......
......@@ -7,6 +7,7 @@
#include "image.hpp"
#ifdef HAVE_LIBARCHIVE
#include <ftl/rgbd/snapshot.hpp>
#include "snapshot_source.hpp"
#endif
......@@ -102,8 +103,14 @@ ftl::rgbd::detail::Source *Source::_createFileImpl(const ftl::URI &uri) {
return new ImageSource(this, path);
} else if (ext == "mp4") {
return new StereoVideoSource(this, path);
} else if (ext == "tar") {
} else if (ext == "tar" || ext == "gz") {
#ifdef HAVE_LIBARCHIVE
ftl::rgbd::SnapshotReader reader(path);
return new ftl::rgbd::detail::SnapshotSource(this, reader, std::to_string(value("index", 0))); // TODO Get ID from config
#else
LOG(ERROR) << "Cannot read snapshots, libarchive not installed";
return nullptr;
#endif // HAVE_LIBARCHIVE
} else {
LOG(WARNING) << "Unrecognised file type: " << path;
}
......
......@@ -9,6 +9,12 @@ static std::string last_type = "";
namespace ftl {
namespace rgbd {
class SnapshotReader {
public:
SnapshotReader(const std::string &) {}
};
namespace detail {
class ImageSource : public ftl::rgbd::detail::Source {
......@@ -47,6 +53,16 @@ class NetSource : public ftl::rgbd::detail::Source {
bool isReady() { return true; };
};
class SnapshotSource : public ftl::rgbd::detail::Source {
public:
SnapshotSource(ftl::rgbd::Source *host, ftl::rgbd::SnapshotReader &r, const std::string &) : ftl::rgbd::detail::Source(host) {
last_type = "snapshot";
}
bool grab() { return true; };
bool isReady() { return true; };
};
class RealsenseSource : public ftl::rgbd::detail::Source {
public:
RealsenseSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) {
......@@ -66,6 +82,7 @@ class RealsenseSource : public ftl::rgbd::detail::Source {
// Prevent these headers...
#define _FTL_RGBD_STEREOVIDEO_HPP_
#define _FTL_RGBD_NET_HPP_
#define _FTL_RGBD_SNAPSHOT_HPP_
#define _FTL_RGBD_SNAPSHOT_SOURCE_HPP_
#define _FTL_RGBD_IMAGE_HPP_
#define _FTL_RGBD_REALSENSE_HPP_
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment