Commit 5cff4f7f authored by Xavier de Blas's avatar Xavier de Blas

ffmpeg, ffplay better path and better error messages

parent 84784875
......@@ -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 =
......
......@@ -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;
......
......@@ -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";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment