예제 #1
0
        public HResult GetEvent(MFEventFlag dwFlags, out IMFMediaEvent ppEvent)
        {
            Debug.WriteLine("StreamSink:GetEvent");

            HResult hr;
            IMFMediaEventQueueAlt queue = null;

            ppEvent = null;

            lock (this)
            {
                hr = CheckShutdown();
                LogIfFailed(hr);

                if (Succeeded(hr))
                {
                    GenEventQueue();
                    queue = EventQueue;
                    Marshal.AddRef(Marshal.GetIUnknownForObject(queue));
                }
            }
            if (Succeeded(hr))
            {
                hr = queue.GetEvent(dwFlags, out ppEvent);
                LogIfFailed(hr);
            }

            SafeRelease(queue);

            return(hr);
        }
예제 #2
0
        public HResult GetEvent(MFEventFlag dwFlags, out IMFMediaEvent ppEvent)
        {
            // NOTE:
            // GetEvent can block indefinitely, so we don't hold the lock.
            // This requires some juggling with the event queue pointer.
            HResult            hr      = HResult.S_OK;
            IMFMediaEventQueue spQueue = null;

            ppEvent = null;

            lock (_spSource)
            {
                // Check shutdown
                hr = CheckShutdown();

                // Get the pointer to the event queue.
                if (MFError.Succeeded(hr))
                {
                    spQueue = _spEventQueue;
                }
            }

            // Now get the event.
            if (MFError.Succeeded(hr))
            {
                hr = spQueue.GetEvent(dwFlags, out ppEvent);
            }

            return(hr);
        }
예제 #3
0
    public HResult GetEvent(MFEventFlag dwFlags, out IMFMediaEvent ppEvent)
    {
        HResult hr;

        hr = m_events.GetEvent(dwFlags, out ppEvent);

        return(hr);
    }
예제 #4
0
        private void ProcesssMediaEvents()
        {
            Dispatcher.BeginInvoke((Action) delegate
            {
                if (m_pSession != null)
                {
                    IMFMediaEvent pmet;

                    MFEventFlag flags = MFEventFlag.NoWait;
                    /* Get all the queued events from the interface */

                    while (m_pSession.GetEvent(flags, out pmet) == 0)
                    {
                        /* Handle anything for this event code */
                        OnMediaEvent(pmet);
                    }
                }
            });
        }
예제 #5
0
        public int GetEvent(MFEventFlag dwFlags, out IMFMediaEvent ppEvent)
        {
            int hr;
            TRACE("CWavStream::GetEvent");

            // NOTE:
            // GetEvent can block indefinitely, so we don't hold the lock.
            // This requires some juggling with the event queue pointer.

            IMFMediaEventQueueAlt pQueue;

            lock (this)
            {
                // Check shutdown
                CheckShutdown();

                // Get the pointer to the event queue.
                pQueue = m_pEventQueue;

            }   // release lock

            // Now get the event.
            hr = pQueue.GetEvent(dwFlags, out ppEvent);
            MFError.ThrowExceptionForHR(hr);

            //SAFE_RELEASE(pQueue);
            return S_Ok;
        }
예제 #6
0
        public int GetEvent(MFEventFlag dwFlags, out IMFMediaEvent ppEvent)
        {
            // Make sure we *never* leave this entry point with an exception
            try
            {
                // NOTE: GetEvent can block indefinitely, so we don't hold the
                //       WavSource lock. This requires some juggling with the
                //       event queue pointer.

                int hr;
                m_Log.WriteLine("-GetEvent");
                ppEvent = null;

                IMFMediaEventQueue pQueue = null;

                lock (this)
                {
                    // Check shutdown
                    CheckShutdown();
                    pQueue = m_pEventQueue;
                }

                hr = pQueue.GetEvent(dwFlags, out ppEvent);
                MFError.ThrowExceptionForHR(hr);

                // not needed SAFE_RELEASE(pQueue);
                return S_Ok;
            }
            catch (Exception e)
            {
                ppEvent = null;
                return Marshal.GetHRForException(e);
            }
        }
예제 #7
0
        public int GetEvent(MFEventFlag dwFlags, out IMFMediaEvent ppEvent)
        {
            // Make sure we *never* leave this entry point with an exception
            try
            {
                int hr;
                m_Log.WriteLine("-GetEvent");
                ppEvent = null;

                IMFMediaEventQueue pQueue = null;

                lock (this)
                {
                    CheckShutdown();
                    pQueue = (IMFMediaEventQueue)m_pEventQueue;
                }

                hr = pQueue.GetEvent(dwFlags, out ppEvent);
                MFError.ThrowExceptionForHR(hr);

                //not needed SAFE_RELEASE(pQueue);
                return S_Ok;
            }
            catch (Exception e)
            {
                ppEvent = null;
                return Marshal.GetHRForException(e);
            }
        }