[longomatch] Add FakeCapturer, which simulate a capture device for fake live analysis



commit c48a8923c3c51a54bdb9f1ec1ce93343cf53ebd8
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Feb 17 21:18:19 2010 +0100

    Add FakeCapturer, which simulate a capture device for fake live analysis

 CesarPlayer/Capturer/FakeCapturer.cs |  110 ++++++++++++++++++++++++++++++++++
 CesarPlayer/CesarPlayer.mdp          |    3 +-
 CesarPlayer/Makefile.am              |    1 +
 3 files changed, 113 insertions(+), 1 deletions(-)
---
diff --git a/CesarPlayer/Capturer/FakeCapturer.cs b/CesarPlayer/Capturer/FakeCapturer.cs
new file mode 100644
index 0000000..54be59f
--- /dev/null
+++ b/CesarPlayer/Capturer/FakeCapturer.cs
@@ -0,0 +1,110 @@
+// 
+//  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 Mono.Unix;
+
+namespace LongoMatch.Video.Capturer
+{
+	
+	
+	public class FakeCapturer : Gtk.Bin, ICapturer
+	{
+		private DateTime lastStart;
+		private TimeSpan ellapsed;
+		private bool playing;
+		private bool started;
+		
+		public FakeCapturer()
+		{
+			lastStart = DateTime.Now;
+			ellapsed = new TimeSpan(0,0,0);
+			playing = false;
+			started = false;
+		}
+		
+		public int CurrentTime{
+			get{
+				if (!started)
+					return 0;
+				else if (playing)
+					return (ellapsed + (DateTime.Now - lastStart)).Milliseconds;
+				else
+					return ellapsed.Milliseconds; 
+			}
+		}
+		
+		public void TogglePause(){
+			if (!started)
+				return;
+			
+			if (playing){
+				playing = false;
+				ellapsed += DateTime.Now - lastStart;								
+			}
+			else{
+				playing = true;
+				lastStart = DateTime.Now;
+			}
+		}
+		
+		public void Start(){
+			lastStart = DateTime.Now;
+			started = true;
+		}
+		
+		public uint EncodeWidth {
+			get{return 0;} 
+			set{}
+		}
+
+		public uint EncodeHeight {
+			get{return 0;}
+			set{}
+		}
+		
+		public string OutputFile {
+			get {return Catalog.GetString("Fake live source");}
+			set {}
+		}
+				
+		public uint VideoBitrate {
+			get {return 0;}
+			set {}
+		}
+		
+		public uint AudioBitrate {
+			get {return 0;}
+			set {}
+		}
+		
+		public void Stop(){}		
+		
+		public bool SetVideoEncoder(LongoMatch.Video.Capturer.GccVideoEncoderType type){
+			return true;
+		}
+		
+		public bool SetAudioEncoder(LongoMatch.Video.Capturer.GccAudioEncoderType type){
+			return true;
+		}
+		
+		public bool SetVideoMuxer(LongoMatch.Video.Capturer.GccVideoMuxerType type){
+			return true;
+		}
+	}
+}
diff --git a/CesarPlayer/CesarPlayer.mdp b/CesarPlayer/CesarPlayer.mdp
index b48cdbf..ef01a40 100644
--- a/CesarPlayer/CesarPlayer.mdp
+++ b/CesarPlayer/CesarPlayer.mdp
@@ -50,7 +50,6 @@
     <File name="Capturer/GccError.cs" subtype="Code" buildaction="Compile" />
     <File name="Capturer/GccVideoEncoderType.cs" subtype="Code" buildaction="Compile" />
     <File name="Capturer/GccVideoMuxerType.cs" subtype="Code" buildaction="Compile" />
-    <File name="Capturer/GstCameraCapturer.cs" subtype="Code" buildaction="Compile" />
     <File name="Editor" subtype="Directory" buildaction="Compile" />
     <File name="Editor/ErrorHandler.cs" subtype="Code" buildaction="Compile" />
     <File name="Editor/IVideoEditor.cs" subtype="Code" buildaction="Compile" />
@@ -75,6 +74,8 @@
     <File name="Player/GstMetadataType.cs" subtype="Code" buildaction="Compile" />
     <File name="Player/GstVideoProperty.cs" subtype="Code" buildaction="Compile" />
     <File name="Utils/PreviewMediaFile.cs" subtype="Code" buildaction="Compile" />
+    <File name="Capturer/FakeCapturer.cs" subtype="Code" buildaction="Compile" />
+    <File name="Capturer/GstCameraCapturer.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
diff --git a/CesarPlayer/Makefile.am b/CesarPlayer/Makefile.am
index 0f5fe1d..f1149fc 100644
--- a/CesarPlayer/Makefile.am
+++ b/CesarPlayer/Makefile.am
@@ -79,6 +79,7 @@ FILES = \
 	Capturer/GccVideoMuxerType.cs \
 	Capturer/GstCameraCapturer.cs \
 	Capturer/ErrorHandler.cs \
+	Capturer/FakeCapturer.cs \
 	Capturer/ICapturer.cs \
 	Capturer/ObjectManager.cs \
 	Editor/ErrorHandler.cs \



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