示例#1
0
        /// <summary>Initialize a VideoStream for an existing stream</summary>
        /// <param name="aviFile">The file that contains the stream</param>
        /// <param name="aviStream">An IAVISTREAM from [aviFile]</param>
        public VideoStream(int aviFile, IntPtr aviStream)
        {
            this.aviFile   = aviFile;
            this.aviStream = aviStream;

            Avi.BITMAPINFOHEADER bih = new Avi.BITMAPINFOHEADER();
            int size = Marshal.SizeOf(bih);

            Avi.AVIStreamReadFormat(aviStream, 0, ref bih, ref size);
            Avi.AVISTREAMINFO streamInfo = GetStreamInfo(aviStream);

            FrameRate         = (float)streamInfo.dwRate / (float)streamInfo.dwScale;
            Width             = (int)streamInfo.rcFrame.right;
            Height            = (int)streamInfo.rcFrame.bottom;
            FrameSize         = bih.biSizeImage;
            CountBitsPerPixel = bih.biBitCount;
            FirstFrame        = Avi.AVIStreamStart(aviStream.ToInt32());
            CountFrames       = Avi.AVIStreamLength(aviStream.ToInt32());
        }