コード例 #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);
        }