public int AdviseNotify(IVMRSurfaceAllocatorNotify lpIVMRSurfAllocNotify) { AdviseNotifyCount++; int hr = defaultAllocatorPresenter.AdviseNotify(lpIVMRSurfAllocNotify); return(hr); }
public void BuildGraph() { int hr = 0; graphBuilder = (IFilterGraph2) new FilterGraph(); rot = new DsROTEntry(graphBuilder); vmr = (IBaseFilter) new VideoMixingRenderer(); IVMRFilterConfig filterConfig = (IVMRFilterConfig)vmr; hr = filterConfig.SetNumberOfStreams(2); DsError.ThrowExceptionForHR(hr); // Put the VMR7 in Renderless mode hr = filterConfig.SetRenderingMode(VMRMode.Renderless); DsError.ThrowExceptionForHR(hr); surfaceAllocatorNotify = (IVMRSurfaceAllocatorNotify)vmr; hr = surfaceAllocatorNotify.AdviseSurfaceAllocator(cookie, this); DsError.ThrowExceptionForHR(hr); defaultAllocatorPresenter = (IVMRSurfaceAllocator)Activator.CreateInstance(Type.GetTypeFromCLSID(VMRClsId.AllocPresenter)); form = new Form(); form.Show(); hr = (defaultAllocatorPresenter as IVMRWindowlessControl).SetVideoClippingWindow(form.Handle); DsError.ThrowExceptionForHR(hr); hr = this.AdviseNotify(surfaceAllocatorNotify); DsError.ThrowExceptionForHR(hr); hr = graphBuilder.AddFilter(vmr, "VMR"); hr = graphBuilder.RenderFile(@"..\..\..\Resources\foo.avi", null); DsError.ThrowExceptionForHR(hr); }