Exemple #1
0
        private void writeStreamInfo(object sender, anyEncoder.DataReceivedEventArgs e)
        {
            string text = e.Text;

            this.logbox.AppendText(text + Environment.NewLine);
            if (text.IndexOf("Performing cleanups") > -1)
            {
            }
        }
Exemple #2
0
        private void writeStreamInfo(object sender, anyEncoder.DataReceivedEventArgs e)
        {
            string text = e.Text;
            int    @int = 0;

            switch (this.runtype)
            {
            case "ffmpeg":
                if (text.IndexOf("time") > -1)
                {
                    @int = func.GetInt(Regex.Replace(text, @"[\s\S]*time=([^\s]*)\.[\s\S]*", "$1"));
                }
                if (text.IndexOf("kb/s:") > -1)
                {
                    @int = 0xf423f;
                }
                this.AppendLog(text);
                this.statini.WriteString("encoder", "speed", text);

                this.statini.WriteInteger("encoder", "entime", @int);
                break;

            case "mencoder":
                if (text.IndexOf("Pos") > -1)
                {
                    @int = func.GetInt(Regex.Replace(text, @"[\s\S]*Pos:  ([^\s]*)\.[\s\S]*", "$1"));
                }
                if (text.IndexOf("Writing index") > -1)
                {
                    @int = 0xf423f;
                }
                this.statini.WriteInteger("encoder", "entime", @int);
                break;
            }
            ProcessCaller caller = (ProcessCaller)sender;

            if (!caller.HasExited)
            {
                TimeSpan span = (TimeSpan)(DateTime.Now - caller.StartTime);
                this.statini.WriteInteger("encoder", "pruntime", (int)span.TotalSeconds);
                try
                {
                    this.statini.WriteInteger("encoder", "cpu", (int)(((caller.TotalProcessorTime.TotalMilliseconds / span.TotalMilliseconds) / ((double)this.cpuCount)) * 100.0));
                }
                catch
                {
                }
            }
        }