protected virtual void Decompose()
{
if (this.graphBuilder != null)
{
int hr = 0;
OnGraphEnded();
// Decompose the graph
try { hr = (this.graphBuilder as IMediaControl).StopWhenReady(); }
catch { }
try { hr = (this.graphBuilder as IMediaControl).Stop(); }
catch { }
RemoveHandlers();
FilterGraphTools.RemoveAllFilters(this.graphBuilder);
if (this.evrVideoDisplayControl != null) Marshal.ReleaseComObject(this.evrVideoDisplayControl); this.evrVideoDisplayControl = 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 { }
}
}