コード例 #1
0
ファイル: AviManager.cs プロジェクト: zesus19/c4.v2.T
        /// <summary>Add an empty video stream to the file</summary>
        /// <remarks>Compresses the stream without showing the codecs dialog</remarks>
        /// <param name="compressOptions">Compression options</param>
        /// <param name="frameRate">Frames per second</param>
        /// <param name="firstFrame">Image to write into the stream as the first frame</param>
        /// <returns>VideoStream object for the new stream</returns>
        public VideoStream AddVideoStream(Avi.AVICOMPRESSOPTIONS compressOptions, double frameRate, Bitmap firstFrame)
        {
            VideoStream stream = new VideoStream(aviFile, compressOptions, frameRate, firstFrame);

            streams.Add(stream);
            return(stream);
        }
コード例 #2
0
ファイル: VideoStream.cs プロジェクト: zesus19/c4.v2.T
 /// <summary>Copy all properties from one VideoStream to another one</summary>
 /// <remarks>Used by EditableVideoStream</remarks>
 /// <param name="frameSize"></param><param name="frameRate"></param>
 /// <param name="width"></param><param name="height"></param>
 /// <param name="countBitsPerPixel"></param>
 /// <param name="countFrames"></param><param name="compressOptions"></param>
 internal VideoStream(int frameSize, double frameRate, int width, int height, Int16 countBitsPerPixel, int countFrames, Avi.AVICOMPRESSOPTIONS compressOptions, bool writeCompressed)
 {
     this.frameSize         = frameSize;
     this.frameRate         = frameRate;
     this.width             = width;
     this.height            = height;
     this.countBitsPerPixel = countBitsPerPixel;
     this.countFrames       = countFrames;
     this.compressOptions   = compressOptions;
     this.writeCompressed   = writeCompressed;
     this.firstFrame        = 0;
 }
コード例 #3
0
ファイル: VideoStream.cs プロジェクト: zesus19/c4.v2.T
        /// <summary>Create a compressed stream from an uncompressed stream</summary>
        private void CreateCompressedStream(Avi.AVICOMPRESSOPTIONS options)
        {
            int result = Avi.AVIMakeCompressedStream(out compressedStream, aviStream, ref options, 0);

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

            this.compressOptions = options;

            SetFormat(compressedStream, 0);
        }
コード例 #4
0
ファイル: VideoStream.cs プロジェクト: zesus19/c4.v2.T
        /// <summary>Create a compressed stream from an uncompressed stream</summary>
        private void CreateCompressedStream()
        {
            //display the compression options dialog...
            Avi.AVICOMPRESSOPTIONS_CLASS options = new Avi.AVICOMPRESSOPTIONS_CLASS();
            //options.fccType = (uint)Avi.streamtypeVIDEO;

            //options.lpParms = IntPtr.Zero;
            //options.lpFormat = IntPtr.Zero;
            //Avi.AVISaveOptions(IntPtr.Zero, Avi.ICMF_CHOOSE_KEYFRAME | Avi.ICMF_CHOOSE_DATARATE, 1, ref aviStream, ref options);

            //..or set static options
            Avi.AVICOMPRESSOPTIONS opts = new Avi.AVICOMPRESSOPTIONS();
            opts.fccType    = (UInt32)Avi.mmioStringToFOURCC("vids", 0);
            opts.fccHandler = (UInt32)Avi.mmioStringToFOURCC("XVID", 0);

            //opts.fccType = 0;
            //opts.fccHandler = 1684633208;

            opts.dwKeyFrameEvery   = 0;
            opts.dwQuality         = 0; // 0 .. 10000
            opts.dwFlags           = 8; // AVICOMRPESSF_KEYFRAMES = 4
            opts.dwBytesPerSecond  = 0;
            opts.lpFormat          = new IntPtr(0);
            opts.cbFormat          = 0;
            opts.lpParms           = Marshal.AllocHGlobal(sizeof(int));
            opts.cbParms           = 0;
            opts.dwInterleaveEvery = 0;

            //get the compressed stream
            //this.compressOptions = options.ToStruct();

            this.compressOptions = opts;
            int result = Avi.AVIMakeCompressedStream(out compressedStream, aviStream, ref compressOptions, 0);

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

            //Avi.AVISaveOptionsFree(1, ref options);
            SetFormat(compressedStream, 0);
        }
コード例 #5
0
ファイル: VideoStream.cs プロジェクト: zesus19/c4.v2.T
 /// <summary>Create a new stream</summary>
 private void CreateStream(Avi.AVICOMPRESSOPTIONS options)
 {
     CreateStreamWithoutFormat();
     CreateCompressedStream(options);
 }
