[longomatch] Turn a compile-time check for OSTYPE_WINDOWS into a runtime check, so the capture device selection w
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Turn a compile-time check for OSTYPE_WINDOWS into a runtime check, so the capture device selection w
- Date: Tue, 31 Mar 2015 17:29:12 +0000 (UTC)
commit c5ef7004b272078d3210be4b4fc657e06728e2d1
Author: Xavi Artigas <xartigas fluendo com>
Date: Thu Mar 19 17:25:47 2015 +0100
Turn a compile-time check for OSTYPE_WINDOWS into a runtime check, so the capture device selection works
from Xamarin.
LongoMatch.Multimedia/Utils/Devices.cs | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/LongoMatch.Multimedia/Utils/Devices.cs b/LongoMatch.Multimedia/Utils/Devices.cs
index 0eb0547..348c8c5 100644
--- a/LongoMatch.Multimedia/Utils/Devices.cs
+++ b/LongoMatch.Multimedia/Utils/Devices.cs
@@ -37,16 +37,21 @@ namespace LongoMatch.Multimedia.Utils
[DllImport("libcesarplayer.dll")]
static extern IntPtr lgm_device_video_format_get_info (IntPtr raw, out int width, out int
height,
out int fps_n, out int fps_d);
- #if OSTYPE_OS_X
- static string[] devices = new string[1] {"avfvideosrc"};
- #elif OSTYPE_WINDOWS
- static string[] devices = new string[2] {"ksvideosrc", "dshowvideosrc"};
- #else
- static string[] devices = new string[2] { "v4l2src", "dv1394src" };
- #endif
+
+ static readonly string[] devices_osx = new string[1] {"avfvideosrc"};
+ static readonly string[] devices_win = new string[2] {"ksvideosrc", "dshowvideosrc"};
+ static readonly string[] devices_lin = new string[2] { "v4l2src", "dv1394src" };
static public List<Device> ListVideoDevices ()
{
+ string[] devices;
+ if (Environment.OSVersion.Platform == PlatformID.MacOSX)
+ devices = devices_osx;
+ else if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+ devices = devices_win;
+ else
+ devices = devices_lin;
+
List<Device> devicesList = new List<Device> ();
foreach (string source in devices) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]