Fix issue with loading ArSessionMetadata

This commit is contained in:
Georg Hagen
2025-06-09 10:16:17 +02:00
parent 128aa6599c
commit fb504e8c51
2 changed files with 5 additions and 7 deletions

View File

@@ -83,7 +83,7 @@ namespace OpenVulkano::AR
std::filesystem::exists(dirPath / RECORDING_METADATA_FILENAME);
}
ArSessionMetadata::ArSessionMetadata(const std::filesystem::path& dirPath)
ArSessionMetadata ArSessionMetadata::FromFile(const std::filesystem::path& dirPath)
{
std::optional<ArSessionMetadata> metaFromFile;
if (!is_directory(dirPath)) throw std::runtime_error("Ar recording path must be a directory!");
@@ -103,10 +103,8 @@ namespace OpenVulkano::AR
metaFromFile = FromYaml(ymlInfoPath.string());
}
if (!metaFromFile) throw std::runtime_error("Ar recording dir is missing platform metadata file!");
type = metaFromFile->type;
depthFormat = metaFromFile->depthFormat;
confidenceRange = metaFromFile->confidenceRange;
playback = true;
metaFromFile->playback = true;
return *metaFromFile;
}
std::string ArSessionMetadata::FinishedRecordingInfoToYaml() const

View File

@@ -46,7 +46,7 @@ namespace OpenVulkano::AR
, recFrameCount(frameCount), recDuration(duration), recSkippedFrames(skippedFrames), frontSensor(frontSensor)
{}
ArSessionMetadata(const std::filesystem::path& dirPath);
ArSessionMetadata(const std::filesystem::path& dirPath) : ArSessionMetadata(FromFile(dirPath)) {}
[[nodiscard]] std::string ToYaml() const;
@@ -60,7 +60,7 @@ namespace OpenVulkano::AR
static bool DirHasMetadata(const std::filesystem::path& dirPath);
static ArSessionMetadata FromXML(const std::filesystem::path& filePath);
static ArSessionMetadata FromYaml(const std::filesystem::path& filePath);
static ArSessionMetadata FromFile(const std::filesystem::path& dirPath);
};
}