Exemple #1
0
        public DmpsInternalVirtualHdmiVgaBncInputController(string key, string name, Card.Dmps3HdmiVgaBncInput inputCard)
            : base(key, name, inputCard)
        {
            InputCard = inputCard;

            HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi,
                                                           eDmps3InputVideoSource.Hdmi, this, VideoStatusHelper.GetHdmiInputStatusFuncs(InputCard.HdmiInputPort));
            VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
                                                          eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eDmps3InputVideoSource.Vga, this,
                                                          VideoStatusHelper.GetVgaInputStatusFuncs(InputCard.VgaInputPort));
            BncIn = new RoutingInputPortWithVideoStatuses(DmPortName.BncIn, eRoutingSignalType.Video, eRoutingPortConnectionType.Component,
                                                          eDmps3InputVideoSource.Bnc, this, VideoStatusHelper.GetBncInputStatusFuncs(InputCard.BncInputPort));
            SpdifIn = new RoutingInputPort(DmPortName.SpdifIn, eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio,
                                           eDmps3InputAudioSource.Spdif, this);

            if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp2xSupport)
            {
                HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
            }
            else if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp1xSupport)
            {
                HdcpSupportCapability = eHdcpCapabilityType.Hdcp1xSupport;
            }

            var combinedFuncs = new VideoStatusFuncsWrapper
            {
                HdcpActiveFeedbackFunc = () =>
                                         (ActualVideoInput == eDmps3InputVideoSource.Hdmi &&
                                          InputCard.HdmiInputPort.VideoAttributes.HdcpActiveFeedback.BoolValue),

                HdcpStateFeedbackFunc = () =>
                {
                    if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
                    {
                        return(InputCard.HdmiInputPort.VideoAttributes.HdcpStateFeedback.ToString());
                    }
                    return("");
                },

                VideoResolutionFeedbackFunc = () =>
                {
                    if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
                    {
                        return(InputCard.HdmiInputPort.VideoAttributes.GetVideoResolutionString());
                    }
                    if (ActualVideoInput == eDmps3InputVideoSource.Vga)
                    {
                        return(InputCard.VgaInputPort.VideoAttributes.GetVideoResolutionString());
                    }
                    if (ActualVideoInput == eDmps3InputVideoSource.Bnc)
                    {
                        return(InputCard.BncInputPort.VideoAttributes.GetVideoResolutionString());
                    }
                    return("");
                },
                VideoSyncFeedbackFunc = () =>
                                        (ActualVideoInput == eDmps3InputVideoSource.Hdmi &&
                                         InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue) ||
                                        (ActualVideoInput == eDmps3InputVideoSource.Vga &&
                                         InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue) ||
                                        (ActualVideoInput == eDmps3InputVideoSource.Bnc &&
                                         InputCard.BncInputPort.VideoDetectedFeedback.BoolValue),

                HasVideoStatusFunc = () =>
                                     (ActualVideoInput == eDmps3InputVideoSource.Hdmi &&
                                      HdmiIn.VideoStatus.HasVideoStatusFeedback.BoolValue) ||
                                     (ActualVideoInput == eDmps3InputVideoSource.Vga &&
                                      VgaIn.VideoStatus.HasVideoStatusFeedback.BoolValue) ||
                                     (ActualVideoInput == eDmps3InputVideoSource.Bnc &&
                                      BncIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
            };

            AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
                                                                  eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);

            ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", () => ActualVideoInput.ToString());

            VideoSourceNumericFeedback = new IntFeedback(() =>
            {
                return((int)InputCard.VideoSourceFeedback);
            });
            AudioSourceNumericFeedback = new IntFeedback(() =>
            {
                return((int)InputCard.AudioSourceFeedback);
            });

            HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
            {
                if (InputCard.HdmiInputPort.HdcpSupportOnFeedback.BoolValue)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            // Set Ports for CEC
            HdmiIn.Port = InputCard.HdmiInputPort;

            VirtualDmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                 eRoutingPortConnectionType.None, null, this);

            AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
                              AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
                              AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
                              AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback);

            //AddPostActivationAction(() =>
            //{
            // Link up all of these damned events to the various RoutingPorts via a helper handler
            InputCard.HdmiInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
            InputCard.HdmiInputPort.VideoAttributes.AttributeChange  += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);

            InputCard.VgaInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
            InputCard.VgaInputPort.VideoAttributes.AttributeChange  += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);

            InputCard.BncInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
            InputCard.BncInputPort.VideoAttributes.AttributeChange  += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
            //});
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <param name="name"></param>
        /// <param name="tx"></param>
        public DmTx401CController(string key, string name, DmTx401C tx)
            : base(key, name, tx)
        {
            Tx = tx;

            HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
                                                           eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.HDMI, this,
                                                           VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
            DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.DisplayPortIn,
                                                                  eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.DisplayPort, this,
                                                                  VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput));
            VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
                                                          eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.VGA, this,
                                                          VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
            CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn,
                                                                eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, eVst.Composite, this,
                                                                VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));

            Tx.BaseEvent += Tx_BaseEvent;

            ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
                                                          () => ActualVideoInput.ToString());

            VideoSourceNumericFeedback = new IntFeedback(() =>
            {
                return((int)Tx.VideoSourceFeedback);
            });
            AudioSourceNumericFeedback = new IntFeedback(() =>
            {
                return((int)Tx.AudioSourceFeedback);
            });

            HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
            {
                if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;

            var combinedFuncs = new VideoStatusFuncsWrapper
            {
                HdcpActiveFeedbackFunc = () =>
                                         (ActualVideoInput == eVst.HDMI &&
                                          tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue) ||
                                         (ActualVideoInput == eVst.DisplayPort &&
                                          tx.DisplayPortInput.VideoAttributes.HdcpActiveFeedback.BoolValue),

                HdcpStateFeedbackFunc = () =>
                {
                    if (ActualVideoInput == eVst.HDMI)
                    {
                        return(tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString());
                    }
                    if (ActualVideoInput == eVst.DisplayPort)
                    {
                        return(tx.DisplayPortInput.VideoAttributes.HdcpStateFeedback.ToString());
                    }
                    return("");
                },

                VideoResolutionFeedbackFunc = () =>
                {
                    if (ActualVideoInput == eVst.HDMI)
                    {
                        return(tx.HdmiInput.VideoAttributes.GetVideoResolutionString());
                    }
                    if (ActualVideoInput == eVst.DisplayPort)
                    {
                        return(tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString());
                    }
                    if (ActualVideoInput == eVst.VGA)
                    {
                        return(tx.VgaInput.VideoAttributes.GetVideoResolutionString());
                    }
                    if (ActualVideoInput == eVst.Composite)
                    {
                        return(tx.CvbsInput.VideoAttributes.GetVideoResolutionString());
                    }
                    return("");
                },
                VideoSyncFeedbackFunc = () =>
                                        (ActualVideoInput == eVst.HDMI &&
                                         tx.HdmiInput.SyncDetectedFeedback.BoolValue) ||
                                        (ActualVideoInput == eVst.DisplayPort &&
                                         tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) ||
                                        (ActualVideoInput == eVst.VGA &&
                                         tx.VgaInput.SyncDetectedFeedback.BoolValue) ||
                                        (ActualVideoInput == eVst.Composite &&
                                         tx.CvbsInput.SyncDetectedFeedback.BoolValue)
            };

            AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
                                                                  eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);

            DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                          eRoutingPortConnectionType.DmCat, null, this);

            AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
                              AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
                              AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
                              AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback);

            // Set Ports for CEC
            DisplayPortIn.Port = Tx.DisplayPortInput;
            HdmiIn.Port        = Tx.HdmiInput;
            DmOut.Port         = Tx.DmOutput;
        }