[chronojump] webcam get supported modes for Windows (done!)



commit 0f10047a2aed9027417379526a7603323f4b321c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon May 20 16:11:35 2019 +0200

    webcam get supported modes for Windows (done!)

 src/gui/preferences.cs | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index c029a2df..6f11084c 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -793,6 +793,7 @@ public class PreferencesWindow
 
                string modesStr = "";
 
+               //TODO: move all this to a class similar to WebcamDevices
                if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX)
                {
                        List<string> parameters = new List<string>();
@@ -806,10 +807,31 @@ public class PreferencesWindow
 
                        modesStr = execute_result.stdout;
                }
+               else if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.WINDOWS)
+               {
+                       string executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffmpeg.exe");
+                       //ffmpeg -f dshow -list_options true -i video="USB 2.0 WebCamera"
+                       List<string> parameters = new List<string>();
+                       parameters.Add("-f");
+                       parameters.Add("dshow");
+                       parameters.Add("-list_options");
+                       parameters.Add("true");
+                       parameters.Add("-i");
+                       parameters.Add("video=" + cameraCode);
+                       ExecuteProcess.Result execute_result = ExecuteProcess.run (executable, parameters, 
true, true);
+                       if(! execute_result.success) {
+                               new DialogMessage("Chronojump - Modes of this webcam",
+                                               Constants.MessageTypes.WARNING, "Need to install ffmpeg");
+                               return;
+                       }
+
+                       modesStr = execute_result.stdout;
+               }
                else if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX)
                {
+                       //select and impossible mode just to get an error on mac, this error will give us the 
"Supported modes"
                        Webcam webcamPlay = new WebcamFfmpeg (Webcam.Action.PLAYPREVIEW, UtilAll.GetOSEnum(),
-                                       cameraCode, "8000x8000", "8000"); //select and impossible mode just 
to get an error on mac, this error will give us the "Supported modes"
+                                       cameraCode, "8000x8000", "8000");
 
                        Webcam.Result result = webcamPlay.PlayPreviewNoBackgroundWantStdoutAndStderr();
                        modesStr = result.output;


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