[chronojump] On Linux now can detect Supported modes of >1 camera
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] On Linux now can detect Supported modes of >1 camera
- Date: Mon, 4 Nov 2019 15:14:29 +0000 (UTC)
commit 7aa2593115ae7cf6d3a95101e251d6de5f669b46
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Nov 4 16:13:48 2019 +0100
On Linux now can detect Supported modes of >1 camera
src/gui/preferences.cs | 8 +++++++-
src/util.cs | 5 +++++
src/webcam/webcamFfmpegSupportedModes.cs | 7 ++++++-
3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 55d059fe..8c5d201d 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -945,7 +945,13 @@ public class PreferencesWindow
return;
if(operatingSystem == UtilAll.OperatingSystems.LINUX)
- wfsm = new WebcamFfmpegSupportedModesLinux();
+ {
+ string number = "0";
+ if(cameraCode.StartsWith("/dev/video") && cameraCode.Length > 10 &&
Util.IsNumber(cameraCode[10], false))
+ number = cameraCode[10].ToString();
+
+ wfsm = new WebcamFfmpegSupportedModesLinux(number);
+ }
else if(operatingSystem == UtilAll.OperatingSystems.WINDOWS)
wfsm = new WebcamFfmpegSupportedModesWindows(cameraCode);
else
diff --git a/src/util.cs b/src/util.cs
index 5fe74cb8..944e5ae4 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -821,6 +821,11 @@ public class Util
LogB.Information("tryParse 'joan' as double: " + Util.IsNumber("joan",true).ToString());
//catalan (True)
}
+ public static bool IsNumber(char c, bool canBeDecimal)
+ {
+ return IsNumber(c.ToString(), canBeDecimal);
+ }
+
//gets a string and returns if all the chars are numbers or the decimal point in current localization
public static bool IsNumber(string str, bool canBeDecimal)
{
diff --git a/src/webcam/webcamFfmpegSupportedModes.cs b/src/webcam/webcamFfmpegSupportedModes.cs
index 50c16d65..294beea9 100644
--- a/src/webcam/webcamFfmpegSupportedModes.cs
+++ b/src/webcam/webcamFfmpegSupportedModes.cs
@@ -134,9 +134,10 @@ public abstract class WebcamFfmpegSupportedModes
public class WebcamFfmpegSupportedModesLinux : WebcamFfmpegSupportedModes
{
- public WebcamFfmpegSupportedModesLinux()
+ public WebcamFfmpegSupportedModesLinux(string cameraCode)
{
initialize();
+ this.cameraCode = cameraCode;
}
public override void GetModes()
@@ -147,7 +148,11 @@ public class WebcamFfmpegSupportedModesLinux : WebcamFfmpegSupportedModes
return;
}
+ //v4l2-ctl -d 1 --list-formats-ext
+
List<string> parameters = new List<string>();
+ parameters.Add("-d");
+ parameters.Add(cameraCode);
parameters.Add("--list-formats-ext");
ExecuteProcess.Result execute_result = ExecuteProcess.run ("v4l2-ctl", parameters, true,
true);
if(! execute_result.success) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]