コード例 #1
0
ファイル: AviFile.cs プロジェクト: thaolt/screenrecorder
        public int AddFrame(IntPtr buffer, int index, int nSamples, int length)
        {
            if (!this.opened)
            {
                throw new InvalidOperationException();
            }
            if (!this.video)
            {
                throw new InvalidOperationException();
            }
            if (buffer == IntPtr.Zero)
            {
                throw new ArgumentException("buffer");
            }
            int    nSamplesWrittern = 0;
            IntPtr stream;

            if (this.pAviCompressedStream != IntPtr.Zero)
            {
                // If compressor is set, use compressed stream
                stream = this.pAviCompressedStream;
            }
            else
            {
                stream = this.pVideoStream;
            }
            int hr = Avi32Interop.AVIStreamWrite(stream, index, nSamples, buffer, length, 0, ref nSamplesWrittern, 0);

            if (hr != 0)
            {
                throw new AviException("AVIStreamWrite", hr);
            }
            return(nSamplesWrittern);
        }
コード例 #2
0
ファイル: AviFile.cs プロジェクト: thaolt/screenrecorder
        private int AddSoundPrivate(int index, byte[] data, int nSamples)
        {
            int nSamplesWritten = 0;
            int hr = Avi32Interop.AVIStreamWrite(this.pAudioStream, index, nSamples, data, data.Length, 0,
                                                 ref nSamplesWritten, 0);

            if (hr != 0)
            {
                throw new AviException("AVIStreamWrite", hr);
            }
            return(nSamplesWritten);
        }