Exemplo n.º 1
0
        public void updateDetailedProgress(int progress, InfoFFmpegProgress ffmpegProgress)
        {
            this.progressBarDetailed.Value = Math.Min(100, progress);
            this.progressBarDetailed.Style = ProgressBarStyle.Marquee;

            if (progress > 0)
            {
                this.progressBarDetailed.Style = ProgressBarStyle.Blocks;
                DateTime timeRemaining = UtilsSubs.getDurationTime(ffmpegProgress.Time, duration);

                this.labelStatsTimeProcessed.Visible      = true;
                this.labelStatsTimeProcessedValue.Visible = true;
                this.labelStatsTimeRemaining.Visible      = true;
                this.labelStatsTimeRemainingValue.Visible = true;

                if (ffmpegProgress.VideoProgress)
                {
                    this.labelStatsFps.Visible        = true;
                    this.labelStatsFpsValue.Visible   = true;
                    this.labelStatsFrame.Visible      = true;
                    this.labelStatsFrameValue.Visible = true;
                }
                else
                {
                    this.labelStatsFps.Visible        = false;
                    this.labelStatsFpsValue.Visible   = false;
                    this.labelStatsFrame.Visible      = false;
                    this.labelStatsFrameValue.Visible = false;
                }

                this.labelStatsTimeProcessedValue.Text = string.Format("{0:00}:{1:00}:{2:00}",
                                                                       ffmpegProgress.Time.TimeOfDay.Hours,
                                                                       ffmpegProgress.Time.TimeOfDay.Minutes,
                                                                       ffmpegProgress.Time.TimeOfDay.Seconds);


                this.labelStatsTimeRemainingValue.Text = string.Format("{0:00}:{1:00}:{2:00}",
                                                                       timeRemaining.TimeOfDay.Hours,
                                                                       timeRemaining.TimeOfDay.Minutes,
                                                                       timeRemaining.TimeOfDay.Seconds);

                if (ffmpegProgress.VideoProgress)
                {
                    this.labelStatsFpsValue.Text   = string.Format("{0}", ffmpegProgress.FPS);
                    this.labelStatsFrameValue.Text = string.Format("{0}", ffmpegProgress.Frame);
                }
            }
        }
Exemplo n.º 2
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();
                }
            }
        }
Exemplo n.º 3
0
 public static void updateDetailedProgressInvoke(DialogProgress dialogProgress, int progress, InfoFFmpegProgress ffmpegProgress)
 {
     // Wait for thread to become avaiable
     if (dialogProgress.IsHandleCreated)
     {
         dialogProgress.Invoke((MethodInvoker) delegate()
         {
             dialogProgress.updateDetailedProgress(progress, ffmpegProgress);
         });
     }
 }