Example #1
0
        /// <summary>Create sample reader and enqueue initial batch of NALUs, starting from SPS and PPS.</summary>
        /// <remarks>This enqueues all buffers in the queue.</remarks>
        public iVideoTrackReader enqueueInitial(iVideoTrack track)
        {
            iVideoTrackReader reader = track.createReader(this);

            // Enqueue moar NALUs from the video to saturate the encoded buffers
            while (true)
            {
                var b = nextEnqueue;
                if (null != b)
                {
                    var act = reader.writeNextNalu(b);
                    if (act == eNaluAction.EOF)
                    {
                        throw new EndOfStreamException("Too few samples in the video");
                    }
                    if (act == eNaluAction.Decode)
                    {
                        enqueue(b);
                    }
                }
                else
                {
                    return(reader);
                }
            }
        }
Example #2
0
        void dispatchInput()
        {
            Debug.Assert(encoded.anyKernelBuffer);
            var b = encoded.dequeue();

            while (true)
            {
                var act = reader.writeNextNalu(b);
                if (act == eNaluAction.EOF)
                {
                    return;
                }
                if (act == eNaluAction.Ignore)
                {
                    continue;
                }
                encoded.enqueue(b);
                return;
            }
        }