public OggVorbisEncodedStream(byte[] buffer)
        {
            //this.buffer = buffer;
            rawStream = new MemoryStream(buffer);

            //Open
            file = new NativeOggVorbisFile();

            NativeCallbacks callbacks = new NativeCallbacks();

            callbacks.ReadFunction = new ReadFunctionDelegate(this.RawStreamRead);
            callbacks.TellFunction = new TellFunctionDelegate(this.RawStreamTell);
            callbacks.SeekFunction = new SeekFunctionDelegate(this.RawStreamSeek);

            int result = 0;

            if ((result = OggVorbisFile.NativeOpenCallbacks(buffer, file, IntPtr.Zero, 0, callbacks)) != 0)
            {
                throw new OggVorbisException(String.Format("Error {0} during open", result));
            }

            //Get info
            info = new VorbisInfo(OggVorbisFile.NativeGetInfo(file, -1));

            //Get lengths of the stream
            pcmLength = OggVorbisFile.NativeGetLength(file, -1);    // -1 to entire bitstream
            rawLength = OggVorbisFile.NativeGetRawLength(file, -1); // -1 to entire bitstream
            duration  = OggVorbisFile.NativeGetDuration(file, -1);  // -1 to entire bitstream

            //Update info
            info.Duration = duration;
        }
        public OggVorbisFileStream(string filename)
        {
            //Open File
            file = new NativeOggVorbisFile();

            //if (ov_open(stream.SafeFileHandle, ref vf, IntPtr.Zero,0) == 0)
            // fopen for Win32!
            if (OggVorbisFile.NativeFOpen(filename, file) != 0)
            {
                throw new OggVorbisException("Error during fopen");
            }

            //Get info
            info = new VorbisInfo(OggVorbisFile.NativeGetInfo(file, -1));

            //Get lengths of the stream
            pcmLength = OggVorbisFile.NativeGetLength(file, -1); // -1 to entire bitstream
            rawLength = OggVorbisFile.NativeGetRawLength(file, -1); // -1 to entire bitstream
            duration = OggVorbisFile.NativeGetDuration(file, -1); // -1 to entire bitstream

            //Update info
            info.Duration = duration;
        }
        public OggVorbisFileStream(string filename)
        {
            //Open File
            file = new NativeOggVorbisFile();

            //if (ov_open(stream.SafeFileHandle, ref vf, IntPtr.Zero,0) == 0)
            // fopen for Win32!
            if (OggVorbisFile.NativeFOpen(filename, file) != 0)
            {
                throw new OggVorbisException("Error during fopen");
            }

            //Get info
            info = new VorbisInfo(OggVorbisFile.NativeGetInfo(file, -1));

            //Get lengths of the stream
            pcmLength = OggVorbisFile.NativeGetLength(file, -1);    // -1 to entire bitstream
            rawLength = OggVorbisFile.NativeGetRawLength(file, -1); // -1 to entire bitstream
            duration  = OggVorbisFile.NativeGetDuration(file, -1);  // -1 to entire bitstream

            //Update info
            info.Duration = duration;
        }
예제 #4
0
 internal static extern double NativeGetDuration([In, Out] NativeOggVorbisFile vf, int i);
예제 #5
0
 internal static extern double NativeGetTime([In, Out] NativeOggVorbisFile vf);
예제 #6
0
 internal static extern long NativeGetPosition([In, Out] NativeOggVorbisFile vf);
예제 #7
0
 internal static extern int NativeSeekTime([In, Out] NativeOggVorbisFile vf, double pos);
예제 #8
0
 internal static extern int NativeSeek([In, Out] NativeOggVorbisFile vf, long pos);
예제 #9
0
 internal static extern long NativeGetRawLength([In, Out] NativeOggVorbisFile vf, int i);
예제 #10
0
 internal static extern int NativeFOpen([In] string path, [In, Out] NativeOggVorbisFile vf);
예제 #11
0
 internal static extern int NativeOpenCallbacks(byte[] datasource, [In, Out] NativeOggVorbisFile vf, IntPtr initial, int ibytes, NativeCallbacks callbacks);
예제 #12
0
 internal static extern int NativeIsSeekable([In, Out] NativeOggVorbisFile vf);
예제 #13
0
 internal static extern int NativeClear([In, Out] NativeOggVorbisFile vf);
        public OggVorbisEncodedStream(byte[] buffer)
        {
            //this.buffer = buffer;
            rawStream = new MemoryStream(buffer);

            //Open
            file = new NativeOggVorbisFile();

            NativeCallbacks callbacks = new NativeCallbacks();
            callbacks.ReadFunction = new ReadFunctionDelegate(this.RawStreamRead);
            callbacks.TellFunction = new TellFunctionDelegate(this.RawStreamTell);
            callbacks.SeekFunction = new SeekFunctionDelegate(this.RawStreamSeek);

            int result = 0;
            if ((result = OggVorbisFile.NativeOpenCallbacks(buffer, file, IntPtr.Zero, 0, callbacks)) != 0)
            {
                throw new OggVorbisException(String.Format("Error {0} during open",result));
            }

            //Get info
            info = new VorbisInfo(OggVorbisFile.NativeGetInfo(file, -1));

            //Get lengths of the stream
            pcmLength = OggVorbisFile.NativeGetLength(file, -1); // -1 to entire bitstream
            rawLength = OggVorbisFile.NativeGetRawLength(file, -1); // -1 to entire bitstream
            duration = OggVorbisFile.NativeGetDuration(file, -1); // -1 to entire bitstream

            //Update info
            info.Duration = duration;
        }
예제 #15
0
 internal static extern long NativeCrosslap([In, Out] NativeOggVorbisFile old_vf, [In, Out] NativeOggVorbisFile new_vf);
예제 #16
0
 internal static unsafe extern int NativeRead([In, Out] NativeOggVorbisFile vf, byte *buffer, int length, int bigendianp, int word, int sgned, IntPtr bitstream);
예제 #17
0
 internal static extern IntPtr NativeGetComment([In, Out] NativeOggVorbisFile vf, int link);