[longomatch] Handle correctly invalid camera configurations



commit d4053d4696f7db2bbdba4a4e3463f57b357ced2d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Apr 9 15:23:31 2015 +0200

    Handle correctly invalid camera configurations

 .../Gui/Utils/FramesCapturer.cs                    |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs 
b/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
index a08b69b..606fb09 100644
--- a/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
@@ -86,17 +86,26 @@ 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) {
+                       if (evt.CamerasVisible.Count == 0 || fileSet.Count == 1) {
                                cameras = new List<int> { 0 };
                        } else {
                                cameras = evt.CamerasVisible;
                        }
+
                        foreach (int cameraIndex in cameras) {
+                               MediaFile file;
+
                                if (quit) {
                                        break;
                                }
                                Log.Debug ("Start frames series capture for angle " + cameraIndex);
-                               MediaFile file = fileSet.First ();
+                               try {
+                                       file = fileSet [cameraIndex];
+                               } catch (Exception ex) {
+                                       Log.Exception (ex);
+                                       Log.Error (string.Format ("Camera index {0} not found in fileset", 
cameraIndex));
+                                       continue;
+                               }
                                capturer.Open (file.FilePath);
                                pos = new Time { MSeconds = start.MSeconds };
                                if (Progress != null) {


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