1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#include <obs-module.h>
#include "decklink-devices.hpp"
OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("decklink", "en-US")
MODULE_EXPORT const char *obs_module_description(void)
{
return "Blackmagic DeckLink source";
}
extern struct obs_source_info create_decklink_source_info();
struct obs_source_info decklink_source_info;
extern struct obs_output_info create_decklink_output_info();
struct obs_output_info decklink_output_info;
bool log_sdk_version()
{
ComPtr<IDeckLinkIterator> deckLinkIterator;
ComPtr<IDeckLinkAPIInformation> deckLinkAPIInformation;
HRESULT result;
deckLinkIterator = CreateDeckLinkIteratorInstance();
if (deckLinkIterator == NULL) {
blog(LOG_WARNING,
"A DeckLink iterator could not be created. The DeckLink drivers may not be installed");
return false;
}
result = deckLinkIterator->QueryInterface(
IID_IDeckLinkAPIInformation, (void **)&deckLinkAPIInformation);
if (result == S_OK) {
decklink_string_t deckLinkVersion;
deckLinkAPIInformation->GetString(BMDDeckLinkAPIVersion,
&deckLinkVersion);
blog(LOG_INFO, "Decklink API Compiled version %s",
BLACKMAGIC_DECKLINK_API_VERSION_STRING);
std::string versionString;
DeckLinkStringToStdString(deckLinkVersion, versionString);
blog(LOG_INFO, "Decklink API Installed version %s",
versionString.c_str());
}
return true;
}
bool obs_module_load(void)
{
if (!log_sdk_version())
return false;
deviceEnum = new DeckLinkDeviceDiscovery();
if (!deviceEnum->Init())
return false;
decklink_source_info = create_decklink_source_info();
obs_register_source(&decklink_source_info);
decklink_output_info = create_decklink_output_info();
obs_register_output(&decklink_output_info);
return true;
}
void obs_module_unload(void)
{
delete deviceEnum;
}
|