Esempio n. 1
0
        protected virtual int NativeConnectionCallback(MmalConnectionType *connection)
        {
            var queue      = new MmalQueueImpl(connection->Queue);
            var bufferImpl = queue.GetBuffer();

            if (bufferImpl.CheckState())
            {
                if (bufferImpl.Length > 0)
                {
                    CallbackHandler.InputCallback(bufferImpl);
                }

                InputPort.SendBuffer(bufferImpl);

                return((int)connection->Flags);
            }

            queue      = new MmalQueueImpl(connection->Pool->Queue);
            bufferImpl = queue.GetBuffer();

            if (!bufferImpl.CheckState())
            {
                MmalLog.Logger.LogInformation("Buffer could not be obtained by connection callback");
                return((int)connection->Flags);
            }

            if (bufferImpl.Length > 0)
            {
                CallbackHandler.OutputCallback(bufferImpl);
            }

            OutputPort.SendBuffer(bufferImpl);

            return((int)connection->Flags);
        }
Esempio n. 2
0
        MmalConnectionImpl(MmalConnectionType *ptr, IOutputPort output, IInputPort input, IDownstreamComponent inputComponent, IComponent outputComponent, bool useCallback)
        {
            Ptr                 = ptr;
            OutputPort          = output;
            InputPort           = input;
            DownstreamComponent = inputComponent;
            UpstreamComponent   = outputComponent;

            if (useCallback)
            {
                CallbackHandler = new DefaultConnectionCallbackHandler(this);
                ConfigureConnectionCallback(output, input);
            }

            Enable();

            if (useCallback)
            {
                OutputPort.SendAllBuffers(ConnectionPool);
            }
        }
Esempio n. 3
0
 public static extern unsafe MmalStatusEnum Disable(MmalConnectionType *connection);
Esempio n. 4
0
 public static extern unsafe MmalStatusEnum Destroy(MmalConnectionType *connection);