public void GetEvent(uint dwFlags, /*IMFMediaEvent*/ out IntPtr ppEvent) { MediaEvent ev = null; try { _eventQueue.GetEvent((int)dwFlags, out ev); ppEvent = ev.Detach(); } finally { ev?.Dispose(); } }
public void EndGetEvent(/*IMFAsyncResult*/ IntPtr pResult, /*IMFMediaEvent*/ out IntPtr ppEvent) { if (pResult == IntPtr.Zero) { throw new ArgumentNullException(); } var ar = new AsyncResult(pResult); MediaEvent ev = null; try { _eventQueue.EndGetEvent(ar, out ev); ppEvent = ev.Detach(); } finally { ev?.Dispose(); ar.NativePointer = IntPtr.Zero; ar.Dispose(); } }