[longomatch] Use a different enum for the capturer GUI type and the camera capturer source type



commit d5ff519e0bde2c10b55aa8031f9af768a4925e91
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Jun 6 22:51:35 2010 +0200

    Use a different enum for the capturer GUI type and the camera capturer source type

 CesarPlayer/Capturer/CaptureProperties.cs        |    2 +-
 CesarPlayer/Capturer/FakeCapturer.cs             |    2 +-
 CesarPlayer/Capturer/GstCameraCapturer.cs        |    2 +-
 CesarPlayer/Capturer/ICapturer.cs                |    2 +-
 CesarPlayer/Common/Enum.cs                       |   11 ++++++++---
 CesarPlayer/Gui/CapturerBin.cs                   |   12 ++++++------
 CesarPlayer/MultimediaFactory.cs                 |    9 +++------
 LongoMatch/Gui/Component/ProjectDetailsWidget.cs |    8 ++++----
 LongoMatch/Gui/MainWindow.cs                     |    4 ++--
 9 files changed, 27 insertions(+), 25 deletions(-)
---
diff --git a/CesarPlayer/Capturer/CaptureProperties.cs b/CesarPlayer/Capturer/CaptureProperties.cs
index 3030915..37af272 100644
--- a/CesarPlayer/Capturer/CaptureProperties.cs
+++ b/CesarPlayer/Capturer/CaptureProperties.cs
@@ -25,7 +25,7 @@ namespace LongoMatch.Video.Capturer
 	
 	public struct CapturePropertiesStruct
 	{
-		public CapturerType SourceType;
+		public CaptureSourceType CaptureSourceType;
 		public string DeviceID;
 		public uint VideoBitrate;
 		public uint AudioBitrate;
diff --git a/CesarPlayer/Capturer/FakeCapturer.cs b/CesarPlayer/Capturer/FakeCapturer.cs
index 65fc574..292a92b 100644
--- a/CesarPlayer/Capturer/FakeCapturer.cs
+++ b/CesarPlayer/Capturer/FakeCapturer.cs
@@ -112,7 +112,7 @@ namespace LongoMatch.Video.Capturer
 			return true;
 		}
 		
-		public bool SetSource(CapturerType type){
+		public bool SetSource(CaptureSourceType type){
 			return true;
 		}
 	}
diff --git a/CesarPlayer/Capturer/GstCameraCapturer.cs b/CesarPlayer/Capturer/GstCameraCapturer.cs
index 6807c02..4552157 100644
--- a/CesarPlayer/Capturer/GstCameraCapturer.cs
+++ b/CesarPlayer/Capturer/GstCameraCapturer.cs
@@ -351,7 +351,7 @@ namespace LongoMatch.Video.Capturer {
 		[DllImport("libcesarplayer.dll")]
 		static extern bool gst_camera_capturer_set_source(IntPtr raw, int type, out IntPtr error);
 
-		public bool SetSource(CapturerType type) {
+		public bool SetSource(CaptureSourceType type) {
 			IntPtr error = IntPtr.Zero;			
 			bool raw_ret = gst_camera_capturer_set_source(Handle, (int) type, out error);
 			if (error != IntPtr.Zero) throw new GLib.GException (error);
diff --git a/CesarPlayer/Capturer/ICapturer.cs b/CesarPlayer/Capturer/ICapturer.cs
index 6eb8573..89f02ee 100644
--- a/CesarPlayer/Capturer/ICapturer.cs
+++ b/CesarPlayer/Capturer/ICapturer.cs
@@ -75,7 +75,7 @@ namespace LongoMatch.Video.Capturer
 		
 		bool SetVideoMuxer(VideoMuxerType type);
 		
-		bool SetSource(CapturerType type);
+		bool SetSource(CaptureSourceType type);
 		
 		void TogglePause();
 		
diff --git a/CesarPlayer/Common/Enum.cs b/CesarPlayer/Common/Enum.cs
index bbe1098..ffafa01 100644
--- a/CesarPlayer/Common/Enum.cs
+++ b/CesarPlayer/Common/Enum.cs
@@ -72,9 +72,8 @@ namespace LongoMatch.Video.Common
 	}	
 	
 	public enum CapturerType{
-		FAKE,
-		DVCAM,
-		WEBCAM,
+		Fake,
+		Live,
 	}	
 
 	public enum VideoFormat {
@@ -159,4 +158,10 @@ namespace LongoMatch.Video.Common
 		Audio,
 		DV
 	}
+	
+	public enum CaptureSourceType {
+		None,
+		DV,
+		Raw,
+	}
 }
diff --git a/CesarPlayer/Gui/CapturerBin.cs b/CesarPlayer/Gui/CapturerBin.cs
index df8874c..92845e8 100644
--- a/CesarPlayer/Gui/CapturerBin.cs
+++ b/CesarPlayer/Gui/CapturerBin.cs
@@ -44,7 +44,7 @@ namespace LongoMatch.Gui
 		private uint outputHeight;
 		private uint videoBitrate;
 		private uint audioBitrate;
-		private CapturerType sourceType;
+		private CaptureSourceType captureSourceType;
 		private string deviceID;
 		private VideoEncoderType  videoEncoder;
 		private AudioEncoderType audioEncoder;
@@ -67,7 +67,7 @@ namespace LongoMatch.Gui
 			audioEncoder = AudioEncoderType.Aac;
 			videoMuxer = VideoMuxerType.Mp4;
 			outputFile = "";
-			Type = CapturerType.FAKE;
+			Type = CapturerType.Live;
 		}		
 		
 		public CapturerType Type {
@@ -81,7 +81,7 @@ namespace LongoMatch.Gui
 				capturer = factory.getCapturer(value);	
 				capturer.EllapsedTime += OnTick;
 				capturer.Error += OnError;
-				if (value != CapturerType.FAKE){
+				if (value != CapturerType.Fake){
 					capturerhbox.Add((Widget)capturer);
 					(capturer as Widget).Visible = true;
 					capturerhbox.Visible = true;
@@ -166,7 +166,7 @@ namespace LongoMatch.Gui
 				audioEncoder = value.AudioEncoder;
 				videoEncoder = value.VideoEncoder;
 				videoMuxer = value.Muxer;
-				sourceType = value.SourceType;
+				captureSourceType = value.CaptureSourceType;
 				deviceID = value.DeviceID;
 			}
 		}
@@ -251,7 +251,7 @@ namespace LongoMatch.Gui
 			capturer.SetVideoEncoder(videoEncoder);
 			capturer.SetAudioEncoder(audioEncoder);
 			capturer.SetVideoMuxer(videoMuxer);	
-			capturer.SetSource(sourceType);
+			capturer.SetSource(captureSourceType);
 			capturer.DeviceID = deviceID;
 			capturer.VideoBitrate = videoBitrate;
 			capturer.AudioBitrate = audioBitrate;
@@ -311,7 +311,7 @@ namespace LongoMatch.Gui
 				capturer.Dispose();
 				capturer = null;
 			}
