Commit 38de27b2 authored by Xavier de Blas's avatar Xavier de Blas

webcam get supported modes for Linux (done!)

parent 50aa563c
...@@ -791,15 +791,34 @@ public class PreferencesWindow ...@@ -791,15 +791,34 @@ public class PreferencesWindow
if(cameraCode == "") if(cameraCode == "")
return; return;
Webcam webcamPlay = new WebcamFfmpeg (Webcam.Action.PLAYPREVIEW, UtilAll.GetOSEnum(), string modesStr = "";
cameraCode, "8000x8000", "8000"); //select and impossible mode just to get an error on mac, this error will give us the "Supported modes"
if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX)
{
List<string> parameters = new List<string>();
parameters.Add("--list-formats-ext");
ExecuteProcess.Result execute_result = ExecuteProcess.run ("v4l2-ctl", parameters, true, true);
if(! execute_result.success) {
new DialogMessage("Chronojump - Modes of this webcam",
Constants.MessageTypes.WARNING, "Need to install v4l2-ctl (on v4l-utils) to know modes");
return;
}
Webcam.Result result = webcamPlay.PlayPreviewNoBackgroundWantStdoutAndStderr(); modesStr = execute_result.stdout;
}
else if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX)
{
Webcam webcamPlay = new WebcamFfmpeg (Webcam.Action.PLAYPREVIEW, UtilAll.GetOSEnum(),
cameraCode, "8000x8000", "8000"); //select and impossible mode just to get an error on mac, this error will give us the "Supported modes"
Webcam.Result result = webcamPlay.PlayPreviewNoBackgroundWantStdoutAndStderr();
modesStr = result.output;
}
//display the result (if any) //display the result (if any)
if(result.output != "") if(modesStr != "")
new DialogMessage("Chronojump - Modes of this webcam", new DialogMessage("Chronojump - Modes of this webcam",
Constants.MessageTypes.INFO, result.output); Constants.MessageTypes.INFO, modesStr, true); //showScrolledWinBar
} }
private void on_button_video_preview_clicked (object o, EventArgs args) private void on_button_video_preview_clicked (object o, EventArgs args)
......
...@@ -104,7 +104,7 @@ public class WebcamFfmpeg : Webcam ...@@ -104,7 +104,7 @@ public class WebcamFfmpeg : Webcam
return new Result (true, ""); return new Result (true, "");
} }
//used to know "Supported modes" on mac and maybe on windows //used to know "Supported modes" on mac
public override Result PlayPreviewNoBackgroundWantStdoutAndStderr() //experimental public override Result PlayPreviewNoBackgroundWantStdoutAndStderr() //experimental
{ {
List<string> parameters = createParametersPlayPreview(); List<string> parameters = createParametersPlayPreview();
......
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