[longomatch] Queue seeks until we can really seek



commit 426ee7161adab487915d7859b93a476546d29a8c
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Nov 24 01:21:59 2012 +0100

    Queue seeks until we can really seek

 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 93539b6..082e32c 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -67,6 +67,7 @@ namespace LongoMatch.Gui
 		//the player.mrl is diferent from the filename as it's an uri eg:file:///foo.avi
 		private string filename = null;
 		protected VolumeWindow vwin;
+		bool readyToSeek = false;
 
 
 		#region Constructors
@@ -211,6 +212,7 @@ namespace LongoMatch.Gui
 				//We handle this error async
 			}
 			detachbutton.Sensitive = true;
+			readyToSeek = false;
 		}
 
 		public void Play() {
@@ -345,8 +347,12 @@ namespace LongoMatch.Gui
 			segmentStopTime = stop;
 			closebutton.Show();
 			vscale1.Value = 25;
-			player.SegmentSeek(start,stop, GetRateFromScale());
-			player.Play();
+			if (readyToSeek) {
+				player.SegmentSeek(start, stop, GetRateFromScale());
+				player.Play();
+			} else {
+				pendingSeek = new object[3] {start, stop, GetRateFromScale()};
+			}
 		}
 
 		public void CloseActualSegment() {
@@ -458,13 +464,13 @@ namespace LongoMatch.Gui
 		}
 
 		protected void OnReadyToSeek(object o, EventArgs args) {
+			readyToSeek = true;
 			if(pendingSeek != null) {
 				player.SegmentSeek((long)pendingSeek[0],
 				                   (long)pendingSeek[1],
 				                   (float)pendingSeek[2]);
 				player.Play();
 				pendingSeek = null;
-
 			}
 		}
 



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