CodeTV.GraphBuilderPlayer.Decompose C# (CSharp) Method

Decompose() protected method

protected Decompose ( ) : void
return void
        protected override void Decompose()
        {
            if (this.graphBuilder != null)
            {
                int hr = 0;

                OnGraphEnded();

                // Decompose the graph
                if (GetGraphState() != FilterState.Stopped)
                {
                    try { hr = (this.graphBuilder as IMediaControl).StopWhenReady(); }
                    catch { }
                    try { hr = (this.graphBuilder as IMediaControl).Stop(); }
                    catch { }
                }
                RemoveHandlers();

                FilterGraphTools.RemoveAllFilters(this.graphBuilder);

                if (this.filterSource != null) Marshal.ReleaseComObject(this.filterSource); this.filterSource = null;
                if (this.mpeg2Demux != null) Marshal.ReleaseComObject(this.mpeg2Demux); this.mpeg2Demux = null;

                if (this.audioRenderer != null) Marshal.ReleaseComObject(this.audioRenderer); this.audioRenderer = null;
                if (this.videoRenderer != null) Marshal.ReleaseComObject(this.videoRenderer); this.videoRenderer = null;

                try { rot.Dispose(); }
                catch { }
                try { Marshal.ReleaseComObject(this.graphBuilder); this.graphBuilder = null; }
                catch { }
            }
        }