Skyler Lipthay dd739d1e49 decklink: Add Windows DeckLink project
The code specific to Windows: helps convert `BSTR` instances to
`std::string`s; provides a Windows COM-specific implementation of
`CreateDeckLinkDiscoveryInstance`; aliases CFUUIDGetUUIDBytes,
CFUUIDBytes, and IUnknownUUID (the Linux SDK does this, but for some
reason the Windows SDK does not).
2015-03-21 16:43:16 -07:00

27 lines
636 B
C++

#include "../platform.hpp"
#include <util/platform.h>
IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void)
{
IDeckLinkDiscovery *instance;
const HRESULT result = CoCreateInstance(CLSID_CDeckLinkDiscovery,
nullptr, CLSCTX_ALL, IID_IDeckLinkDiscovery,
(void **)&instance);
return result == S_OK ? instance : nullptr;
}
bool DeckLinkStringToStdString(decklink_string_t input, std::string& output)
{
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;
}