fix(decklink-bridge): use IDeckLinkVideoBuffer QueryInterface to get raw bytes

This commit is contained in:
Wild Dragon Dev 2026-06-04 00:35:16 +00:00
parent 74055e79f8
commit 400cb786ab

View file

@ -268,12 +268,16 @@ public:
/* ── Write video frame ──────────────────────────────────────── */
void *bytes = nullptr;
/* Some SDK versions require casting to the base IDeckLinkVideoFrame
* to access GetBytes() from an IDeckLinkVideoInputFrame. */
IDeckLinkVideoFrame *baseFrame = static_cast<IDeckLinkVideoFrame *>(videoFrame);
// SDK has changed: GetBytes() is no longer directly on IDeckLinkVideoFrame.
// Use GetFrameInternalBufferBytes() which is more robust.
videoFrame->GetFrameInternalBufferBytes(&bytes);
IDeckLinkVideoBuffer *videoBuffer = nullptr;
if (videoFrame->QueryInterface(IID_IDeckLinkVideoBuffer, (void**)&videoBuffer) == S_OK) {
videoBuffer->GetBytes(&bytes);
videoBuffer->Release();
} else {
fprintf(stderr, "[decklink:%d] ERROR: Failed to get IDeckLinkVideoBuffer interface\n", m_ds->device_idx);
return S_OK;
}
uint32_t sz = (uint32_t)(videoFrame->GetRowBytes() * videoFrame->GetHeight());
uint32_t frame_bytes_expected = (uint32_t)m_ds->width * (uint32_t)m_ds->height * 2;