[longomatch] Store default cameras config for the main file set



commit cdeba2262a00989892c0ba59015d1304c05967c4
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Mar 30 15:22:27 2015 +0200

    Store default cameras config for the main file set

 LongoMatch.Services/Services/PlayerController.cs |   12 +++++++++---
 Tests/Services/TestPlayerController.cs           |    2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.Services/Services/PlayerController.cs 
b/LongoMatch.Services/Services/PlayerController.cs
index 2e45ec3..1dd70ac 100644
--- a/LongoMatch.Services/Services/PlayerController.cs
+++ b/LongoMatch.Services/Services/PlayerController.cs
@@ -51,6 +51,7 @@ namespace LongoMatch.Services
                Playlist loadedPlaylist;
                List<IViewPort> viewPorts;
                List<int> camerasVisible;
+               List<int> defaultCamerasVisible;
 
                Time streamLength, videoTS, imageLoadedTS;
                bool readyToSeek, stillimageLoaded, ready, delayedOpen, disposed, ignoreCameras;
@@ -234,7 +235,7 @@ namespace LongoMatch.Services
                        Log.Debug ("Player ready");
                        if (delayedOpen) {
                                Log.Debug ("Openning delayed file set");
-                               Open (FileSet, true, true);
+                               Open (FileSet, true, true, false, true);
                        }
                        ready = true;
                        delayedOpen = false;
@@ -244,7 +245,7 @@ namespace LongoMatch.Services
                {
                        Log.Debug ("Openning file set");
                        if (ready) {
-                               Open (fileSet, true);
+                               Open (fileSet, true, true, false, true);
                        } else {
                                Log.Debug ("Player is not ready, delaying ...");
                                delayedOpen = true;
@@ -476,6 +477,7 @@ namespace LongoMatch.Services
                {
                        Log.Debug ("Unload current event");
                        Reset ();
+                       CamerasVisible = defaultCamerasVisible;
                        EmitEventUnloaded ();
                }
 
@@ -644,7 +646,8 @@ namespace LongoMatch.Services
                /// <param name="seek">If set to <c>true</c>, seeks to the beginning of the stream.</param>
                /// <param name="force">If set to <c>true</c>, opens the fileset even if it was already 
set.</param>
                /// <param name="play">If set to <c>true</c>, sets the player to play.</param>
-               void Open (MediaFileSet fileSet, bool seek, bool force = false, bool play = false)
+               /// <param name="storeCamsConfig">If set to <c>true</c>, store the cameras configuration as 
the default one.</param>
+               void Open (MediaFileSet fileSet, bool seek, bool force = false, bool play = false, bool 
storeCamsConfig = true)
                {
                        Reset ();
                        ignoreCameras = true;
@@ -653,6 +656,9 @@ namespace LongoMatch.Services
                        // should adapt if needed.
                        EmitMediaFileSetLoaded (fileSet, camerasVisible);
                        ignoreCameras = false;
+                       if (storeCamsConfig) {
+                               defaultCamerasVisible = CamerasVisible;
+                       }
                        if (fileSet != this.FileSet || force) {
                                readyToSeek = false;
                                FileSet = fileSet;
diff --git a/Tests/Services/TestPlayerController.cs b/Tests/Services/TestPlayerController.cs
index 6f674ed..4285995 100644
--- a/Tests/Services/TestPlayerController.cs
+++ b/Tests/Services/TestPlayerController.cs
@@ -567,7 +567,7 @@ namespace Tests.Services
                        player.UnloadCurrentEvent ();
                        Assert.AreEqual (0, elementLoaded);
                        // Check that cameras have been restored
-                       Assert.AreSame (new List<int> { 0, 1 }, player.CamerasVisible);
+                       Assert.AreEqual (new List<int> { 0, 1 }, player.CamerasVisible);
                }
 
                [Test ()]


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