Exemple #1
0
        public static SuperSourceState Build(IBMDSwitcherInputSuperSource props)
        {
            var state = new SuperSourceState();

            props.GetInputFill(out long input);
            state.Properties.ArtFillSource = (VideoSource)input;
            props.GetInputCut(out long cutInput);
            state.Properties.ArtCutSource = (VideoSource)cutInput;
            props.GetArtOption(out _BMDSwitcherSuperSourceArtOption option);
            state.Properties.ArtOption = AtemEnumMaps.SuperSourceArtOptionMap.FindByValue(option);
            props.GetPreMultiplied(out int preMultiplied);
            state.Properties.ArtPreMultiplied = preMultiplied != 0;
            props.GetClip(out double clip);
            state.Properties.ArtClip = clip * 100;
            props.GetGain(out double gain);
            state.Properties.ArtGain = gain * 100;
            props.GetInverse(out int inverse);
            state.Properties.ArtInvertKey = inverse != 0;

            BuildBorder(state.Border, (IBMDSwitcherSuperSourceBorder)props);

            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherSuperSourceBoxIterator>(props.CreateIterator);

            state.Boxes = AtemSDKConverter.IterateList <IBMDSwitcherSuperSourceBox, SuperSourceState.BoxState>(
                iterator.Next, (box, boxId) => BuildBox(box));

            return(state);
        }
        protected static void EachSuperSource(AtemMockServerWrapper helper, Action <AtemState, SuperSourceState, IBMDSwitcherInputSuperSource, SuperSourceId, int> fcn, int iterations = 5)
        {
            Dictionary <VideoSource, IBMDSwitcherInputSuperSource> ssrcs = helper.GetSdkInputsOfType <IBMDSwitcherInputSuperSource>();

            foreach (KeyValuePair <VideoSource, IBMDSwitcherInputSuperSource> ssrc in ssrcs)
            {
                AtemState        stateBefore = helper.Helper.BuildLibState();
                SuperSourceId    id          = (SuperSourceId)(ssrc.Key - VideoSource.SuperSource);
                SuperSourceState ssrcBefore  = stateBefore.SuperSources[(int)id];
                Assert.NotNull(ssrcBefore);

                for (int i = 0; i < iterations; i++)
                {
                    fcn(stateBefore, ssrcBefore, ssrc.Value, id, i);
                }
            }
        }