[longomatch] Use the current player to get frames when possible



commit d4fa2ed78b6660032bd17250777a2ecc1428e1a7
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Oct 5 15:49:04 2014 +0200

    Use the current player to get frames when possible

 LongoMatch.Core/Common/EventsBroker.cs             |    4 ++--
 LongoMatch.Core/Handlers/Multimedia.cs             |    2 +-
 LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs       |    1 -
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs         |    7 +------
 LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs |    9 ---------
 LongoMatch.GUI/Gui/Menu/PlaysMenu.cs               |    3 ++-
 LongoMatch.Services/Services/EventsManager.cs      |    9 +++++----
 .../Services/RenderingJobsManager.cs               |    2 +-
 8 files changed, 12 insertions(+), 25 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index 2a05721..0e6827a 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -353,10 +353,10 @@ namespace LongoMatch.Core.Common
                        }
                }
 
-               public void EmitDrawFrame (TimelineEvent play, int drawingIndex)
+               public void EmitDrawFrame (TimelineEvent play, int drawingIndex, MediaFileAngle angle, bool 
current)
                {
                        if (DrawFrame != null) {
-                               DrawFrame (play, drawingIndex);
+                               DrawFrame (play, drawingIndex, angle, current);
                        }
                }
 
diff --git a/LongoMatch.Core/Handlers/Multimedia.cs b/LongoMatch.Core/Handlers/Multimedia.cs
index 71b4a45..5de6447 100644
--- a/LongoMatch.Core/Handlers/Multimedia.cs
+++ b/LongoMatch.Core/Handlers/Multimedia.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Core.Handlers
        public delegate void PrevButtonClickedHandler();
        public delegate void ProgressHandler(float progress);
        public delegate void FramesProgressHandler(int actual, int total, Image frame);
-       public delegate void DrawFrameHandler (TimelineEvent play, int drawingIndex);
+       public delegate void DrawFrameHandler (TimelineEvent play, int drawingIndex, MediaFileAngle angle, 
bool current);
        public delegate void EllpasedTimeHandler(Time ellapsedTime);
        public delegate void PlaybackRateChangedHandler (float rate);
        
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs b/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
index 8ba29d3..faba7fc 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
@@ -36,7 +36,6 @@ namespace LongoMatch.Core.Interfaces.GUI
                bool SeekingEnabled {set;}
                bool Sensitive {set; get;}
                bool Playing { get; }
-               IFramesCapturer FramesCapturer {get;set;}
 
                void Open (MediaFileSet fileSet);
                void Close();
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 5efeb21..d8a24a1 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -143,11 +143,6 @@ namespace LongoMatch.Gui
                        }
                }
 
-               public IFramesCapturer FramesCapturer {
-                       get;
-                       set;
-               }
-               
                public Image CurrentMiniatureFrame {
                        get {
                                return player.GetCurrentFrame (THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_WIDTH);
@@ -828,7 +823,7 @@ namespace LongoMatch.Gui
 
                void OnDrawButtonClicked (object sender, System.EventArgs e)
                {
-                       Config.EventsBroker.EmitDrawFrame (null, -1);
+                       Config.EventsBroker.EmitDrawFrame (null, -1, angle, true);
                }
 
                void HandleReady (object sender, EventArgs e)
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs 
b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
index d13d756..8cf370c 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
@@ -167,15 +167,6 @@ namespace LongoMatch.Gui
                        }
                }
                
-               public IFramesCapturer FramesCapturer {
-                       set {
-                               playerbin.FramesCapturer = value;
-                       }
-                       get {
-                               return playerbin.FramesCapturer;
-                       }
-               }
-               
                public bool SeekingEnabled {
                        set {
                                playerbin.SeekingEnabled = value;
diff --git a/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs b/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
index 97248f8..cbb6a42 100644
--- a/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
+++ b/LongoMatch.GUI/Gui/Menu/PlaysMenu.cs
@@ -137,7 +137,8 @@ namespace LongoMatch.Gui.Menus
                                        drawingMenu.Append (editItem);
                                        drawingMenu.Append (deleteItem);
                                        editItem.Activated += (sender, e) => {
-                                               Config.EventsBroker.EmitDrawFrame (plays [0], index);
+                                               Config.EventsBroker.EmitDrawFrame (plays [0], index,
+                                                                                  
plays[0].Drawings[index].Angle, false);
                                        }; 
                                        deleteItem.Activated += (sender, e) => {
                                                plays [0].Drawings.RemoveAt (index);
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index 75b4edb..4c7c371 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -74,7 +74,6 @@ namespace LongoMatch.Services
                        }
                        this.analysisWindow = analysisWindow;
                        player = analysisWindow.Player;
-                       player.FramesCapturer = framesCapturer;
                        capturer = analysisWindow.Capturer;
                }
 
@@ -148,7 +147,7 @@ namespace LongoMatch.Services
                        guiToolkit.ShowProjectStats (project);
                }
 
-               void HandleDrawFrame (TimelineEvent play, int drawingIndex)
+               void HandleDrawFrame (TimelineEvent play, int drawingIndex, MediaFileAngle angle, bool 
current)
                {
                        Image pixbuf;
                        FrameDrawing drawing = null;
@@ -162,6 +161,7 @@ namespace LongoMatch.Services
                                if (drawingIndex == -1) {
                                        drawing = new FrameDrawing ();
                                        drawing.Render = player.CurrentTime;
+                                       drawing.Angle = angle;
                                } else {
                                        drawing = play.Drawings [drawingIndex];
                                }
@@ -170,8 +170,9 @@ namespace LongoMatch.Services
                                pos = player.CurrentTime;
                        }
 
-                       if (framesCapturer != null) {
-                               pixbuf = framesCapturer.GetFrame (pos, true, -1, -1);
+                       if (framesCapturer != null && !current) {
+                               Time offset = openedProject.Description.FileSet.GetAngle (angle).Offset;
+                               pixbuf = framesCapturer.GetFrame (pos + offset, true, -1, -1);
                        } else {
                                pixbuf = player.CurrentFrame;
                        }
diff --git a/LongoMatch.Services/Services/RenderingJobsManager.cs 
b/LongoMatch.Services/Services/RenderingJobsManager.cs
index 6dabce2..ebbba36 100644
--- a/LongoMatch.Services/Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/Services/RenderingJobsManager.cs
@@ -235,7 +235,7 @@ 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.Angles.Contains (element.Angles[0]));
+                       drawings = play.Drawings.Where (d => d.Angle == element.Angles[0]);
                        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]