private void DisposePlayer() { if (_mFactory == null) { return; } try { _mPlayer.Dispose(); } catch { } try { _mFactory.Dispose(); } catch { } try { _mMedia.Dispose(); } catch { } _mPlayer = null; _mFactory = null; _mMedia = null; }
/// <summary> /// Closes the media player and releases all resources. /// </summary> public void CloseMedia() { if (_player != null) { // Close the media player. _disk.Stop(); _disk.Dispose(); _player.Dispose(); _media.Dispose(); } _player = null; _disk = null; _media = null; }
// Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { try { _abort.Close(); _abort.Dispose(); _mFactory?.Dispose(); } catch { // ignored } } // Free any unmanaged objects here. // _disposed = true; }
//private string[] GetVlcMediaOptions() //{ /* * if (SessionInfo.vlcMediaOptions == null) * { * SessionInfo.vlcMediaOptions = new string[] { * "--no-snapshot-preview" // vlcOpt && !vlcMediaOpt * }.Where(x => !string.IsNullOrEmpty(x)).ToArray(); * * } * * return SessionInfo.vlcMediaOptions;*/ // return null; //} /* private string GetVlcLibLocation() * { * * string aP; * if (Environment.Is64BitOperatingSystem) * aP = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "VideoLAN\\VLC"); * else * aP = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "VideoLAN\\VLC"); */ /*else if (!File.Exists(Path.Combine(aP, "libvlc.dll")) * { * Using fbdDialog As New FolderBrowserDialog() * fbdDialog.Description = "Select VLC Path" * fbdDialog.SelectedPath = Path.Combine(aP, "VideoLAN\VLC") * * If fbdDialog.ShowDialog() = DialogResult.OK Then * e.VlcLibDirectory = New DirectoryInfo(fbdDialog.SelectedPath) * } * * e.VlcLibDirectory = new DirectoryInfo(aP); * * return "c:\\Program Files (x86)\\VideoLAN\\VLC";//aP; * }*/ #region CleanUp internal void CleanUp() { SessionInfo.Logger.CleanUp(); ToggleRunningMedia(false); _mFactory.Dispose(); _mFactory = null; }
//private string[] GetVlcMediaOptions() //{ /* * if (SessionInfo.vlcMediaOptions == null) * { * SessionInfo.vlcMediaOptions = new string[] { * "--no-snapshot-preview" // vlcOpt && !vlcMediaOpt * }.Where(x => !string.IsNullOrEmpty(x)).ToArray(); * * } * * return SessionInfo.vlcMediaOptions;*/ // return null; //} /* private string GetVlcLibLocation() * { * * string aP; * if (Environment.Is64BitOperatingSystem) * aP = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "VideoLAN\\VLC"); * else * aP = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "VideoLAN\\VLC"); */ /*else if (!File.Exists(Path.Combine(aP, "libvlc.dll")) * { * Using fbdDialog As New FolderBrowserDialog() * fbdDialog.Description = "Select VLC Path" * fbdDialog.SelectedPath = Path.Combine(aP, "VideoLAN\VLC") * * If fbdDialog.ShowDialog() = DialogResult.OK Then * e.VlcLibDirectory = New DirectoryInfo(fbdDialog.SelectedPath) * } * * e.VlcLibDirectory = new DirectoryInfo(aP); * * return "c:\\Program Files (x86)\\VideoLAN\\VLC";//aP; * }*/ #region CleanUp internal void CleanUp() { CLogger.On = false; ToggleRunningMedia(false); _mFactory.Dispose(); _mFactory = null; }
private void Player_FormClosing(object sender, FormClosingEventArgs e) { try { m_player.Stop(); } catch { } m_factory.Dispose(); m_media.Dispose(); m_player.Dispose(); }
private void Player_FormClosing(object sender, FormClosingEventArgs e) { try { _mPlayer.Stop(); } catch { } _mFactory.Dispose(); _mMedia.Dispose(); _mPlayer.Dispose(); }
protected virtual void Dispose(bool disposing) { if (!disposing) { return; } DisposeMedia(); _factory.Dispose(); _player.Dispose(); }
/// <summary> /// Disposes of object resources. /// </summary> /// <param name="disposeManagedResources">If true, managed resources should be /// disposed of in addition to unmanaged resources.</param> protected virtual void Dispose(bool disposeManagedResources) { if (disposeManagedResources) { m_factory.Dispose(); m_player.Dispose(); m_equalizer.Dispose(); m_media.Dispose(); m_media_preview.Dispose(); m_memRender.Dispose(); m_media_list.Dispose(); m_list_player.Dispose(); m_media_list_preview.Dispose(); m_list_preview_player.Dispose(); } }
// Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { _mFactory?.Dispose(); _stopEvent?.Close(); } // Free any unmanaged objects here. // _disposed = true; }
public void ReleasenVLC() { CheckConnectionTimer.Stop(); DisposeMedia(); if (m_player != null) { m_player.Events.PlayerPositionChanged -= Events_PlayerPositionChanged; m_player.Events.TimeChanged -= Events_TimeChanged; m_player.Events.MediaEnded -= Events_MediaEnded; m_player.Events.PlayerStopped -= Events_PlayerStopped; m_player.Dispose(); } if (m_factory != null) { m_factory.Dispose(); } //GC.SuppressFinalize(this); }
private void Player_FormClosing(object sender, FormClosingEventArgs e) { lock (_lock) { if (_mPlayer != null) { try { _mPlayer.Stop(); } catch { } } try { if (_mFactory != null) { _mFactory.Dispose(); } if (_mMedia != null) { _mMedia.Dispose(); } if (_mPlayer != null) { _mPlayer.Dispose(); } } catch { } } if (vNav != null) { vNav.ReleaseGraph(); } }