protected override void Decompose()
{
if (this.graphBuilder != null)
{
int hr = 0;
OnGraphEnded();
this.epg.UnRegisterEvent();
// 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.networkProvider != null) Marshal.ReleaseComObject(this.networkProvider); this.networkProvider = null;
if (this.mpeg2Demux != null) Marshal.ReleaseComObject(this.mpeg2Demux); this.mpeg2Demux = null;
if (this.tuner != null) Marshal.ReleaseComObject(this.tuner); this.tuner = null;
if (this.capture != null) Marshal.ReleaseComObject(this.capture); this.capture = null;
if (this.bdaTIF != null) Marshal.ReleaseComObject(this.bdaTIF); this.bdaTIF = null;
if (this.bdaSecTab != null) Marshal.ReleaseComObject(this.bdaSecTab); this.bdaSecTab = null;
if (this.audioDecoderFilter != null) Marshal.ReleaseComObject(this.audioDecoderFilter); this.audioDecoderFilter = null;
if (this.videoH264DecoderFilter != null) Marshal.ReleaseComObject(this.videoH264DecoderFilter); this.videoH264DecoderFilter = null;
if (this.videoMpeg2DecoderFilter != null) Marshal.ReleaseComObject(this.videoMpeg2DecoderFilter); this.videoMpeg2DecoderFilter = null;
if (this.audioRenderer != null) Marshal.ReleaseComObject(this.audioRenderer); this.audioRenderer = null;
if (this.videoRenderer != null) Marshal.ReleaseComObject(this.videoRenderer); this.videoRenderer = null;
if (this.captureGraphBuilder != null) Marshal.ReleaseComObject(this.captureGraphBuilder); this.captureGraphBuilder = null;
if (useWPF)
WPFStop();
try { rot.Dispose(); }
catch { }
try { Marshal.ReleaseComObject(this.graphBuilder); this.graphBuilder = null; }
catch { }
}
}