Example #1
0
        public static void poll(ReadOnlySpan <pollfd> waitHandles, out eDecoderBits decoderBits, out eAudioBits audio, out bool seekRequest, out bool shutdownRequest)
        {
            LibC.poll(waitHandles);
            decoderBits = (eDecoderBits)waitHandles[0].revents;
            audio       = (eAudioBits)waitHandles[1].revents;
            ePollEvents seek     = waitHandles[2].revents;
            ePollEvents shutdown = waitHandles[3].revents;

            if (decoderBits.HasFlag(eDecoderBits.Error))
            {
                throw new ApplicationException("poll(3) returned error status for the decoder device, probably the decoder failed");
            }
            if (audio.HasFlag(eAudioBits.Error))
            {
                throw new ApplicationException("poll(3) returned error status for the audio queue");
            }
            if (seek.HasFlag(ePollEvents.POLLERR))
            {
                throw new ApplicationException("poll(3) returned error status for the seek event handle");
            }
            if (shutdown.HasFlag(ePollEvents.POLLERR))
            {
                throw new ApplicationException("poll(3) returned error status for the shutdown event handle");
            }

            seekRequest     = seek.HasFlag(ePollEvents.POLLIN);
            shutdownRequest = shutdown.HasFlag(ePollEvents.POLLIN);
        }
Example #2
0
 public static bool hasEncodedBits(this eDecoderBits bits)
 {
     return(0 != (bits & (eDecoderBits.Encoded1 | eDecoderBits.Encoded2)));
 }