[chronojump] testing-stuff/ffmpegCapture plays at end. ensures open ffplay on window.



commit 6e3de40a602089931ac8187ad5c5dfde933453f9
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jan 9 19:46:07 2019 +0100

    testing-stuff/ffmpegCapture plays at end. ensures open ffplay on window.

 testing-stuff/ffmpegCapture/executeProcess.cs |   7 ++--
 testing-stuff/ffmpegCapture/ffmpegCapture.exe | Bin 18944 -> 19456 bytes
 testing-stuff/ffmpegCapture/main.cs           |  44 ++++++++++++++++++++++++--
 3 files changed, 46 insertions(+), 5 deletions(-)
---
diff --git a/testing-stuff/ffmpegCapture/executeProcess.cs b/testing-stuff/ffmpegCapture/executeProcess.cs
index 0738ab8e..fe0ffded 100644
--- a/testing-stuff/ffmpegCapture/executeProcess.cs
+++ b/testing-stuff/ffmpegCapture/executeProcess.cs
@@ -136,7 +136,8 @@ class ExecuteProcess
         * don't call WaitForExit(), kill it on Chronojump exit
         * returns false if there are problems calling it
         */
-       public static bool RunAtBackground(ref Process process, string file_name, List<string> parameters, 
bool redirectInput)
+       public static bool RunAtBackground(ref Process process, string file_name, List<string> parameters, 
bool createNoWindow, bool useShellExecute, bool redirectInput)
+       //public static bool RunAtBackground(ref Process process, string file_name, List<string> parameters, 
bool redirectInput)
        {
                ProcessStartInfo processStartInfo = new ProcessStartInfo();
 
@@ -153,8 +154,8 @@ class ExecuteProcess
                Console.WriteLine ("ExecuteProcess FileName: " + processStartInfo.FileName);
                Console.WriteLine ("ExecuteProcess Arguments: " + processStartInfo.Arguments);
 
-               processStartInfo.CreateNoWindow = true;
-               processStartInfo.UseShellExecute = false;
+               processStartInfo.CreateNoWindow = createNoWindow;
+               processStartInfo.UseShellExecute = useShellExecute;
                processStartInfo.RedirectStandardInput = redirectInput; //note UseShellExecute has to be 
false to be able to redirect
                processStartInfo.RedirectStandardError = true;
                processStartInfo.RedirectStandardOutput = true;
diff --git a/testing-stuff/ffmpegCapture/ffmpegCapture.exe b/testing-stuff/ffmpegCapture/ffmpegCapture.exe
index e348c3bc..73bdcdd6 100755
Binary files a/testing-stuff/ffmpegCapture/ffmpegCapture.exe and 
b/testing-stuff/ffmpegCapture/ffmpegCapture.exe differ
diff --git a/testing-stuff/ffmpegCapture/main.cs b/testing-stuff/ffmpegCapture/main.cs
index 1ef19ac4..44f4eef6 100644
--- a/testing-stuff/ffmpegCapture/main.cs
+++ b/testing-stuff/ffmpegCapture/main.cs
@@ -120,7 +120,8 @@ class FfmpegCapture
                process = new Process();
                List<string> parameters = createParametersOnlyCapture();
                //List<string> parameters = createParametersCaptureAndDelayedView();
-               bool success = ExecuteProcess.RunAtBackground (ref process, captureExecutable, parameters, 
true); //redirectInput
+               bool success = ExecuteProcess.RunAtBackground (ref process, captureExecutable, parameters,
+                               true, false, true); //createNoWindow, useShellExecute, redirectInput
                if(! success)
                {
                        streamWriter = null;
@@ -140,12 +141,42 @@ class FfmpegCapture
                        Console.WriteLine(countA.ToString());
                }
        
-               ExitAndFinish (0, Constants.TestTypes.RUN, 1);
+               int sessionID = 0;
+               Constants.TestTypes testType = Constants.TestTypes.RUN;
+               int testID = 1;
+               ExitAndFinish (sessionID, testType, testID);
 
+               Console.WriteLine("Recorded, copied, and deleted ok. Now we are going to play it");
+
+               PlayFile(Util.GetVideoFileName(sessionID, testType, testID));
 
                //return new Result (true, "");
        }
 
+       public Result PlayFile (string filename)
+        {
+               string executable = "ffplay";
+               if(os == UtilAll.OperatingSystems.WINDOWS)
+                       executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffplay.exe");
+
+                if(process != null || filename == "")
+                        return new Result (false, "");
+
+                List<string> parameters = createParametersPlayFile (filename);
+
+                process = new Process();
+                bool success = ExecuteProcess.RunAtBackground (ref process, executable, parameters, false, 
false, false);
+                if(! success)
+                {
+                        process = null;
+                        return new Result (false, "", programFfmpegNotInstalled);
+                }
+
+                Running = true;
+                return new Result (true, "");
+        }
+
+
        //TODO: on Windows or old machines adjust rtbufsize parameter, on our tests we have problems with 
default 3041280
        private List<string> createParametersOnlyCapture()
        {
@@ -220,6 +251,15 @@ class FfmpegCapture
                return parameters;
        }
 
+       private List<string> createParametersPlayFile(string filename)
+       {
+               // ffplay out.mp4
+               List<string> parameters = new List<string>();
+               parameters.Insert (0, filename);
+               return parameters;
+       }
+
+
        /*
         * there are problems calling the process with the "|"
         * better call a shell script like this:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]