Use std::filesystem::path for playback path
This commit is contained in:
@@ -57,7 +57,7 @@ namespace OpenVulkano::AR
|
||||
return { nullptr, ArCreateResult::FAILED_UNKNOWN, "Unknown exception while initializing AR system." };
|
||||
}
|
||||
|
||||
ArCreateResult ArSession::CreatePlayback(const std::string& recordingPath, bool autoAdvance, bool loadImages, bool loadDepth)
|
||||
ArCreateResult ArSession::CreatePlayback(const std::filesystem::path& recordingPath, bool autoAdvance, bool loadImages, bool loadDepth)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "ArTrackingState.hpp"
|
||||
#include "ArSessionMetadata.hpp"
|
||||
#include "ArRecorder.hpp"
|
||||
#include "Math/Range.hpp"
|
||||
#include "Base/Event.hpp"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -112,9 +111,11 @@ namespace OpenVulkano::AR
|
||||
* Creates a playback AR session. nullptr if failed to create session for given path.
|
||||
* @param recordingPath Path to a previously recorded AR session.
|
||||
* @param autoAdvance If set to true the playback will advance based on the stored timestamps. If set to false it will only advance if a new frame is requested.
|
||||
* @param loadImages If set to true, image will be loaded
|
||||
* @param loadDepth If set to true, depth data will be loaded
|
||||
* @return ArCreateResult about the status of the AR session creation. The session pointer will always be nullptr unless the status is SUCCESS.
|
||||
*/
|
||||
[[nodiscard]] [[deprecated]] static ArCreateResult CreatePlayback(const std::string& recordingPath, bool autoAdvance = true, bool loadImages = true, bool loadDepth = true);
|
||||
[[nodiscard]] static ArCreateResult CreatePlayback(const std::filesystem::path& recordingPath, bool autoAdvance = true, bool loadImages = true, bool loadDepth = true);
|
||||
|
||||
/**
|
||||
* Creates a network streamed AR session. nullptr if failed to create session for given address. This will block till the connection with the remote host has been established.
|
||||
|
||||
@@ -47,9 +47,9 @@ namespace OpenVulkano::AR::Playback
|
||||
size_t m_imgTotalSize = 0, m_imgReadSize = 0;
|
||||
|
||||
public:
|
||||
[[deprecated]] ArPlaybackReader(const std::string& recDir)
|
||||
ArPlaybackReader(const std::filesystem::path& recDir)
|
||||
{
|
||||
std::string extensions = R"((_\d+|\.part\d+)?)" + std::string(TAR_EXTENSIONS_REGEX);
|
||||
const std::string extensions = R"((_\d+|\.part\d+)?)" + std::string(TAR_EXTENSIONS_REGEX);
|
||||
m_archiveMetadata.Open(recDir, ".*meta(data)?" + extensions);
|
||||
m_archiveColor.Open(recDir, ".*(color|image)" + extensions, &m_imgTotalSize);
|
||||
m_archiveDepth.Open(recDir, ".*depth" + extensions);
|
||||
|
||||
@@ -14,7 +14,7 @@ using namespace std::chrono_literals;
|
||||
|
||||
namespace OpenVulkano::AR::Playback
|
||||
{
|
||||
ArSessionPlayback::ArSessionPlayback(const std::string& recordingPath, bool autoAdvance, bool loadImages, bool loadDepth)
|
||||
ArSessionPlayback::ArSessionPlayback(const std::filesystem::path& recordingPath, const bool autoAdvance, const bool loadImages, const bool loadDepth)
|
||||
: ArSession(ArSessionMetadata(recordingPath)), recordingPath(recordingPath), autoAdvance(autoAdvance)
|
||||
, loadImages(loadImages), loadDepth(loadDepth), playbackReader(recordingPath)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ namespace OpenVulkano::AR::Playback
|
||||
OnSessionInterruptionChange(true);
|
||||
}
|
||||
|
||||
Scene::Texture* ArSessionPlayback::MakeTexture(OpenVulkano::AR::ArFrame* frame)
|
||||
Scene::Texture* ArSessionPlayback::MakeTexture(ArFrame* frame)
|
||||
{
|
||||
Scene::Texture* texture;
|
||||
if (!m_textureCache.empty())
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenVulkano::AR::Playback
|
||||
class ArSessionPlayback final : public ArSession, public std::enable_shared_from_this<ArSessionPlayback>
|
||||
{
|
||||
public:
|
||||
[[deprecated]] ArSessionPlayback(const std::string& recordingPath, bool autoAdvance, bool loadImages, bool loadDepth);
|
||||
ArSessionPlayback(const std::filesystem::path& recordingPath, bool autoAdvance, bool loadImages, bool loadDepth);
|
||||
|
||||
~ArSessionPlayback() override;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenVulkano::AR::Playback
|
||||
|
||||
[[nodiscard]] ArType GetArType() override;
|
||||
|
||||
[[nodiscard]] [[deprecated]] const std::string& GetPlaybackPath() const { return recordingPath; }
|
||||
[[nodiscard]] const std::filesystem::path& GetPlaybackPath() const { return recordingPath; }
|
||||
|
||||
[[nodiscard]] bool IsLoadColorEnabled() const { return loadImages; }
|
||||
[[nodiscard]] bool IsLoadDepthEnabled() const { return loadDepth; }
|
||||
@@ -43,7 +43,7 @@ namespace OpenVulkano::AR::Playback
|
||||
Event<double> OnPlaybackProgress;
|
||||
|
||||
protected:
|
||||
Scene::Texture* MakeTexture(OpenVulkano::AR::ArFrame* frame) override;
|
||||
Scene::Texture* MakeTexture(ArFrame* frame) override;
|
||||
|
||||
void ReturnTexture(Scene::Texture *texture) override;
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenVulkano::AR::Playback
|
||||
|
||||
|
||||
Math::Timestamp lastTimestamp;
|
||||
const std::string recordingPath;
|
||||
const std::filesystem::path recordingPath;
|
||||
const bool autoAdvance, loadImages, loadDepth;
|
||||
ArPlaybackReader playbackReader;
|
||||
ArTrackingState m_lastTrackingState = ArTrackingState::UNKNOWN;
|
||||
|
||||
Reference in New Issue
Block a user