コード例 #6
0
ファイル: VideoStream.cs プロジェクト: zesus19/c4.v2.T
 /// <summary>Initialize a new VideoStream and add the first frame</summary>
 /// <param name="aviFile">The file that contains the stream</param>
 /// <param name="writeCompressed">true: create a compressed stream before adding frames</param>
 /// <param name="frameRate">Frames per second</param>
 /// <param name="firstFrame">Image to write into the stream as the first frame</param>
 public VideoStream(int aviFile, Avi.AVICOMPRESSOPTIONS compressOptions, double frameRate, Bitmap firstFrame)
 {
     Initialize(aviFile, true, frameRate, firstFrame);
     CreateStream(compressOptions);
     AddFrame(firstFrame);
 }
コード例 #7
0
ファイル: VideoStream.cs プロジェクト: zesus19/c4.v2.T
        /// <summary>Create a compressed stream from an uncompressed stream</summary>
        private void CreateCompressedStream(Avi.AVICOMPRESSOPTIONS options) {
            int result = Avi.AVIMakeCompressedStream(out compressedStream, aviStream, ref options, 0);
            if (result != 0) {
                throw new Exception("Exception in AVIMakeCompressedStream: " + result.ToString());
            }

            this.compressOptions = options;

            SetFormat(compressedStream, 0);
        }
コード例 #8
0
ファイル: VideoStream.cs プロジェクト: zesus19/c4.v2.T
		/// <summary>Create a compressed stream from an uncompressed stream</summary>
		private void CreateCompressedStream(){
			//display the compression options dialog...
            Avi.AVICOMPRESSOPTIONS_CLASS options = new Avi.AVICOMPRESSOPTIONS_CLASS();
            //options.fccType = (uint)Avi.streamtypeVIDEO;

            //options.lpParms = IntPtr.Zero;
            //options.lpFormat = IntPtr.Zero;
            //Avi.AVISaveOptions(IntPtr.Zero, Avi.ICMF_CHOOSE_KEYFRAME | Avi.ICMF_CHOOSE_DATARATE, 1, ref aviStream, ref options);
			
            //..or set static options
            Avi.AVICOMPRESSOPTIONS opts = new Avi.AVICOMPRESSOPTIONS();
            opts.fccType = (UInt32)Avi.mmioStringToFOURCC("vids", 0);
            opts.fccHandler = (UInt32)Avi.mmioStringToFOURCC("XVID", 0);

            //opts.fccType = 0;
            //opts.fccHandler = 1684633208;

            opts.dwKeyFrameEvery = 0;
            opts.dwQuality = 0;  // 0 .. 10000
            opts.dwFlags = 8;  // AVICOMRPESSF_KEYFRAMES = 4
            opts.dwBytesPerSecond = 0;
            opts.lpFormat = new IntPtr(0);
            opts.cbFormat = 0;
            opts.lpParms = Marshal.AllocHGlobal(sizeof(int));
            opts.cbParms = 0;
            opts.dwInterleaveEvery = 0;

			//get the compressed stream
            //this.compressOptions = options.ToStruct();

            this.compressOptions = opts;
            int result = Avi.AVIMakeCompressedStream(out compressedStream, aviStream, ref compressOptions, 0);
            if(result != 0) {
				throw new Exception("Exception in AVIMakeCompressedStream: "+result.ToString());
			}

            //Avi.AVISaveOptionsFree(1, ref options);
            SetFormat(compressedStream, 0);
		}
コード例 #9
0
ファイル: VideoStream.cs プロジェクト: zesus19/c4.v2.T
        /// <summary>Copy all properties from one VideoStream to another one</summary>
        /// <remarks>Used by EditableVideoStream</remarks>
        /// <param name="frameSize"></param><param name="frameRate"></param>
        /// <param name="width"></param><param name="height"></param>
        /// <param name="countBitsPerPixel"></param>
        /// <param name="countFrames"></param><param name="compressOptions"></param>
        internal VideoStream(int frameSize, double frameRate, int width, int height, Int16 countBitsPerPixel, int countFrames, Avi.AVICOMPRESSOPTIONS compressOptions, bool writeCompressed) {
            this.frameSize = frameSize;
            this.frameRate = frameRate;
            this.width = width;
            this.height = height;
            this.countBitsPerPixel = countBitsPerPixel;
            this.countFrames = countFrames;
            this.compressOptions = compressOptions;
            this.writeCompressed = writeCompressed;
			this.firstFrame = 0;
        }