DeckLinkInputDevice Connected/Disconnected

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

cameronleeperlm

  • Posts: 6
  • Joined: Thu Nov 21, 2019 8:57 pm
  • Real Name: Cam Leeper

DeckLinkInputDevice Connected/Disconnected

PostTue Jun 02, 2020 3:16 pm

I have a DeckLink Quad HDMI Recorder. I am looking to keep track of each HDMI ports Connected/Disconnected state.

What I have:
I have seen in the CSharpStills example that the VideoFrameArrived handler is used to see if invalid frames are coming and if so an error dialog is shot out and won't allow captures. I have implemented something similar. I have started streams for all 4 and if I receive so many consecutive invalid/valid frames then I determine it is disconnected or connected. That means from the card all 4 inputs are enabled and sending streams all the time. On my application I am constantly handling frames for all 4 inputs whether they are connected or not. It seems too busy and inefficient...

There has to be a better way:
I'm thinking the DeckLink card is sending out some event, callback, flag or something else that I can handle on more of a true Disconnect/Connnect event basis. This is what I have looked at:
    1. IDeckLinkInput
    DoesSupportVideoMode is the closest thing I could find in IDeckLinkInput... No arguments or outputs that provide anything around a connection status.
    DoesSupportVideoMode(BMDVideoConnection connection,BMDDisplayMode requestedMode,BMDPixelFormat requestedPixelFormat,BMDSupportedVideoModeFlags flags, bool **supported)
    The DoesSupportVideoMode method indicates whether a given display mode is supported
    Name | Direction | Description
    connection | in |Input connection to check (see BMDVideoConnection for details).
    requestedMode | in | Display mode to check
    requestedPixelFormat | in | Pixel format to check
    flags | in | Input video mode flags (see BMDSupportedVideoModeFlags for details).
    supported | out | Returns true if the display mode is supported.

    2. At first I thought I could use the IDeckLinkNotification[Callback] but then I read in 2.4.4 "A callback notification can be provided to an application when a Thunderbolt or USB 3.0 based DeckLink device is connected or disconnected." I have PCIe card...
    3. IBMDStreamingH264InputCallback has H264VideoInputConnectorChanged but I think this is for the H.264 Pro Recorder
Is there an interface that does this already that I can use on the DeckLink Quad HDMI Recorder?
Offline

Cameron Nichols

Blackmagic Design

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

Re: DeckLinkInputDevice Connected/Disconnected

PostWed Jun 03, 2020 11:36 pm

Hi Cam,

You can use IDeckLinkStatus interface to monitor the bmdDeckLinkStatusVideoInputSignalLocked status ID[1]. This ID can be used to determine that the input is locked to a valid input signal.

To monitor with a callback, implement IDeckLinkNotificationCallback, your implementation of IDeckLinkNotificationCallback.Notify[2] should check for notification bmdStatusChanged[3] and param1 for the required status ID. Create a IDeckLinkNotification object from each IDeckLink and call IDeckLinkNotification.Subscribe() [4] to register your IDeckLinkNotificationCallback object.

Your process for enabling input should be:
  • IDeckLinkInput::EnableVideoInput
  • Wait for bmdDeckLinkStatusVideoInputSignalLocked to be true (input is valid)
  • IDeckLinkInput::StartStreams
Use a synchronization element, such as System.Threading.EventWaitHandle to provide the wait for valid input.

Regards
Cameron

References (DeckLink SDK Manual):
[1] 3.59 DeckLink Status ID
[2] 2.5.34.1 IDeckLinkNotificationCallback::Notify
[3] 3.43 DeckLink Device Notification
[4] 2.5.33.1 IDeckLinkNotification::Subscribe method
Offline

cameronleeperlm

  • Posts: 6
  • Joined: Thu Nov 21, 2019 8:57 pm
  • Real Name: Cam Leeper

Re: DeckLinkInputDevice Connected/Disconnected

PostMon Jun 08, 2020 11:12 am

Thanks Cameron. That worked great and was what I was looking for. I stopped looking down the DeckLink Device Notification path because it specified in 2.4.4 that that the callback notification was for a "Thunderbolt or USB 3.0 based DeckLink device" and mine is PCI Express. Glad this was available.
Offline

Cameron Nichols

Blackmagic Design

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

Re: DeckLinkInputDevice Connected/Disconnected

PostWed Jun 10, 2020 12:22 pm

Hi Cam,

Can I clarify two points:
  • IDeckLinkDeviceNotificationCallback interface has 2 callbacks - DeckLinkDeviceArrived, when a device is connected and DeckLinkDeviceRemoved when a device is removed. You will still receive DeckLinkDeviceArrived callbacks for PCIe devices when notifications are installed.
  • This interface is not the same as IDeckLinkNotificationCallback, which provides callback when a status item or device preferences are changed.
Regards
Cameron
Offline

cameronleeperlm

  • Posts: 6
  • Joined: Thu Nov 21, 2019 8:57 pm
  • Real Name: Cam Leeper

Re: DeckLinkInputDevice Connected/Disconnected

PostWed Jun 10, 2020 6:26 pm

Thank you for your clarification. I didn't not notice that they were two different interfaces. I appreciate your help.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 12 guests