C# Atem SDK - integrate IBMDSwitcherStreamRTMP

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

chris08

  • Posts: 3
  • Joined: Thu Jul 01, 2021 10:09 pm
  • Real Name: Christian Dommel

C# Atem SDK - integrate IBMDSwitcherStreamRTMP

PostThu Jul 01, 2021 10:44 pm

Hi,

I'm trying to integrate the IBMDSwitcherStreamRTMP object with C#.
I have found examples of how to integrate the IBMDSwitcherMultiViewIterator object, but nothing about the IBMDSwitcherStreamRTMP object. The MultiView object can be integrated like this:

Code: Select all
private bool InitializeMultiView()
        {
            IntPtr multiViewPtr;
            Guid multiViewIID = typeof(IBMDSwitcherMultiViewIterator).GUID;
            _BMDSwitcher.CreateIterator(ref multiViewIID, out multiViewPtr);
            if (multiViewPtr == null)
            {
                return false;
            }
            IBMDSwitcherMultiViewIterator multiViewIterator = (IBMDSwitcherMultiViewIterator)Marshal.GetObjectForIUnknown(multiViewPtr);
            if (multiViewIterator == null)
            {
                return false;
            }

            multiViewIterator.Next(out _BMDSwitcherMultiView);

            return true;
        }


This doesn't work with the SwitcherStreamRTMP object. According to the documentation, the MultiView object is integrated via the CreateIterator method, the SwitcherStreamRTMP object with the QueryInterface method. So I tried something like this:

Code: Select all

private bool atem_initialize_stream_rtmp()
      {
         IntPtr StreamPtr;
         Guid streamIID = typeof(IBMDSwitcherStreamRTMP).GUID;
         Marshal.QueryInterface(_BMDSwitcher, ref streamIID, out StreamPtr);
      }



Unfortunately that doesn't work. I got the error: Conversion of "BMDSwitcherAPI.IBMDSwitcher" to "System.IntPtr" not possible.
Does anybody know how to integrate the StreamRTMP object?
Thanks!
Offline

Ian Morrish

  • Posts: 580
  • Joined: Sun Jan 18, 2015 9:24 pm
  • Location: New Zealand

Re: C# Atem SDK - integrate IBMDSwitcherStreamRTMP

PostSun Jul 04, 2021 7:23 am

This works for me

public void StreamRTMPStartStreaming()
{
BMDSwitcherAPI.IBMDSwitcherStreamRTMP m_params =
(BMDSwitcherAPI.IBMDSwitcherStreamRTMP)switcher;
m_params.StartStreaming();
}
Regards,
Ian Morrish
Video Integrated Scripting Environment
(Windows PowerShell with ATEM driver + more)
https://ianmorrish.wordpress.com
Offline

Cameron Nichols

Blackmagic Design

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

Re: C# Atem SDK - integrate IBMDSwitcherStreamRTMP

PostMon Jul 05, 2021 1:42 am

Hi Christian,

You don't need to use Marshal library to perform query interface, the following code should work for you:
Code: Select all
IBMDSwitcher switcher;
IBMDSwitcherStreamRTMP switcherStreamRTMP;

/// Connect to IBMDSwitcher

try
{
    switcherStreamRTMP = switcher as IBMDSwitcherStreamRTMP;
}
catch (InvalidCastException)
{
    // Switcher does not support stream RTMP interface
}
Regards
Cameron
Offline

chris08

  • Posts: 3
  • Joined: Thu Jul 01, 2021 10:09 pm
  • Real Name: Christian Dommel

Re: C# Atem SDK - integrate IBMDSwitcherStreamRTMP

PostMon Jul 12, 2021 12:08 am

Thanks! That helped me!

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 26 guests