/// <summary> /// Accepts incoming data from a previous connection. /// If this is an input, it will throw. /// </summary> /// <param name="data">The data being pushed from the previous node</param> public void AcceptIncomingData(StreamlineCore core, DataPacket data) { // Throw if illegal if (!IsOutput) { throw new System.Exception("An input cannot accept data from other program nodes."); } // Don't accept anything if not enabled if (!Enabled) { data.Clear(); return; } // Check if the data can be written directly if (Converter == null && MediaConnection.CanWriteDirect) { // Send the data directly MediaConnection.WriteDirect(data); } else { // Encode the data var encodedData = Converter.EncodeData(data); // Pass it on to be output MediaConnection.Write(encodedData, 0, encodedData.Length); } }