2015-02-18 15:15:38 -08:00
|
|
|
#include <obs-module.h>
|
2018-09-25 15:51:32 -07:00
|
|
|
#include "decklink-devices.hpp"
|
2015-02-18 15:15:38 -08:00
|
|
|
|
|
|
|
OBS_DECLARE_MODULE()
|
|
|
|
OBS_MODULE_USE_DEFAULT_LOCALE("decklink", "en-US")
|
2018-09-11 01:51:38 -07:00
|
|
|
MODULE_EXPORT const char *obs_module_description(void)
|
|
|
|
{
|
|
|
|
return "Blackmagic DeckLink source";
|
|
|
|
}
|
2015-02-18 15:15:38 -08:00
|
|
|
|
2018-09-25 15:51:32 -07:00
|
|
|
extern struct obs_source_info create_decklink_source_info();
|
|
|
|
struct obs_source_info decklink_source_info;
|
2015-02-18 15:15:38 -08:00
|
|
|
|
2018-09-25 15:51:32 -07:00
|
|
|
extern struct obs_output_info create_decklink_output_info();
|
|
|
|
struct obs_output_info decklink_output_info;
|
2015-02-18 15:15:38 -08:00
|
|
|
|
2020-02-09 14:22:05 -08:00
|
|
|
void log_sdk_version()
|
|
|
|
{
|
|
|
|
IDeckLinkIterator *deckLinkIterator;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
deckLinkAPIInformation->Release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-18 15:15:38 -08:00
|
|
|
bool obs_module_load(void)
|
|
|
|
{
|
2020-02-09 14:22:05 -08:00
|
|
|
log_sdk_version();
|
|
|
|
|
2015-02-18 15:15:38 -08:00
|
|
|
deviceEnum = new DeckLinkDeviceDiscovery();
|
|
|
|
if (!deviceEnum->Init())
|
|
|
|
return true;
|
|
|
|
|
2018-09-25 15:51:32 -07:00
|
|
|
decklink_source_info = create_decklink_source_info();
|
|
|
|
obs_register_source(&decklink_source_info);
|
2015-02-18 15:15:38 -08:00
|
|
|
|
2018-09-25 15:51:32 -07:00
|
|
|
decklink_output_info = create_decklink_output_info();
|
|
|
|
obs_register_output(&decklink_output_info);
|
2015-02-18 15:15:38 -08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void obs_module_unload(void)
|
|
|
|
{
|
|
|
|
delete deviceEnum;
|
|
|
|
}
|