/// <summary> /// Check if we are allowed to disconnect two pins /// </summary> /// <param name="output"></param> /// <param name="input"></param> /// <returns>false if pins failed to disconnect</returns> bool Graph_BeforePinsDisconnected(DaggerOutputPin output, DaggerInputPin input) { int hr = 0; // make sure the graph is stopped Stop(); // do these two pins still belong to the ds filters? if ((output.ParentNode as DSFilterNode).GetPins().Contains((output as DSOutputPin)._pin) && (input.ParentNode as DSFilterNode).GetPins().Contains((input as DSInputPin)._pin)) { // are these two pins actually connected? This can be caused by Syncing a graph that has pins re-routed elsewhere. IPin conto = null; (output as DSOutputPin)._pin.ConnectedTo(out conto); if ((input as DSInputPin)._pin != conto) { if (conto != null) { Marshal.ReleaseComObject(conto); } return(true); } if (conto != null) { Marshal.ReleaseComObject(conto); } // If we fail to disconnect the IPins return false. // This will tell DaggerLib not to remove the Noodle in it's own internal graph. hr = (output as DSOutputPin)._pin.Disconnect(); if (hr != 0 && hr != 1) /* 1 = not connected*/ { MessageBox.Show(DsError.GetErrorText(hr)); return(false); } // Call Disconnect on the input also to reset it's allowed media types (who knew?) (input as DSInputPin)._pin.Disconnect(); // sync the pins on the nodes in case pins have been added or deleted if ((output.ParentNode as DSFilterNode)._filter != null) { (output.ParentNode as DSFilterNode).SyncPins(); } if ((input.ParentNode as DSFilterNode)._filter != null) { (input.ParentNode as DSFilterNode).SyncPins(); } return(true); } else { return(false); } }
public DaggerNoodle(DaggerOutputPin output, DaggerInputPin input) { _inputPin = input; _outputPin = output; UpdateNoodlePath(NoodleStyle.Bezier, null); }
/// <summary> /// Try to connect 2 pins in the FilterGraph. /// </summary> /// <param name="output"></param> /// <param name="input"></param> /// <returns>false if pins cannot be connected</returns> bool Graph_BeforePinsConnected(DaggerOutputPin output, DaggerInputPin input) { IPin connectedTo; (output as DSOutputPin)._pin.ConnectedTo(out connectedTo); if (connectedTo == (input as DSInputPin)._pin) { // these two are already connected in DSGraph so allow it Marshal.ReleaseComObject(connectedTo); return(true); } if (connectedTo != null) { Marshal.ReleaseComObject(connectedTo); } // make sure the graph is stopped Stop(); int hr = 0; if (!_connectIntelligent) { hr = _graph.ConnectDirect((output as DSOutputPin)._pin, (input as DSInputPin)._pin, null); if (hr == 0) { // sync the pins on the nodes (output.ParentNode as DSFilterNode).SyncPins(); (input.ParentNode as DSFilterNode).SyncPins(); return(true); } } else { // try intelligent connection with the GraphBuilder hr = _graphBuilder.Connect((output as DSOutputPin)._pin, (input as DSInputPin)._pin); if (hr == 0 || hr == DsResults.S_PartialRender) { // sync the FilterGraph and the DaggerGraph dsDaggerUIGraph1.SyncGraphs(null); // sync the pins on the nodes (output.ParentNode as DSFilterNode).SyncPins(); (input.ParentNode as DSFilterNode).SyncPins(); // because SyncGraph already creates needed connections, return false to cancel this connection return(false); } } // cancel pin connection operations dsDaggerUIGraph1.StopPinConnect(); // if we get here, we simply couldn't connect the pins MessageBox.Show(DsError.GetErrorText(hr)); // sync the pins on the nodes just in case an attempt to connect created new pins (output.ParentNode as DSFilterNode).SyncPins(); (input.ParentNode as DSFilterNode).SyncPins(); return(false); }
void DSDaggerUIGraph_NoodleAddedRemoved(DaggerOutputPin output, DaggerInputPin input) { RouteDVDControl(); }
public override bool IsCompatibleDataTypes(DaggerInputPin inpin, DaggerOutputPin outpin) { // all pins in DSGraphEdit are compatible becuase they hold no data return(true); }