Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the handling of path string #528

Merged
merged 8 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FilterData.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ struct filter_data : public ORTModelData {
std::mutex outputLock;

#if _WIN32
const wchar_t *modelFilepath = nullptr;
std::wstring modelFilepath;
#else
const char *modelFilepath = nullptr;
std::string modelFilepath;
#endif
};

Expand Down
4 changes: 2 additions & 2 deletions src/background-filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ void background_filter_update(void *data, obs_data_t *settings)
obs_log(LOG_INFO, " Blur Focus Depth: %f", tf->blurFocusDepth);
obs_log(LOG_INFO, " Disabled: %s", tf->isDisabled ? "true" : "false");
#ifdef _WIN32
obs_log(LOG_INFO, " Model file path: %S", tf->modelFilepath);
obs_log(LOG_INFO, " Model file path: %S", tf->modelFilepath.c_str());
#else
obs_log(LOG_INFO, " Model file path: %s", tf->modelFilepath);
obs_log(LOG_INFO, " Model file path: %s", tf->modelFilepath.c_str());
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions src/ort-utils/ort-session-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ int createOrtSession(filter_data *tf)
std::wstring modelFilepath_ws(modelFilepath_s.size(), L' ');
std::copy(modelFilepath_s.begin(), modelFilepath_s.end(),
modelFilepath_ws.begin());
tf->modelFilepath = modelFilepath_ws.c_str();
tf->modelFilepath = modelFilepath_ws;
#else
tf->modelFilepath = modelFilepath_s.c_str();
tf->modelFilepath = modelFilepath_s;
#endif

try {
Expand Down Expand Up @@ -92,7 +92,7 @@ int createOrtSession(filter_data *tf)
sessionOptions, coreml_flags));
}
#endif
tf->session.reset(new Ort::Session(*tf->env, tf->modelFilepath,
tf->session.reset(new Ort::Session(*tf->env, tf->modelFilepath.c_str(),
sessionOptions));
} catch (const std::exception &e) {
obs_log(LOG_ERROR, "%s", e.what());
Expand Down
Loading