/// <summary> /// Adds the subtitle filter to the graph. The caller need to call <see cref="Marshal.ReleaseComObject"/> on the /// returned instance when done. /// </summary> /// <param name="graphBuilder">The IGraphBuilder</param> /// <returns>DvbSub2(3) filter instance</returns> public IBaseFilter AddSubtitleFilter(IGraphBuilder graphBuilder) { try { _filter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, FilterName); _subFilter = _filter as IDVBSubtitleSource; ServiceRegistration.Get <ILogger>().Debug("SubtitleRenderer: CreateFilter success: " + (_filter != null) + " & " + (_subFilter != null)); } catch (Exception e) { ServiceRegistration.Get <ILogger>().Error(e); } if (_subFilter != null) { _subFilter.StatusTest(111); _callBack = OnSubtitle; IntPtr pCallback = Marshal.GetFunctionPointerForDelegate(_callBack); _subFilter.SetBitmapCallback(pCallback); _subFilter.StatusTest(222); IntPtr pResetCallBack = Marshal.GetFunctionPointerForDelegate(_resetCallBack); _subFilter.SetResetCallback(pResetCallBack); IntPtr pUpdateTimeoutCallBack = Marshal.GetFunctionPointerForDelegate(_updateTimeoutCallBack); _subFilter.SetUpdateTimeoutCallback(pUpdateTimeoutCallBack); } return(_filter); }
/// <summary> /// Adds the subtitle filter to the graph. The caller need to call <see cref="Marshal.ReleaseComObject"/> on the /// returned instance when done. /// </summary> /// <param name="graphBuilder">The IGraphBuilder</param> /// <returns>DvbSub2(3) filter instance</returns> public IBaseFilter AddSubtitleFilter(IGraphBuilder graphBuilder) { try { _filter = FilterLoader.LoadFilterFromDll("DVBSub3.ax", CLSID_DVBSUB3, true); _subFilter = _filter as IDVBSubtitleSource; ServiceRegistration.Get <ILogger>().Debug("SubtitleRenderer: CreateFilter success: " + (_filter != null) + " & " + (_subFilter != null)); } catch (Exception e) { ServiceRegistration.Get <ILogger>().Error(e); } if (_subFilter != null) { graphBuilder.AddFilter(_filter, "MediaPortal DVBSub3"); _subFilter.StatusTest(111); _callBack = OnSubtitle; IntPtr pCallback = Marshal.GetFunctionPointerForDelegate(_callBack); _subFilter.SetBitmapCallback(pCallback); _subFilter.StatusTest(222); IntPtr pResetCallBack = Marshal.GetFunctionPointerForDelegate(_resetCallBack); _subFilter.SetResetCallback(pResetCallBack); IntPtr pUpdateTimeoutCallBack = Marshal.GetFunctionPointerForDelegate(_updateTimeoutCallBack); _subFilter.SetUpdateTimeoutCallback(pUpdateTimeoutCallBack); } return(_filter); }
/// <summary> /// Adds the subtitle filter to the graph. /// </summary> /// <param name="_graphBuilder"></param> /// <returns></returns> public IBaseFilter AddSubtitleFilter(IGraphBuilder _graphBuilder) { try { _filter = DirectShowUtil.AddFilterToGraph(_graphBuilder, "MediaPortal DVBSub3"); _subFilter = _filter as IDVBSubtitleSource; Log.Debug("SubtitleRenderer: CreateFilter success: " + (_filter != null) + " & " + (_subFilter != null)); } catch (Exception e) { Log.Error(e); } _subFilter.StatusTest(111); IntPtr pCallback = Marshal.GetFunctionPointerForDelegate(_callBack); _subFilter.SetBitmapCallback(pCallback); _subFilter.StatusTest(222); IntPtr pResetCallBack = Marshal.GetFunctionPointerForDelegate(_resetCallBack); _subFilter.SetResetCallback(pResetCallBack); IntPtr pUpdateTimeoutCallBack = Marshal.GetFunctionPointerForDelegate(_updateTimeoutCallBack); _subFilter.SetUpdateTimeoutCallback(pUpdateTimeoutCallBack); return(_filter); }
/// <summary> /// Adds the subtitle filter to the graph. The caller need to call <see cref="Marshal.ReleaseComObject"/> on the /// returned instance when done. /// </summary> /// <param name="graphBuilder">The IGraphBuilder</param> /// <returns>DvbSub2(3) filter instance</returns> public IBaseFilter AddSubtitleFilter(IGraphBuilder graphBuilder) { try { _filter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, FilterName); _subFilter = _filter as IDVBSubtitleSource; ServiceRegistration.Get<ILogger>().Debug("SubtitleRenderer: CreateFilter success: " + (_filter != null) + " & " + (_subFilter != null)); } catch (Exception e) { ServiceRegistration.Get<ILogger>().Error(e); } if (_subFilter != null) { _subFilter.StatusTest(111); _callBack = OnSubtitle; IntPtr pCallback = Marshal.GetFunctionPointerForDelegate(_callBack); _subFilter.SetBitmapCallback(pCallback); _subFilter.StatusTest(222); IntPtr pResetCallBack = Marshal.GetFunctionPointerForDelegate(_resetCallBack); _subFilter.SetResetCallback(pResetCallBack); IntPtr pUpdateTimeoutCallBack = Marshal.GetFunctionPointerForDelegate(_updateTimeoutCallBack); _subFilter.SetUpdateTimeoutCallback(pUpdateTimeoutCallBack); } return _filter; }
/// <summary> /// Adds the subtitle filter to the graph. The caller need to call <see cref="Marshal.ReleaseComObject"/> on the /// returned instance when done. /// </summary> /// <param name="graphBuilder">The IGraphBuilder</param> /// <returns>DvbSub2(3) filter instance</returns> public IBaseFilter AddSubtitleFilter(IGraphBuilder graphBuilder) { try { _filter = FilterLoader.LoadFilterFromDll("DVBSub3.ax", CLSID_DVBSUB3, true); _subFilter = _filter as IDVBSubtitleSource; ServiceRegistration.Get<ILogger>().Debug("SubtitleRenderer: CreateFilter success: " + (_filter != null) + " & " + (_subFilter != null)); } catch (Exception e) { ServiceRegistration.Get<ILogger>().Error(e); } if (_subFilter != null) { graphBuilder.AddFilter(_filter, "MediaPortal DVBSub3"); _subFilter.StatusTest(111); _callBack = OnSubtitle; IntPtr pCallback = Marshal.GetFunctionPointerForDelegate(_callBack); _subFilter.SetBitmapCallback(pCallback); _subFilter.StatusTest(222); IntPtr pResetCallBack = Marshal.GetFunctionPointerForDelegate(_resetCallBack); _subFilter.SetResetCallback(pResetCallBack); IntPtr pUpdateTimeoutCallBack = Marshal.GetFunctionPointerForDelegate(_updateTimeoutCallBack); _subFilter.SetUpdateTimeoutCallback(pUpdateTimeoutCallBack); } return _filter; }
/// <summary> /// Adds the subtitle filter to the graph. /// </summary> /// <param name="_graphBuilder"></param> /// <returns></returns> public IBaseFilter AddSubtitleFilter(IGraphBuilder _graphBuilder) { try { _filter = DirectShowUtil.AddFilterToGraph(_graphBuilder, "MediaPortal DVBSub3"); _subFilter = _filter as IDVBSubtitleSource; Log.Debug("SubtitleRenderer: CreateFilter success: " + (_filter != null) + " & " + (_subFilter != null)); } catch (Exception e) { Log.Error(e); } if (_subFilter != null) { _subFilter.StatusTest(111); IntPtr pCallback = Marshal.GetFunctionPointerForDelegate(_callBack); _subFilter.SetBitmapCallback(pCallback); _subFilter.StatusTest(222); IntPtr pResetCallBack = Marshal.GetFunctionPointerForDelegate(_resetCallBack); _subFilter.SetResetCallback(pResetCallBack); IntPtr pUpdateTimeoutCallBack = Marshal.GetFunctionPointerForDelegate(_updateTimeoutCallBack); _subFilter.SetUpdateTimeoutCallback(pUpdateTimeoutCallBack); } return _filter; }