/// <summary> /// Adds the EVR to graph. /// </summary> protected virtual void AddEvr() { ServiceRegistration.Get <ILogger>().Debug("{0}: Initialize EVR", PlayerTitle); _evr = (IBaseFilter) new EnhancedVideoRenderer(); IntPtr upDevice = SkinContext.Device.NativePointer; int hr = EvrInit(_evrCallback, (uint)upDevice.ToInt32(), _evr, SkinContext.Form.Handle, out _presenterInstance); if (hr != 0) { SafeEvrDeinit(); FilterGraphTools.TryRelease(ref _evr); throw new VideoPlayerException("Initializing of EVR failed"); } // Check if CC is enabled, in this case the EVR needs one more input pin VideoSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>(); if (settings.EnableClosedCaption) { _streamCount++; } // Set the number of video/subtitle/cc streams that are allowed to be connected to EVR. This has to be done after the custom presenter is initialized. IEVRFilterConfig config = (IEVRFilterConfig)_evr; config.SetNumberOfStreams(_streamCount); _graphBuilder.AddFilter(_evr, EVR_FILTER_NAME); }
public void DoTests() { int i; int hr; myEVR my = new myEVR(); m_fc = my as IEVRFilterConfig; hr = m_fc.SetNumberOfStreams(3); MFError.ThrowExceptionForHR(hr); hr = m_fc.GetNumberOfStreams(out i); MFError.ThrowExceptionForHR(hr); Debug.Assert(i == 3); }