public static Avi.AVICOMPRESSOPTIONS_CLASS ShowCodecsDialog()
        {
            Int32 streamtypeVIDEO = mmioFOURCC('v', 'i', 'd', 's');

            AVIFileInit();

            int file = 0;

            AVIFileOpen(ref file, "clock.avi", 0, 0);

            IntPtr stream = IntPtr.Zero;

            AVIFileGetStream(file, out stream, streamtypeVIDEO, 0);

            Avi.AVICOMPRESSOPTIONS_CLASS options = new Avi.AVICOMPRESSOPTIONS_CLASS();
            options.fccType  = streamtypeVIDEOU;
            options.lpParms  = IntPtr.Zero;
            options.lpFormat = IntPtr.Zero;

            AVISaveOptions(IntPtr.Zero, ICMF_CHOOSE_KEYFRAME, 1, ref stream, ref options);

            AVISaveOptionsFree(1, ref options);
            AVIFileRelease(file);
            AVIFileExit();

//			Avi.AVICOMPRESSOPTIONS_CLASS myOpts;
//			myOpts.cbFormat = options.cbFormat;

            return(options);
        }
        /// <summary>Copy the stream into a new file</summary>
        /// <param name="fileName">Name of the new file</param>
        public override void ExportStream(String fileName)
        {
            Avi.AVICOMPRESSOPTIONS_CLASS opts = new Avi.AVICOMPRESSOPTIONS_CLASS();
            opts.fccType  = (uint)Avi.streamtypeVIDEO;
            opts.lpParms  = IntPtr.Zero;
            opts.lpFormat = IntPtr.Zero;
            IntPtr streamPointer = StreamPointer;

            Avi.AVISaveOptions(IntPtr.Zero, Avi.ICMF_CHOOSE_KEYFRAME | Avi.ICMF_CHOOSE_DATARATE, 1, ref streamPointer, ref opts);
            Avi.AVISaveOptionsFree(1, ref opts);

            Avi.AVISaveV(fileName, 0, 0, 1, ref aviStream, ref opts);
        }
        public static void MakeFileFromStream(String fileName, AviStream stream)
        {
            IntPtr newFile = IntPtr.Zero;
            IntPtr streamPointer = stream.StreamPointer;

            Avi.AVICOMPRESSOPTIONS_CLASS opts = new Avi.AVICOMPRESSOPTIONS_CLASS();
            opts.fccType = (uint)Avi.streamtypeVIDEO;
            opts.lpParms = IntPtr.Zero;
            opts.lpFormat = IntPtr.Zero;
            Avi.AVISaveOptions(IntPtr.Zero, Avi.ICMF_CHOOSE_KEYFRAME | Avi.ICMF_CHOOSE_DATARATE, 1, ref streamPointer, ref opts);
            Avi.AVISaveOptionsFree(1, ref opts);

            Avi.AVISaveV(fileName, 0, 0, 1, ref streamPointer, ref opts);
        }
        public static void MakeFileFromStream(String fileName, AviStream stream)
        {
            IntPtr newFile       = IntPtr.Zero;
            IntPtr streamPointer = stream.StreamPointer;

            Avi.AVICOMPRESSOPTIONS_CLASS opts = new Avi.AVICOMPRESSOPTIONS_CLASS();
            opts.fccType  = (uint)Avi.streamtypeVIDEO;
            opts.lpParms  = IntPtr.Zero;
            opts.lpFormat = IntPtr.Zero;
            Avi.AVISaveOptions(IntPtr.Zero, Avi.ICMF_CHOOSE_KEYFRAME | Avi.ICMF_CHOOSE_DATARATE, 1, ref streamPointer, ref opts);
            Avi.AVISaveOptionsFree(1, ref opts);

            Avi.AVISaveV(fileName, 0, 0, 1, ref streamPointer, ref opts);
        }
