コード例 #1
0
ファイル: FFmpegPlugin.cs プロジェクト: JGTM2016/bdhero
        public void Mux(CancellationToken cancellationToken, Job job)
        {
            if (cancellationToken.IsCancellationRequested)
                return;

            const string startStatus = "Starting FFmpeg process...";

            Host.ReportProgress(this, 0.0, startStatus);
            Logger.Info(startStatus);

            _exception = null;

            var ffmpeg = new FFmpeg(job, job.SelectedPlaylist, job.OutputPath, _jobObjectManager, _tempFileRegistrar);
            ffmpeg.ProgressUpdated += state => OnProgressUpdated(ffmpeg, state, cancellationToken);
            ffmpeg.Exited += FFmpegOnExited;
            ffmpeg.StartAsync();
            cancellationToken.Register(ffmpeg.Kill, true);
            WaitForThreadToExit();

            if (_exception == null) return;

            if (_exception is OperationCanceledException)
                throw new OperationCanceledException("FFmpeg was canceled", _exception);
            throw new Exception("Error occurred while muxing with FFmpeg", _exception);
        }
コード例 #2
0
ファイル: FFmpegPlugin.cs プロジェクト: JGTM2016/bdhero
        private void OnProgressUpdated(FFmpeg ffmpeg, ProgressState progressState, CancellationToken cancellationToken)
        {
            var status = string.Format("Muxing to MKV with FFmpeg: {0} - {1} @ {2} fps",
                TimeSpan.FromMilliseconds(ffmpeg.CurOutTimeMs).ToStringMedium(),
                FileUtils.HumanFriendlyFileSize(ffmpeg.CurSize),
                ffmpeg.CurFps.ToString("0.0"));

            Host.ReportProgress(this, progressState.PercentComplete, status);

            if (cancellationToken.IsCancellationRequested)
                ffmpeg.Kill();
        }
コード例 #3
0
        void MakeFFMpegVersion(object jobObjectManager)
        {
            string version = FFmpeg.ExeVersion(jobObjectManager as IJobObjectManager);

            lblFFMpegVer.Invoke((MethodInvoker) delegate { lblFFMpegVer.Text = version; });
        }