Esempio n. 1
0
        int IMFVideoPresenter.ProcessMessage(MFVPMessageType eMessage, IntPtr ulParam)
        {
            // Make sure we *never* leave this entry point with an exception
            try
            {
                lock (this)
                {
                    //Debug.WriteLine(eMessage);

                    CheckShutdown();

                    switch (eMessage)
                    {
                        // Flush all pending samples.
                        case MFVPMessageType.Flush:
                            Flush();
                            break;

                        // Renegotiate the media type with the mixer.
                        case MFVPMessageType.InvalidateMediaType:
                            RenegotiateMediaType();
                            break;

                        // The mixer received a new input sample.
                        case MFVPMessageType.ProcessInputNotify:
                            ProcessInputNotify();
                            break;

                        // Streaming is about to start.
                        case MFVPMessageType.BeginStreaming:
                            BeginStreaming();
                            break;

                        // Streaming has ended. (The EVR has stopped.)
                        case MFVPMessageType.EndStreaming:
                            EndStreaming();
                            break;

                        // All input streams have ended.
                        case MFVPMessageType.EndOfStream:
                            // Set the EOS flag.
                            m_bEndStreaming = true;
                            // Check if it's time to send the EC_COMPLETE event to the EVR.
                            CheckEndOfStream();
                            break;

                        // Frame-stepping is starting.
                        case MFVPMessageType.Step:
                            PrepareFrameStep(ulParam.ToInt32());
                            break;

                        // Cancels frame-stepping.
                        case MFVPMessageType.CancelStep:
                            CancelFrameStep();
                            break;

                        default:
                            throw new COMException("ProcessMessage", E_InvalidArgument); // Unknown message. (This case should never occur.)
                    }
                }

                return S_Ok;
            }
            catch (Exception e)
            {
                return Marshal.GetHRForException(e);
            }
        }
Esempio n. 2
0
 public int ProcessMessage(MFVPMessageType eMessage, IntPtr ulParam)
 {
     Wrapper.CCallbackHandler _handler =
         new Wrapper.ProcessMessageHandler(m_Caller, eMessage, ulParam);
     _handler.Invoke();
     return _handler.m_Result;
 }
Esempio n. 3
0
        public int ProcessMessageImpl(MFVPMessageType eMessage, IntPtr ulParam)
        {
            try
            {
                HRESULT hr = S_OK;

                lock (m_ObjectLock)
                {
                    hr = CheckShutdown();
                    if (hr.Failed) return hr;

                    switch (eMessage)
                    {
                        // Flush all pending samples.
                        case MFVPMessageType.Flush:
                            hr = Flush();
                            break;

                        // Renegotiate the media type with the mixer.
                        case MFVPMessageType.InvalidateMediaType:
                            hr = RenegotiateMediaType();
                            break;

                        // The mixer received a new input sample.
                        case MFVPMessageType.ProcessInputNotify:
                            hr = ProcessInputNotify();
                            break;

                        // Streaming is about to start.
                        case MFVPMessageType.BeginStreaming:
                            hr = BeginStreaming();
                            break;

                        // Streaming has ended. (The EVR has stopped.)
                        case MFVPMessageType.EndStreaming:
                            hr = EndStreaming();
                            break;

                        // All input streams have ended.
                        case MFVPMessageType.EndOfStream:
                            // Set the EOS flag.
                            m_bEndStreaming = TRUE;
                            // Check if it's time to send the EC_COMPLETE event to the EVR.
                            hr = CheckEndOfStream();
                            break;

                        // Frame-stepping is starting.
                        case MFVPMessageType.Step:
                            hr = E_NOTIMPL;
                            break;

                        // Cancels frame-stepping.
                        case MFVPMessageType.CancelStep:
                            hr = E_NOTIMPL;
                            break;

                        default:
                            hr = E_INVALIDARG; // Unknown message. (This case should never occur.)
                            break;
                    }
                }
                return hr;
            }
            catch (Exception _exception)
            {
                throw _exception;
            }
        }
Esempio n. 4
0
 public ProcessMessageHandler(Wrapper _Invoker, MFVPMessageType _eMessage, IntPtr _ulParam)
     : base(_Invoker)
 {
     eMessage = _eMessage;
     ulParam = _ulParam;
     m_Type = CallType.ProcessMessage;
 }