コード例 #1
0
        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());
                            }
                        });
                    }
                }
            }
        }
コード例 #2
0
        public static void Build(AtemState state, IBMDSwitcherCameraControl camera, AtemStateBuilderSettings updateSettings)
        {
            camera.GetPeriodicFlushInterval(out uint interval);
            state.CameraControl.PeriodicFlushInterval = interval;

            IBMDSwitcherCameraControlParameterIterator iterator =
                AtemSDKConverter.CastSdk <IBMDSwitcherCameraControlParameterIterator>(camera.CreateIterator);
            uint lastDevice    = uint.MaxValue;
            uint lastCategory  = 0u;
            uint lastParameter = 0u;

            for (iterator.Next(out var device, out var category, out var parameter);
                 ;
                 iterator.Next(out device, out category, out parameter))
            {
                if (device == lastDevice && category == lastCategory && parameter == lastParameter)
                {
                    break;
                }

                lastDevice    = device;
                lastCategory  = category;
                lastParameter = parameter;

                if (device == 0)
                {
                    continue;
                }

                if (!state.CameraControl.Cameras.TryGetValue(device, out CameraControlState.CameraState cState))
                {
                    cState = state.CameraControl.Cameras[device] = new CameraControlState.CameraState();
                }

                CameraControlGetCommand cmd = BuildCommand(camera, device, category, parameter);
                CameraControlUtil.ApplyToState(cState, cmd, updateSettings.IgnoreUnknownCameraControlProperties);
            }
        }