Videohub in C#

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

Noumaan Sohail

  • Posts: 12
  • Joined: Sat Jul 20, 2013 11:57 am

Videohub in C#

PostFri Aug 31, 2018 12:05 am

Hi guys,

i'm trying to write Blackmagic Videohub application in c# but unfortunately BMD does not provide any sample project for C#.
please someone help me to understand about VideoHub interface and addref in C#

My Code is:
Code: Select all
private Videohub.HubMonitor m_hubMonitor;
public Form1()
{
    InitializeComponent();
}
IVideohubDiscovery videoHubDiscovery;
public static IVideohub m_hub;
static IVideohubState m_state;
private void button1_Click(object sender, EventArgs e)
{
    videoHubDiscovery = new CVideohubDiscovery();
    try
    {
        videoHubDiscovery.ConnectTo(TBserver.Text, 10000, out m_hub);
    }
    catch(COMException ex)
    {
        if (ex.HResult == -2147467259)
            MessageBox.Show("Connection Timeout");
        return;
    }
    m_hub.GetState(out m_state);
    uint index = 0;
    _BMDVideohubHardwareState hardware = new _BMDVideohubHardwareState();
    System.Diagnostics.Debug.WriteLine("--- Video input ports\n");
    while (index <= 40 - 1)
    {
        m_state.GetLabel(_BMDVideohubPortType.BMDVideohubVideoInputPort, index, out string label);
        m_state.GetHardware(_BMDVideohubPortType.BMDVideohubVideoInputPort, index, out hardware);
        string bstrLabel = label;
        System.Diagnostics.Debug.WriteLine("  \n " + index + " " + hardware.ToString() + " " + bstrLabel);
        index++;
    }
    //m_hubMonitor = new Videohub.HubMonitor(m_hub);
    //m_hub.AddVideohubCallback(m_hubMonitor);
}


i'm getting input ports like this but when i'm trying to get input ports by calling callback i get NOINTERFACE error or even i try to get input ports from another method i get same NOInterface error

callback error line is:
Code: Select all
public HubMonitor(IVideohub hub)
{
    m_hub = hub;
}

void IVideohubCallback.StateChanged()
{
    if (m_state == null)
    {
        m_hub.GetState(out m_state); //Getting Error Here NOINTERFACE
        DumpState(m_state);
    }
    else
    {
        m_hub.GetState(out m_state);
        DumpState(m_state);
    }
}


waiting for help

thanks and regards,
Noumaan
Offline

Noumaan Sohail

  • Posts: 12
  • Joined: Sat Jul 20, 2013 11:57 am

Re: Videohub in C#

PostWed Sep 05, 2018 9:56 pm

any one please ??

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 13 guests