decklink: Cleanup hide/show code

The obs_source_showing calls are unnecessary in these
functions.
This commit is contained in:
Clayton Groeneveld 2021-08-21 12:53:13 -05:00
parent d83f45992a
commit 5fd40b3feb

View File

@ -87,9 +87,8 @@ static void decklink_update(void *data, obs_data_t *settings)
static void decklink_show(void *data) static void decklink_show(void *data)
{ {
DeckLinkInput *decklink = (DeckLinkInput *)data; DeckLinkInput *decklink = (DeckLinkInput *)data;
obs_source_t *source = decklink->GetSource();
bool showing = obs_source_showing(source); if (decklink->dwns && !decklink->Capturing()) {
if (decklink->dwns && showing && !decklink->Capturing()) {
ComPtr<DeckLinkDevice> device; ComPtr<DeckLinkDevice> device;
device.Set(deviceEnum->FindByHash(decklink->hash.c_str())); device.Set(deviceEnum->FindByHash(decklink->hash.c_str()));
decklink->Activate(device, decklink->id, decklink->Activate(device, decklink->id,
@ -100,9 +99,8 @@ static void decklink_show(void *data)
static void decklink_hide(void *data) static void decklink_hide(void *data)
{ {
DeckLinkInput *decklink = (DeckLinkInput *)data; DeckLinkInput *decklink = (DeckLinkInput *)data;
obs_source_t *source = decklink->GetSource();
bool showing = obs_source_showing(source); if (decklink->dwns && decklink->Capturing())
if (decklink->dwns && !showing && decklink->Capturing())
decklink->Deactivate(); decklink->Deactivate();
} }