AnimatGuiCtrls.Video.Avi.AVIStreamRead C# (CSharp) Method

AVIStreamRead() private method

private AVIStreamRead ( IntPtr pavi, Int32 lStart, Int32 lSamples, IntPtr lpBuffer, Int32 cbBuffer, Int32 plBytes, Int32 plSamples ) : int
pavi System.IntPtr
lStart System.Int32
lSamples System.Int32
lpBuffer System.IntPtr
cbBuffer System.Int32
plBytes System.Int32
plSamples System.Int32
return int
        public static extern int AVIStreamRead(
            IntPtr pavi,
            Int32 lStart,
            Int32 lSamples,
            IntPtr lpBuffer,
            Int32 cbBuffer,
            Int32  plBytes,
            Int32  plSamples
            );

Usage Example

示例#1
0
        /// <summary>Returns all data needed to copy the stream</summary>
        /// <remarks>Do not forget to call Marshal.FreeHGlobal and release the raw data pointer</remarks>
        /// <param name="streamInfo">Receives the header information</param>
        /// <param name="format">Receives the format</param>
        /// <param name="streamLength">Receives the length of the stream</param>
        /// <returns>Pointer to the wave data</returns>
        public IntPtr GetStreamData(ref Avi.AVISTREAMINFO streamInfo, ref Avi.PCMWAVEFORMAT format, ref int streamLength)
        {
            streamInfo = GetStreamInfo();

            format = GetFormat();
            //length in bytes = length in samples * length of a sample
            streamLength = Avi.AVIStreamLength(aviStream.ToInt32()) * streamInfo.dwSampleSize;
            IntPtr waveData = Marshal.AllocHGlobal(streamLength);

            int result = Avi.AVIStreamRead(aviStream, 0, streamLength, waveData, streamLength, 0, 0);

            if (result != 0)
            {
                throw new Exception("Exception in AVIStreamRead: " + result.ToString());
            }

            return(waveData);
        }