public override void Close() { try { if (m_Writer != null) { m_Writer.EndWriting(); IWMWriterAdvanced wa = (IWMWriterAdvanced)m_Writer; wa.RemoveSink((IWMWriterSink)this); m_Writer = null; m_Profile = null; } } finally { base.Close(); } }
private void RemoveAllSinks(IWMWriterAdvanced pWriterAdvanced) { IWMWriterSink ppSink; int iSinkCount; pWriterAdvanced.GetSinkCount(out iSinkCount); for (int x = iSinkCount - 1; x >= 0; x--) { pWriterAdvanced.GetSink(x, out ppSink); pWriterAdvanced.RemoveSink(ppSink); } }
/// <summary> /// Stop the encoder /// </summary> public void Stop() { try { writer.EndWriting(); writerAdvanced.RemoveSink(netSink); netSink.Close(); } catch (Exception e) { eventLog.WriteEntry("Failed to stop: " + e.ToString(), EventLogEntryType.Error, 1000); Debug.WriteLine("Failed to stop: " + e.ToString()); } }
public void Dispose() { try { if (m_Writer != null) { m_Writer.EndWriting(); IWMWriterAdvanced wa = (IWMWriterAdvanced)m_Writer; wa.RemoveSink((IWMWriterSink)this); m_Writer = null; m_Profile = null; } } finally { m_outputStream.Close(); } }
private void RemoveAllSinks(IWMWriterAdvanced pWriterAdvanced) { IWMWriterSink ppSink; int iSinkCount; int hr = pWriterAdvanced.GetSinkCount(out iSinkCount); WMError.ThrowExceptionForHR(hr); for (int x = iSinkCount - 1; x >= 0; x--) { hr = pWriterAdvanced.GetSink(x, out ppSink); WMError.ThrowExceptionForHR(hr); hr = pWriterAdvanced.RemoveSink(ppSink); WMError.ThrowExceptionForHR(hr); } }
private void TestSink() { int i; IWMWriterFileSink pSink; IWMWriterSink pSink2; WMUtils.WMCreateWriterFileSink(out pSink); m_Writer.AddSink(pSink); m_Writer.GetSinkCount(out i); Debug.Assert(i == 1); m_Writer.GetSink(0, out pSink2); Debug.Assert(pSink2 != null); m_Writer.RemoveSink(pSink2); m_Writer.GetSinkCount(out i); Debug.Assert(i == 0); }