[chronojump] Webcam fix detection on windows parameters.Insert (i ++, "video=" + videoDevice);



commit 8722f3932be54d2af45a21bd2c29fe098b78e19b
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 8 15:55:23 2019 +0200

    Webcam fix detection on windows
                            parameters.Insert (i ++, "video=" + videoDevice);

 src/webcamFfmpegDevices.cs | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/webcamFfmpegDevices.cs b/src/webcamFfmpegDevices.cs
index 9d0288e2..dc0e9269 100644
--- a/src/webcamFfmpegDevices.cs
+++ b/src/webcamFfmpegDevices.cs
@@ -284,16 +284,21 @@ public class WebcamFfmpegGetDevicesWindows : WebcamFfmpegGetDevicesWinMac
 
        protected override void parseMatch(string l)
        {
+               int i=0;
+               string name = "";
+               //on windows, on each device, first line is the name and second line is the code
                foreach(Match match in Regex.Matches(l, "\"([^\"]*)\""))
                {
                        //remove quotes from the match (at beginning and end) to add it in SQL
                        string s = match.ToString().Substring(1, match.ToString().Length -2);
 
-                       LogB.Information("add match: " + s);
-                       if(s.Length < 3)
-                               break;
-
-                       wd_list.Add(new WebcamDevice(s[1].ToString(), s)); //code will be char 1: "[0] my 
device"
+                       if (i % 2 == 0) //even (par)
+                               name = s;
+                       else {
+                               LogB.Information(string.Format("add match: code: {0} ; name: {1}", s, name));
+                               wd_list.Add(new WebcamDevice(s, name));
+                       }
+                       i++;
                }
        }
 }


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