Skip to content

Commit

Permalink
fix: decklink output with driver 14.3 broken
Browse files Browse the repository at this point in the history
due to missing QueryInterface implementation on IDecklinkVideoFrame
  • Loading branch information
Julusian committed Dec 9, 2024
1 parent 3ab57da commit 0f7a9a8
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/modules/decklink/consumer/decklink_consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,26 @@ class decklink_frame : public IDeckLinkVideoFrame

// IUnknown

HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID*) override { return E_NOINTERFACE; }
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID* ppv) override {
CFUUIDBytes iunknown = CFUUIDGetUUIDBytes(IUnknownUUID);
if (memcmp(&iid, &iunknown, sizeof(REFIID)) == 0)
{
*ppv = this;
AddRef();
}
else if (memcmp(&iid, &IID_IDeckLinkVideoFrame, sizeof(REFIID)) == 0)
{
*ppv = static_cast<IDeckLinkVideoFrame*>(this);
AddRef();
}
else
{
*ppv = nullptr;
return E_NOINTERFACE;
}

return S_OK;
}

ULONG STDMETHODCALLTYPE AddRef() override { return ++ref_count_; }

Expand All @@ -228,7 +247,7 @@ class decklink_frame : public IDeckLinkVideoFrame
long STDMETHODCALLTYPE GetWidth() override { return static_cast<long>(format_desc_.width); }
long STDMETHODCALLTYPE GetHeight() override { return static_cast<long>(format_desc_.height); }
long STDMETHODCALLTYPE GetRowBytes() override { return static_cast<long>(format_desc_.width) * 4; }
BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat() override { return bmdFormat8BitBGRA; }
BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat() override { return bmdFormat10BitYUV; }
BMDFrameFlags STDMETHODCALLTYPE GetFlags() override { return bmdFrameFlagDefault; }

HRESULT STDMETHODCALLTYPE GetBytes(void** buffer) override
Expand Down Expand Up @@ -633,6 +652,8 @@ struct decklink_consumer final : public IDeckLinkVideoOutputCallback
CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info(print() + L" Failed to schedule primary playback."));
}

CASPAR_LOG(info) << "started playback";

for (auto& context : secondary_port_contexts_) {
context->start_playback([this]() { return print(); });
}
Expand Down

0 comments on commit 0f7a9a8

Please sign in to comment.