[longomatch] Use a HashSet for the active view to avoid duplicates



commit f97f4a0803035be1c83b1fb1001a0c69747261f5
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Oct 10 22:39:54 2014 +0200

    Use a HashSet for the active view to avoid duplicates

 .../Store/Playlists/PlaylistPlayElement.cs         |    4 ++--
 LongoMatch.Core/Store/TimelineEvent.cs             |    4 ++--
 .../Services/RenderingJobsManager.cs               |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs 
b/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
index ad60d0c..7637e77 100644
--- a/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
+++ b/LongoMatch.Core/Store/Playlists/PlaylistPlayElement.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Core.Store.Playlists
                        Play = play;
                        Title = play.Name;
                        Rate = play.Rate;
-                       Angles = play.ActiveViews.ToList ();
+                       Angles = new HashSet<MediaFileAngle> (play.ActiveViews);
                        FileSet = fileset;
                }
 
@@ -61,7 +61,7 @@ namespace LongoMatch.Core.Store.Playlists
                        set;
                }
 
-               public List<MediaFileAngle> Angles {
+               public HashSet<MediaFileAngle> Angles {
                        get;
                        set;
                }
diff --git a/LongoMatch.Core/Store/TimelineEvent.cs b/LongoMatch.Core/Store/TimelineEvent.cs
index a9da6c0..a57365c 100644
--- a/LongoMatch.Core/Store/TimelineEvent.cs
+++ b/LongoMatch.Core/Store/TimelineEvent.cs
@@ -43,7 +43,7 @@ namespace LongoMatch.Core.Store
                        Tags = new List<Tag> ();
                        Rate = 1.0f;
                        ID = Guid.NewGuid ();
-                       ActiveViews = new List<MediaFileAngle>();
+                       ActiveViews = new HashSet<MediaFileAngle>();
                        ActiveViews.Add (MediaFileAngle.Angle1);
                }
                #endregion
@@ -142,7 +142,7 @@ namespace LongoMatch.Core.Store
                        set;
                }
 
-               public List<MediaFileAngle> ActiveViews {
+               public HashSet<MediaFileAngle> ActiveViews {
                        get;
                        set;
                }
diff --git a/LongoMatch.Services/Services/RenderingJobsManager.cs 
b/LongoMatch.Services/Services/RenderingJobsManager.cs
index ebbba36..2aa51f6 100644
--- a/LongoMatch.Services/Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/Services/RenderingJobsManager.cs
@@ -234,8 +234,8 @@ namespace LongoMatch.Services
                        
                        lastTS = play.Start;
                        /* FIXME: for now we only support rendering the first angle in the list */
-                       file = element.FileSet.GetAngle (element.Angles[0]);
-                       drawings = play.Drawings.Where (d => d.Angle == element.Angles[0]);
+                       file = element.FileSet.GetAngle (element.Angles.FirstOrDefault ());
+                       drawings = play.Drawings.Where (d => d.Angle == element.Angles.FirstOrDefault ());
                        foreach (FrameDrawing fd in drawings) {
                                if (fd.Render < play.Start || fd.Render > play.Stop) {
                                        Log.Warning ("Drawing is not in the segments boundaries " +


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