[longomatch] Add new Device class
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add new Device class
- Date: Tue, 8 Jun 2010 21:47:42 +0000 (UTC)
commit 61bf2b5c9fb03201b6e0a699b3508ab1f533e95b
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sat Jun 5 19:08:29 2010 +0200
Add new Device class
CesarPlayer/CesarPlayer.mdp | 2 +
CesarPlayer/Common/Enum.cs | 6 +++
CesarPlayer/Makefile.am | 1 +
CesarPlayer/Utils/Device.cs | 90 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 99 insertions(+), 0 deletions(-)
---
diff --git a/CesarPlayer/CesarPlayer.mdp b/CesarPlayer/CesarPlayer.mdp
index b861b5d..9f16991 100644
--- a/CesarPlayer/CesarPlayer.mdp
+++ b/CesarPlayer/CesarPlayer.mdp
@@ -54,6 +54,8 @@
<File subtype="Code" buildaction="Compile" name="Common/Handlers.cs" />
<File subtype="Code" buildaction="Compile" name="Capturer/LiveSourceTimer.cs" />
<File subtype="Code" buildaction="Compile" name="Capturer/CaptureProperties.cs" />
+ <File subtype="Code" buildaction="Compile" name="Utils/Device.cs" />
+ <File subtype="Code" buildaction="Compile" name="Common/Constants.cs" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
diff --git a/CesarPlayer/Common/Enum.cs b/CesarPlayer/Common/Enum.cs
index b6c0593..bbe1098 100644
--- a/CesarPlayer/Common/Enum.cs
+++ b/CesarPlayer/Common/Enum.cs
@@ -153,4 +153,10 @@ namespace LongoMatch.Video.Common
AudioSampleRate,
AudioChannels,
}
+
+ public enum DeviceType {
+ Video,
+ Audio,
+ DV
+ }
}
diff --git a/CesarPlayer/Makefile.am b/CesarPlayer/Makefile.am
index 4545a57..76d2c41 100644
--- a/CesarPlayer/Makefile.am
+++ b/CesarPlayer/Makefile.am
@@ -74,6 +74,7 @@ FILES = \
Editor/IVideoSplitter.cs \
Editor/VideoSegment.cs \
Editor/EditorState.cs \
+ Utils/Device.cs \
Utils/MediaFile.cs \
Utils/PreviewMediaFile.cs
diff --git a/CesarPlayer/Utils/Device.cs b/CesarPlayer/Utils/Device.cs
new file mode 100644
index 0000000..1894493
--- /dev/null
+++ b/CesarPlayer/Utils/Device.cs
@@ -0,0 +1,90 @@
+//
+// Copyright (C) 2010 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using System.Collections.Generic;
+using LongoMatch.Video.Capturer;
+using LongoMatch.Video.Common;
+using Mono.Unix;
+
+namespace LongoMatch.Video.Utils
+{
+
+
+ public class Device
+ {
+ public Device () {
+
+ }
+
+ /// <summary>
+ /// Device Type among Video, Audio or DV (for dv cameras)
+ /// </summary>
+ public DeviceType DeviceType {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Device id, can be a human friendly name (for DirectShow devices),
+ /// the de device name (/dev/video0) or the GUID (dv1394src)
+ /// </summary>
+ public string ID {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// The name of the gstreamer element property used to set the device
+ /// </summary>
+
+ public string IDProperty {
+ get;
+ set;
+ }
+
+ static public List<Device> ListVideoDevices (){
+ List<Device> devicesList = new List<Device>();
+
+ /* Generate the list of devices and add the gconf one at the bottom
+ * so that DV sources are always selected before, at least on Linux,
+ * since on Windows both raw an dv sources are listed from the same
+ * source element (dshowvideosrc) */
+ foreach (string devName in GstCameraCapturer.VideoDevices){
+ string idProp;
+
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ idProp = Constants.DV1394SRC_PROP;
+ else
+ idProp = Constants.DSHOWVIDEOSINK_PROP;
+
+ devicesList.Add(new Device {
+ ID = devName,
+ IDProperty = idProp,
+ DeviceType = DeviceType.DV});
+ }
+ if (Environment.OSVersion.Platform == PlatformID.Unix){
+ devicesList.Add(new Device {
+ ID = Catalog.GetString("GConf configured device"),
+ IDProperty = "",
+ DeviceType = DeviceType.DV});
+ }
+ return devicesList;
+ }
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]