/// <summary> /// Meldet, dass nun eine Verbindung zu einem anderen Endpunkt festgelegt wurde. /// </summary> /// <param name="connector">Ein anderer Endpunkt.</param> /// <param name="mediaType">Die Art der Daten, die zwischen den Endpunkten ausgetauscht werden.</param> public void ReceiveConnection(IntPtr connector, IntPtr mediaType) { // Free Disconnect(); // Remember if (connector != null) { Marshal.AddRef(connector); } m_Connected = connector; // Clone the media type m_ConnectType.Dispose(); m_ConnectType = new MediaType(mediaType); // Attach to raw COM interface m_MemPin = ComIdentity.QueryInterface(m_Connected, typeof(IMemInputPin)); // Get the delegate for the calls - dirty but we have to avoid automatic marshalling inside the graph IntPtr comFunctionTable = Marshal.ReadIntPtr(m_MemPin); IntPtr receiveSingle = Marshal.ReadIntPtr(comFunctionTable, 24); IntPtr notifyAllocator = Marshal.ReadIntPtr(comFunctionTable, 16); m_MemSink = (MediaSampleSink)Marshal.GetDelegateForFunctionPointer(receiveSingle, typeof(MediaSampleSink)); m_NotifySink = (NotifyAllocatorSink)Marshal.GetDelegateForFunctionPointer(notifyAllocator, typeof(NotifyAllocatorSink)); }
/// <summary> /// Trennt den Endpunkt von anderen. /// </summary> public void Disconnect() { // Detach all helper m_NotifySink = null; m_MemSink = null; // Release BDAEnvironment.Release(ref m_MemPin); BDAEnvironment.Release(ref m_Connected); // Reset m_ConnectType.Dispose(); m_ConnectType = new MediaType(); }