Page 1 of 1

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

PostPosted: Wed Aug 07, 2019 7:54 pm
by guzewski
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.

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

PostPosted: Thu Aug 08, 2019 6:22 am
by Cameron Nichols
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

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

PostPosted: Fri Aug 09, 2019 1:22 pm
by guzewski
Thanks for the info. I'll get back to this as soon as I'm able.