yolobs-studio/plugins/decklink/win/platform.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.2 KiB
C++
Raw Normal View History

2016-02-23 23:16:51 +00:00
#include "../platform.hpp"
#include <util/platform.h>
IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void)
{
IDeckLinkDiscovery *instance;
2019-09-22 21:19:10 +00:00
const HRESULT result =
CoCreateInstance(CLSID_CDeckLinkDiscovery, nullptr, CLSCTX_ALL,
IID_IDeckLinkDiscovery, (void **)&instance);
2016-02-23 23:16:51 +00:00
return result == S_OK ? instance : nullptr;
}
2020-03-25 08:07:22 +00:00
IDeckLinkIterator *CreateDeckLinkIteratorInstance(void)
{
IDeckLinkIterator *iterator;
const HRESULT result =
CoCreateInstance(CLSID_CDeckLinkIterator, nullptr, CLSCTX_ALL,
IID_IDeckLinkIterator, (void **)&iterator);
return result == S_OK ? iterator : nullptr;
}
2020-12-22 17:32:50 +00:00
IDeckLinkVideoConversion *CreateVideoConversionInstance(void)
{
IDeckLinkVideoConversion *conversion;
const HRESULT result = CoCreateInstance(CLSID_CDeckLinkVideoConversion,
nullptr, CLSCTX_ALL,
IID_IDeckLinkVideoConversion,
(void **)&conversion);
return result == S_OK ? conversion : nullptr;
}
2019-09-22 21:19:10 +00:00
bool DeckLinkStringToStdString(decklink_string_t input, std::string &output)
2016-02-23 23:16:51 +00:00
{
if (input == nullptr)
return false;
size_t len = wcslen(input);
size_t utf8_len = os_wcs_to_utf8(input, len, nullptr, 0);
output.resize(utf8_len);
os_wcs_to_utf8(input, len, &output[0], utf8_len);
return true;
}