Capturing from Decklink with pull model

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

An_private

  • Posts: 4
  • Joined: Sun Feb 19, 2023 9:40 am
  • Real Name: Andrey Korobeynikov

Capturing from Decklink with pull model

PostMon Jul 31, 2023 3:01 pm

Is it possible to capture from Decklink card without using the callback?
There are two functions in SDK:
IDeckLinkInput::GetAvailableVideoFrameCount
IDeckLinkInput::GetAvailableAudioSampleFrameCount
These functions have no meaning without possibility of pulling frames from queue. But there is no any methods describer in SDK to get frames from the internal queue.
In decription of audio:
Use of this method is only required when using pull model audio

But how can I use pull model if there is no any function to pull data?
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 443
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Capturing from Decklink with pull model

PostFri Aug 04, 2023 1:14 pm

Hi Andrey,

The only mechanism for getting captured video frames and audio packets is by creating a class that implements IDeckLinkInputCallback callback interface. The implementation of IDeckLinkInputCallback::VideoInputFrameArrived provides input parameters of types IDeckLinkVideoInputFrame and IDeckLinkAudioInputPacket for the captured video and audio. The SDK manual will be updated to remove the statement on pull model.

If your application requires pull-model behaviour, you will need to implement a queue where objects are pushed from the callback and pulled from the queue in another thread. Ensure that you call AddRef on the video frame/audio packet from the callback to ensure reference is retained after the callback and Release when completed with the object.

You will find an example of this behaviour in the Windows FileCapture sample in the Desktop Video SDK.

Regards
Cameron
Offline

An_private

  • Posts: 4
  • Joined: Sun Feb 19, 2023 9:40 am
  • Real Name: Andrey Korobeynikov

Re: Capturing from Decklink with pull model

PostFri Aug 04, 2023 1:51 pm

I have already written an application with callbacks. And it is working. But sometimes I got null as audio and video data in callback (frame dropped). And I can't understand - why. So I would like to try pull model to prevent it. Ok, I will try to find another solution.
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 443
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Capturing from Decklink with pull model

PostFri Aug 18, 2023 12:13 pm

Hi Andrey,

If the video processing is not fast enough it is possible to receive an IDeckLinkInputCallback::VideoInputFrameArrived with valid audio packet but null video frame. However in this circumstance you would then receive a subsequent VideoInputFrameArrived callback with the delayed video frame, but null audio.

This situation should be OK, but if you are continually receiving delayed video frames, you may need to check your system to ensure that there is sufficient PCIe bandwidth available to the DeckLink card for video capture.

You should also check the VideoInputFrameArrived callback is promptly returned so not to queue subsequent captured frames. You should consider using a sample queue, such as the one in FileCapture sample to move video processing outside the callback and into seperate thread.

Regards
Cameron

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 21 guests