From patchwork Thu Nov 19 20:51:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 23733 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 672E544AC04 for ; Thu, 19 Nov 2020 22:51:48 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C89F68B7FB; Thu, 19 Nov 2020 22:51:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 22BB168B903 for ; Thu, 19 Nov 2020 22:51:41 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 3A801E4A66; Thu, 19 Nov 2020 21:51:41 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M9j-hJmwNikl; Thu, 19 Nov 2020 21:51:39 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 46FDCE4A57; Thu, 19 Nov 2020 21:51:39 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Thu, 19 Nov 2020 21:51:22 +0100 Message-Id: <20201119205123.21968-5-cus@passwd.hu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201119205123.21968-1-cus@passwd.hu> References: <20201119205123.21968-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] avdevice/decklink: warn about too old decklink API version X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- libavdevice/decklink_common.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index 8b58ede1ef..24aa9b1d13 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -70,9 +70,30 @@ static IDeckLinkIterator *decklink_create_iterator(AVFormatContext *avctx) #else iter = CreateDeckLinkIteratorInstance(); #endif - if (!iter) + if (!iter) { av_log(avctx, AV_LOG_ERROR, "Could not create DeckLink iterator. " "Make sure you have DeckLink drivers " BLACKMAGIC_DECKLINK_API_VERSION_STRING " or newer installed.\n"); + } else { + IDeckLinkAPIInformation *api; + int64_t version; +#ifdef _WIN32 + if (CoCreateInstance(CLSID_CDeckLinkAPIInformation, NULL, CLSCTX_ALL, + IID_IDeckLinkAPIInformation, (void**) &api) != S_OK) { + api = NULL; + } +#else + api = CreateDeckLinkAPIInformationInstance(); +#endif + if (api && api->GetInt(BMDDeckLinkAPIVersion, &version) == S_OK) { + if (version < BLACKMAGIC_DECKLINK_API_VERSION) + av_log(avctx, AV_LOG_WARNING, "Installed DeckLink drivers are too old and may be incompatible with the SDK this module was built against. " + "Make sure you have DeckLink drivers " BLACKMAGIC_DECKLINK_API_VERSION_STRING " or newer installed.\n"); + } else { + av_log(avctx, AV_LOG_ERROR, "Failed to check installed DeckLink API version.\n"); + } + if (api) + api->Release(); + } return iter; }