/// <summary>Open or create an AVI file</summary>
        /// <param name="fileName">Name of the AVI file</param>
        /// <param name="open">true: Open the file; false: Create or overwrite the file</param>
        public AviManager(String fileName, bool open)
        {
            Avi.AVIFileInit();
            int result;

            if (open)             //open existing file

            {
                result = Avi.AVIFileOpen(
                    ref aviFile, fileName,
                    Avi.OF_READWRITE, 0);
            }
            else               //create empty file

            {
                result = Avi.AVIFileOpen(
                    ref aviFile, fileName,
                    Avi.OF_WRITE | Avi.OF_CREATE, 0);
            }

            if (result != 0)
            {
                throw new Exception("Exception in AVIFileOpen: " + result.ToString());
            }
        }
        /// <summary>Create an editable stream from an uneditable stream</summary>
        /// <param name="stream">uneditable stream</param>
        public EditableVideoStream(VideoStream stream) : base(stream.FrameSize, stream.FrameRate, stream.Width, stream.Height, stream.CountBitsPerPixel, stream.CountFrames, stream.CompressOptions, stream.WriteCompressed)
        {
            Avi.AVIFileInit();
            int result = Avi.CreateEditableStream(ref editableStream, stream.StreamPointer);

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

            SetInfo(stream.StreamInfo);
        }