[longomatch] Start using the new API



commit 95bb21700fdc764ba09f09438ed71e324475ef61
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Mar 20 19:31:12 2015 +0100

    Start using the new API

 LongoMatch.Core/Common/Enums.cs                    |    7 ++
 LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs  |    5 +-
 LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs       |    4 +-
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs         |  104 +++++++++++++++++++-
 LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs |    3 +-
 LongoMatch.GUI/Gui/Component/AnalysisComponent.cs  |    3 +-
 .../Gui/Component/FakeAnalysisComponent.cs         |    7 +-
 LongoMatch.Services/Services/EventsManager.cs      |    2 +-
 LongoMatch.Services/Services/PlaylistManager.cs    |   12 +-
 LongoMatch.Services/Services/ProjectsManager.cs    |    7 +-
 10 files changed, 130 insertions(+), 24 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Enums.cs b/LongoMatch.Core/Common/Enums.cs
index 2a15eaf..b1f3208 100644
--- a/LongoMatch.Core/Common/Enums.cs
+++ b/LongoMatch.Core/Common/Enums.cs
@@ -411,4 +411,11 @@ namespace LongoMatch.Core.Common
                Season,
                Competition
        }
+
+       public enum PlayerViewOperationMode
+       {
+               Synchronization,
+               LiveAnalysisReview,
+               Analysis,
+       }
 }
diff --git a/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs 
b/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
index db622f7..c359d87 100644
--- a/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
@@ -17,11 +17,8 @@
 // 
 using System;
 using System.Collections.Generic;
-
 using LongoMatch.Core.Common;
-using LongoMatch.Core.Handlers;
 using LongoMatch.Core.Store;
-using LongoMatch.Core.Store.Templates;
 
 namespace LongoMatch.Core.Interfaces.GUI
 {
@@ -59,7 +56,7 @@ namespace LongoMatch.Core.Interfaces.GUI
 
                void TagTeam (TeamType team);
 
-               IPlayerBin Player{ get; }
+               IPlayerController Player{ get; }
 
                ICapturerBin Capturer{ get; }
        }
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs b/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
index 7cff6b6..939b147 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
@@ -68,9 +68,9 @@ namespace LongoMatch.Core.Interfaces.GUI
 
                void StepBackward ();
 
-               void SeekToNextFrame ();
+               bool SeekToNextFrame ();
 
-               void SeekToPreviousFrame ();
+               bool SeekToPreviousFrame ();
 
                void FramerateUp ();
 
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index e34a66d..0a9717d 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -44,7 +44,7 @@ namespace LongoMatch.Gui
        [System.ComponentModel.Category("LongoMatch")]
        [System.ComponentModel.ToolboxItem(true)]
 
-       public partial class PlayerBin : Gtk.Bin, IPlayerBin
+       public partial class PlayerBin : Gtk.Bin, IPlayerBin, IPlayerController
        {
                struct Segment
                {
@@ -177,12 +177,16 @@ namespace LongoMatch.Gui
                        get {
                                return 0;
                        }
+                       set {
+                       }
                }
 
                public List<int> CamerasVisible {
                        get {
                                return new List<int> { 0 };
                        }
+                       set {
+                       }
                }
 
                public bool SeekingEnabled {
@@ -377,27 +381,29 @@ namespace LongoMatch.Gui
                        }
                }
 
-               public void SeekToNextFrame ()
+               public bool SeekToNextFrame ()
                {
                        if (ImageLoaded) {
-                               return;
+                               return false;
                        }
                        DrawingsVisible = false;
                        if (CurrentTime < segment.Stop) {
                                player.SeekToNextFrame ();
                                OnTick ();
                        }
+                       return true;
                }
 
-               public void SeekToPreviousFrame ()
+               public bool SeekToPreviousFrame ()
                {
                        if (ImageLoaded) {
-                               return;
+                               return false;
                        }
                        DrawingsVisible = false;
                        if (CurrentTime > segment.Start) {
                                seeker.Seek (SeekType.StepDown);
                        }
+                       return true;
                }
 
                public void StepForward ()
@@ -1044,6 +1050,94 @@ namespace LongoMatch.Gui
                                Seek (start, type == SeekType.Accurate);
                        }
                }
