Skip to content

Commit

Permalink
decklink: Don't load modules if Decklink not found
Browse files Browse the repository at this point in the history
This also modifies decklink-captions and decklink-output-ui.
  • Loading branch information
cg2121 authored and jp9000 committed Feb 26, 2022
1 parent 93c2e68 commit 8510731
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
10 changes: 8 additions & 2 deletions UI/frontend-plugins/decklink-captions/decklink-captions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,13 @@ void addOutputUI(void)

bool obs_module_load(void)
{
addOutputUI();

return true;
}

void obs_module_post_load(void)
{
if (!obs_get_module("decklink"))
return;

addOutputUI();
}
14 changes: 10 additions & 4 deletions UI/frontend-plugins/decklink-output-ui/decklink-ui-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,6 @@ static void OBSEvent(enum obs_frontend_event event, void *)

bool obs_module_load(void)
{
addOutputUI();

obs_frontend_add_event_callback(OBSEvent, nullptr);

return true;
}

Expand All @@ -357,3 +353,13 @@ void obs_module_unload(void)
if (main_output_running)
output_stop();
}

void obs_module_post_load(void)
{
if (!obs_get_module("decklink"))
return;

addOutputUI();

obs_frontend_add_event_callback(OBSEvent, nullptr);
}
11 changes: 7 additions & 4 deletions plugins/decklink/plugin-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct obs_source_info decklink_source_info;
extern struct obs_output_info create_decklink_output_info();
struct obs_output_info decklink_output_info;

void log_sdk_version()
bool log_sdk_version()
{
IDeckLinkIterator *deckLinkIterator;
IDeckLinkAPIInformation *deckLinkAPIInformation;
Expand All @@ -24,7 +24,7 @@ void log_sdk_version()
if (deckLinkIterator == NULL) {
blog(LOG_WARNING,
"A DeckLink iterator could not be created. The DeckLink drivers may not be installed");
return;
return false;
}

result = deckLinkIterator->QueryInterface(
Expand All @@ -45,15 +45,18 @@ void log_sdk_version()

deckLinkAPIInformation->Release();
}

return true;
}

bool obs_module_load(void)
{
log_sdk_version();
if (!log_sdk_version())
return false;

deviceEnum = new DeckLinkDeviceDiscovery();
if (!deviceEnum->Init())
return true;
return false;

decklink_source_info = create_decklink_source_info();
obs_register_source(&decklink_source_info);
Expand Down

0 comments on commit 8510731

Please sign in to comment.
  翻译: