Genlock detecting SDK

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

nikitadedov

  • Posts: 4
  • Joined: Fri May 20, 2022 9:56 am
  • Real Name: Nikita Dedov

Genlock detecting SDK

PostFri Apr 28, 2023 4:16 pm

Hello,

We have an issue with genlock detect. while the application is running we asked sdk genlock status. turn off genlock status switch to bmdReferenceUnlocked, but if turn it back status still shows bmdReferenceUnlocked

but if I rerun the application it shows the correct status (bmdReferenceLocked if I have signal), so it seems I need to call some function to get it working back.

code what we are using:
Code: Select all
HRESULT hr = S_OK;
if (!m_dlOutput) {
   hr = m_dlDevice->QueryInterface(IID_IDeckLinkOutput, (void**) &m_dlOutput);
   if (FAILED(hr) || !m_dlOutput) {
      return false;
   }
}
BMDReferenceStatus status = (BMDReferenceStatus) 0;
hr = m_dlOutput->GetReferenceStatus(&status);


What do we need to call to refresh the correct BMDReferenceStatus?
Thank you
Offline

Cameron Nichols

Blackmagic Design

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

Re: Genlock detecting SDK

PostMon May 01, 2023 2:52 am

Hi Nikita,

The preferred method of getting the reference locked status is with the IDeckLinkStatus interface by querying the status item bmdDeckLinkStatusReferenceSignalLocked [1][2] with the following example code:
Code: Select all
HRESULT hr = S_OK;
IDeckLink* deckLink = nullptr;
bool referenceLockedStatus;  // Use BOOL for Windows
// ... Initialize deckLink.
hr = deckLink->QueryInterface(IID_IDeckLinkStatus, (void**) &deckLinkStatus);
if (hr != S_OK)
{
    // Error
    return;
}
hr = deckLinkStatus->GetFlag(bmdDeckLinkStatusReferenceSignalLocked, &referenceLockedStatus);
if (hr != S_OK)
{
    // Error
    return;
}
In addition you can get the locked video mode of the genlock reference input by querying status item bmdDeckLinkStatusReferenceSignalMode.
Code: Select all
int64_t statusInt;
hr = deckLinkStatus->GetInt(bmdDeckLinkStatusReferenceSignalMode, &statusInt);
if (hr == S_OK)
{
    BMDDisplayMode referenceVideoMode = (BMDDisplayMode)statusInt;
}
Your application may need to receive callback notifications when the reference lock status changes. I suspect that there is delay in relocking to the powered genlock reference. If this is the case, you should perform the following steps:
  • Generate a class that implements the IDeckLinkNotificationCallback interface [3].
  • In your implementation of IDeckLinkNotificationCallback::Notify, check for topic == bmdStatusChanged and param1 == bmdDeckLinkStatusReferenceSignalLocked. In this case use a conditional variable or similar to notify your application that this value has changed [4].
  • Get an IDeckLinkNotification object by calling IDeckLink::QueryInterface with IID_IDeckLinkNotification [5].
  • Register your IDeckLinkNotificationCallback with IDeckLinkNotification::Subscribe, with topic = bmdStatusChanged.
  • Remember to unsubscribe your IDeckLinkNotificationCallback with DeckLinkNotification::Unsubscribe when you have completed with notifications, to prevent memory leak.
There are examples of notification callbacks with bmdDeckLinkStatusReferenceSignalLocked in the InputLoopThrough and SynchronizedPlayback SDK samples.

Regards
Cameron

References (DeckLink SDK Manual):
[1] 2.5.42 IDeckLinkStatus Interface
[2] 3.59 DeckLink Status ID
[3] 2.5.34 IDeckLinkNotificationCallback Interface
[4] 3.43 DeckLink Device Notification
[5] 2.5.33 IDeckLinkNotification Interface

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 18 guests