+
+               #endregion
+
+               #region IPlayerController Additions
+
+               public event TimeChangedHandler TimeChangedEvent;
+
+               public event StateChangeHandler PlaybackStateChangedEvent;
+
+               public event LoadImageHander LoadImageEvent;
+
+               public event PlaybackRateChangedHandler PlaybackRateChangedEvent;
+
+               public event VolumeChangedHandler VolumeChangedEvent;
+
+               public event ElementLoadedHandler ElementLoadedEvent;
+
+               public event ElementUnloadedHandler ElementUnloadedEvent;
+
+               public event PARChangedHandler PARChangedEvent;
+
+               public void LoadEvent (MediaFileSet file, TimelineEvent play, Time seekTime, bool playing)
+               {
+                       LoadPlay (file, play, seekTime, playing);
+               }
+
+               public void LoadPlayListEvent (Playlist playlist, IPlaylistElement play)
+               {
+                       LoadPlayListEvent (playlist, play);
+               }
+
+               public void UnloadCurrentEvent ()
+               {
+                       CloseSegment ();
+               }
+
+               public Time Step {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public bool IgnoreTicks {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public void Stop ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool Seek (Time time, bool accurate = false, bool synchronous = false)
+               {
+                       Seek (time, accurate);
+                       return true;
+               }
+
+               public void Expose ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public double Rate {
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public List<IntPtr> WindowHandles {
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               public IntPtr WindowHandle {
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+
                #endregion
        }
 }
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs 
b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
index 562e97c..d374d03 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
@@ -22,6 +22,7 @@ using LongoMatch.Core.Interfaces.GUI;
 using LongoMatch.Core.Common;
 using LongoMatch.Core.Store;
 using LongoMatch.Gui.Helpers;
+using LongoMatch.Core.Interfaces;
 
 namespace LongoMatch.Gui
 {
@@ -64,7 +65,7 @@ namespace LongoMatch.Gui
                        base.OnDestroyed ();
                }
 
-               public IPlayerBin Player {
+               public IPlayerController Player {
                        get {
                                return playerbin;
                        }
diff --git a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs 
b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
index bf779b8..fa03ebe 100644
--- a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
+++ b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
@@ -21,6 +21,7 @@ using LongoMatch.Core.Common;
 using LongoMatch.Core.Interfaces.GUI;
 using LongoMatch.Core.Store;
 using LongoMatch.GUI.Helpers;
+using LongoMatch.Core.Interfaces;
 
 namespace LongoMatch.Gui.Component
 {
@@ -46,7 +47,7 @@ namespace LongoMatch.Gui.Component
                        base.OnDestroyed ();
                }
 
-               public IPlayerBin Player {
+               public IPlayerController Player {
                        get {
                                return playercapturer.Player;
                        }
diff --git a/LongoMatch.GUI/Gui/Component/FakeAnalysisComponent.cs 
b/LongoMatch.GUI/Gui/Component/FakeAnalysisComponent.cs
index d61dc97..6bf4352 100644
--- a/LongoMatch.GUI/Gui/Component/FakeAnalysisComponent.cs
+++ b/LongoMatch.GUI/Gui/Component/FakeAnalysisComponent.cs
@@ -16,10 +16,11 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 //
 using System;
+using System.Collections.Generic;
+using LongoMatch.Core.Common;
+using LongoMatch.Core.Interfaces;
 using LongoMatch.Core.Interfaces.GUI;
 using LongoMatch.Core.Store;
-using LongoMatch.Core.Common;
-using System.Collections.Generic;
 
 namespace LongoMatch.Gui.Component
 {
@@ -107,7 +108,7 @@ namespace LongoMatch.Gui.Component
                        codingwidget1.TagTeam (team);
                }
 
-               public IPlayerBin Player {
+               public IPlayerController Player {
                        get {
                                return null;
                        }
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index a90ae7e..b6172ef 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -42,7 +42,7 @@ namespace LongoMatch.Services
                EventsFilter filter;
                IGUIToolkit guiToolkit;
                IAnalysisWindow analysisWindow;
-               IPlayerBin player;
+               IPlayerController player;
                ICapturerBin capturer;
                IFramesCapturer framesCapturer;
                IRenderingJobsManager renderer;
diff --git a/LongoMatch.Services/Services/PlaylistManager.cs b/LongoMatch.Services/Services/PlaylistManager.cs
index af1e970..2423181 100644
--- a/LongoMatch.Services/Services/PlaylistManager.cs
+++ b/LongoMatch.Services/Services/PlaylistManager.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Services
        public class PlaylistManager
        {
                IGUIToolkit guiToolkit;
-               IPlayerBin player;
+               IPlayerController player;
                IRenderingJobsManager videoRenderer;
                Project openedProject;
                ProjectType openedProjectType;
@@ -68,14 +68,14 @@ namespace LongoMatch.Services
                void LoadPlay (TimelineEvent play, Time seekTime, bool playing)
                {
                        play.Selected = true;
-                       player.LoadPlay (openedProject.Description.FileSet, play,
-                                        seekTime, playing);
+                       player.LoadEvent (openedProject.Description.FileSet, play,
+                               seekTime, playing);
                        loadedPlay = play;
                        if (playing) {
                                player.Play ();
                        }
                }
-               
+
                void Switch (TimelineEvent play, Playlist playlist, IPlaylistElement element)
                {
                        if (loadedElement != null) {
@@ -122,7 +122,7 @@ namespace LongoMatch.Services
                        if (element != null) {
                                playlist.SetActive (element);
                        }
-                       player.LoadPlayListPlay (playlist, element);
+                       player.LoadPlayListEvent (playlist, element);
                }
 
                void HandleLoadPlayEvent (TimelineEvent play)
@@ -137,7 +137,7 @@ namespace LongoMatch.Services
                                if (play != null) {
                                        LoadPlay (play, play.Start, true);
                                } else {
-                                       player.CloseSegment ();
+                                       player.UnloadCurrentEvent ();
                                }
                                Config.EventsBroker.EmitEventLoaded (play);
                        }
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index da2dfd9..677ab5a 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -74,7 +74,7 @@ namespace LongoMatch.Services
                        get;
                }
 
-               public IPlayerBin Player {
+               public IPlayerController Player {
                        get;
                        set;
                }
@@ -170,9 +170,14 @@ namespace LongoMatch.Services
                                
                        PlaysFilter = new EventsFilter (project);
                        project.CleanupTimers ();
+                       /* FIXME: the controller is created here and passed to the view
+                        * Player = new PlayerController ();
+                        * analysisWindow.Player = Player;
+                       */
                        guiToolkit.OpenProject (project, projectType, props, PlaysFilter,
                                out analysisWindow);
                        Player = analysisWindow.Player;
+                       /* FIXME: CapturerBin should be also split into controller + view */
                        Capturer = analysisWindow.Capturer;
                        OpenedProject = project;
                        OpenedProjectType = projectType;


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