Пример #1
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="alsoManaged"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        private void Dispose(bool alsoManaged)
        {
            if (IsDisposed)
            {
                return;
            }

            if (alsoManaged)
            {
                // free managed resources
                Commands.Close();

                if (Container != null)
                {
                    Container.Dispose();
                    Container = null;
                }

                if (UIPropertyUpdateTimer != null)
                {
                    UIPropertyUpdateTimer.Stop();
                    UIPropertyUpdateTimer.IsEnabled = false;
                    UIPropertyUpdateTimer           = null;
                }

                PacketReadingCycle.Dispose();
                FrameDecodingCycle.Dispose();
                BlockRenderingCycle.Dispose();
                SeekingDone.Dispose();
                DelayLock.Dispose();
            }

            IsDisposed = true;
        }
Пример #2
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// Please not that this call is non-blocking/asynchronous.
        /// </summary>
        /// <param name="alsoManaged"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        private void Dispose(bool alsoManaged)
        {
            if (IsDisposed)
            {
                return;
            }

            // Run the close command immediately
            if (BeginSynchronousCommand() == false)
            {
                return;
            }

            // Dispose the wait handle: No more command accepted from this point forward.
            SynchronousCommandDone.Dispose();

            try
            {
                var closeCommand = new CloseCommand(Commands);
                closeCommand.RunSynchronously();
            }
            catch { throw; }
            finally
            {
                IsDisposed = true;
            }

            // Dispose the container
            Container?.Dispose();
            Container = null;

            // Dispose the RTC
            Clock.Dispose();

            // Dispose the Wait Event objects as they are
            // backed by unmanaged code
            PacketReadingCycle.Dispose();
            FrameDecodingCycle.Dispose();
            BlockRenderingCycle.Dispose();
            SeekingDone.Dispose();
            MediaChangingDone.Dispose();
        }
Пример #3
0
        /// <inheritdoc />
        public void Dispose()
        {
            if (m_IsDisposed == true)
            {
                return;
            }
            m_IsDisposed.Value = true;

            // Dispose of commands. This closes the
            // Media automatically and signals an exit
            // This also causes the Container to get disposed.
            Commands.Dispose();

            // Reset the RTC
            ResetPosition();

            // Dispose the Wait Event objects as they are
            // backed by unmanaged code
            PacketReadingCycle.Dispose();
            FrameDecodingCycle.Dispose();
            BlockRenderingCycle.Dispose();
            BufferChangedEvent.Dispose();
        }