/// <summary> /// Adds a source filter to the graph and sets the input. /// </summary> protected override void AddSourceFilter() { if (!_useTsReader) { base.AddSourceFilter(); return; } // Render the file _sourceFilter = FilterLoader.LoadFilterFromDll("TsReader.ax", typeof(TsReader).GUID, true); IFileSourceFilter fileSourceFilter = (IFileSourceFilter)_sourceFilter; ITsReader tsReader = (ITsReader)_sourceFilter; tsReader.SetRelaxedMode(1); tsReader.SetTsReaderCallback(this); tsReader.SetRequestAudioChangeCallback(this); _graphBuilder.AddFilter(_sourceFilter, TSREADER_FILTER_NAME); if (_resourceLocator.NativeResourcePath.IsNetworkResource) { // _resourceAccessor points to an rtsp:// stream or network file var sourcePathOrUrl = SourcePathOrUrl; if (sourcePathOrUrl == null) { throw new IllegalCallException("The LiveRadioPlayer can only play network resources of type INetworkResourceAccessor"); } ServiceRegistration.Get <ILogger>().Debug("{0}: Initializing for stream '{1}'", PlayerTitle, sourcePathOrUrl); IDisposable accessEnsurer = null; if (IsLocalFilesystemResource) { accessEnsurer = ((ILocalFsResourceAccessor)_resourceAccessor).EnsureLocalFileSystemAccess(); } using (accessEnsurer) { int hr = fileSourceFilter.Load(SourcePathOrUrl, null); new HRESULT(hr).Throw(); } } else { //_resourceAccessor points to a local .ts file var localFileSystemResourceAccessor = _resourceAccessor as ILocalFsResourceAccessor; if (localFileSystemResourceAccessor == null) { throw new IllegalCallException("The LiveRadioPlayer can only play file resources of type ILocalFsResourceAccessor"); } using (localFileSystemResourceAccessor.EnsureLocalFileSystemAccess()) { ServiceRegistration.Get <ILogger>().Debug("{0}: Initializing for stream '{1}'", PlayerTitle, localFileSystemResourceAccessor.LocalFileSystemPath); fileSourceFilter.Load(localFileSystemResourceAccessor.LocalFileSystemPath, null); } } }
/// <summary> /// Adds the file source filter to the graph. /// </summary> protected override void AddFileSource() { // Render the file _fileSource = FilterLoader.LoadFilterFromDll("TsReader.ax", typeof(TsReader).GUID, true); ITsReader tsReader = (ITsReader)_fileSource; tsReader.SetRelaxedMode(1); tsReader.SetTsReaderCallback(this); tsReader.SetRequestAudioChangeCallback(this); _graphBuilder.AddFilter(_fileSource, TSREADER_FILTER_NAME); _subtitleRenderer = new SubtitleRenderer(OnTextureInvalidated); _subtitleFilter = _subtitleRenderer.AddSubtitleFilter(_graphBuilder); if (_subtitleFilter != null) { _subtitleRenderer.RenderSubtitles = true; _subtitleRenderer.SetPlayer(this); } IFileSourceFilter f = (IFileSourceFilter)_fileSource; f.Load(SourcePathOrUrl, null); // Init GraphRebuilder _graphRebuilder = new GraphRebuilder(_graphBuilder, _fileSource, OnAfterGraphRebuild) { PlayerName = PlayerTitle }; }
/// <summary> /// Adds the file source filter to the graph. /// </summary> protected override void AddFileSource() { // Render the file _fileSource = (IBaseFilter) new TsReader(); ITsReader tsReader = (ITsReader)_fileSource; tsReader.SetRelaxedMode(1); tsReader.SetTsReaderCallback(this); tsReader.SetRequestAudioChangeCallback(this); _graphBuilder.AddFilter(_fileSource, TSREADER_FILTER_NAME); _subtitleRenderer = new SubtitleRenderer(OnTextureInvalidated); _subtitleFilter = _subtitleRenderer.AddSubtitleFilter(_graphBuilder); if (_subtitleFilter != null) { _subtitleRenderer.RenderSubtitles = true; _subtitleRenderer.SetPlayer(this); } IFileSourceFilter f = (IFileSourceFilter)_fileSource; f.Load(_resourceAccessor.LocalFileSystemPath, null); // Init GraphRebuilder _graphRebuilder = new GraphRebuilder(_graphBuilder, _fileSource, OnAfterGraphRebuild) { PlayerName = PlayerTitle }; }
/// <summary> /// Adds the TsReader filter to the graph. /// </summary> protected override void AddSourceFilter() { // Render the file _sourceFilter = FilterLoader.LoadFilterFromDll("TsReader.ax", typeof(TsReader).GUID, true); IFileSourceFilter fileSourceFilter = (IFileSourceFilter)_sourceFilter; ITsReader tsReader = (ITsReader)_sourceFilter; tsReader.SetRelaxedMode(1); tsReader.SetTsReaderCallback(this); tsReader.SetRequestAudioChangeCallback(this); _graphBuilder.AddFilter(_sourceFilter, TSREADER_FILTER_NAME); _subtitleRenderer = new SubtitleRenderer(OnTextureInvalidated); _subtitleFilter = _subtitleRenderer.AddSubtitleFilter(_graphBuilder); if (_subtitleFilter != null) { _subtitleRenderer.RenderSubtitles = true; _subtitleRenderer.SetPlayer(this); } if (_resourceLocator.NativeResourcePath.IsNetworkResource) { // _resourceAccessor points to an rtsp:// stream or network file var sourcePathOrUrl = SourcePathOrUrl; if (sourcePathOrUrl == null) { throw new IllegalCallException("The TsVideoPlayer can only play network resources of type INetworkResourceAccessor"); } ServiceRegistration.Get <ILogger>().Debug("{0}: Initializing for stream '{1}'", PlayerTitle, sourcePathOrUrl); int hr = fileSourceFilter.Load(SourcePathOrUrl, null); new HRESULT(hr).Throw(); } else { // _resourceAccessor points to a local or remote mapped .ts file _localFsRaHelper = new LocalFsResourceAccessorHelper(_resourceAccessor); var localFileSystemResourceAccessor = _localFsRaHelper.LocalFsResourceAccessor; if (localFileSystemResourceAccessor == null) { throw new IllegalCallException("The TsVideoPlayer can only play file resources of type ILocalFsResourceAccessor"); } ServiceRegistration.Get <ILogger>().Debug("{0}: Initializing for stream '{1}'", PlayerTitle, localFileSystemResourceAccessor.LocalFileSystemPath); int hr = fileSourceFilter.Load(localFileSystemResourceAccessor.LocalFileSystemPath, null); new HRESULT(hr).Throw(); } // Init GraphRebuilder _graphRebuilder = new GraphRebuilder(_graphBuilder, _sourceFilter, OnAfterGraphRebuild) { PlayerName = PlayerTitle }; }
/// <summary> /// Adds the file source filter to the graph. /// </summary> protected override void AddFileSource() { if (!_useTsReader) { base.AddFileSource(); return; } // Render the file _fileSource = (IBaseFilter) new TsReader(); ITsReader tsReader = (ITsReader)_fileSource; tsReader.SetRelaxedMode(1); tsReader.SetTsReaderCallback(this); tsReader.SetRequestAudioChangeCallback(this); _graphBuilder.AddFilter(_fileSource, TSREADER_FILTER_NAME); IFileSourceFilter f = (IFileSourceFilter)_fileSource; f.Load(SourcePathOrUrl, null); }
/// <summary> /// Adds a source filter to the graph and sets the input. /// </summary> protected override void AddSourceFilter() { if (!_useTsReader) { base.AddSourceFilter(); return; } // Render the file // Notes Morpheus_xx, 2017-04-19: // In contrast to TV we need to use a relative path here, as the method is located inside the SlimTV assembly. // For TV part, the base class inside VideoPlayers is used and thus the correct path to TsReader.ax // The problem with different paths appears only inside RELEASE builds, but not DEBUG. Why this happens I don't know. var platform = IntPtr.Size > 4 ? "x64" : "x86"; _sourceFilter = FilterLoader.LoadFilterFromDll($"..\\VideoPlayers\\{platform}\\TsReader.ax", typeof(TsReader).GUID, true); var baseFilter = _sourceFilter.GetFilter(); IFileSourceFilter fileSourceFilter = (IFileSourceFilter)baseFilter; _tsReader = (ITsReader)baseFilter; _tsReader.SetRelaxedMode(1); _tsReader.SetTsReaderCallback(this); _tsReader.SetRequestAudioChangeCallback(this); _graphBuilder.AddFilter(baseFilter, TSREADER_FILTER_NAME); if (_resourceLocator.NativeResourcePath.IsNetworkResource) { // _resourceAccessor points to an rtsp:// stream or network file var sourcePathOrUrl = SourcePathOrUrl; if (sourcePathOrUrl == null) { throw new IllegalCallException("The LiveRadioPlayer can only play network resources of type INetworkResourceAccessor"); } ServiceRegistration.Get <ILogger>().Debug("{0}: Initializing for stream '{1}'", PlayerTitle, sourcePathOrUrl); IDisposable accessEnsurer = null; if (IsLocalFilesystemResource) { accessEnsurer = ((ILocalFsResourceAccessor)_resourceAccessor).EnsureLocalFileSystemAccess(); } using (accessEnsurer) { int hr = fileSourceFilter.Load(SourcePathOrUrl, null); new HRESULT(hr).Throw(); } } else { //_resourceAccessor points to a local .ts file var localFileSystemResourceAccessor = _resourceAccessor as ILocalFsResourceAccessor; if (localFileSystemResourceAccessor == null) { throw new IllegalCallException("The LiveRadioPlayer can only play file resources of type ILocalFsResourceAccessor"); } using (localFileSystemResourceAccessor.EnsureLocalFileSystemAccess()) { ServiceRegistration.Get <ILogger>().Debug("{0}: Initializing for stream '{1}'", PlayerTitle, localFileSystemResourceAccessor.LocalFileSystemPath); fileSourceFilter.Load(localFileSystemResourceAccessor.LocalFileSystemPath, null); } } }
/// <summary> /// Informs the ITsReader that the graph rebuild was done. /// </summary> protected void OnAfterGraphRebuild() { ITsReader tsReader = (ITsReader)_sourceFilter; tsReader.OnGraphRebuild(_changedMediaType); }
/// <summary> /// Adds the TsReader filter to the graph. /// </summary> protected override void AddSourceFilter() { var platform = IntPtr.Size > 4 ? "x64" : "x86"; _sourceFilter = FilterLoader.LoadFilterFromDll($"{platform}\\TsReader.ax", typeof(TsReader).GUID, true); var baseFilter = _sourceFilter.GetFilter(); IFileSourceFilter fileSourceFilter = (IFileSourceFilter)baseFilter; _tsReader = (ITsReader)baseFilter; _tsReader.SetRelaxedMode(1); _tsReader.SetTsReaderCallback(this); _tsReader.SetRequestAudioChangeCallback(this); _graphBuilder.AddFilter(baseFilter, TSREADER_FILTER_NAME); if (_resourceLocator.NativeResourcePath.IsNetworkResource) { // _resourceAccessor points to an rtsp:// stream or network file var sourcePathOrUrl = SourcePathOrUrl; if (sourcePathOrUrl == null) { throw new IllegalCallException("The TsVideoPlayer can only play network resources of type INetworkResourceAccessor"); } ServiceRegistration.Get <ILogger>().Debug("{0}: Initializing for stream '{1}'", PlayerTitle, sourcePathOrUrl); IDisposable accessEnsurer = null; if (IsLocalFilesystemResource) { accessEnsurer = ((ILocalFsResourceAccessor)_resourceAccessor).EnsureLocalFileSystemAccess(); } using (accessEnsurer) { int hr = fileSourceFilter.Load(SourcePathOrUrl, null); new HRESULT(hr).Throw(); } } else { // _resourceAccessor points to a local or remote mapped .ts file _localFsRaHelper = new LocalFsResourceAccessorHelper(_resourceAccessor); var localFileSystemResourceAccessor = _localFsRaHelper.LocalFsResourceAccessor; if (localFileSystemResourceAccessor == null) { throw new IllegalCallException("The TsVideoPlayer can only play file resources of type ILocalFsResourceAccessor"); } using (localFileSystemResourceAccessor.EnsureLocalFileSystemAccess()) { ServiceRegistration.Get <ILogger>().Debug("{0}: Initializing for stream '{1}'", PlayerTitle, localFileSystemResourceAccessor.LocalFileSystemPath); int hr = fileSourceFilter.Load(localFileSystemResourceAccessor.LocalFileSystemPath, null); new HRESULT(hr).Throw(); } } // Init GraphRebuilder _graphRebuilder = new GraphRebuilder(_graphBuilder, baseFilter, OnAfterGraphRebuild) { PlayerName = PlayerTitle }; }