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.
This commit is contained in:
Thomas Gritzan
2025-11-24 00:26:33 +01:00
committed by Marton Balint
parent 5169b0c3dc
commit 0cd75dbfa0
2 changed files with 27 additions and 3 deletions

4
configure vendored
View File

@@ -7405,8 +7405,8 @@ fi
if enabled decklink; then
case $target_os in
mingw32*|mingw64*|win32|win64)
decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -luuid -loleaut32"
decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -luuid -loleaut32"
;;
esac
fi

View File

@@ -47,6 +47,16 @@ extern "C" {
#include "libklvanc/pixels.h"
#endif
#ifdef _WIN32
#include <guiddef.h>
#else
/* There is no guiddef.h in Linux builds, so we provide our own IsEqualIID() */
static bool IsEqualIID(REFIID riid1, REFIID riid2)
{
return memcmp(&riid1, &riid2, sizeof(REFIID)) == 0;
}
#endif
/* DeckLink callback class declaration */
class decklink_frame : public IDeckLinkVideoFrame
{
@@ -111,7 +121,21 @@ public:
_ancillary->AddRef();
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID *ppv)
{
if (IsEqualIID(riid, IID_IUnknown)) {
*ppv = static_cast<IUnknown*>(this);
} else if (IsEqualIID(riid, 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)
{