Exemplo n.º 1
0
        private void AddFilter_Crossbar()
        {
            this.DX.Crossbar = null;
            ICaptureGraphBuilder2 builder = null;

            try
            {
                builder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
                DsError.ThrowExceptionForHR(builder.SetFiltergraph(this.DX.FilterGraph));
                object ppint = null;
                builder.FindInterface(FindDirection.UpstreamOnly, Guid.Empty, this.DX.CaptureFilter, typeof(IAMCrossbar).GUID, out ppint);
                if (ppint != null)
                {
                    this.DX.Crossbar = (IAMCrossbar)ppint;
                }
            }
            finally
            {
                SafeReleaseComObject(builder);
                builder = null;
            }
            if (this.DX.Crossbar != null)
            {
                DsError.ThrowExceptionForHR(this.DX.FilterGraph.AddFilter((IBaseFilter)this.DX.Crossbar, "Crossbar"));
                SetCrossbarInput(this.DX.Crossbar, this._VideoInput);
                this._VideoInput = GetCrossbarInput(this.DX.Crossbar);
            }
        }
Exemplo n.º 2
0
        private static Camera_NET.VideoInput GetCrossbarInput(IAMCrossbar crossbar)
        {
            int num;
            int num2;

            Camera_NET.VideoInput input = Camera_NET.VideoInput.Default;
            if (crossbar.get_PinCounts(out num2, out num) == 0)
            {
                int num4;
                int num6;
                int outputPinIndex = -1;
                for (int i = 0; i < num2; i++)
                {
                    PhysicalConnectorType type;
                    if ((crossbar.get_CrossbarPinInfo(false, i, out num4, out type) == 0) && (type == PhysicalConnectorType.Video_VideoDecoder))
                    {
                        outputPinIndex = i;
                        break;
                    }
                }
                if ((outputPinIndex != -1) && (crossbar.get_IsRoutedTo(outputPinIndex, out num6) == 0))
                {
                    PhysicalConnectorType type2;
                    crossbar.get_CrossbarPinInfo(true, num6, out num4, out type2);
                    input = new Camera_NET.VideoInput(num6, type2);
                }
            }
            return(input);
        }
Exemplo n.º 3
0
 public void DisplayPropertyPage_Crossbar(IntPtr hwndOwner)
 {
     if (this.DX.Crossbar != null)
     {
         DisplayPropertyPageFilter((IBaseFilter)this.DX.Crossbar, hwndOwner);
         this._VideoInput = GetCrossbarInput(this.DX.Crossbar);
     }
 }
Exemplo n.º 4
0
        private static void SetCrossbarInput(IAMCrossbar crossbar, Camera_NET.VideoInput videoInput)
        {
            int num;
            int num2;

            if (((videoInput.Type != Camera_NET.VideoInput.PhysicalConnectorType_Default) && (videoInput.Index != -1)) && (crossbar.get_PinCounts(out num2, out num) == 0))
            {
                int num5;
                PhysicalConnectorType type;
                int outputPinIndex = -1;
                int inputPinIndex  = -1;
                for (int i = 0; i < num2; i++)
                {
                    if ((crossbar.get_CrossbarPinInfo(false, i, out num5, out type) == 0) && (type == PhysicalConnectorType.Video_VideoDecoder))
                    {
                        outputPinIndex = i;
                        break;
                    }
                }
                for (int j = 0; j < num; j++)
                {
                    if (((crossbar.get_CrossbarPinInfo(true, j, out num5, out type) == 0) && (type == videoInput.Type)) && (j == videoInput.Index))
                    {
                        inputPinIndex = j;
                        break;
                    }
                }
                if ((inputPinIndex == -1) || (outputPinIndex == -1))
                {
                    throw new Exception("Can't find routing pins.");
                }
                if (crossbar.CanRoute(outputPinIndex, inputPinIndex) != 0)
                {
                    throw new Exception("Can't route from selected VideoInput to VideoDecoder.");
                }
                DsError.ThrowExceptionForHR(crossbar.Route(outputPinIndex, inputPinIndex));
            }
        }