[longomatch] Replace CameraVisible with CamerasConfig.
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Replace CameraVisible with CamerasConfig.
- Date: Thu, 23 Apr 2015 15:21:54 +0000 (UTC)
commit f4c3fe4c2622c5fb132cdde5602c13c80dd3cd5c
Author: Julien Moutte <julien fluendo com>
Date: Wed Apr 22 16:31:24 2015 +0200
Replace CameraVisible with CamerasConfig.
We don't use a List<int> anymore but a List<CameraConfig> which will let us store more information such
as RegionOfInterest.
LongoMatch.Core/Handlers/Multimedia.cs | 2 +-
LongoMatch.Core/Interfaces/IPlayerController.cs | 4 +-
LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs | 8 +-
.../Store/Playlists/PlaylistPlayElement.cs | 6 +-
LongoMatch.Core/Store/Project.cs | 2 +-
LongoMatch.Core/Store/TimelineEvent.cs | 11 +--
LongoMatch.GUI.Multimedia/Gui/PlayerView.cs | 2 +-
.../Gui/Utils/FramesCapturer.cs | 20 +++---
.../Gui/Component/SynchronizationWidget.cs | 4 +-
LongoMatch.Migration/Converter.cs | 2 +-
LongoMatch.Services/EventsManager.cs | 4 +-
LongoMatch.Services/PlayerController.cs | 58 +++++++-------
LongoMatch.Services/PlaylistManager.cs | 2 +-
LongoMatch.Services/RenderingJobsManager.cs | 4 +-
.../Store/Playlists/TestPlaylistPlayElement.cs | 8 +-
Tests/Core/Store/TestTimelineEvent.cs | 2 +-
Tests/Services/TestPlayerController.cs | 85 ++++++++++---------
Tests/Services/TestRenderingJobsManager.cs | 6 +-
18 files changed, 117 insertions(+), 113 deletions(-)
---
diff --git a/LongoMatch.Core/Handlers/Multimedia.cs b/LongoMatch.Core/Handlers/Multimedia.cs
index f7da99f..41d6222 100644
--- a/LongoMatch.Core/Handlers/Multimedia.cs
+++ b/LongoMatch.Core/Handlers/Multimedia.cs
@@ -46,7 +46,7 @@ namespace LongoMatch.Core.Handlers
public delegate void MediaInfoHandler (int width,int height,int parN,int parD);
public delegate void LoadDrawingsHandler (FrameDrawing frameDrawing);
public delegate void ElementLoadedHandler (object element,bool hasNext);
- public delegate void MediaFileSetLoadedHandler (MediaFileSet fileset,List<int> camerasVisible = null);
+ public delegate void MediaFileSetLoadedHandler (MediaFileSet fileset,List<CameraConfig> camerasConfig
= null);
public delegate void ScopeStateChangedHandler (int index,bool visible);
public delegate void ErrorHandler (object sender,string message);
diff --git a/LongoMatch.Core/Interfaces/IPlayerController.cs b/LongoMatch.Core/Interfaces/IPlayerController.cs
index 83ec057..2c1ec5d 100644
--- a/LongoMatch.Core/Interfaces/IPlayerController.cs
+++ b/LongoMatch.Core/Interfaces/IPlayerController.cs
@@ -76,9 +76,9 @@ namespace LongoMatch.Core.Interfaces
object CamerasLayout { get; set; }
/// <summary>
- /// The list of visible cameras.
+ /// The list of configurations for visible cameras.
/// </summary>
- List<int> CamerasVisible { get; set; }
+ List<CameraConfig> CamerasConfig { get; set; }
/// <summary>
/// List of view ports set by the view.
diff --git a/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
b/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
index d10391e..f7b8a86 100644
--- a/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
+++ b/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
@@ -164,14 +164,14 @@ namespace LongoMatch.Core.Interfaces.Multimedia
List<IntPtr> WindowHandles { set; }
/// <summary>
- /// A list with the current cameras visibles.
- /// The value of the integer is the index of the <see cref="MediaFile"/>
+ /// A list with the current configurations of visible cameras.
+ /// Each configuration contains the camera index of the <see cref="MediaFile"/>
/// to use from the <see cref="MediaFileSet"/> opened.
- /// The position in the list is the WindowHandle on which it should e drawn.
+ /// The position in the list matches with the WindowHandle on which it should be drawn.
/// {0, 1} will play MediaFileSet[0] in WindowHandles[0] and MediaFileSet[1] in
WindowsHandles[1]
/// {2, 3} will play MediaFileSet[2] in WindowHandles[0] and MediaFileSet[3] in
WindowsHandles[1]
/// </summary>
- List<int> CamerasVisible { set; }
+ List<CameraConfig> CamerasConfig { set; }
void ApplyCamerasConfig ();
diff --git a/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
b/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
index 6967c1b..b6c898d 100644
--- a/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
+++ b/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
@@ -33,7 +33,7 @@ namespace LongoMatch.Core.Store.Playlists
Title = play.Name;
Rate = play.Rate;
CamerasLayout = play.CamerasLayout;
- CamerasVisible = play.CamerasVisible.ToList ();
+ CamerasConfig = play.CamerasConfig.ToList ();
FileSet = fileset;
}
@@ -101,10 +101,10 @@ namespace LongoMatch.Core.Store.Playlists
}
/// <summary>
- /// Override the default <see cref="TimelineEvent.CamerasVisible"/>
+ /// Override the default <see cref="TimelineEvent.CamerasConfig"/>
/// defined by the <see cref="TimelineEvent"/>
/// </summary>
- public List<int> CamerasVisible {
+ public List<CameraConfig> CamerasConfig {
get;
set;
}
diff --git a/LongoMatch.Core/Store/Project.cs b/LongoMatch.Core/Store/Project.cs
index 64872b8..f6a849f 100644
--- a/LongoMatch.Core/Store/Project.cs
+++ b/LongoMatch.Core/Store/Project.cs
@@ -254,7 +254,7 @@ namespace LongoMatch.Core.Store
evt.EventType = type;
evt.Notes = "";
evt.Miniature = miniature;
- evt.CamerasVisible = new List<int> { 0 };
+ evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (0) };
if (addToTimeline) {
Timeline.Add (evt);
diff --git a/LongoMatch.Core/Store/TimelineEvent.cs b/LongoMatch.Core/Store/TimelineEvent.cs
index 03a1fba..fdef8d9 100644
--- a/LongoMatch.Core/Store/TimelineEvent.cs
+++ b/LongoMatch.Core/Store/TimelineEvent.cs
@@ -45,13 +45,13 @@ namespace LongoMatch.Core.Store
Tags = new List<Tag> ();
Rate = 1.0f;
ID = Guid.NewGuid ();
- CamerasVisible = new List<int> ();
+ CamerasConfig = new List<CameraConfig> ();
}
internal void InitializeLists ()
{
- if (CamerasVisible.Count == 0) {
- CamerasVisible.Add (0);
+ if (CamerasConfig.Count == 0) {
+ CamerasConfig.Add (new CameraConfig (0));
}
}
@@ -179,10 +179,9 @@ namespace LongoMatch.Core.Store
}
/// <summary>
- /// A list of camera indexes visible for this event, where the index
- /// is the position of the camera in the <see cref="MediaFileSet"/>
+ /// A list of visible <see cref="CameraConfig"/> for this event.
/// </summary>
- public List<int> CamerasVisible {
+ public List<CameraConfig> CamerasConfig {
get;
set;
}
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerView.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerView.cs
index 78d191f..bc2dbf2 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerView.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerView.cs
@@ -100,7 +100,7 @@ namespace LongoMatch.Gui
controlsbox.HeightRequest = StyleConf.PlayerCapturerControlsHeight;
Player = new PlayerController ();
- Player.CamerasVisible = new List<int> { 0 };
+ Player.CamerasConfig = new List<CameraConfig> { new CameraConfig (0) };
Player.Step = new Time { TotalSeconds = jumpspinbutton.ValueAsInt };
Mode = PlayerViewOperationMode.Analysis;
CreateWindows ();
diff --git a/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
b/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
index 606fb09..262454c 100644
--- a/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
@@ -58,7 +58,7 @@ namespace LongoMatch.Video.Utils
this.interval = interval;
this.outputDir = outputDir;
this.seriesName = System.IO.Path.GetFileName (outputDir);
- this.totalFrames = ((int)Math.Floor ((double)((stop - start).MSeconds / interval)) +
1) * evt.CamerasVisible.Count;
+ this.totalFrames = ((int)Math.Floor ((double)((stop - start).MSeconds / interval)) +
1) * evt.CamerasConfig.Count;
this.cancel = false;
}
@@ -77,7 +77,7 @@ namespace LongoMatch.Video.Utils
{
Time pos;
LongoMatch.Core.Common.Image frame;
- List<int> cameras;
+ List<CameraConfig> cameras;
bool quit = false;
int i = 0;
int j = 0;
@@ -86,24 +86,24 @@ namespace LongoMatch.Video.Utils
Log.Debug ("Start frames series capture with interval: " + interval);
Log.Debug ("Total frames to be captured: " + totalFrames);
- if (evt.CamerasVisible.Count == 0 || fileSet.Count == 1) {
- cameras = new List<int> { 0 };
+ if (evt.CamerasConfig.Count == 0 || fileSet.Count == 1) {
+ cameras = new List<CameraConfig> { new CameraConfig (0) };
} else {
- cameras = evt.CamerasVisible;
+ cameras = evt.CamerasConfig;
}
- foreach (int cameraIndex in cameras) {
+ foreach (CameraConfig cameraConfig in cameras) {
MediaFile file;
if (quit) {
break;
}
- Log.Debug ("Start frames series capture for angle " + cameraIndex);
+ Log.Debug ("Start frames series capture for angle " + cameraConfig.Index);
try {
- file = fileSet [cameraIndex];
+ file = fileSet [cameraConfig.Index];
} catch (Exception ex) {
Log.Exception (ex);
- Log.Error (string.Format ("Camera index {0} not found in fileset",
cameraIndex));
+ Log.Error (string.Format ("Camera index {0} not found in fileset",
cameraConfig.Index));
continue;
}
capturer.Open (file.FilePath);
@@ -120,7 +120,7 @@ namespace LongoMatch.Video.Utils
if (!cancel) {
frame = capturer.GetFrame (pos + file.Offset, true);
if (frame != null) {
- string path = String.Format ("{0}_angle{1}_{2}.png",
seriesName, cameraIndex, j);
+ string path = String.Format ("{0}_angle{1}_{2}.png",
seriesName, cameraConfig.Index, j);
frame.Save (System.IO.Path.Combine (outputDir, path));
frame.ScaleInplace (THUMBNAIL_MAX_WIDTH,
THUMBNAIL_MAX_HEIGHT);
}
diff --git a/LongoMatch.GUI/Gui/Component/SynchronizationWidget.cs
b/LongoMatch.GUI/Gui/Component/SynchronizationWidget.cs
index 0d1d038..9ad5db5 100644
--- a/LongoMatch.GUI/Gui/Component/SynchronizationWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/SynchronizationWidget.cs
@@ -165,12 +165,12 @@ namespace LongoMatch.Gui.Component
public void SaveChanges (bool resyncEvents)
{
foreach (TimelineEvent evt in project.Timeline) {
- int cc = evt.CamerasVisible.Count;
+ int cc = evt.CamerasConfig.Count;
int fc = project.Description.FileSet.Count;
if (cc < fc) {
for (int i = cc; i < fc; i++) {
- evt.CamerasVisible.Add (i);
+ evt.CamerasConfig.Add (new CameraConfig (i));
}
}
}
diff --git a/LongoMatch.Migration/Converter.cs b/LongoMatch.Migration/Converter.cs
index ce53d51..d617cde 100644
--- a/LongoMatch.Migration/Converter.cs
+++ b/LongoMatch.Migration/Converter.cs
@@ -315,7 +315,7 @@ namespace LongoMatch.Migration
LongoMatch.Core.Common.Coordinates c;
var newplay = new LongoMatch.Core.Store.TimelineEvent ();
- newplay.CamerasVisible.Add (0);
+ newplay.CamerasConfig.Add (new LongoMatch.Core.Store.CameraConfig (0));
var fd = ConvertFrameDrawing (play.KeyFrameDrawing);
if (fd != null) {
newplay.Drawings.Add (fd);
diff --git a/LongoMatch.Services/EventsManager.cs b/LongoMatch.Services/EventsManager.cs
index 974679e..be3acbe 100644
--- a/LongoMatch.Services/EventsManager.cs
+++ b/LongoMatch.Services/EventsManager.cs
@@ -241,10 +241,10 @@ namespace LongoMatch.Services
if (projectType == ProjectType.FileProject) {
play.Stop.MSeconds = Math.Min (player.StreamLength.MSeconds,
play.Stop.MSeconds);
play.CamerasLayout = player.CamerasLayout;
- play.CamerasVisible = player.CamerasVisible;
+ play.CamerasConfig = player.CamerasConfig;
} else {
play.CamerasLayout = null;
- play.CamerasVisible = new List<int> { 0 };
+ play.CamerasConfig = new List<CameraConfig> { new CameraConfig (0) };
}
filter.Update ();
diff --git a/LongoMatch.Services/PlayerController.cs b/LongoMatch.Services/PlayerController.cs
index 9d3f442..c84ab7a 100644
--- a/LongoMatch.Services/PlayerController.cs
+++ b/LongoMatch.Services/PlayerController.cs
@@ -50,8 +50,8 @@ namespace LongoMatch.Services
IPlaylistElement loadedPlaylistElement;
Playlist loadedPlaylist;
List<IViewPort> viewPorts;
- List<int> camerasVisible;
- List<int> defaultCamerasVisible;
+ List<CameraConfig> camerasConfig;
+ List<CameraConfig> defaultCamerasConfig;
object defaultCamerasLayout;
MediaFileSet defaultFileSet;
@@ -106,28 +106,28 @@ namespace LongoMatch.Services
set;
}
- public List<int> CamerasVisible {
+ public List<CameraConfig> CamerasConfig {
set {
Log.Debug ("Updating cameras configuration: ", string.Join ("-", value));
- camerasVisible = value;
- if (defaultCamerasVisible == null) {
- defaultCamerasVisible = value;
+ camerasConfig = value;
+ if (defaultCamerasConfig == null) {
+ defaultCamerasConfig = value;
}
if (loadedEvent != null) {
- loadedEvent.CamerasVisible = value.ToList ();
+ loadedEvent.CamerasConfig = value.ToList ();
} else if (loadedPlaylistElement is PlaylistPlayElement) {
- (loadedPlaylistElement as PlaylistPlayElement).CamerasVisible =
value.ToList ();
+ (loadedPlaylistElement as PlaylistPlayElement).CamerasConfig =
value.ToList ();
}
if (multiPlayer != null) {
- multiPlayer.CamerasVisible = camerasVisible;
+ multiPlayer.CamerasConfig = camerasConfig;
if (!skipApplyCamerasConfig && Opened) {
ApplyCamerasConfig ();
}
}
}
get {
- if (camerasVisible != null) {
- return camerasVisible.ToList ();
+ if (camerasConfig != null) {
+ return camerasConfig.ToList ();
} else {
return null;
}
@@ -458,7 +458,7 @@ namespace LongoMatch.Services
if (element is PlaylistPlayElement) {
PlaylistPlayElement ple = element as PlaylistPlayElement;
LoadSegment (ple.FileSet, ple.Play.Start, ple.Play.Stop,
- ple.Play.Start, ple.Rate, ple.CamerasVisible,
+ ple.Play.Start, ple.Rate, ple.CamerasConfig,
ple.CamerasLayout, true);
} else if (element is PlaylistVideo) {
LoadVideo (element as PlaylistVideo);
@@ -479,7 +479,7 @@ namespace LongoMatch.Services
loadedEvent = evt;
if (evt.Start != null && evt.Start != null) {
LoadSegment (fileSet, evt.Start, evt.Stop, seekTime, evt.Rate,
- evt.CamerasVisible, evt.CamerasLayout, playing);
+ evt.CamerasConfig, evt.CamerasLayout, playing);
} else if (evt.EventTime != null) {
Seek (evt.EventTime, true);
} else {
@@ -493,11 +493,11 @@ namespace LongoMatch.Services
Log.Debug ("Unload current event");
Reset ();
if (FileSet != defaultFileSet) {
- UpdateCamerasConfig (defaultCamerasVisible, defaultCamerasLayout);
+ UpdateCamerasConfig (defaultCamerasConfig, defaultCamerasLayout);
EmitEventUnloaded ();
Open (defaultFileSet);
} else {
- CamerasVisible = defaultCamerasVisible;
+ CamerasConfig = defaultCamerasConfig;
EmitEventUnloaded ();
}
}
@@ -575,10 +575,10 @@ namespace LongoMatch.Services
}
}
- void EmitMediaFileSetLoaded (MediaFileSet fileSet, List<int> camerasVisible)
+ void EmitMediaFileSetLoaded (MediaFileSet fileSet, List<CameraConfig> camerasVisible)
{
if (MediaFileSetLoadedEvent != null) {
- MediaFileSetLoadedEvent (fileSet, camerasVisible);
+ MediaFileSetLoadedEvent (fileSet, camerasConfig);
}
}
@@ -638,10 +638,10 @@ namespace LongoMatch.Services
/// </summary>
/// <param name="camerasConfig">The cameras configuration.</param>
/// <param name="layout">The cameras layout.</param>
- void UpdateCamerasConfig (List<int> camerasConfig, object layout)
+ void UpdateCamerasConfig (List<CameraConfig> camerasConfig, object layout)
{
skipApplyCamerasConfig = true;
- CamerasVisible = camerasConfig;
+ CamerasConfig = camerasConfig;
CamerasLayout = layout;
skipApplyCamerasConfig = false;
}
@@ -663,9 +663,9 @@ namespace LongoMatch.Services
/// </summary>
void ValidateVisibleCameras ()
{
- if (FileSet != null && camerasVisible != null && camerasVisible.Max () >=
FileSet.Count) {
+ if (FileSet != null && camerasConfig != null && camerasConfig.Max (c => c.Index) >=
FileSet.Count) {
Log.Error ("Invalid cameras configuration, fixing list of cameras");
- UpdateCamerasConfig (camerasVisible.Where (i => i <
FileSet.Count).ToList<int> (),
+ UpdateCamerasConfig (camerasConfig.Where (i => i.Index <
FileSet.Count).ToList<CameraConfig> (),
CamerasLayout);
}
}
@@ -675,8 +675,8 @@ namespace LongoMatch.Services
/// </summary>
void UpdatePar ()
{
- for (int i = 0; i < Math.Min (CamerasVisible.Count, ViewPorts.Count); i++) {
- int index = CamerasVisible [i];
+ for (int i = 0; i < Math.Min (CamerasConfig.Count, ViewPorts.Count); i++) {
+ int index = CamerasConfig [i].Index;
MediaFile file = FileSet [index];
float par = 1;
if (file.VideoHeight != 0) {
@@ -701,7 +701,7 @@ namespace LongoMatch.Services
// As there might already be a configuration defined (loading an event for example),
the view
// should adapt if needed.
skipApplyCamerasConfig = true;
- EmitMediaFileSetLoaded (fileSet, camerasVisible);
+ EmitMediaFileSetLoaded (fileSet, camerasConfig);
skipApplyCamerasConfig = false;
if (defaultFile) {
@@ -712,7 +712,7 @@ namespace LongoMatch.Services
readyToSeek = false;
FileSet = fileSet;
// Check if the view failed to configure a proper cam config
- if (CamerasVisible == null) {
+ if (CamerasConfig == null) {
Config.EventsBroker.EmitMultimediaError (this,
Catalog.GetString ("Invalid camera configuration"));
FileSet = null;
@@ -777,14 +777,14 @@ namespace LongoMatch.Services
/// <param name="camerasLayout">Cameras layout.</param>
/// <param name="playing">If set to <c>true</c> starts playing.</param>
void LoadSegment (MediaFileSet fileSet, Time start, Time stop, Time seekTime,
- float rate, List<int> camerasConfig, object camerasLayout,
+ float rate, List<CameraConfig> camerasConfig, object camerasLayout,
bool playing)
{
Log.Debug (String.Format ("Update player segment {0} {1} {2}",
start, stop, rate));
if (!SegmentLoaded) {
- defaultCamerasVisible = CamerasVisible;
+ defaultCamerasConfig = CamerasConfig;
defaultCamerasLayout = CamerasLayout;
}
@@ -837,7 +837,7 @@ namespace LongoMatch.Services
MediaFileSet fileSet = new MediaFileSet ();
fileSet.Add (video.File);
EmitLoadDrawings (null);
- UpdateCamerasConfig (new List<int> { 0 }, null);
+ UpdateCamerasConfig (new List<CameraConfig> { new CameraConfig (0) }, null);
InternalOpen (fileSet, false, true, true);
}
@@ -933,7 +933,7 @@ namespace LongoMatch.Services
if (drawings != null) {
/* Check if the event has drawings to display */
FrameDrawing fd = drawings.FirstOrDefault (f =>
f.Render > videoTS &&
- f.Render <= currentTime &&
f.CameraIndex == CamerasVisible [0]);
+ f.Render <= currentTime &&
f.CameraIndex == CamerasConfig [0].Index);
if (fd != null) {
LoadPlayDrawing (fd);
}
diff --git a/LongoMatch.Services/PlaylistManager.cs b/LongoMatch.Services/PlaylistManager.cs
index 94023e4..5e84d21 100644
--- a/LongoMatch.Services/PlaylistManager.cs
+++ b/LongoMatch.Services/PlaylistManager.cs
@@ -262,7 +262,7 @@ namespace LongoMatch.Services
evt = (loadedElement as PlaylistPlayElement).Play;
}
if (evt != null) {
- Config.EventsBroker.EmitDrawFrame (evt, -1,
player.CamerasVisible [0], true);
+ Config.EventsBroker.EmitDrawFrame (evt, -1,
player.CamerasConfig [0].Index, true);
}
return;
case KeyAction.TogglePlay:
diff --git a/LongoMatch.Services/RenderingJobsManager.cs b/LongoMatch.Services/RenderingJobsManager.cs
index 8ed83fc..2015c29 100644
--- a/LongoMatch.Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/RenderingJobsManager.cs
@@ -244,10 +244,10 @@ namespace LongoMatch.Services
Log.Debug (String.Format ("Adding segment with {0} drawings", play.Drawings.Count));
lastTS = play.Start;
- if (element.CamerasVisible.Count == 0) {
+ if (element.CamerasConfig.Count == 0) {
cameraIndex = 0;
} else {
- cameraIndex = element.CamerasVisible [0];
+ cameraIndex = element.CamerasConfig [0].Index;
}
if (cameraIndex >= element.FileSet.Count) {
Log.Error (string.Format ("Camera index={0} not matching for current fileset
count={1}",
diff --git a/Tests/Core/Store/Playlists/TestPlaylistPlayElement.cs
b/Tests/Core/Store/Playlists/TestPlaylistPlayElement.cs
index 4ef613e..dbd06d8 100644
--- a/Tests/Core/Store/Playlists/TestPlaylistPlayElement.cs
+++ b/Tests/Core/Store/Playlists/TestPlaylistPlayElement.cs
@@ -33,7 +33,7 @@ namespace Tests.Core.Store.Playlists
evt.Start = new Time (1000);
evt.Stop = new Time (2000);
evt.CamerasLayout = 1;
- evt.CamerasVisible.Add (0);
+ evt.CamerasConfig.Add (new CameraConfig (0));
PlaylistPlayElement element = new PlaylistPlayElement (evt);
Utils.CheckSerialization (element);
@@ -44,7 +44,7 @@ namespace Tests.Core.Store.Playlists
Assert.AreEqual (element.Rate, element2.Rate);
Assert.AreEqual (element.RateString, element2.RateString);
Assert.AreEqual (element.Title, element2.Title);
- Assert.AreEqual (new List<int> { 0 }, element2.CamerasVisible);
+ Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0) },
element2.CamerasConfig);
Assert.AreEqual (element.CamerasLayout, element2.CamerasLayout);
}
@@ -55,13 +55,13 @@ namespace Tests.Core.Store.Playlists
evt.Start = new Time (1000);
evt.Stop = new Time (2000);
evt.CamerasLayout = 1;
- evt.CamerasVisible = new List<int> { 2, 4 };
+ evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (2), new CameraConfig
(4) };
PlaylistPlayElement element = new PlaylistPlayElement (evt);
Assert.AreEqual (evt.Duration, element.Duration);
Assert.AreEqual (evt.CamerasLayout, element.CamerasLayout);
- Assert.AreEqual (evt.CamerasVisible, element.CamerasVisible);
+ Assert.AreEqual (evt.CamerasConfig, element.CamerasConfig);
Assert.AreEqual (evt.Rate, element.Rate);
Assert.AreEqual (evt.Name, element.Title);
}
diff --git a/Tests/Core/Store/TestTimelineEvent.cs b/Tests/Core/Store/TestTimelineEvent.cs
index a9dbb5b..22d03d5 100644
--- a/Tests/Core/Store/TestTimelineEvent.cs
+++ b/Tests/Core/Store/TestTimelineEvent.cs
@@ -74,7 +74,7 @@ namespace Tests.Core.Store
Assert.AreEqual (p.Start, newp.Start);
Assert.AreEqual (p.Stop, newp.Stop);
Assert.AreEqual (p.Rate, newp.Rate);
- Assert.AreEqual (p.CamerasVisible, new List<int> { 0 });
+ Assert.AreEqual (p.CamerasConfig, new List<CameraConfig> { new CameraConfig (0) });
Assert.IsNull (p.CamerasLayout);
}
diff --git a/Tests/Services/TestPlayerController.cs b/Tests/Services/TestPlayerController.cs
index 185faf0..6a11685 100644
--- a/Tests/Services/TestPlayerController.cs
+++ b/Tests/Services/TestPlayerController.cs
@@ -69,7 +69,7 @@ namespace Tests.Services
mfs.Add (new MediaFile { FilePath = "test2", VideoWidth = 320, VideoHeight = 240, Par
= 1 });
evt = new TimelineEvent { Start = new Time (100), Stop = new Time (200),
- CamerasVisible = new List<int> { 0 }
+ CamerasConfig = new List<CameraConfig> { new CameraConfig (0) }
};
plImage = new PlaylistImage (Utils.LoadImageFromFile (), new Time (5));
playlist = new Playlist ();
@@ -95,7 +95,7 @@ namespace Tests.Services
void PreparePlayer (bool readyToSeek = true)
{
- player.CamerasVisible = new List<int> { 0, 1 };
+ player.CamerasConfig = new List<CameraConfig> { new CameraConfig (0), new
CameraConfig (1) };
viewPortMock = new Mock <IViewPort> ();
viewPortMock.SetupAllProperties ();
player.ViewPorts = new List<IViewPort> { viewPortMock.Object, viewPortMock.Object };
@@ -562,24 +562,24 @@ namespace Tests.Services
// Load
player.LoadEvent (mfs, evt, evt.Start, true);
Assert.AreEqual (1, elementLoaded);
- Assert.AreEqual (evt.CamerasVisible, player.CamerasVisible);
+ Assert.AreEqual (evt.CamerasConfig, player.CamerasConfig);
// Unload
player.UnloadCurrentEvent ();
Assert.AreEqual (0, elementLoaded);
// Check that cameras have been restored
- Assert.AreEqual (new List<int> { 0, 1 }, player.CamerasVisible);
+ Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (1)
}, player.CamerasConfig);
/* Change again the cameras visible */
- player.CamerasVisible = new List<int> { 2, 3 };
- Assert.AreEqual (evt.CamerasVisible, new List <int> { 0 });
+ player.CamerasConfig = new List<CameraConfig> { new CameraConfig (2), new
CameraConfig (3) };
+ Assert.AreEqual (evt.CamerasConfig, new List <CameraConfig> { new CameraConfig (0) });
player.LoadEvent (mfs, evt, evt.Start, true);
Assert.AreEqual (1, elementLoaded);
- Assert.AreEqual (evt.CamerasVisible, player.CamerasVisible);
+ Assert.AreEqual (evt.CamerasConfig, player.CamerasConfig);
/* And unload */
player.UnloadCurrentEvent ();
Assert.AreEqual (0, elementLoaded);
// Check that cameras have been restored
- Assert.AreEqual (new List<int> { 2, 3 }, player.CamerasVisible);
+ Assert.AreEqual (new List<CameraConfig> { new CameraConfig (2), new CameraConfig (3)
}, player.CamerasConfig);
}
[Test ()]
@@ -587,25 +587,30 @@ namespace Tests.Services
{
// Create an event referencing unknown MediaFiles in the set.
TimelineEvent evt2 = new TimelineEvent { Start = new Time (150), Stop = new Time
(200),
- CamerasVisible = new List<int> { 0, 1, 4, 6 }
+ CamerasConfig = new List<CameraConfig> {
+ new CameraConfig (0),
+ new CameraConfig (1),
+ new CameraConfig (4),
+ new CameraConfig (6)
+ }
};
- player.CamerasVisible = new List<int> { 1, 0 };
+ player.CamerasConfig = new List<CameraConfig> { new CameraConfig (1), new
CameraConfig (0) };
viewPortMock = new Mock <IViewPort> ();
viewPortMock.SetupAllProperties ();
player.ViewPorts = new List<IViewPort> { viewPortMock.Object, viewPortMock.Object };
player.Ready ();
player.LoadEvent (mfs, evt2, evt2.Start, true);
// Only valid cameras should be visible although no fileset was opened.
- Assert.AreEqual (2, player.CamerasVisible.Count);
- Assert.AreEqual (0, player.CamerasVisible [0]);
- Assert.AreEqual (1, player.CamerasVisible [1]);
+ Assert.AreEqual (2, player.CamerasConfig.Count);
+ Assert.AreEqual (0, player.CamerasConfig [0].Index);
+ Assert.AreEqual (1, player.CamerasConfig [1].Index);
// Again now that the fileset is opened
player.LoadEvent (mfs, evt2, evt2.Start, true);
// Only valid cameras should be visible
- Assert.AreEqual (2, player.CamerasVisible.Count);
- Assert.AreEqual (0, player.CamerasVisible [0]);
- Assert.AreEqual (1, player.CamerasVisible [1]);
+ Assert.AreEqual (2, player.CamerasConfig.Count);
+ Assert.AreEqual (0, player.CamerasConfig [0].Index);
+ Assert.AreEqual (1, player.CamerasConfig [1].Index);
}
[Test ()]
@@ -620,7 +625,7 @@ namespace Tests.Services
};
/* Not ready to seek */
- player.CamerasVisible = new List<int> { 0, 1 };
+ player.CamerasConfig = new List<CameraConfig> { new CameraConfig (0), new
CameraConfig (1) };
viewPortMock = new Mock <IViewPort> ();
viewPortMock.SetupAllProperties ();
player.ViewPorts = new List<IViewPort> { viewPortMock.Object, viewPortMock.Object };
@@ -663,7 +668,7 @@ namespace Tests.Services
/* Open another event with the same MediaFileSet and already ready to seek
* and check the cameras layout and visibility is respected */
TimelineEvent evt2 = new TimelineEvent { Start = new Time (400), Stop = new Time
(50000),
- CamerasVisible = new List<int> { 1, 0 },
+ CamerasConfig = new List<CameraConfig> { new CameraConfig (1), new
CameraConfig (0) },
CamerasLayout = "test"
};
player.LoadEvent (nfs, evt2, evt2.Start, true);
@@ -673,7 +678,7 @@ namespace Tests.Services
playerMock.Verify (p => p.Seek (evt2.Start, true, false), Times.Once ());
playerMock.Verify (p => p.Play (), Times.Once ());
playerMock.VerifySet (p => p.Rate = 1);
- Assert.AreEqual (evt2.CamerasVisible, player.CamerasVisible);
+ Assert.AreEqual (evt2.CamerasConfig, player.CamerasConfig);
Assert.AreEqual (evt2.CamerasLayout, player.CamerasLayout);
playerMock.ResetCalls ();
@@ -702,7 +707,7 @@ namespace Tests.Services
player.LoadPlaylistEvent (playlist, el1);
Assert.AreEqual (1, elementLoaded);
elementLoaded = 0;
- Assert.AreEqual (el1.CamerasVisible, player.CamerasVisible);
+ Assert.AreEqual (el1.CamerasConfig, player.CamerasConfig);
Assert.AreEqual (el1.CamerasLayout, player.CamerasLayout);
playerMock.Verify (p => p.Open (nfs [0]), Times.Once ());
playerMock.Verify (p => p.Seek (el1.Play.Start, true, false), Times.Never ());
@@ -738,7 +743,7 @@ namespace Tests.Services
player.LoadPlaylistEvent (playlist, vid);
Assert.AreNotEqual (mfs, player.FileSet);
Assert.IsTrue (player.Playing);
- Assert.AreEqual (new List<int> { 0 }, player.CamerasVisible);
+ Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0) },
player.CamerasConfig);
}
[Test ()]
@@ -803,7 +808,7 @@ namespace Tests.Services
public void TestMultiplayerCamerasConfig ()
{
TimelineEvent evt1;
- List<int> cams1, cams2;
+ List<CameraConfig> cams1, cams2;
Mock<IMultiPlayer> multiplayerMock = new Mock<IMultiPlayer> ();
mtkMock.Setup (m => m.GetMultiPlayer ()).Returns (multiplayerMock.Object);
@@ -811,64 +816,64 @@ namespace Tests.Services
PreparePlayer ();
/* Only called internally in the openning */
- cams1 = new List<int> { 0, 1 };
- cams2 = new List<int> { 1, 0 };
+ cams1 = new List<CameraConfig> { new CameraConfig (0), new CameraConfig (1) };
+ cams2 = new List<CameraConfig> { new CameraConfig (1), new CameraConfig (0) };
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ());
- Assert.AreEqual (cams1, player.CamerasVisible);
+ Assert.AreEqual (cams1, player.CamerasConfig);
- player.CamerasVisible = cams2;
+ player.CamerasConfig = cams2;
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
- Assert.AreEqual (cams2, player.CamerasVisible);
+ Assert.AreEqual (cams2, player.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Now load an event */
evt1 = new TimelineEvent { Start = new Time (100), Stop = new Time (200),
- CamerasVisible = new List<int> { 1, 1 }
+ CamerasConfig = new List<CameraConfig> { new CameraConfig (1), new
CameraConfig (1) }
};
player.LoadEvent (mfs, evt1, evt1.Start, true);
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
- Assert.AreEqual (evt1.CamerasVisible, player.CamerasVisible);
+ Assert.AreEqual (evt1.CamerasConfig, player.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Change event cams config */
- player.CamerasVisible = new List<int> { 0, 0 };
+ player.CamerasConfig = new List<CameraConfig> { new CameraConfig (0), new
CameraConfig (0) };
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
- Assert.AreEqual (new List<int> { 0, 0 }, evt1.CamerasVisible);
- Assert.AreEqual (player.CamerasVisible, evt1.CamerasVisible);
+ Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0)
}, evt1.CamerasConfig);
+ Assert.AreEqual (player.CamerasConfig, evt1.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Unload and check the original cams config is set back*/
player.UnloadCurrentEvent ();
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
- Assert.AreEqual (cams2, player.CamerasVisible);
- Assert.AreEqual (new List<int> { 0, 0 }, evt1.CamerasVisible);
+ Assert.AreEqual (cams2, player.CamerasConfig);
+ Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0)
}, evt1.CamerasConfig);
multiplayerMock.ResetCalls ();
/* And changing the config does not affects the unloaded event */
- player.CamerasVisible = cams1;
+ player.CamerasConfig = cams1;
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
- Assert.AreEqual (new List<int> { 0, 0 }, evt1.CamerasVisible);
+ Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0)
}, evt1.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Now load a playlist video */
PlaylistVideo plv = new PlaylistVideo (mfs [0]);
player.LoadPlaylistEvent (playlist, plv);
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ());
- Assert.AreEqual (new List<int> { 0 }, player.CamerasVisible);
+ Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0) },
player.CamerasConfig);
multiplayerMock.ResetCalls ();
player.UnloadCurrentEvent ();
/* Called by Open internally () */
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ());
- Assert.AreEqual (cams2, player.CamerasVisible);
+ Assert.AreEqual (cams2, player.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Now load a playlist event and make sure its config is loaded
* and not the event's one */
PlaylistPlayElement ple = new PlaylistPlayElement (evt, mfs);
- ple.CamerasVisible = cams2;
+ ple.CamerasConfig = cams2;
player.LoadPlaylistEvent (playlist, ple);
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
- Assert.AreEqual (cams2, player.CamerasVisible);
+ Assert.AreEqual (cams2, player.CamerasConfig);
multiplayerMock.ResetCalls ();
}
}
diff --git a/Tests/Services/TestRenderingJobsManager.cs b/Tests/Services/TestRenderingJobsManager.cs
index d5c289e..9c970c8 100644
--- a/Tests/Services/TestRenderingJobsManager.cs
+++ b/Tests/Services/TestRenderingJobsManager.cs
@@ -38,7 +38,7 @@ namespace Tests.Services
try {
TimelineEvent evt = p.Timeline [0];
- evt.CamerasVisible = new List<int> { 0 };
+ evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (0) };
PlaylistPlayElement element = new PlaylistPlayElement (evt,
p.Description.FileSet);
// Playlist with one event
@@ -75,7 +75,7 @@ namespace Tests.Services
renderer.CancelAllJobs ();
mock.ResetCalls ();
evt = p.Timeline [1];
- evt.CamerasVisible = new List<int> { 1 };
+ evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (1) };
element = new PlaylistPlayElement (evt, p.Description.FileSet);
playlist.Elements [0] = element;
job = new EditionJob (playlist, settings);
@@ -87,7 +87,7 @@ namespace Tests.Services
renderer.CancelAllJobs ();
mock.ResetCalls ();
evt = p.Timeline [1];
- evt.CamerasVisible = new List<int> { 2 };
+ evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (2) };
element = new PlaylistPlayElement (evt, p.Description.FileSet);
playlist.Elements [0] = element;
job = new EditionJob (playlist, settings);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]