Exemplo n.º 1
0
        public int ConnectEx(PinEx pReceivePinEx, AMMediaType pmt)
        {
            var eventArg = new PinConnectEventArg(pmt);

            if (PinConnecting != null)
            {
                PinConnecting(this, eventArg);
            }

            var result = Pin.Connect(pReceivePinEx.Pin, eventArg.Reset ?? pmt);

            if (result == 0)
            {
                pReceivePinEx.InitAMMediaType();
                if (PinConnectSuccess != null)
                {
                    PinConnectSuccess(this, new EventArgsEx <AMMediaType>(pmt));
                }
            }
            else
            {
                Console.WriteLine(string.Format("DSError:{0}  {1}", result, DsError.GetErrorText(result)));
                if (PinConnectFailure != null)
                {
                    PinConnectFailure(this, new EventArgsEx <AMMediaType>(pmt));
                }
            }
            return(result);
        }