コード例 #1
0
 public override void Dispose()
 {
     FLLog.Info("Video", "Closing Windows Media Foundation backend");
     if (session != null)
     {
         session.ClearTopologies();
         session.Stop();
         session.Close();
         session.Dispose();
     }
     if (topology != null)
     {
         topology.Dispose();
     }
     if (videoSampler != null)
     {
         videoSampler.Dispose();
     }
     if (clock != null)
     {
         clock.Dispose();
     }
     if (_texture != null)
     {
         _texture.Dispose();
     }
     if (cb != null)
     {
         cb.Dispose();
     }
 }
コード例 #2
0
 private void AfterClose()
 {
     try {
         _mediaSession?.Shutdown();
         _mediaSession?.Dispose();
         _callback?.Dispose();
     } catch (SharpDXException) { }
     _mediaSession = null;
     _callback     = null;
 }
コード例 #3
0
        private void ProcessPlayerClosed()
        {
            // The session finished to close, we have to dispose all related object.
            currentMusic = null;

            mediaSessionCallback.Dispose();

            if (mediaSource != null)
            {
                mediaSource.Shutdown();
            }
            if (mediaSession != null)
            {
                mediaSession.Shutdown();
            }

            if (streamVolume != null)
            {
                streamVolume.Dispose();
            }
            if (mediaSource != null)
            {
                mediaSource.Dispose();
            }
            if (topology != null)
            {
                topology.Dispose();
            }
            if (mediaSession != null)
            {
                mediaSession.Dispose();
            }
            if (mediaInputByteStream != null)
            {
                mediaInputByteStream.Dispose();
            }

            topology             = null;
            streamVolume         = null;
            mediaSession         = null;
            mediaSource          = null;
            mediaInputByteStream = null;
            mediaSessionCallback = null;
            isMusicPlayerReady   = false;
        }
コード例 #4
0
 public override void Dispose()
 {
     FLLog.Info("Video", "Closing Windows Media Foundation backend");
     if (session != null)
     {
         session.Stop();
         session.ClearTopologies();
         //Sample grabber thread works asynchronously (as task), so we need give him a time, to understand, that session is closed
         //minimal time to wait: 33 ms (1000 ms / 30 fps), but I decide to use a little more
         System.Threading.Thread.Sleep(100);
         session.Close();
         session.Dispose();
         session = null;
     }
     if (topology != null)
     {
         topology.Dispose();
         topology = null;
     }
     if (videoSampler != null)
     {
         videoSampler.Dispose();
         videoSampler = null;
     }
     if (clock != null)
     {
         clock.Dispose();
         clock = null;
     }
     if (_texture != null)
     {
         _texture.Dispose();
         _texture = null;
     }
     if (cb != null)
     {
         cb.Dispose();
         cb = null;
     }
 }