How to detect unplugged camera with DeckLink SDK?

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

Jules Davis

  • Posts: 7
  • Joined: Wed Apr 12, 2017 9:14 am
  • Location: Surrey, UK

How to detect unplugged camera with DeckLink SDK?

PostFri Aug 04, 2017 9:45 am

I am using the DeckLink SDK to capture input from a DeckLink 4K capture card that has a Blackmagic Studio 4K camera plugged into it via SDI.

If I unplug the camera from the SDI In, then, if I am already capturing, then I continue to receive (black) frames from DeckLinkDevice::VideoInputFrameArrived at about the same frame rate.

This is actually very handy, however I would like to detect when this has happened. Is there any way to detect that the camera has been unplugged within the SDK?

Thanks

Jules
--
Jules Davis
CTO Focal Point VR Ltd
Offline

Nicholas Gill

Blackmagic Design

  • Posts: 169
  • Joined: Mon May 04, 2015 10:28 pm

Re: How to detect unplugged camera with DeckLink SDK?

PostFri Aug 11, 2017 5:58 am

Hi Jules,

You can determine whether a video frame has been created from a valid input signal by checking for the absence of the bmdFrameHasNoInputSource[1] flag (via IDeckLinkVideoFrame::GetFlags()[2]).

For example (from the Linux 'Capture' SDK sample):

Code: Select all
...
      if (videoFrame->GetFlags() & bmdFrameHasNoInputSource)
      {
         printf("Frame received (#%lu) - No input signal detected\n", g_frameCount);
      }
...

Cheers,

-nick

[1] 2.7.6 Frame Flags
[2] 2.5.5.5 IDeckLinkVideoFrame::GetFlags method

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 16 guests