示例#1
0
        public static IUpdateResult Update(AtemState state, ICommand command, AtemStateBuilderSettings settings = null)
        {
            var result = new UpdateResultImpl();

            UpdateInternal(state, result, command);
            AudioStateUpdater.Update(state, result, command);
            FairlightStateUpdater.Update(state, result, command);
            TalkbackStateUpdater.Update(state, result, command);
            AuxStateUpdater.Update(state, result, command);
            ColorStateUpdater.Update(state, result, command);
            DownstreamKeyerStateUpdater.Update(state, result, command);
            InfoStateUpdater.Update(state, result, command);
            MacroStateUpdater.Update(state, result, command);
            MediaPlayerStateUpdater.Update(state, result, command, settings);
            MediaPoolStateUpdater.Update(state, result, command);
            MixEffectStateUpdater.Update(state, result, command);
            SettingsStateUpdater.Update(state, result, command);
            HyperDeckStateUpdater.Update(state, result, command);
            SuperSourceStateUpdater.Update(state, result, command);
            StreamingStateUpdater.Update(state, result, command);
            RecordingStateUpdater.Update(state, result, command);
            CameraControllerUpdater.Update(state, result, command, settings);

            return(result);
        }
示例#2
0
        public static void Update(AtemState state, UpdateResultImpl result, ICommand command, AtemStateBuilderSettings updateSettings)
        {
            if (command is MediaPlayerSourceGetCommand sourceCmd)
            {
                UpdaterUtil.TryForIndex(result, state.MediaPlayers, (int)sourceCmd.Index, mp =>
                {
                    UpdaterUtil.CopyAllProperties(sourceCmd, mp.Source, new [] { "Index" });
                    result.SetSuccess($"MediaPlayers.{sourceCmd.Index:D}.Source");
                });
            }
            else if (command is MediaPlayerClipStatusGetCommand statusCmd)
            {
                if (state.MediaPool.Clips.Count > 0)
                {
                    UpdaterUtil.TryForIndex(result, state.MediaPlayers, (int)statusCmd.Index, mp =>
                    {
                        if (mp.ClipStatus == null)
                        {
                            mp.ClipStatus = new MediaPlayerState.ClipStatusState();
                        }

                        var skipProps = new List <string> {
                            "Index"
                        };
                        var ignoreDestProps = new List <string> {
                            "Index"
                        };
                        if (updateSettings != null && !updateSettings.TrackMediaClipFrames)
                        {
                            skipProps.Add("AtBeginning");
                            skipProps.Add("ClipFrame");
                            ignoreDestProps.Add("AtBeginning");
                            ignoreDestProps.Add("ClipFrame");
                        }

                        UpdaterUtil.CopyAllProperties(statusCmd, mp.ClipStatus, skipProps.ToArray(), ignoreDestProps.ToArray());
                        result.SetSuccess($"MediaPlayers.{statusCmd.Index:D}.ClipStatus");
                    });
                }
            }
        }
        public static void Update(AtemState state, UpdateResultImpl result, ICommand command, AtemStateBuilderSettings settings)
        {
            if (command is CameraControlSettingsGetCommand ccstCmd)
            {
                state.CameraControl.PeriodicFlushInterval = ccstCmd.Interval;
                result.SetSuccess("CameraControl.PeriodicFlushInterval");
            }
            else if (state.CameraControl != null)
            {
                if (command is CameraControlGetCommand camCmd)
                {
                    if (camCmd.Input != VideoSource.Black)
                    {
                        if (!state.CameraControl.Cameras.ContainsKey((int)camCmd.Input))
                        {
                            state.CameraControl.Cameras[(int)camCmd.Input] = new CameraControlState.CameraState();
                        }

                        UpdaterUtil.TryForKey(result, state.CameraControl.Cameras, (long)camCmd.Input, input =>
                        {
                            try
                            {
                                string[] path = CameraControlUtil.ApplyToState(input, camCmd,
                                                                               settings.IgnoreUnknownCameraControlProperties);
                                if (path.Length > 0)
                                {
                                    result.SetSuccess(path.Select(p => $"CameraControl.Cameras.{camCmd.Input:D}.p"));
                                }
                            }
                            catch (Exception e)
                            {
                                result.AddError(e.ToString());
                            }
                        });
                    }
                }
            }
        }