- Posts: 12
- Joined: Sat Jul 20, 2013 11:57 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:
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:
waiting for help
thanks and regards,
Noumaan
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