[longomatch] Only apply camera visiblity changes after loading the file set
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Only apply camera visiblity changes after loading the file set
- Date: Tue, 31 Mar 2015 17:38:32 +0000 (UTC)
commit f52ec94aa38766d16306aa92d9084ffac052d10c
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Mar 31 07:21:10 2015 +0200
Only apply camera visiblity changes after loading the file set
LongoMatch.Services/Services/PlayerController.cs | 52 +++++++++++++++-------
1 files changed, 35 insertions(+), 17 deletions(-)
---
diff --git a/LongoMatch.Services/Services/PlayerController.cs
b/LongoMatch.Services/Services/PlayerController.cs
index 3ffbcb8..9819dc6 100644
--- a/LongoMatch.Services/Services/PlayerController.cs
+++ b/LongoMatch.Services/Services/PlayerController.cs
@@ -52,10 +52,11 @@ namespace LongoMatch.Services
List<IViewPort> viewPorts;
List<int> camerasVisible;
List<int> defaultCamerasVisible;
+ object defaultCamerasLayout;
MediaFileSet defaultFileSet;
Time streamLength, videoTS, imageLoadedTS;
- bool readyToSeek, stillimageLoaded, ready, delayedOpen, disposed, ignoreCameras;
+ bool readyToSeek, stillimageLoaded, ready, delayedOpen, disposed, skipApplyCamerasConfig;
Seeker seeker;
Segment loadedSegment;
PendingSeek pendingSeek;
@@ -107,13 +108,12 @@ namespace LongoMatch.Services
public List<int> CamerasVisible {
set {
+ Log.Debug ("Updating cameras configuration: ", string.Join ("-", value));
camerasVisible = value;
- ValidateVisibleCameras ();
if (multiPlayer != null) {
multiPlayer.CamerasVisible = camerasVisible;
- if (!ignoreCameras && Opened) {
- multiPlayer.ApplyCamerasConfig ();
- UpdatePar ();
+ if (!skipApplyCamerasConfig && Opened) {
+ ApplyCamerasConfig ();
}
}
}
@@ -480,7 +480,7 @@ namespace LongoMatch.Services
Reset ();
EmitEventUnloaded ();
if (FileSet != defaultFileSet) {
- camerasVisible = defaultCamerasVisible;
+ UpdateCamerasConfig (defaultCamerasVisible, defaultCamerasLayout, false);
Open (defaultFileSet);
} else {
CamerasVisible = defaultCamerasVisible;
@@ -622,12 +622,30 @@ namespace LongoMatch.Services
#region Private methods
+ void UpdateCamerasConfig (List<int> camerasConfig, object layout, bool update)
+ {
+ skipApplyCamerasConfig = !update;
+ CamerasVisible = camerasConfig;
+ CamerasLayout = layout;
+ skipApplyCamerasConfig = false;
+ }
+
+ void ApplyCamerasConfig ()
+ {
+ if (multiPlayer != null) {
+ ValidateVisibleCameras ();
+ multiPlayer.ApplyCamerasConfig ();
+ UpdatePar ();
+ }
+ }
+
/// <summary>
/// Validates that the list of visible cameras indexes are consistent with fileset
/// </summary>
void ValidateVisibleCameras ()
{
- if (FileSet != null && camerasVisible != null) {
+ if (FileSet != null && camerasVisible != null && camerasVisible.Max () >=
FileSet.Count) {
+ Log.Error ("Invalid cameras configuration, fixing list of cameras");
camerasVisible = camerasVisible.Where (i => i < FileSet.Count).ToList<int> ();
}
}
@@ -658,22 +676,21 @@ namespace LongoMatch.Services
/// <param name="defaultFile">If set to <c>true</c>, store this as the default file set to
use.</param>
void InternalOpen (MediaFileSet fileSet, bool seek, bool force = false, bool play = false,
bool defaultFile = false)
{
- MediaFileSet previousFileSet = FileSet;
-
Reset ();
- FileSet = fileSet;
- ignoreCameras = true;
+ skipApplyCamerasConfig = true;
// This event gives a chance to the view to define camera visibility.
// As there might already be a configuration defined (loading an event for example),
the view
// should adapt if needed.
EmitMediaFileSetLoaded (fileSet, camerasVisible);
- ignoreCameras = false;
+ skipApplyCamerasConfig = false;
if (defaultFile) {
defaultCamerasVisible = CamerasVisible;
+ defaultCamerasLayout = CamerasLayout;
defaultFileSet = fileSet;
}
- if (previousFileSet != FileSet || force) {
+ if (fileSet != FileSet || force) {
readyToSeek = false;
+ FileSet = fileSet;
// Check if the view failed to configure a proper cam config
if (CamerasVisible == null) {
Config.EventsBroker.EmitMultimediaError (this,
@@ -740,11 +757,13 @@ namespace LongoMatch.Services
Log.Debug (String.Format ("Update player segment {0} {1} {2}",
evt.Start, evt.Stop, evt.Rate));
- CamerasVisible = evt.CamerasVisible;
- CamerasLayout = evt.CamerasLayout;
+ UpdateCamerasConfig (evt.CamerasVisible, evt.CamerasLayout, false);
if (fileSet != this.FileSet) {
InternalOpen (fileSet, false);
+ } else {
+ ApplyCamerasConfig ();
}
+
Pause ();
loadedSegment.Start = evt.Start;
loadedSegment.Stop = evt.Stop;
@@ -786,8 +805,7 @@ namespace LongoMatch.Services
MediaFileSet fileSet = new MediaFileSet ();
fileSet.Add (video.File);
EmitLoadDrawings (null);
- CamerasVisible = new List<int> { 0 };
- CamerasLayout = null;
+ UpdateCamerasConfig (new List<int> { 0 }, null, false);
InternalOpen (fileSet, false, true, true);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]