[chronojump] ffmpeg, ffplay better path and better error messages



commit 5cff4f7fe32812de6efd91e676c1848d33af2814
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 8 11:50:14 2019 +0200

    ffmpeg, ffplay better path and better error messages

 src/webcam.cs              |  2 ++
 src/webcamFfmpeg.cs        | 15 ++++++++++++---
 src/webcamFfmpegDevices.cs |  2 +-
 3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/webcam.cs b/src/webcam.cs
index d97d74b5..4aee6eab 100644
--- a/src/webcam.cs
+++ b/src/webcam.cs
@@ -101,6 +101,8 @@ public abstract class Webcam
                string.Format(Catalog.GetString("Error. {0} is not installed."), "mplayer");
        protected static internal string programFfmpegNotInstalled =
                string.Format(Catalog.GetString("Error. {0} is not installed."), "ffmpeg");
+       protected static internal string programFfplayNotInstalled =
+               string.Format(Catalog.GetString("Error. {0} is not installed."), "ffplay");
        protected static internal string programMplayerClosed =
                string.Format(Catalog.GetString("Error. {0} has been closed."), "mplayer");
        protected static internal string programMplayerCannotSave =
diff --git a/src/webcamFfmpeg.cs b/src/webcamFfmpeg.cs
index d43ec8d0..3957ea60 100644
--- a/src/webcamFfmpeg.cs
+++ b/src/webcamFfmpeg.cs
@@ -47,12 +47,16 @@ public class WebcamFfmpeg : Webcam
                        executable = "ffmpeg";
                        if(os == UtilAll.OperatingSystems.WINDOWS)
                                executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffmpeg.exe");
+                       if(os == UtilAll.OperatingSystems.MACOSX)
+                               executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffmpeg");
                }
                else // PLAYPREVIEW || PLAYFILE
                {
                        executable = "ffplay";
                        if(os == UtilAll.OperatingSystems.WINDOWS)
                                executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffplay.exe");
+                       if(os == UtilAll.OperatingSystems.MACOSX)
+                               executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffplay");
                }
 
                Running = false;
@@ -80,7 +84,7 @@ public class WebcamFfmpeg : Webcam
                if(! success)
                {
                        process = null;
-                       return new Result (false, "", programFfmpegNotInstalled);
+                       return new Result (false, "", programFfplayNotInstalled);
                }
 
                streamWriter = process.StandardInput;
@@ -95,7 +99,7 @@ public class WebcamFfmpeg : Webcam
                ExecuteProcess.Result execute_result = ExecuteProcess.run (executable, parameters, false, 
false);
                if(! execute_result.success)
                {
-                       return new Result (false, "", programFfmpegNotInstalled);
+                       return new Result (false, "", programFfplayNotInstalled);
                }
 
                return new Result (true, "");
@@ -105,6 +109,11 @@ public class WebcamFfmpeg : Webcam
        public override bool Snapshot ()
        {
                executable = "ffmpeg";
+               if(os == UtilAll.OperatingSystems.WINDOWS)
+                       executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffmpeg.exe");
+               if(os == UtilAll.OperatingSystems.MACOSX)
+                       executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffmpeg");
+
                List<string> parameters = createParametersSnapshot();
 
                process = new Process();
@@ -126,7 +135,7 @@ public class WebcamFfmpeg : Webcam
                if(! success)
                {
                        process = null;
-                       return new Result (false, "", programFfmpegNotInstalled);
+                       return new Result (false, "", programFfplayNotInstalled);
                }
 
                Running = true;
diff --git a/src/webcamFfmpegDevices.cs b/src/webcamFfmpegDevices.cs
index 341c483c..9d0288e2 100644
--- a/src/webcamFfmpegDevices.cs
+++ b/src/webcamFfmpegDevices.cs
@@ -303,7 +303,7 @@ public class WebcamFfmpegGetDevicesMac : WebcamFfmpegGetDevicesWinMac
        public WebcamFfmpegGetDevicesMac()
        {
                initialize();
-               executable = "ffmpeg";
+               executable = System.IO.Path.Combine(Util.GetPrefixDir(), "bin/ffmpeg");
                videoDevString = "AVFoundation video devices";
                audioDevString = "AVFoundation audio devices";
        }


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