[longomatch] Add a timer to notify the ellapsed time



commit 7b9ab2c1eb82e8d548c3d1c641c3cc025993ae2c
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Feb 17 22:06:20 2010 +0100

    Add a timer to notify the ellapsed time

 CesarPlayer/Capturer/FakeCapturer.cs |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/CesarPlayer/Capturer/FakeCapturer.cs b/CesarPlayer/Capturer/FakeCapturer.cs
index 95291f4..6fa99f8 100644
--- a/CesarPlayer/Capturer/FakeCapturer.cs
+++ b/CesarPlayer/Capturer/FakeCapturer.cs
@@ -18,6 +18,7 @@
 
 using System;
 using Mono.Unix;
+using GLib;
 using LongoMatch.Video.Handlers;
 
 namespace LongoMatch.Video.Capturer
@@ -32,13 +33,14 @@ namespace LongoMatch.Video.Capturer
 		private TimeSpan ellapsed;
 		private bool playing;
 		private bool started;
+		private uint timerID;
 		
 		public FakeCapturer()
 		{
 			lastStart = DateTime.Now;
 			ellapsed = new TimeSpan(0,0,0);
 			playing = false;
-			started = false;
+			started = false;			
 		}
 		
 		public int CurrentTime{
@@ -67,6 +69,7 @@ namespace LongoMatch.Video.Capturer
 		}
 		
 		public void Start(){
+			timerID = GLib.Timeout.Add(1000, OnTick);
 			lastStart = DateTime.Now;
 			started = true;
 		}
@@ -96,7 +99,9 @@ namespace LongoMatch.Video.Capturer
 			set {}
 		}
 		
-		public void Stop(){}		
+		public void Stop(){
+			GLib.Source.Remove(timerID);
+		}		
 		
 		public bool SetVideoEncoder(LongoMatch.Video.Capturer.GccVideoEncoderType type){
 			return true;
@@ -109,5 +114,11 @@ namespace LongoMatch.Video.Capturer
 		public bool SetVideoMuxer(LongoMatch.Video.Capturer.GccVideoMuxerType type){
 			return true;
 		}
+		
+		protected virtual bool OnTick(){
+			if (EllapsedTime != null)
+				EllapsedTime(CurrentTime);
+			return true;
+		}
 	}
 }



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