-			Type = CapturerType.FAKE;
+			Type = CapturerType.Fake;
 		}
 		
 		protected virtual void OnLogodrawingareaExposeEvent (object o, Gtk.ExposeEventArgs args)
diff --git a/CesarPlayer/MultimediaFactory.cs b/CesarPlayer/MultimediaFactory.cs
index 4e04874..a9712c1 100644
--- a/CesarPlayer/MultimediaFactory.cs
+++ b/CesarPlayer/MultimediaFactory.cs
@@ -1,4 +1,4 @@
-// PlayerMaker.cs 
+// PlayerMaker.cs 
 //
 //  Copyright(C) 2007-2009 Andoni Morales Alastruey
 //
@@ -94,14 +94,11 @@ namespace LongoMatch.Video
 		
 		public ICapturer getCapturer(CapturerType type){
 			switch (type) { 
-				case CapturerType.FAKE:
+				case CapturerType.Fake:
 					return new FakeCapturer();
 					
-				case CapturerType.DVCAM:
+				case CapturerType.Live:
 					return new GstCameraCapturer("test.avi");
-				
-				case CapturerType.WEBCAM:
-					return new FakeCapturer();
 									
 				default:
 					return new FakeCapturer();
diff --git a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
index 17bca60..eb83ec7 100644
--- a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
@@ -238,9 +238,9 @@ namespace LongoMatch.Gui.Component
 				s.AudioBitrate = (uint)audiobitratespinbutton.Value;
 				s.VideoBitrate = (uint)videobitratespinbutton.Value;
 				if (videoDevices[devicecombobox.Active].DeviceType == DeviceType.DV)
-					s.SourceType =  CapturerType.DVCAM;
+					s.CaptureSourceType = CaptureSourceType.DV;
 				else 
-				    s.SourceType =  CapturerType.WEBCAM;		
+					s.CaptureSourceType = CaptureSourceType.Raw;
 				s.DeviceID = videoDevices[devicecombobox.Active].ID;
 				switch (sizecombobox.ActiveText){
 					/* FIXME: Don't harcode size values */
@@ -284,9 +284,9 @@ namespace LongoMatch.Gui.Component
 						break;
 				}
 				if (devicecombobox.ActiveText.Contains (Catalog.GetString(GCONF_SOURCE)))
-					s.SourceType = CapturerType.WEBCAM;
+					s.CaptureSourceType = CaptureSourceType.Raw;
 				else
-					s.SourceType = CapturerType.DVCAM;
+					s.CaptureSourceType = CaptureSourceType.DV;
 				return s;
 			}
 		}
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index 6a85971..fc517d7 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -150,14 +150,14 @@ namespace LongoMatch.Gui
 					capturerBin.OutputFile = project.File.FilePath;
 					capturerBin.CaptureProperties = props;
 					try {
-						capturerBin.Type = CapturerType.DVCAM;
+						capturerBin.Type = CapturerType.Live;
 					} catch (Exception ex) {
 						MessagePopup.PopupMessage (this, MessageType.Error, ex.Message);
 						CloseOpenedProject (false);
 						return;
 					}
 				} else
-					capturerBin.Type = CapturerType.FAKE;
+					capturerBin.Type = CapturerType.Fake;
 				playerbin1.Visible = false;
 				capturerBin.Visible = true;
 				capturerBin.Run ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]