/// <summary>Create a new AVI Player</summary> /// <param name="videoStream">Video stream to play</param> /// <param name="picDisplay">PictureBox to display the video</param> /// <param name="ctlFrameIndexFeedback">Optional Label to show the current frame index</param> public AviPlayer(VideoStream videoStream, PictureBox picDisplay, Control ctlFrameIndexFeedback) { this.videoStream = videoStream; this.picDisplay = picDisplay; this.ctlFrameIndexFeedback = ctlFrameIndexFeedback; this.isRunning = false; }
/// <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); }
/// <summary>Copy all frames into a new file</summary> /// <param name="fileName">Name of the new file</param> /// <param name="recompress">true: Compress the new stream</param> /// <returns>AviManager for the new file</returns> /// <remarks>Use this method if you want to append frames to an existing, compressed stream</remarks> public AviManager DecompressToNewFile(String fileName, bool recompress, out VideoStream newStream2) { AviManager newFile = new AviManager(fileName, false); this.GetFrameOpen(); Bitmap frame = GetBitmap(0); VideoStream newStream = newFile.AddVideoStream(recompress, frameRate, frame); frame.Dispose(); for(int n=1; n<countFrames; n++){ frame = GetBitmap(n); newStream.AddFrame(frame); frame.Dispose(); } this.GetFrameClose(); newStream2 = newStream; return newFile; }
/// <summary>Paste a number of frames from another video stream into this stream</summary> /// <param name="sourceStream">Stream to copy from</param> /// <param name="copyPosition">Index of the first frame to copy</param> /// <param name="pastePosition">Where to paste the copied frames</param> /// <param name="length">Count of frames to paste</param> public void Paste(VideoStream sourceStream, int copyPosition, int pastePosition, int length) { Paste(sourceStream.StreamPointer, copyPosition, pastePosition, length); }