/// <summary> /// Enables processing on an input port. /// </summary> internal override void EnableInputPort() { if (!this.Enabled) { this.ManagedInputCallback = InputCallbackProvider.FindCallback(this); this.NativeCallback = new MMALPort.MMAL_PORT_BH_CB_T(this.NativeInputPortCallback); IntPtr ptrCallback = Marshal.GetFunctionPointerForDelegate(this.NativeCallback); MMALLog.Logger.Debug("Enabling input port."); if (this.ManagedInputCallback == null) { MMALLog.Logger.Warn("Callback null"); MMALCheck(MMALPort.mmal_port_enable(this.Ptr, IntPtr.Zero), "Unable to enable port."); } else { MMALCheck(MMALPort.mmal_port_enable(this.Ptr, ptrCallback), "Unable to enable port."); } this.InitialiseBufferPool(); } if (!this.Enabled) { throw new PiCameraError("Unknown error occurred whilst enabling port"); } }
/// <summary> /// If it exists, removes a <see cref="IInputCallbackHandler"/> on this component's input port. /// </summary> public void RemoveInputCallback() => InputCallbackProvider.RemoveCallback(this.Inputs[0]);
/// <summary> /// Registers a <see cref="IInputCallbackHandler"/>. /// </summary> /// <param name="handler">The input handler.</param> public void RegisterInputCallback(IInputCallbackHandler handler) => InputCallbackProvider.RegisterCallback(handler);