public void OpenOverlay(Guid gPresenter) { object o; if (m_ImageHandlers != null) { foreach (ImageHandler ih in m_ImageHandlers) { ih.Dispose(); } m_ImageHandlers = null; } m_ImageHandlers = new ImageHandler[2]; m_ImageHandlers[0] = new ImageFromPixels(30, new FourCC("YUY2"), 320, 240, 16); //m_ImageHandlers[0] = new ImageFromPixels(30, new FourCC(3), 320, 240, 32, 255); //m_ImageHandlers[0] = new ImageFromPixels(30, new FourCC("AYUV"), 320, 240, 32, 255); //m_ImageHandlers[0] = new ImageFromPixels(30, new FourCC("NV12"), 320, 240, 12, 255); //m_ImageHandlers[1] = new ImageFromText(30, new FourCC(3), 320, 240, 32); m_ImageHandlers[1] = new ImageFromText(30, new FourCC("AYUV"), 320, 240, 32); InitializeGraph(); SetupGraph(gPresenter); IMFGetService pGetService = (IMFGetService)m_pEVR; pGetService.GetService(MFServices.MR_VIDEO_MIXER_SERVICE, typeof(IMFVideoMixerControl).GUID, out o); m_pMixer = (IMFVideoMixerControl)o; pGetService.GetService(MFServices.MR_VIDEO_RENDER_SERVICE, typeof(IMFVideoPositionMapper).GUID, out o); m_pMapper = (IMFVideoPositionMapper)o; }
private void GetInterface() { object o; int hr; m_pGraph = (IGraphBuilder)new FilterGraph(); IBaseFilter pSource; hr = m_pGraph.AddSourceFilter(@"C:\SourceForge\mflib\Test\Media\AspectRatio4x3.wmv", null, out pSource); DsError.ThrowExceptionForHR(hr); IBaseFilter pEVR = (IBaseFilter)new EnhancedVideoRenderer(); hr = m_pGraph.AddFilter(pEVR, "EVR"); DsError.ThrowExceptionForHR(hr); ICaptureGraphBuilder2 cgb; cgb = (ICaptureGraphBuilder2)new CaptureGraphBuilder2(); hr = cgb.SetFiltergraph(m_pGraph); DsError.ThrowExceptionForHR(hr); hr = cgb.RenderStream(null, MediaType.Video, pSource, null, pEVR); DsError.ThrowExceptionForHR(hr); IMFGetService gs = pEVR as IMFGetService; hr = gs.GetService(MFServices.MR_VIDEO_RENDER_SERVICE, typeof(IMFVideoPositionMapper).GUID, out o); MFError.ThrowExceptionForHR(hr); m_vp = o as IMFVideoPositionMapper; }
private void TearDownGraph() { #if DEBUG if (m_rot != null) { m_rot.Dispose(); m_rot = null; } #endif // Stop sending event messages if (m_pEvent != null) { m_pEvent.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero); m_pEvent = null; } if (m_pControl != null) { m_pControl.Stop(); m_pControl = null; } if (m_pDisplay != null) { //Marshal.ReleaseComObject(m_pDisplay); m_pDisplay = null; } if (m_pMapper != null) { Marshal.ReleaseComObject(m_pMapper); m_pMapper = null; } if (m_pMixer != null) { Marshal.ReleaseComObject(m_pMixer); m_pMixer = null; } if (m_pEVR != null) { Marshal.ReleaseComObject(m_pEVR); m_pEVR = null; } if (m_pGraph != null) { Marshal.ReleaseComObject(m_pGraph); m_pGraph = null; } m_state = PlaybackState.Closed; m_seekCaps = 0; m_pSeek = null; }
public DShowPlayer(Control hwndVideo, IntPtr hwnd, int msg) { m_state = PlaybackState.Closed; m_hwndVideo = hwndVideo; m_hwndEvent = hwnd; m_EventMsg = msg; m_pGraph = null; m_pControl = null; m_pEvent = null; m_pSeek = null; m_pDisplay = null; m_pEVR = null; m_pMapper = null; m_seekCaps = 0; m_clsidPresenter = Guid.Empty; }