Use API to set up a switcher from a saved XML file?

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

guzewski

  • Posts: 15
  • Joined: Mon Jul 15, 2019 2:30 pm
  • Real Name: Mark Guzewski

Use API to set up a switcher from a saved XML file?

PostWed Aug 07, 2019 7:54 pm

First of all, please tolerate my ignorance about this. I haven't worked with switchers since the analog days (probably the mid 80's :shock: )

The client wants to have switcher setups that can be recalled from my application. They plan to save several switcher setup XML files and my application will apply one of these setups based on various conditions. My idea is to read the appropriate XML file and set up the switcher according to the contents therein using the switcher API.

So I have no problem reading and parsing the switcher XML files. However, I'm struggling to map what I see there to the objects exposed in the API.

For example, here is part of a switcher XML file:
Code: Select all
Profile majorVersion="1" minorVersion="4" product="ATEM 4 M/E Broadcast Studio 4K">
    <MixEffectBlocks>
        <MixEffectBlock index="0">
            <Program input="15"/>
            <Preview input="20"/>
            <NextTransition selection="Key1" nextSelection="Key1"/>
            <TransitionStyle style="Mix" nextStyle="Mix" previewTransition="False" ...   >
                <MixParameters rate="90"/>
                <DipParameters rate="30" input="2001"/>
                ...
                ...

When I look at the API document, I see the the IBMDSwitcherMixEffectBlock interface, and it does indeed has a set/get for the program and preview inputs, which I also see in the XML file. So far so good.

And then it gets a bit less clear. For example, the MixEffectBlock in the XML refers to NextTransition, TransitionStyle, etc, which do not appear in the IBMDSwitcherMixEffectBlock interface. I see them in the IBMDSwitcherTransitionParameters but it's not clear how that relates to the MixEffectBlock.

I was hoping for a somewhat more obvious mapping between the XML file contents and the API object model, but I guess I'm out of luck.

If anyone can clarify this XML-to-object mapping I'd sure appreciate it.
Offline

Cameron Nichols

Blackmagic Design

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

Re: Use API to set up a switcher from a saved XML file?

PostThu Aug 08, 2019 6:22 am

Hi Mark,

From the example, the relevant interfaces you will need to infer are:
  • IBMDSwitcherTransitionParameters - Common transition parameters
  • IBMDSwitcherTransitionMixParameters - Parameters specific to Mix transition
  • IBMDSwitcherTransitionDipParameters - Parameters specific to Dip transition
Each of these interfaces can be obtained by calling QueryInterface on your IBMDSwitcherMixEffectBlock object, eg (where meb is the IBMDSwitcherMixEffectBlock interface object):

C++
Code: Select all
IBMDSwitcherTransitionMixParameters* meTransitionMixParams;
HRESULT hr = meb->QueryInterface(IID_IBMDSwitcherTransitionMixParameters, (void**)&meTransitionMixParams);
if (hr == S_OK)
    ...
C#
Code: Select all
var meTransitionMixParams = meb as IBMDSwitcherTransitionMixParameters;
Regards
Cameron
Offline

guzewski

  • Posts: 15
  • Joined: Mon Jul 15, 2019 2:30 pm
  • Real Name: Mark Guzewski

Re: Use API to set up a switcher from a saved XML file?

PostFri Aug 09, 2019 1:22 pm

Thanks for the info. I'll get back to this as soon as I'm able.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 23 guests