platform.cpp 1.2 KB
Newer Older
1 2 3 4 5 6 7
#include "../platform.hpp"

#include <util/platform.h>

IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void)
{
	IDeckLinkDiscovery *instance;
J
jp9000 已提交
8 9 10
	const HRESULT result =
		CoCreateInstance(CLSID_CDeckLinkDiscovery, nullptr, CLSCTX_ALL,
				 IID_IDeckLinkDiscovery, (void **)&instance);
11 12 13
	return result == S_OK ? instance : nullptr;
}

14 15 16 17
IDeckLinkIterator *CreateDeckLinkIteratorInstance(void)
{
	IDeckLinkIterator *iterator;
	const HRESULT result =
J
jp9000 已提交
18 19
		CoCreateInstance(CLSID_CDeckLinkIterator, nullptr, CLSCTX_ALL,
				 IID_IDeckLinkIterator, (void **)&iterator);
20 21 22
	return result == S_OK ? iterator : nullptr;
}

23 24 25 26 27 28 29 30 31 32
IDeckLinkVideoConversion *CreateVideoConversionInstance(void)
{
	IDeckLinkVideoConversion *conversion;
	const HRESULT result = CoCreateInstance(CLSID_CDeckLinkVideoConversion,
						nullptr, CLSCTX_ALL,
						IID_IDeckLinkVideoConversion,
						(void **)&conversion);
	return result == S_OK ? conversion : nullptr;
}

J
jp9000 已提交
33
bool DeckLinkStringToStdString(decklink_string_t input, std::string &output)
34 35 36 37 38 39 40 41 42 43 44 45
{
	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;
}