예제 #1
0
        public void ffmpegOutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
        {
            if (!String.IsNullOrEmpty(outLine.Data))
            {
                InfoFFmpegProgress ffmpegProgress = new InfoFFmpegProgress();

                bool parseSuccess = ffmpegProgress.parseFFmpegProgress(outLine.Data);

                if (parseSuccess)
                {
                    int progress = (int)((ffmpegProgress.Time.TimeOfDay.TotalMilliseconds / Math.Max(1, Duration.TimeOfDay.TotalMilliseconds)) * 100);

                    DialogProgress.updateDetailedProgressInvoke(this, progress, ffmpegProgress);

                    // Debug
                    //TextWriter writer = new StreamWriter("ffmpeg_output.txt", true, Encoding.UTF8);
                    //writer.WriteLine(outLine.Data);
                    //writer.WriteLine(String.Format("Progress: {0:00}", progress));
                    //writer.Close();
                }
            }
        }