[chronojump] Fixes on webcam mac for ffmpeg 4.3



commit 7215e9673bba09cd80b47fc9c5a26a100da8e12f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jul 7 16:12:19 2020 +0200

    Fixes on webcam mac for ffmpeg 4.3

 src/webcam/webcamFfmpegDevices.cs        |  3 ++-
 src/webcam/webcamFfmpegSupportedModes.cs | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/webcam/webcamFfmpegDevices.cs b/src/webcam/webcamFfmpegDevices.cs
index 5b3e26ad..663dcd06 100644
--- a/src/webcam/webcamFfmpegDevices.cs
+++ b/src/webcam/webcamFfmpegDevices.cs
@@ -368,7 +368,8 @@ public class WebcamFfmpegGetDevicesMac : WebcamFfmpegGetDevicesWinMac
 
        protected override void parseMatch(string l)
        {
-               if(! l.Contains("AVFoundation input device"))
+               //ffmpeg 4.3 seems to return "indev"
+               if( ! l.Contains("AVFoundation input device") && ! l.Contains("AVFoundation indev") )
                        return;
 
                int firstBracketEnd = l.IndexOf(']');
diff --git a/src/webcam/webcamFfmpegSupportedModes.cs b/src/webcam/webcamFfmpegSupportedModes.cs
index e196300f..bacb6905 100644
--- a/src/webcam/webcamFfmpegSupportedModes.cs
+++ b/src/webcam/webcamFfmpegSupportedModes.cs
@@ -507,12 +507,28 @@ public class WebcamFfmpegSupportedModesMac : WebcamFfmpegSupportedModes
                        return;
                }
 
+               /*
                //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");
+                               */
+
+               //Try with 640x480 at 30Hz
+               Webcam webcamPlay = new WebcamFfmpeg (Webcam.Action.PLAYPREVIEW, UtilAll.GetOSEnum(),
+                               cameraCode, "", "640x480", "30");
 
                Webcam.Result result = webcamPlay.PlayPreviewNoBackgroundWantStdoutAndStderr();
-               modesStr = parseSupportedModes(result.output);
+               if(result.success)
+               {
+                       WebcamSupportedMode currentMode = new WebcamSupportedMode("640x480");
+                       currentMode.AddFramerate("30");
+
+                       WebcamSupportedModesList wsmList = new WebcamSupportedModesList("avfoundation");
+                       wsmList.Add(currentMode);
+                       wsmListOfLists.Add(wsmList);
+                       modesStr = printListOfLists();
+               } else
+                       modesStr = parseSupportedModes(result.output);
        }
 
        protected override string parseSupportedModes(string allOutput)


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