[chronojump] Webcam: Shown error message on Linux if no cameras found



commit 1e09e39cabbb17abfe1fe10b618d5c3c3f21e547
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Apr 21 20:38:03 2019 +0200

    Webcam: Shown error message on Linux if no cameras found

 src/webcamFfmpegDevices.cs | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/webcamFfmpegDevices.cs b/src/webcamFfmpegDevices.cs
index ad395b82..de73bfe0 100644
--- a/src/webcamFfmpegDevices.cs
+++ b/src/webcamFfmpegDevices.cs
@@ -143,7 +143,9 @@ public class WebcamFfmpegGetDevicesLinux : WebcamFfmpegGetDevices
                LogB.Information(string.Format("wd_list is null: ", wd_list == null));
                string prefix = "/dev/";
                var dir = new DirectoryInfo(prefix);
+               bool found = false;
                foreach(var file in dir.EnumerateFiles("video*"))
+               {
                        /*
                         * return 0, 1, ...
                         if( file.Name.Length > 5 &&                            //there's something more than 
"video", like "video0" or "video1", ...
@@ -154,6 +156,10 @@ public class WebcamFfmpegGetDevicesLinux : WebcamFfmpegGetDevices
                        wd_list.Add(new WebcamDevice(
                                                prefix + file.Name,
                                                prefix + file.Name + " (default camera)"));
+                       found = true;
+               }
+               if(! found)
+                       wd_list.Error = Constants.CameraNotFound;
 
                return wd_list;
        }


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