Exemple #5
0
        /// <summary>Copy the stream into a new file</summary>
        /// <param name="fileName">Name of the new file</param>
        public override void ExportStream(String fileName)
        {
            Avi.AVICOMPRESSOPTIONS_CLASS opts = new Avi.AVICOMPRESSOPTIONS_CLASS();
            opts.fccType           = (UInt32)Avi.mmioStringToFOURCC("auds", 0);
            opts.fccHandler        = (UInt32)Avi.mmioStringToFOURCC("CAUD", 0);
            opts.dwKeyFrameEvery   = 0;
            opts.dwQuality         = 0;
            opts.dwFlags           = 0;
            opts.dwBytesPerSecond  = 0;
            opts.lpFormat          = new IntPtr(0);
            opts.cbFormat          = 0;
            opts.lpParms           = new IntPtr(0);
            opts.cbParms           = 0;
            opts.dwInterleaveEvery = 0;

            Avi.AVISaveV(fileName, 0, 0, 1, ref aviStream, ref opts);
        }
        /// <summary>Copy the stream into a new file</summary>
        /// <param name="fileName">Name of the new file</param>
        public override void ExportStream(String fileName)
        {
            Avi.AVICOMPRESSOPTIONS_CLASS opts = new Avi.AVICOMPRESSOPTIONS_CLASS();
            opts.fccType         = (UInt32)Avi.mmioStringToFOURCC("auds", 0);
            opts.fccHandler      = (UInt32)Avi.mmioStringToFOURCC("CAUD", 0);
            opts.dwKeyFrameEvery = 0;
            opts.dwQuality       = 0;
            opts.dwFlags         = 0;
            opts.dwBytesPerSecond= 0;
            opts.lpFormat        = new IntPtr(0);
            opts.cbFormat        = 0;
            opts.lpParms         = new IntPtr(0);
            opts.cbParms         = 0;
            opts.dwInterleaveEvery = 0;

            Avi.AVISaveV(fileName, 0, 0, 1, ref aviStream, ref opts);
        }
        /// <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);
            Avi.AVISaveOptionsFree(1, ref options);

            //..or set static options

            /*Avi.AVICOMPRESSOPTIONS opts = new Avi.AVICOMPRESSOPTIONS();
             * opts.fccType         = (UInt32)Avi.mmioStringToFOURCC("vids", 0);
             * opts.fccHandler      = (UInt32)Avi.mmioStringToFOURCC("CVID", 0);
             * opts.dwKeyFrameEvery = 0;
             * opts.dwQuality       = 0;  // 0 .. 10000
             * opts.dwFlags         = 0;  // AVICOMRPESSF_KEYFRAMES = 4
             * opts.dwBytesPerSecond= 0;
             * opts.lpFormat        = new IntPtr(0);
             * opts.cbFormat        = 0;
             * opts.lpParms         = new IntPtr(0);
             * opts.cbParms         = 0;
             * opts.dwInterleaveEvery = 0;*/

            //get the compressed stream
            this.compressOptions = options.ToStruct();
            int result = Avi.AVIMakeCompressedStream(out compressedStream, aviStream, ref compressOptions, 0);

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

            SetFormat(compressedStream);
        }
        /// <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);
            Avi.AVISaveOptionsFree(1, ref options);

            //..or set static options
            /*Avi.AVICOMPRESSOPTIONS opts = new Avi.AVICOMPRESSOPTIONS();
            opts.fccType         = (UInt32)Avi.mmioStringToFOURCC("vids", 0);
            opts.fccHandler      = (UInt32)Avi.mmioStringToFOURCC("CVID", 0);
            opts.dwKeyFrameEvery = 0;
            opts.dwQuality       = 0;  // 0 .. 10000
            opts.dwFlags         = 0;  // AVICOMRPESSF_KEYFRAMES = 4
            opts.dwBytesPerSecond= 0;
            opts.lpFormat        = new IntPtr(0);
            opts.cbFormat        = 0;
            opts.lpParms         = new IntPtr(0);
            opts.cbParms         = 0;
            opts.dwInterleaveEvery = 0;*/

            //get the compressed stream
            this.compressOptions = options.ToStruct();
            int result = Avi.AVIMakeCompressedStream(out compressedStream, aviStream, ref compressOptions, 0);
            if(result != 0) {
                throw new Exception("Exception in AVIMakeCompressedStream: "+result.ToString());
            }

            SetFormat(compressedStream);
        }
        /// <summary>Copy the stream into a new file</summary>
        /// <param name="fileName">Name of the new file</param>
        public override void ExportStream(String fileName)
        {
            Avi.AVICOMPRESSOPTIONS_CLASS opts = new Avi.AVICOMPRESSOPTIONS_CLASS();
            opts.fccType = (uint)Avi.streamtypeVIDEO;
            opts.lpParms = IntPtr.Zero;
            opts.lpFormat = IntPtr.Zero;
            IntPtr streamPointer = StreamPointer;
            Avi.AVISaveOptions(IntPtr.Zero, Avi.ICMF_CHOOSE_KEYFRAME | Avi.ICMF_CHOOSE_DATARATE, 1, ref streamPointer, ref opts);
            Avi.AVISaveOptionsFree(1, ref opts);

            Avi.AVISaveV(fileName, 0, 0, 1, ref aviStream, ref opts);
        }
        public static Avi.AVICOMPRESSOPTIONS_CLASS ShowCodecsDialog()
        {
            Int32 streamtypeVIDEO = mmioFOURCC('v', 'i', 'd', 's');
            AVIFileInit();

            int file = 0;
            AVIFileOpen(ref file, "clock.avi", 0, 0);

            IntPtr stream = IntPtr.Zero;
            AVIFileGetStream(file, out stream, streamtypeVIDEO, 0);

            Avi.AVICOMPRESSOPTIONS_CLASS options = new Avi.AVICOMPRESSOPTIONS_CLASS();
            options.fccType = streamtypeVIDEOU;
            options.lpParms = IntPtr.Zero;
            options.lpFormat = IntPtr.Zero;

            AVISaveOptions(IntPtr.Zero, ICMF_CHOOSE_KEYFRAME, 1, ref stream, ref options);

            AVISaveOptionsFree(1, ref options);
            AVIFileRelease(file);
            AVIFileExit();

            //			Avi.AVICOMPRESSOPTIONS_CLASS myOpts;
            //			myOpts.cbFormat = options.cbFormat;

            return options;
        }