mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
nvidia: Assign to std::string_view& instead of swapping
For unknown reasons this results in an error only when the project is built within git-bash and with cmake. It does not occur with cmake-gui or VS itself.
This commit is contained in:
parent
16a52ca126
commit
cbddee5b90
2 changed files with 10 additions and 8 deletions
|
@ -70,9 +70,9 @@ streamfx::nvidia::cv::result streamfx::nvidia::ar::feature::get(parameter_t para
|
||||||
cv::result res = get(param, cvalue);
|
cv::result res = get(param, cvalue);
|
||||||
if (res == cv::result::SUCCESS) {
|
if (res == cv::result::SUCCESS) {
|
||||||
if (cvalue) {
|
if (cvalue) {
|
||||||
value.swap(std::string_view(cvalue));
|
value = std::string_view(cvalue);
|
||||||
} else {
|
} else {
|
||||||
value.swap(std::string_view());
|
value = std::string_view();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
// SOFTWARE.
|
// SOFTWARE.
|
||||||
|
|
||||||
#include "nvidia-vfx-effect.hpp"
|
#include "nvidia-vfx-effect.hpp"
|
||||||
|
#include <string_view>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "util/util-logging.hpp"
|
#include "util/util-logging.hpp"
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
|
|
||||||
using namespace ::streamfx::nvidia;
|
using namespace ::streamfx::nvidia;
|
||||||
|
|
||||||
vfx::effect::~effect()
|
streamfx::nvidia::vfx::effect::~effect()
|
||||||
{
|
{
|
||||||
auto gctx = ::streamfx::obs::gs::context();
|
auto gctx = ::streamfx::obs::gs::context();
|
||||||
auto cctx = cuda::obs::get()->get_context()->enter();
|
auto cctx = cuda::obs::get()->get_context()->enter();
|
||||||
|
@ -49,7 +50,8 @@ vfx::effect::~effect()
|
||||||
_nvcuda.reset();
|
_nvcuda.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
vfx::effect::effect(effect_t effect) : _nvcuda(cuda::obs::get()), _nvcvi(cv::cv::get()), _nvvfx(vfx::vfx::get()), _fx()
|
streamfx::nvidia::vfx::effect::effect(effect_t effect)
|
||||||
|
: _nvcuda(cuda::obs::get()), _nvcvi(cv::cv::get()), _nvvfx(vfx::vfx::get()), _fx()
|
||||||
{
|
{
|
||||||
auto gctx = ::streamfx::obs::gs::context();
|
auto gctx = ::streamfx::obs::gs::context();
|
||||||
auto cctx = cuda::obs::get()->get_context()->enter();
|
auto cctx = cuda::obs::get()->get_context()->enter();
|
||||||
|
@ -74,21 +76,21 @@ vfx::effect::effect(effect_t effect) : _nvcuda(cuda::obs::get()), _nvcvi(cv::cv:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::result vfx::effect::get(parameter_t param, std::string_view& value)
|
cv::result streamfx::nvidia::vfx::effect::get(parameter_t param, std::string_view& value)
|
||||||
{
|
{
|
||||||
const char* cvalue = nullptr;
|
const char* cvalue = nullptr;
|
||||||
cv::result res = get(param, cvalue);
|
cv::result res = get(param, cvalue);
|
||||||
if (res == cv::result::SUCCESS) {
|
if (res == cv::result::SUCCESS) {
|
||||||
if (cvalue) {
|
if (cvalue) {
|
||||||
value.swap(std::string_view(cvalue));
|
value = std::string_view(cvalue);
|
||||||
} else {
|
} else {
|
||||||
value.swap(std::string_view());
|
value = std::string_view();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::result vfx::effect::get(parameter_t param, std::string& value)
|
cv::result streamfx::nvidia::vfx::effect::get(parameter_t param, std::string& value)
|
||||||
{
|
{
|
||||||
const char* cvalue = nullptr;
|
const char* cvalue = nullptr;
|
||||||
cv::result res = get(param, cvalue);
|
cv::result res = get(param, cvalue);
|
||||||
|
|
Loading…
Reference in a new issue