nvidia/cv: Add specialized exception
This commit is contained in:
parent
a822fcf4c7
commit
fe4ed123d0
|
@ -89,7 +89,7 @@ streamfx::nvidia::cv::cv::cv()
|
||||||
if (env_size > 0) {
|
if (env_size > 0) {
|
||||||
buffer.resize(static_cast<size_t>(env_size) + 1);
|
buffer.resize(static_cast<size_t>(env_size) + 1);
|
||||||
env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, buffer.data(),
|
env_size = GetEnvironmentVariableW(ST_ENV_NVIDIA_VIDEO_EFFECTS_SDK_PATH, buffer.data(),
|
||||||
static_cast<DWORD>(buffer.size()));
|
static_cast<DWORD>(buffer.size()));
|
||||||
vfx_sdk_path = std::wstring(buffer.data(), buffer.size());
|
vfx_sdk_path = std::wstring(buffer.data(), buffer.size());
|
||||||
} else {
|
} else {
|
||||||
PWSTR str = nullptr;
|
PWSTR str = nullptr;
|
||||||
|
|
|
@ -284,6 +284,25 @@ namespace streamfx::nvidia::cv {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<::streamfx::nvidia::cv::cv> get();
|
static std::shared_ptr<::streamfx::nvidia::cv::cv> get();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class exception : std::runtime_error {
|
||||||
|
result _code;
|
||||||
|
|
||||||
|
public:
|
||||||
|
exception(const char* what, result code) : std::runtime_error(what), _code(code) {}
|
||||||
|
exception(const std::string& what, result code) : std::runtime_error(what), _code(code) {}
|
||||||
|
~exception(){};
|
||||||
|
|
||||||
|
inline result code()
|
||||||
|
{
|
||||||
|
return _code;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char* description()
|
||||||
|
{
|
||||||
|
return ::streamfx::nvidia::cv::cv::get()->NvCV_GetErrorStringFromCode(_code);
|
||||||
|
}
|
||||||
|
};
|
||||||
} // namespace streamfx::nvidia::cv
|
} // namespace streamfx::nvidia::cv
|
||||||
|
|
||||||
P_ENABLE_BITMASK_OPERATORS(::streamfx::nvidia::cv::color_information);
|
P_ENABLE_BITMASK_OPERATORS(::streamfx::nvidia::cv::color_information);
|
||||||
|
|
Loading…
Reference in New Issue