[chronojump] webcam GetDevices mac parse done (untested)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] webcam GetDevices mac parse done (untested)
- Date: Fri, 29 Mar 2019 16:18:19 +0000 (UTC)
commit aab37067ae3868627583a15c3ffbf768a40c36f4
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Mar 29 17:17:41 2019 +0100
webcam GetDevices mac parse done (untested)
src/utilMultimedia.cs | 15 ---------------
src/webcamFfmpegDevices.cs | 14 +++++++++++++-
2 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/src/utilMultimedia.cs b/src/utilMultimedia.cs
index 25e06160..9330cab7 100644
--- a/src/utilMultimedia.cs
+++ b/src/utilMultimedia.cs
@@ -36,20 +36,6 @@ public class UtilMultimedia
public static List<string> GetVideoDevices ()
{
- /*
- * TODO: reimplement this with ffmpeg
- *
- List<LongoMatch.Video.Utils.Device> devices =
LongoMatch.Video.Utils.Device.ListVideoDevices();
- string [] devicesStr = new String[devices.Count];
- int count = 0;
- LogB.Information("Searching video devices");
- foreach(LongoMatch.Video.Utils.Device dev in devices) {
- devicesStr[count++] = dev.ID.ToString();
- LogB.Information(dev.ID.ToString());
- }
- return devicesStr;
- */
-
WebcamFfmpegGetDevices w;
if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX)
@@ -57,7 +43,6 @@ public class UtilMultimedia
else if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.WINDOWS)
w = new WebcamFfmpegGetDevicesWindows();
else
- //return new List<string>();
w = new WebcamFfmpegGetDevicesMac();
return w.GetDevices();
diff --git a/src/webcamFfmpegDevices.cs b/src/webcamFfmpegDevices.cs
index 3d0180ae..347ab9ff 100644
--- a/src/webcamFfmpegDevices.cs
+++ b/src/webcamFfmpegDevices.cs
@@ -233,7 +233,19 @@ public class WebcamFfmpegGetDevicesMac : WebcamFfmpegGetDevices
List<string> parsedList = new List<string>();
foreach(string l in lines)
{
- parsedList.Add(l);
+ LogB.Information("line: " + l);
+ foreach(Match match in Regex.Matches(l, "\"([^\"]*)\""))
+ {
+ //remove quotes from the match (at beginning and end) to add it in SQL
+ string s = match.ToString().Substring(1, match.ToString().Length -2);
+
+ LogB.Information("add match: " + s);
+ parsedList.Add(s);
+ }
+
+ //after the list of video devices comes the list of audio devices, skip it
+ if(l.Contains("AVFoundation audio devices"))
+ break;
}
return parsedList;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]