yolobs-studio/plugins/decklink/plugin-main.cpp

71 lines
1.7 KiB
C++
Raw Permalink Normal View History

2016-02-23 23:16:51 +00:00
#include <obs-module.h>
2019-07-27 12:47:10 +00:00
#include "decklink-devices.hpp"
2016-02-23 23:16:51 +00:00
OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("decklink", "en-US")
2019-07-27 12:47:10 +00:00
MODULE_EXPORT const char *obs_module_description(void)
2016-02-23 23:16:51 +00:00
{
2019-07-27 12:47:10 +00:00
return "Blackmagic DeckLink source";
2016-02-23 23:16:51 +00:00
}
2019-07-27 12:47:10 +00:00
extern struct obs_source_info create_decklink_source_info();
struct obs_source_info decklink_source_info;
2016-02-23 23:16:51 +00:00
2019-07-27 12:47:10 +00:00
extern struct obs_output_info create_decklink_output_info();
struct obs_output_info decklink_output_info;
2016-02-23 23:16:51 +00:00
2020-03-25 08:07:22 +00: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();
}
}
2016-02-23 23:16:51 +00:00
bool obs_module_load(void)
{
2020-03-25 08:07:22 +00:00
log_sdk_version();
2016-02-23 23:16:51 +00:00
deviceEnum = new DeckLinkDeviceDiscovery();
if (!deviceEnum->Init())
return true;
2019-07-27 12:47:10 +00:00
decklink_source_info = create_decklink_source_info();
obs_register_source(&decklink_source_info);
2016-02-23 23:16:51 +00:00
2019-07-27 12:47:10 +00:00
decklink_output_info = create_decklink_output_info();
obs_register_output(&decklink_output_info);
2016-02-23 23:16:51 +00:00
return true;
}
void obs_module_unload(void)
{
delete deviceEnum;
}