Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] libavdevice/decklink: Implement QueryInterface to support newer driver (PR #21002)
@ 2025-11-23 23:40 Thomas Gritzan via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: Thomas Gritzan via ffmpeg-devel @ 2025-11-23 23:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Thomas Gritzan

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 <phygon@gmx.de>
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-23 23:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-23 23:40 [FFmpeg-devel] [PATCH] libavdevice/decklink: Implement QueryInterface to support newer driver (PR #21002) Thomas Gritzan via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git