예제 #1
0
        private void Init()
        {
            this.internalReadCallback   = this.ReadCallback;
            this.internalSeekCallback   = this.SeekCallback;
            this.internalTellCallback   = this.TellCallback;
            this.internalLengthCallback = this.LengthCallback;
            this.internalEofCallback    = this.EofCallback;
            this.internalWriteCallback  = this.WriteCallback;
            this.internalErrorCallback  = this.ErrorCallback;

            this.handle = FLAC__stream_decoder_new();
            if (this.handle == IntPtr.Zero)
            {
                throw new FlacException("Error creating decoder");
            }

            int initStreamResult = FLAC__stream_decoder_init_stream(this.handle, this.internalReadCallback, this.internalSeekCallback, this.internalTellCallback, this.internalLengthCallback, this.internalEofCallback, this.internalWriteCallback, null, this.internalErrorCallback, IntPtr.Zero);

            if (initStreamResult != 0)
            {
                FLAC__stream_decoder_delete(this.handle);
                throw new FlacException("Error initializing decoder");
            }

            FLAC__stream_decoder_set_md5_checking(this.handle, this.md5Checking);

            while (this.pcm == null)
            {
                if (!FLAC__stream_decoder_process_single(this.handle))
                {
                    FLAC__stream_decoder_delete(this.handle);
                    throw new FlacException("Error reading up to metadata");
                }
            }
        }
예제 #2
0
        private void Init()
        {
            this.internalReadCallback = this.ReadCallback;
            this.internalSeekCallback = this.SeekCallback;
            this.internalTellCallback = this.TellCallback;
            this.internalLengthCallback = this.LengthCallback;
            this.internalEofCallback = this.EofCallback;
            this.internalWriteCallback = this.WriteCallback;
            this.internalErrorCallback = this.ErrorCallback;

            this.handle = FLAC__stream_decoder_new();
            if (this.handle == IntPtr.Zero)
            {
                throw new FlacException("Error creating decoder");
            }

            int initStreamResult = FLAC__stream_decoder_init_stream(this.handle, this.internalReadCallback, this.internalSeekCallback, this.internalTellCallback, this.internalLengthCallback, this.internalEofCallback, this.internalWriteCallback, null, this.internalErrorCallback, IntPtr.Zero);
            if (initStreamResult != 0)
            {
                FLAC__stream_decoder_delete(this.handle);
                throw new FlacException("Error initializing decoder");
            }

            FLAC__stream_decoder_set_md5_checking(this.handle, this.md5Checking);

            while (this.pcm == null)
            {
                if (!FLAC__stream_decoder_process_single(this.handle))
                {
                    FLAC__stream_decoder_delete(this.handle);
                    throw new FlacException("Error reading up to metadata");
                }
            }
        }
예제 #3
0
 private static extern int FLAC__stream_decoder_init_stream(IntPtr decoder, FlacDecoderReadCallback readCallback, FlacDecoderSeekCallback seekCallback, FlacDecoderTellCallback tellCallback, FlacDecoderLengthCallback lengthCallback, FlacDecoderEofCallback eofCallback, FlacDecoderWriteCallback writeCallback, FlacDecoderMetadataCallback metadataCallback, FlacDecoderErrorCallback errorCallback, IntPtr clientData);
예제 #4
0
 private static extern int FLAC__stream_decoder_init_stream(IntPtr decoder, FlacDecoderReadCallback readCallback, FlacDecoderSeekCallback seekCallback, FlacDecoderTellCallback tellCallback, FlacDecoderLengthCallback lengthCallback, FlacDecoderEofCallback eofCallback, FlacDecoderWriteCallback writeCallback, FlacDecoderMetadataCallback metadataCallback, FlacDecoderErrorCallback errorCallback, IntPtr clientData);