PR #21002 opened by Thomas Gritzan (Phygon)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21002
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21002.patch

Playback to a decklink device with a newer version of the
DeckLink SDK (14.3) stalls because the driver code calls
IDeckLinkVideoFrame::QueryInterface, which is not
implemented by ffmpeg.
This patch implements decklink_frame::QueryInterface,
so that playback works with both older (12.x) and
newer (>= 14.3) drivers.

Note: The patch still does not allow the code to compile
with DeckLink SDK 14.3 or newer, as the API has changed.


>From 22f08f1d0158d5064fa121d03b8330aa29ae8e28 Mon Sep 17 00:00:00 2001
From: Thomas Gritzan <[email protected]>
Date: Mon, 24 Nov 2025 00:26:33 +0100
Subject: [PATCH] libavdevice/decklink: Implement QueryInterface to support
 newer driver

Playback to a decklink device with a newer version of the
DeckLink SDK (14.3) stalls because the driver code calls
IDeckLinkVideoFrame::QueryInterface, which is not
implemented by ffmpeg.
This patch implements decklink_frame::QueryInterface,
so that playback works with both older (12.x) and
newer (>= 14.3) drivers.

Note: The patch still does not allow the code to compile
with DeckLink SDK 14.3 or newer, as the API has changed.
---
 libavdevice/decklink_enc.cpp | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index cb8f91730e..0e743348c6 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -47,6 +47,11 @@ extern "C" {
 #include "libklvanc/pixels.h"
 #endif
 
+static bool IsEqualGUID(const REFIID &iid1, const REFIID &iid2)
+{
+    return memcmp(&iid1, &iid2, sizeof(REFIID)) == 0;
+}
+
 /* DeckLink callback class declaration */
 class decklink_frame : public IDeckLinkVideoFrame
 {
@@ -111,7 +116,19 @@ public:
         _ancillary->AddRef();
         return S_OK;
     }
-    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) 
{ return E_NOINTERFACE; }
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv)
+    {
+        if (IsEqualGUID(iid, IID_IUnknown) || IsEqualGUID(iid, 
IID_IDeckLinkVideoFrame)) {
+            *ppv = static_cast<IDeckLinkVideoFrame*>(this);
+        } else {
+            *ppv = NULL;
+            return E_NOINTERFACE;
+        }
+
+        AddRef();
+        return S_OK;
+    }
+
     virtual ULONG   STDMETHODCALLTYPE AddRef(void)                            
{ return ++_refs; }
     virtual ULONG   STDMETHODCALLTYPE Release(void)
     {
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to