コード例 #1
0
ファイル: Deflater.cs プロジェクト: unherd-uf/xamarin-macios
        private unsafe CompressionStatus ReadDeflateOutput(byte[] outputBuffer, StreamFlag flushCode, out int bytesRead)
        {
            if (outputBuffer?.Length < 0)
            {
                throw new ArgumentException("outputbuffer length must be bigger than 0");
            }
            lock (SyncLock)
            {
                fixed(byte *bufPtr = &outputBuffer[0])
                {
                    _compression_struct.Destination     = (IntPtr)bufPtr;
                    _compression_struct.DestinationSize = outputBuffer.Length;

                    var readStatus = CompressionStreamStruct.compression_stream_process(ref _compression_struct, flushCode);

                    switch (readStatus)
                    {
                    case CompressionStatus.Ok:
                    case CompressionStatus.End:
                        bytesRead = outputBuffer.Length - (int)_compression_struct.DestinationSize;
                        break;

                    default:
                        bytesRead = 0;
                        break;
                    }
                    _finished = readStatus == CompressionStatus.End;
                    return(readStatus);
                }
            }
        }
コード例 #2
0
 public UserSampleStream(uint freq, uint channels, StreamProc proc, StreamFlag flag, int getData_retryMax = 0)
     : base(getData_retryMax)
 {
     this.streamProc = (handle, buffer, length, user) => this.disposed ? 0x80000000 : this.proc(buffer, length);
     this.proc       = proc;
     this.handle     = _BASS_StreamCreate(freq, channels, (uint)flag, this.streamProc, (IntPtr)this.GetHashCode());
     if (this.handle == IntPtr.Zero)
     {
         throw new BASSException("UserSampleStream: BASS_StreamCreate Failed.");
     }
 }
コード例 #3
0
            public FileStream(String filename, StreamFlag flags = 0, ulong offset = 0, ulong length = 0, int getData_retryMax = 0)
                : base(getData_retryMax)
            {
                IntPtr ret = _BASS_StreamCreateFile(false, filename, offset, length, (BASS_UNICODE | (uint)flags));

                if (ret == IntPtr.Zero)
                {
                    throw (new BASSException("Could not create stream."));
                }
                handle = ret;
                _BASS_ChannelSetPosition(ret, 0, BASS_POS_BYTE);
            }
コード例 #4
0
 public static extern CompressionStatus compression_stream_process(ref CompressionStreamStruct stream, StreamFlag flags);
コード例 #5
0
 public FlvHeader(StreamFlag streamFlag)
 {
     HeaderBytes = new byte[] { (byte)'F', (byte)'L', (byte)'V', 0x01, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00 };
     StreamType  = streamFlag;
 }