From 8090ebffb1e024683b293da7e8b19cdeabddddf6 Mon Sep 17 00:00:00 2001 From: Colin Edwards Date: Sun, 9 Feb 2020 16:22:05 -0600 Subject: [PATCH] decklink: Log decklink API version on plugin load --- plugins/decklink/platform.hpp | 4 ++++ plugins/decklink/plugin-main.cpp | 35 +++++++++++++++++++++++++++++++ plugins/decklink/win/platform.cpp | 9 ++++++++ 3 files changed, 48 insertions(+) diff --git a/plugins/decklink/platform.hpp b/plugins/decklink/platform.hpp index b3af22cf9..80b25a7ec 100644 --- a/plugins/decklink/platform.hpp +++ b/plugins/decklink/platform.hpp @@ -2,19 +2,23 @@ #if defined(_WIN32) #include +#include "win/decklink-sdk/DeckLinkAPIVersion.h" typedef BOOL decklink_bool_t; typedef BSTR decklink_string_t; IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void); +IDeckLinkIterator *CreateDeckLinkIteratorInstance(void); #define IUnknownUUID IID_IUnknown typedef REFIID CFUUIDBytes; #define CFUUIDGetUUIDBytes(x) x #elif defined(__APPLE__) #include "mac/decklink-sdk/DeckLinkAPI.h" +#include "mac/decklink-sdk/DeckLinkAPIVersion.h" #include typedef bool decklink_bool_t; typedef CFStringRef decklink_string_t; #elif defined(__linux__) #include "linux/decklink-sdk/DeckLinkAPI.h" +#include "linux/decklink-sdk/DeckLinkAPIVersion.h" typedef bool decklink_bool_t; typedef const char *decklink_string_t; #endif diff --git a/plugins/decklink/plugin-main.cpp b/plugins/decklink/plugin-main.cpp index 023de7b1e..ee46edd27 100644 --- a/plugins/decklink/plugin-main.cpp +++ b/plugins/decklink/plugin-main.cpp @@ -14,8 +14,43 @@ 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() +{ + 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(); + } +} + bool obs_module_load(void) { + log_sdk_version(); + deviceEnum = new DeckLinkDeviceDiscovery(); if (!deviceEnum->Init()) return true; diff --git a/plugins/decklink/win/platform.cpp b/plugins/decklink/win/platform.cpp index c15aae5b2..c44214017 100644 --- a/plugins/decklink/win/platform.cpp +++ b/plugins/decklink/win/platform.cpp @@ -11,6 +11,15 @@ IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void) return result == S_OK ? instance : nullptr; } +IDeckLinkIterator *CreateDeckLinkIteratorInstance(void) +{ + IDeckLinkIterator *iterator; + const HRESULT result = + CoCreateInstance(CLSID_CDeckLinkIterator, nullptr, CLSCTX_ALL, + IID_IDeckLinkIterator, (void **)&iterator); + return result == S_OK ? iterator : nullptr; +} + bool DeckLinkStringToStdString(decklink_string_t input, std::string &output) { if (input == nullptr)