Пример #1
0
        private void DoSave(String _FilePath, Metadata _Metadata, double _fPlaybackFrameInterval, Int64 _iSelStart, Int64 _iSelEnd, bool _bFlushDrawings, bool _bKeyframesOnly, bool _bPausedVideo, DelegateGetOutputBitmap _DelegateOutputBitmap)
        {
            // Save video.
            // We use a bgWorker and a Progress Bar.

            // Memorize the parameters, they will be used later in bgWorkerSave_DoWork.
            // Note: _iSelStart, _iSelEnd, _Metadata, should ultimately be taken from the local members.
            m_iSaveStart               = _iSelStart;
            m_iSaveEnd                 = _iSelEnd;
            m_SaveMetadata             = _Metadata;
            m_SaveFile                 = _FilePath;
            m_fSaveFramesInterval      = _fPlaybackFrameInterval;
            m_bSaveFlushDrawings       = _bFlushDrawings;
            m_bSaveKeyframesOnly       = _bKeyframesOnly;
            m_bSavePausedVideo         = _bPausedVideo;
            m_SaveDelegateOutputBitmap = _DelegateOutputBitmap;

            // Instanciate and configure the bgWorker.
            BackgroundWorker bgWorkerSave = new BackgroundWorker();

            bgWorkerSave.WorkerReportsProgress      = true;
            bgWorkerSave.WorkerSupportsCancellation = true;
            bgWorkerSave.DoWork             += new DoWorkEventHandler(bgWorkerSave_DoWork);
            bgWorkerSave.ProgressChanged    += new ProgressChangedEventHandler(bgWorkerSave_ProgressChanged);
            bgWorkerSave.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorkerSave_RunWorkerCompleted);

            // Attach the bgWorker to the VideoFile object so it can report progress.
            m_VideoFile.BgWorker = bgWorkerSave;

            // Create the progress bar and launch the worker.
            m_FormProgressBar        = new formProgressBar(true);
            m_FormProgressBar.Cancel = Cancel_Asked;
            bgWorkerSave.RunWorkerAsync();
            m_FormProgressBar.ShowDialog();
        }
Пример #2
0
        public void SaveDiaporama(Int64 _iSelStart, Int64 _iSelEnd, DelegateGetOutputBitmap _DelegateOutputBitmap, bool _diapo)
        {
            // Let the user configure the diaporama export.

            formDiapoExport fde = new formDiapoExport(_diapo);

            if (fde.ShowDialog() == DialogResult.OK)
            {
                DoSave(fde.Filename,
                       null,
                       fde.FrameInterval,
                       _iSelStart,
                       _iSelEnd,
                       true,
                       fde.PausedVideo ? false : true,
                       fde.PausedVideo,
                       _DelegateOutputBitmap);
            }

            // Release configuration form.
            fde.Dispose();
        }
Пример #3
0
        public void Save(double _fPlaybackFrameInterval, double _fSlowmotionPercentage, Int64 _iSelStart, Int64 _iSelEnd, DelegateGetOutputBitmap _DelegateOutputBitmap)
        {
            // Let the user select what he wants to save exactly.
            // Note: _iSelStart, _iSelEnd, _Metadata, should ultimately be taken from local members.

            formVideoExport fve = new formVideoExport(m_VideoFile.FilePath, m_Metadata, _fSlowmotionPercentage);

            if (fve.Spawn() == DialogResult.OK)
            {
                if (fve.SaveAnalysis)
                {
                    // Save analysis.
                    m_Metadata.ToXmlFile(fve.Filename);
                }
                else
                {
                    DoSave(fve.Filename,
                           fve.MuxDrawings ? m_Metadata : null,
                           fve.UseSlowMotion ? _fPlaybackFrameInterval : m_VideoFile.Infos.fFrameInterval,
                           _iSelStart,
                           _iSelEnd,
                           fve.BlendDrawings,
                           false,
                           false,
                           _DelegateOutputBitmap);
                }
            }

            // Release configuration form.
            fve.Dispose();
        }