fix(decklink-bridge): use IDeckLinkVideoBuffer QueryInterface to get raw bytes
This commit is contained in:
parent
74055e79f8
commit
400cb786ab
1 changed files with 10 additions and 6 deletions
|
|
@ -268,12 +268,16 @@ public:
|
||||||
|
|
||||||
/* ── Write video frame ──────────────────────────────────────── */
|
/* ── Write video frame ──────────────────────────────────────── */
|
||||||
void *bytes = nullptr;
|
void *bytes = nullptr;
|
||||||
/* Some SDK versions require casting to the base IDeckLinkVideoFrame
|
|
||||||
* to access GetBytes() from an IDeckLinkVideoInputFrame. */
|
IDeckLinkVideoBuffer *videoBuffer = nullptr;
|
||||||
IDeckLinkVideoFrame *baseFrame = static_cast<IDeckLinkVideoFrame *>(videoFrame);
|
if (videoFrame->QueryInterface(IID_IDeckLinkVideoBuffer, (void**)&videoBuffer) == S_OK) {
|
||||||
// SDK has changed: GetBytes() is no longer directly on IDeckLinkVideoFrame.
|
videoBuffer->GetBytes(&bytes);
|
||||||
// Use GetFrameInternalBufferBytes() which is more robust.
|
videoBuffer->Release();
|
||||||
videoFrame->GetFrameInternalBufferBytes(&bytes);
|
} 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 sz = (uint32_t)(videoFrame->GetRowBytes() * videoFrame->GetHeight());
|
||||||
|
|
||||||
uint32_t frame_bytes_expected = (uint32_t)m_ds->width * (uint32_t)m_ds->height * 2;
|
uint32_t frame_bytes_expected = (uint32_t)m_ds->width * (uint32_t)m_ds->height * 2;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue