예제 #1
0
파일: VLCStream.cs 프로젝트: uzbekdev1/main
        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;
        }
예제 #2
0
        /// <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;
        }
예제 #3
0
        // 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;
        }
예제 #4
0
파일: Vlc.cs 프로젝트: Pzkgw/Camera-Support
        //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;
        }
예제 #5
0
        //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;
        }
예제 #6
0
 private void Player_FormClosing(object sender, FormClosingEventArgs e)
 {
     try { m_player.Stop(); } catch
     {
     }
     m_factory.Dispose();
     m_media.Dispose();
     m_player.Dispose();
 }
예제 #7
0
 private void Player_FormClosing(object sender, FormClosingEventArgs e)
 {
     try { _mPlayer.Stop(); } catch
     {
     }
     _mFactory.Dispose();
     _mMedia.Dispose();
     _mPlayer.Dispose();
 }
예제 #8
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     DisposeMedia();
     _factory.Dispose();
     _player.Dispose();
 }
예제 #9
0
 /// <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();
     }
 }
예제 #10
0
        // 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);
        }
예제 #12
0
 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();
     }
 }