[longomatch] Sanitize interfaces and event handlers



commit e6cc523205f526aaf74ff36c331ca7bf8796e9bc
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Apr 11 02:01:40 2014 +0200

    Sanitize interfaces and event handlers

 LongoMatch.Core/Handlers/Multimedia.cs             |   15 ++++----
 LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs  |    4 +-
 .../GUI/{ICapturer.cs => ICapturerBin.cs}          |    2 +-
 .../Interfaces/GUI/{IPlayer.cs => IPlayerBin.cs}   |    2 +-
 .../Interfaces/Multimedia}/ICapturer.cs            |    4 +-
 .../Interfaces/Multimedia}/IPlayer.cs              |    6 ++--
 LongoMatch.Core/LongoMatch.Core.mdp                |    6 ++-
 LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs       |   20 ++++++-----
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs         |   36 +++++++++----------
 LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs |   18 +++++-----
 .../Gui/Utils/FramesCapturer.cs                    |    1 +
 LongoMatch.GUI.Multimedia/Gui/Utils/Remuxer.cs     |    2 +-
 LongoMatch.GUI/Gui/Component/AnalysisComponent.cs  |    8 ++--
 LongoMatch.GUI/LongoMatch.GUI.mdp                  |    2 +-
 LongoMatch.Multimedia/Capturer/FakeCapturer.cs     |    7 ++--
 .../Capturer/GstCameraCapturer.cs                  |   31 ++++++++++++----
 LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs  |    4 ++-
 LongoMatch.Multimedia/Common/Handlers.cs           |   12 +++---
 .../Converter/GstVideoConverter.cs                 |    8 ++--
 LongoMatch.Multimedia/Editor/GstVideoSplitter.cs   |    6 ++--
 LongoMatch.Multimedia/LongoMatch.Multimedia.mdp    |   11 ++----
 LongoMatch.Multimedia/Player/GstPlayer.cs          |   35 ++++++++++++++++---
 LongoMatch.Multimedia/Remuxer/GstRemuxer.cs        |    8 ++--
 LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs       |    3 +-
 LongoMatch.Multimedia/Utils/PreviewMediaFile.cs    |    1 -
 LongoMatch.Services/Services/EventsManager.cs      |    4 +-
 LongoMatch.Services/Services/GameUnitsManager.cs   |    2 +-
 LongoMatch.Services/Services/PlaylistManager.cs    |    2 +-
 LongoMatch.Services/Services/ProjectsManager.cs    |    4 +-
 .../Services/RenderingJobsManager.cs               |    2 +-
 30 files changed, 153 insertions(+), 113 deletions(-)
---
diff --git a/LongoMatch.Core/Handlers/Multimedia.cs b/LongoMatch.Core/Handlers/Multimedia.cs
index 7ddce57..e30b851 100644
--- a/LongoMatch.Core/Handlers/Multimedia.cs
+++ b/LongoMatch.Core/Handlers/Multimedia.cs
@@ -35,11 +35,12 @@ namespace LongoMatch.Handlers
        public delegate void DrawFrameHandler(Time time);
        public delegate void EllpasedTimeHandler(Time ellapsedTime);
        public delegate void PlaybackRateChangedHandler (float rate);
-
-
-       public delegate void ErrorHandler(object o, string message);
-       public delegate void PercentCompletedHandler(object o, float percent);
-       public delegate void StateChangeHandler(object o, bool playing);
-       public delegate void TickHandler(object o, Time currentTime, Time streamLength,
-               double currentPosition);
+       
+       public delegate void DeviceChangeHandler(int deviceID);
+       public delegate void ErrorHandler(string message);
+       public delegate void PercentCompletedHandler(float percent);
+       public delegate void StateChangeHandler(bool playing);
+       public delegate void TickHandler(Time currentTime, Time streamLength, double currentPosition);
+       public delegate void EosHandler();
+       public delegate void ReadyToSeekHandler();
 }
diff --git a/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs 
b/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
index 1674e9a..0372497 100644
--- a/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
@@ -76,8 +76,8 @@ namespace LongoMatch.Interfaces.GUI
                bool PlaylistVisible {set;}
                VideoAnalysisMode AnalysisMode {set;}
                
-               IPlayer Player{get;}
-               ICapturer Capturer{get;}
+               IPlayerBin Player{get;}
+               ICapturerBin Capturer{get;}
                IPlaylistWidget Playlist{get;}
                ITemplatesService TemplatesService{set;}
        }
diff --git a/LongoMatch.Core/Interfaces/GUI/ICapturer.cs b/LongoMatch.Core/Interfaces/GUI/ICapturerBin.cs
similarity index 97%
rename from LongoMatch.Core/Interfaces/GUI/ICapturer.cs
rename to LongoMatch.Core/Interfaces/GUI/ICapturerBin.cs
index 1f5d338..264cbf6 100644
--- a/LongoMatch.Core/Interfaces/GUI/ICapturer.cs
+++ b/LongoMatch.Core/Interfaces/GUI/ICapturerBin.cs
@@ -23,7 +23,7 @@ using LongoMatch.Store;
 
 namespace LongoMatch.Interfaces.GUI
 {
-       public interface ICapturer
+       public interface ICapturerBin
        {
                event EventHandler CaptureFinished;
                event ErrorHandler Error;
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlayer.cs b/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
similarity index 98%
rename from LongoMatch.Core/Interfaces/GUI/IPlayer.cs
rename to LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
index f06ad09..a28fad8 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlayer.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IPlayerBin.cs
@@ -22,7 +22,7 @@ using LongoMatch.Store;
 
 namespace LongoMatch.Interfaces.GUI
 {
-       public interface IPlayer
+       public interface IPlayerBin
        {
                event SegmentClosedHandler SegmentClosedEvent;
                event TickHandler Tick;
diff --git a/LongoMatch.Multimedia/Interfaces/ICapturer.cs 
b/LongoMatch.Core/Interfaces/Multimedia/ICapturer.cs
similarity index 94%
rename from LongoMatch.Multimedia/Interfaces/ICapturer.cs
rename to LongoMatch.Core/Interfaces/Multimedia/ICapturer.cs
index 3256317..892f70c 100644
--- a/LongoMatch.Multimedia/Interfaces/ICapturer.cs
+++ b/LongoMatch.Core/Interfaces/Multimedia/ICapturer.cs
@@ -20,11 +20,11 @@
 
 using System;
 using LongoMatch.Common;
-using LongoMatch.Video.Common;
 using LongoMatch.Store;
 using Image = LongoMatch.Common.Image;
+using LongoMatch.Handlers;
 
-namespace LongoMatch.Multimedia.Interfaces
+namespace LongoMatch.Interfaces.Multimedia
 {
 
 
diff --git a/LongoMatch.Multimedia/Interfaces/IPlayer.cs b/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
similarity index 92%
rename from LongoMatch.Multimedia/Interfaces/IPlayer.cs
rename to LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
index a69d397..f6c21be 100644
--- a/LongoMatch.Multimedia/Interfaces/IPlayer.cs
+++ b/LongoMatch.Core/Interfaces/Multimedia/IPlayer.cs
@@ -19,12 +19,12 @@
 //
 
 using System;
-using LongoMatch.Video.Common;
 using LongoMatch.Store;
+using LongoMatch.Handlers;
 using Image = LongoMatch.Common.Image;
 
 
-namespace LongoMatch.Multimedia.Interfaces
+namespace LongoMatch.Interfaces.Multimedia
 {
        public interface IPlayer
        {
@@ -33,7 +33,7 @@ namespace LongoMatch.Multimedia.Interfaces
                event         System.EventHandler Eos;
                event         StateChangeHandler StateChange;
                event         TickHandler Tick;
-               event         System.EventHandler ReadyToSeek;
+               event         ReadyToSeekHandler ReadyToSeek;
 
                Time StreamLength {get;}
                Time CurrentTime {get;}
diff --git a/LongoMatch.Core/LongoMatch.Core.mdp b/LongoMatch.Core/LongoMatch.Core.mdp
index 8c742eb..a2aad3d 100644
--- a/LongoMatch.Core/LongoMatch.Core.mdp
+++ b/LongoMatch.Core/LongoMatch.Core.mdp
@@ -72,10 +72,10 @@
     <File subtype="Code" buildaction="Compile" name="Interfaces/ITimelineNode.cs" />
     <File subtype="Directory" buildaction="Compile" name="Interfaces/GUI" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IRenderingStateBar.cs" />
-    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IPlayer.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IPlayerBin.cs" />
     <File subtype="Code" buildaction="Compile" name="Handlers/Multimedia.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IAnalysisWindow.cs" />
-    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/ICapturer.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/ICapturerBin.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IPlaylistWidget.cs" />
     <File subtype="Directory" buildaction="Compile" name="Interfaces" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IGUIToolkit.cs" />
@@ -114,6 +114,8 @@
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/half_field_background.svg" />
     <File subtype="Code" buildaction="Compile" name="Utils.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IPanel.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/Multimedia/ICapturer.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/Multimedia/IPlayer.cs" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
index 93c3e71..7bf83fb 100644
--- a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
@@ -25,6 +25,7 @@ using Image = LongoMatch.Common.Image;
 using LongoMatch.Common;
 using LongoMatch.Handlers;
 using LongoMatch.Interfaces.GUI;
+using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Gui.Helpers;
 using LongoMatch.Video;
 using LongoMatch.Video.Common;
@@ -32,6 +33,7 @@ using LongoMatch.Video.Capturer;
 using LongoMatch.Video.Utils;
 using Mono.Unix;
 using LongoMatch.Store;
+using LongoMatch.Multimedia.Utils;
 
 namespace LongoMatch.Gui
 {
@@ -39,16 +41,16 @@ namespace LongoMatch.Gui
 
        [System.ComponentModel.Category("CesarPlayer")]
        [System.ComponentModel.ToolboxItem(true)]
-       public partial class CapturerBin : Gtk.Bin, ICapturer
+       public partial class CapturerBin : Gtk.Bin, ICapturerBin
        {
                public event EventHandler CaptureFinished;
-               public event LongoMatch.Handlers.ErrorHandler Error;
+               public event ErrorHandler Error;
 
                Image logopix;
                CaptureSettings settings;
                CapturerType type;
                bool captureStarted, capturing, delayStart;
-               LongoMatch.Multimedia.Interfaces.ICapturer capturer;
+               ICapturer capturer;
 
                public CapturerBin()
                {
@@ -154,7 +156,7 @@ namespace LongoMatch.Gui
                        recbutton.Visible = true;
                        captureStarted = false;
                        capturing = false;
-                       OnTick(0);
+                       OnTick(new Time (0));
 
                        if(capturer == null)
                                return;
@@ -246,23 +248,23 @@ namespace LongoMatch.Gui
                        }
                }
                
-               protected virtual void OnTick(int ellapsedTime) {
+               protected virtual void OnTick(Time ellapsedTime) {
                        timelabel.Markup = String.Format("<span font=\"20px bold\">Time --> {0}</span> ", 
                                                         CurrentTime.ToSecondsString());
                }
 
-               protected virtual void OnError(object o, ErrorArgs args)
+               protected virtual void OnError(string message)
                {
                        if(Error != null)
-                               Error(o, args.Message);
+                               Error(message);
                        Close();
                }
 
-               protected virtual void OnDeviceChange(object o, DeviceChangeArgs args)
+               protected virtual void OnDeviceChange(int deviceID)
                {
                        string msg;
                        /* device disconnected, pause capture */
-                       if(args.DeviceChange == -1) {
+                       if(deviceID == -1) {
                                if(capturing)
                                        TogglePause();
 
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 20302fb..0933452 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -26,12 +26,13 @@ using System.Runtime.InteropServices;
 using Image = LongoMatch.Common.Image;
 using LongoMatch.Handlers;
 using LongoMatch.Interfaces.GUI;
-using LongoMatch.Multimedia.Interfaces;
+using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Video;
 using LongoMatch.Video.Common;
 using LongoMatch.Video.Player;
 using LongoMatch.Video.Utils;
 using LongoMatch.Store;
+using LongoMatch.Multimedia.Utils;
 
 
 namespace LongoMatch.Gui
@@ -39,7 +40,7 @@ namespace LongoMatch.Gui
        [System.ComponentModel.Category("LongoMatch")]
        [System.ComponentModel.ToolboxItem(true)]
 
-       public partial class PlayerBin : Gtk.Bin, LongoMatch.Interfaces.GUI.IPlayer
+       public partial class PlayerBin : Gtk.Bin, LongoMatch.Interfaces.GUI.IPlayerBin
        {
                struct Segment {
                        public Time Start;
@@ -59,8 +60,8 @@ namespace LongoMatch.Gui
 
                const int THUMBNAIL_MAX_WIDTH = 100;
                const int SCALE_FPS = 25;
-               LongoMatch.Video.Common.TickHandler tickHandler;
-               LongoMatch.Multimedia.Interfaces.IPlayer player;
+               TickHandler tickHandler;
+               IPlayer player;
                Time length;
                bool seeking, IsPlayingPrevState, muted, emitRateScale, readyToSeek;
                string filename;
@@ -78,7 +79,7 @@ namespace LongoMatch.Gui
                        this.Build();
                        vwin = new VolumeWindow();
                        vwin.VolumeChanged += new VolumeChangedHandler(OnVolumeChanged);
-                       tickHandler = new LongoMatch.Video.Common.TickHandler(OnTick);
+                       tickHandler = new TickHandler(OnTick);
                        controlsbox.Visible = false;
                        UnSensitive();
                        timescale.Adjustment.PageIncrement = 0.01;
@@ -385,13 +386,13 @@ namespace LongoMatch.Gui
                #endregion
 
                #region Callbacks
-               void HandleExposeEvent (object o, ExposeEventArgs args)
+               void HandleExposeEvent (object sender, ExposeEventArgs args)
                {
                        player.Expose();
                }
                
-               void OnStateChanged(object o, StateChangeArgs args) {
-                       if(args.Playing) {
+               void OnStateChanged(bool playing) {
+                       if(playing) {
                                playbutton.Hide();
                                pausebutton.Show();
                        }
@@ -400,10 +401,10 @@ namespace LongoMatch.Gui
                                pausebutton.Hide();
                        }
                        if(PlayStateChanged != null)
-                               PlayStateChanged(this,args.Playing);
+                               PlayStateChanged(playing);
                }
 
-               void OnReadyToSeek(object o, EventArgs args) {
+               void OnReadyToSeek() {
                        readyToSeek = true;
                        if(pendingSeek != null) {
                                player.Rate = (float) pendingSeek [2];
@@ -413,10 +414,7 @@ namespace LongoMatch.Gui
                        }
                }
 
-               void OnTick (object o, TickArgs args) {
-                       Time currentTime = args.CurrentTime;
-                       Time streamLength = args.StreamLength;
-                       double currentposition = args.CurrentPosition;
+               void OnTick (Time currentTime, Time streamLength, double currentPosition) {
                        string slength;
 
                        if (length != streamLength) {
@@ -429,7 +427,7 @@ namespace LongoMatch.Gui
                                        player.Pause ();
                                }
                                currentTime -= segment.Start;
-                               currentposition = (float)currentTime.MSeconds/(float)(duration.MSeconds);
+                               currentPosition = (float)currentTime.MSeconds/(float)(duration.MSeconds);
                                slength = duration.ToMSecondsString();
                                
                        } else {
@@ -437,9 +435,9 @@ namespace LongoMatch.Gui
                        }
 
                        timelabel.Text = currentTime.ToMSecondsString() + "/" + slength;
-                       timescale.Value = currentposition;
+                       timescale.Value = currentPosition;
                        if (Tick != null)
-                               Tick (o, currentTime, streamLength, currentposition);
+                               Tick (currentTime, streamLength, currentPosition);
 
                }
 
@@ -510,9 +508,9 @@ namespace LongoMatch.Gui
                        player.Pause();
                }
 
-               void OnError(object o, ErrorArgs args) {
+               void OnError(string message) {
                        if(Error != null)
-                               Error(o, args.Message);
+                               Error(message);
                }
 
                void OnClosebuttonClicked(object sender, System.EventArgs e)
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs 
b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
index ec26cd4..e35fa10 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
@@ -26,7 +26,7 @@ namespace LongoMatch.Gui
 {
        [System.ComponentModel.Category("LongoMatch")]
        [System.ComponentModel.ToolboxItem(true)]
-       public partial class PlayerCapturerBin : Gtk.Bin, IPlayer, ICapturer
+       public partial class PlayerCapturerBin : Gtk.Bin, IPlayerBin, ICapturerBin
        {       
                /* Common events */
                public event ErrorHandler Error;
@@ -274,14 +274,14 @@ namespace LongoMatch.Gui
                                        CaptureFinished (sender, e);
                        };
                        
-                       capturerbin.Error += delegate(object sender, string message) {
+                       capturerbin.Error += delegate(string message) {
                                if (Error != null)
-                                       Error (sender, message);
+                                       Error (message);
                        };
                        
-                       playerbin.Error += delegate(object sender, string message) {
+                       playerbin.Error += delegate(string message) {
                                if (Error != null)
-                                       Error (sender, message);
+                                       Error (message);
                        };
                        
                        playerbin.SegmentClosedEvent += delegate () {
@@ -289,14 +289,14 @@ namespace LongoMatch.Gui
                                        SegmentClosedEvent ();
                        };
                        
-                       playerbin.Tick += delegate (object o, Time t, Time s, double p) {
+                       playerbin.Tick += delegate (Time t, Time s, double p) {
                                if (Tick != null)
-                                       Tick (o, t, s, p);
+                                       Tick (t, s, p);
                        };
                        
-                       playerbin.PlayStateChanged += delegate (object sender, bool playing) {
+                       playerbin.PlayStateChanged += delegate (bool playing) {
                                if (PlayStateChanged != null)
-                                       PlayStateChanged (sender, playing);
+                                       PlayStateChanged (playing);
                        };
                        
                        playerbin.Next += delegate () {
diff --git a/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs 
b/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
index e854ae0..389b393 100644
--- a/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
@@ -26,6 +26,7 @@ using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Video;
 using LongoMatch.Video.Common;
 using LongoMatch.Store;
+using LongoMatch.Multimedia.Utils;
 
 namespace LongoMatch.Video.Utils
 {
diff --git a/LongoMatch.GUI.Multimedia/Gui/Utils/Remuxer.cs b/LongoMatch.GUI.Multimedia/Gui/Utils/Remuxer.cs
index 4350955..1d9a3ea 100644
--- a/LongoMatch.GUI.Multimedia/Gui/Utils/Remuxer.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/Utils/Remuxer.cs
@@ -115,7 +115,7 @@ namespace LongoMatch.Video.Utils
                        Cancel();
                }
 
-               void HandleRemuxerError (object o, string error)
+               void HandleRemuxerError (string error)
                {
                        Application.Invoke (delegate {Error (error);});
                }
diff --git a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs 
b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
index 313ea39..63f300c 100644
--- a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
+++ b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
@@ -107,13 +107,13 @@ namespace LongoMatch.Gui.Component
                        postagger.SetMode (false);
                }
                
-               public IPlayer Player{
+               public IPlayerBin Player{
                        get {
                                return playercapturer;
                        }
                }
                
-               public ICapturer Capturer{
+               public ICapturerBin Capturer{
                        get {
                                return playercapturer;
                        }
@@ -501,7 +501,7 @@ namespace LongoMatch.Gui.Component
                        selectedTimeNode = null;
                }
                
-               protected virtual void OnTick (object o, Time currentTime, Time streamLength,
+               protected virtual void OnTick (Time currentTime, Time streamLength,
                        double currentPosition)
                {
                        if (currentTime.MSeconds != 0 && timeline != null && openedProject != null) {
@@ -512,7 +512,7 @@ namespace LongoMatch.Gui.Component
                        gameunitstaggerwidget1.CurrentTime = currentTime;
                }
                
-               protected virtual void OnMultimediaError(object o, string message)
+               protected virtual void OnMultimediaError(string message)
                {
                        MessagesHelpers.ErrorMessage (this,
                                Catalog.GetString("The following error happened and" +
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index 5b14661..2286797 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -215,4 +215,4 @@
     <ProjectReference type="Project" localcopy="True" refto="LongoMatch.GUI.Helpers" />
   </References>
   <LanguageParameters ApplicationIcon="." CodePage="65001" ctype="CSharpProjectParameters" />
-</Project>
+</Project>
\ No newline at end of file
diff --git a/LongoMatch.Multimedia/Capturer/FakeCapturer.cs b/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
index e17f17f..4e26812 100644
--- a/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
+++ b/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
@@ -20,10 +20,10 @@ using System;
 using Mono.Unix;
 using GLib;
 using LongoMatch.Common;
-using LongoMatch.Multimedia.Interfaces;
-using LongoMatch.Video.Common;
+using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Store;
 using Image = LongoMatch.Common.Image;
+using LongoMatch.Handlers;
 
 namespace LongoMatch.Video.Capturer
 {
@@ -40,12 +40,11 @@ namespace LongoMatch.Video.Capturer
                public FakeCapturer(): base()
                {
                        timer = new LiveSourceTimer();
-                       timer.EllapsedTime += delegate(int ellapsedTime) {
+                       timer.EllapsedTime += delegate(Time ellapsedTime) {
                                if(EllapsedTime!= null)
                                        EllapsedTime(ellapsedTime);
                        };
                }
-               
 
                public Time CurrentTime {
                        get {
diff --git a/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs 
b/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
index 489544b..e0fe8ff 100644
--- a/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
+++ b/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
@@ -24,9 +24,10 @@ using Mono.Unix;
 using GLib;
 
 using LongoMatch.Common;
-using LongoMatch.Multimedia.Interfaces;
+using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Video.Common;
 using LongoMatch.Store;
+using LongoMatch.Handlers;
 
 namespace LongoMatch.Video.Capturer {
 
@@ -36,6 +37,8 @@ namespace LongoMatch.Video.Capturer {
        public  class GstCameraCapturer : GLib.Object, ICapturer {
 
                public event EllpasedTimeHandler EllapsedTime;
+               public event ErrorHandler Error;
+               public event DeviceChangeHandler DeviceChange;
 
                private LiveSourceTimer timer;
 
@@ -79,9 +82,21 @@ namespace LongoMatch.Video.Capturer {
                        if(error != IntPtr.Zero) throw new GLib.GException(error);
 
                        timer = new LiveSourceTimer();
-                       timer.EllapsedTime += delegate(int ellapsedTime) {
-                               if(EllapsedTime!= null)
-                                       EllapsedTime(ellapsedTime);
+                       timer.EllapsedTime += delegate(Time ellapsedTime) {
+                               if(EllapsedTime != null)
+                                       EllapsedTime (ellapsedTime);
+                       };
+                       
+                       this.GlibError += (o, args) => {
+                               if (Error != null) {
+                                       Error (args.Message);
+                               }
+                       };
+                       
+                       this.GlibDeviceChange += (o, args) => {
+                               if (DeviceChange != null) {
+                                       DeviceChange (args.DeviceChange);
+                               }
                        };
                }
 
@@ -99,7 +114,7 @@ namespace LongoMatch.Video.Capturer {
 
                                args.Args = new object[1];
                                args.Args[0] = GLib.Marshaller.Utf8PtrToString(arg1);
-                               ErrorHandler handler = (ErrorHandler) sig.Handler;
+                               GlibErrorHandler handler = (GlibErrorHandler) sig.Handler;
                                handler(GLib.Object.GetObject(arg0), args);
                        } catch(Exception e) {
                                GLib.ExceptionManager.RaiseUnhandledException(e, false);
@@ -144,7 +159,7 @@ namespace LongoMatch.Video.Capturer {
                }
 
                [GLib.Signal("error")]
-               public event ErrorHandler Error {
+               public event GlibErrorHandler GlibError {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "error", new 
ErrorSignalDelegate(ErrorSignalCallback));
                                sig.AddDelegate(value);
@@ -168,7 +183,7 @@ namespace LongoMatch.Video.Capturer {
 
                                args.Args = new object[1];
                                args.Args[0] = arg1;
-                               DeviceChangeHandler handler = (DeviceChangeHandler) sig.Handler;
+                               GlibDeviceChangeHandler handler = (GlibDeviceChangeHandler) sig.Handler;
                                handler(GLib.Object.GetObject(arg0), args);
                        } catch(Exception e) {
                                GLib.ExceptionManager.RaiseUnhandledException(e, false);
@@ -213,7 +228,7 @@ namespace LongoMatch.Video.Capturer {
                }
 
                [GLib.Signal("device_change")]
-               public event DeviceChangeHandler DeviceChange {
+               public event GlibDeviceChangeHandler GlibDeviceChange {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "device_change", new 
DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
                                sig.AddDelegate(value);
diff --git a/LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs 
b/LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs
index 3ff3ac2..3b51bbc 100644
--- a/LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs
+++ b/LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs
@@ -18,6 +18,8 @@
 
 using System;
 using LongoMatch.Video.Common;
+using LongoMatch.Handlers;
+using LongoMatch.Store;
 
 
 namespace LongoMatch.Video.Capturer
@@ -80,7 +82,7 @@ namespace LongoMatch.Video.Capturer
 
                protected virtual bool OnTick() {
                        if(EllapsedTime != null)
-                               EllapsedTime(CurrentTime);
+                               EllapsedTime(new Time (CurrentTime));
                        return true;
                }
        }
diff --git a/LongoMatch.Multimedia/Common/Handlers.cs b/LongoMatch.Multimedia/Common/Handlers.cs
index 831dbbf..54d57b5 100644
--- a/LongoMatch.Multimedia/Common/Handlers.cs
+++ b/LongoMatch.Multimedia/Common/Handlers.cs
@@ -26,14 +26,14 @@ namespace LongoMatch.Video.Common
        public delegate void ProgressHandler(float progress);
        public delegate void FramesProgressHandler(int actual, int total, Image frame);
        public delegate void DrawFrameHandler(int time);
-       public delegate void EllpasedTimeHandler(int ellapsedTime);
-       public delegate void ErrorHandler(object o, ErrorArgs args);
-       public delegate void PercentCompletedHandler(object o, PercentCompletedArgs args);
-       public delegate void StateChangeHandler(object o, StateChangeArgs args);
-       public delegate void TickHandler(object o, TickArgs args);
-       public delegate void DeviceChangeHandler(object o, DeviceChangeArgs args);
        public delegate void SeekHandler (SeekType type, Time start, float rate);
 
+       public delegate void GlibErrorHandler(object o, ErrorArgs args);
+       public delegate void GlibPercentCompletedHandler(object o, PercentCompletedArgs args);
+       public delegate void GlibStateChangeHandler(object o, StateChangeArgs args);
+       public delegate void GlibTickHandler(object o, TickArgs args);
+       public delegate void GlibDeviceChangeHandler(object o, DeviceChangeArgs args);
+
 
 
        public class ErrorArgs : GLib.SignalArgs {
diff --git a/LongoMatch.Multimedia/Converter/GstVideoConverter.cs 
b/LongoMatch.Multimedia/Converter/GstVideoConverter.cs
index 6c5cb96..16acf3e 100644
--- a/LongoMatch.Multimedia/Converter/GstVideoConverter.cs
+++ b/LongoMatch.Multimedia/Converter/GstVideoConverter.cs
@@ -58,7 +58,7 @@ namespace LongoMatch.Video.Converter {
                        };
                        InternalError += delegate(object o, ErrorArgs args) {
                                if (Error != null)
-                                       Error (o, args.Message);
+                                       Error (args.Message);
                        };
                }
 
@@ -76,7 +76,7 @@ namespace LongoMatch.Video.Converter {
 
                                args.Args = new object[1];
                                args.Args[0] = GLib.Marshaller.Utf8PtrToString(arg1);
-                               ErrorHandler handler = (ErrorHandler) sig.Handler;
+                               GlibErrorHandler handler = (GlibErrorHandler) sig.Handler;
                                handler(GLib.Object.GetObject(arg0), args);
                        } catch(Exception e) {
                                GLib.ExceptionManager.RaiseUnhandledException(e, false);
@@ -121,7 +121,7 @@ namespace LongoMatch.Video.Converter {
                }
 
                [GLib.Signal("error")]
-               public event ErrorHandler InternalError {
+               public event GlibErrorHandler InternalError {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "error", new 
ErrorSignalDelegate(ErrorSignalCallback));
                                sig.AddDelegate(value);
@@ -170,7 +170,7 @@ namespace LongoMatch.Video.Converter {
                }
 
                [GLib.Signal("percent_completed")]
-               public event PercentCompletedHandler PercentCompleted {
+               public event GlibPercentCompletedHandler PercentCompleted {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "percent_completed", 
typeof(PercentCompletedArgs));
                                sig.AddDelegate(value);
diff --git a/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs 
b/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
index d1fbaa8..6d52f3d 100644
--- a/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
+++ b/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
@@ -52,7 +52,7 @@ namespace LongoMatch.Video.Editor {
                        };
                        InternalError += delegate(object o, ErrorArgs args) {
                                if (Error != null)
-                                       Error (o, args.Message);
+                                       Error (args.Message);
                        };
                }
 
@@ -96,7 +96,7 @@ namespace LongoMatch.Video.Editor {
                }
 
                [GLib.Signal("error")]
-               public event ErrorHandler InternalError {
+               public event GlibErrorHandler InternalError {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "error", typeof(ErrorArgs));
                                sig.AddDelegate(value);
@@ -146,7 +146,7 @@ namespace LongoMatch.Video.Editor {
                }
 
                [GLib.Signal("percent_completed")]
-               public event PercentCompletedHandler PercentCompleted {
+               public event GlibPercentCompletedHandler PercentCompleted {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "percent_completed", 
typeof(PercentCompletedArgs));
                                sig.AddDelegate(value);
diff --git a/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp b/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
index 0b9a8d8..2ba1937 100644
--- a/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
+++ b/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
@@ -14,8 +14,6 @@
     </Configuration>
   </Configurations>
   <Contents>
-    <File subtype="Code" buildaction="Compile" name="Player/GstPlayer.cs" />
-    <File subtype="Code" buildaction="Compile" name="Player/ObjectManager.cs" />
     <File subtype="Code" buildaction="Compile" name="Editor/GstVideoSplitter.cs" />
     <File subtype="Code" buildaction="Compile" name="Editor/VideoSegment.cs" />
     <File subtype="Code" buildaction="Compile" name="Common/Constants.cs" />
@@ -39,18 +37,12 @@
     <File subtype="Directory" buildaction="Compile" name="Common" />
     <File subtype="Directory" buildaction="Compile" name="Common" />
     <File subtype="Directory" buildaction="Compile" name="Utils" />
-    <File subtype="Directory" buildaction="Compile" name="Player" />
     <File subtype="Directory" buildaction="Compile" name="Editor" />
     <File subtype="Directory" buildaction="Compile" name="Capturer" />
     <File subtype="Directory" buildaction="Compile" name="Utils" />
-    <File subtype="Directory" buildaction="Compile" name="Interfaces" />
-    <File subtype="Code" buildaction="Compile" name="Interfaces/ICapturer.cs" />
-    <File subtype="Code" buildaction="Compile" name="Interfaces/IPlayer.cs" />
     <File subtype="Code" buildaction="Compile" name="Utils/VideoDevice.cs" />
     <File subtype="Code" buildaction="Compile" name="Utils/GStreamer.cs" />
     <File subtype="Directory" buildaction="Compile" name="Interfaces" />
-    <File subtype="Directory" buildaction="Compile" name="Interfaces" />
-    <File subtype="Directory" buildaction="Compile" name="Interfaces" />
     <File subtype="Code" buildaction="Compile" name="Common/Handlers.cs" />
     <File subtype="Directory" buildaction="Compile" name="Remuxer" />
     <File subtype="Code" buildaction="Compile" name="Remuxer/GstRemuxer.cs" />
@@ -64,6 +56,9 @@
     <File subtype="Code" buildaction="EmbedAsResource" name="gtk-gui/gui.stetic" />
     <File subtype="Code" buildaction="Compile" name="gtk-gui/generated.cs" />
     <File subtype="Code" buildaction="Compile" name="Utils/GtkHelpers.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Player" />
+    <File subtype="Code" buildaction="Compile" name="Player/GstPlayer.cs" />
+    <File subtype="Code" buildaction="Compile" name="Player/ObjectManager.cs" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="libcesarplayer" />
diff --git a/LongoMatch.Multimedia/Player/GstPlayer.cs b/LongoMatch.Multimedia/Player/GstPlayer.cs
index cf5dc71..06f3d6a 100644
--- a/LongoMatch.Multimedia/Player/GstPlayer.cs
+++ b/LongoMatch.Multimedia/Player/GstPlayer.cs
@@ -19,11 +19,11 @@ using System;
 using System.Collections;
 using System.Runtime.InteropServices;
 using LongoMatch.Interfaces.Multimedia;
-using LongoMatch.Multimedia.Interfaces;
 using LongoMatch.Video.Common;
 using LongoMatch.Video.Utils;
 using LongoMatch.Store;
 using LongoMatch.Common;
+using LongoMatch.Handlers;
 
 
 namespace LongoMatch.Video.Player {
@@ -31,6 +31,11 @@ namespace LongoMatch.Video.Player {
        #region Autogenerated code
        public class GstPlayer : GLib.Object, IPlayer, IFramesCapturer {
 
+               public event ErrorHandler Error;
+               public event StateChangeHandler StateChange;
+               public event TickHandler Tick;
+               public event ReadyToSeekHandler ReadyToSeek;
+               
                [DllImport("libcesarplayer.dll")]
                static extern IntPtr lgm_video_player_get_type ();
                [DllImport("libcesarplayer.dll")]
@@ -84,6 +89,26 @@ namespace LongoMatch.Video.Player {
                        IntPtr error = IntPtr.Zero;
                        Raw = lgm_video_player_new ((int) type, out error);
                        if (error != IntPtr.Zero) throw new GLib.GException(error);
+                       
+                       this.GlibError += (o, args) => {
+                               if (Error != null)
+                                       Error (args.Message);
+                       };
+                       
+                       this.GlibStateChange += (o, args) => {
+                               if (StateChange != null)
+                                       StateChange (args.Playing);
+                       };
+                       
+                       this.GlibTick += (o, args) =>  {
+                               if (Tick != null)
+                                       Tick (args.CurrentTime, args.StreamLength, args.CurrentPosition);
+                       };
+                       
+                       this.GlibReadyToSeek += (sender, e) => {
+                               if (ReadyToSeek != null)
+                                       ReadyToSeek ();
+                       };
                }
 
 #pragma warning disable 0169
@@ -123,7 +148,7 @@ namespace LongoMatch.Video.Player {
                }
 
                [GLib.Signal("ready_to_seek")]
-               public event System.EventHandler ReadyToSeek {
+               public event System.EventHandler GlibReadyToSeek {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "ready_to_seek");
                                sig.AddDelegate(value);
@@ -172,7 +197,7 @@ namespace LongoMatch.Video.Player {
                }
 
                [GLib.Signal("state_change")]
-               public event StateChangeHandler StateChange {
+               public event GlibStateChangeHandler GlibStateChange {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "state_change", 
typeof(StateChangeArgs));
                                sig.AddDelegate(value);
@@ -268,7 +293,7 @@ namespace LongoMatch.Video.Player {
                }
 
                [GLib.Signal("error")]
-               public event ErrorHandler Error {
+               public event GlibErrorHandler GlibError {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "error", typeof(ErrorArgs));
                                sig.AddDelegate(value);
@@ -321,7 +346,7 @@ namespace LongoMatch.Video.Player {
                }
 
                [GLib.Signal("tick")]
-               public event TickHandler Tick {
+               public event GlibTickHandler GlibTick {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "tick", typeof(TickArgs));
                                sig.AddDelegate(value);
diff --git a/LongoMatch.Multimedia/Remuxer/GstRemuxer.cs b/LongoMatch.Multimedia/Remuxer/GstRemuxer.cs
index 98406a4..b240384 100644
--- a/LongoMatch.Multimedia/Remuxer/GstRemuxer.cs
+++ b/LongoMatch.Multimedia/Remuxer/GstRemuxer.cs
@@ -54,7 +54,7 @@ namespace LongoMatch.Video.Remuxer {
                        
                        GstError += delegate(object o, ErrorArgs args) {
                                if (Error != null)
-                                       Error (this, args.Message);
+                                       Error (args.Message);
                        };
                }
 
@@ -73,7 +73,7 @@ namespace LongoMatch.Video.Remuxer {
 
                                args.Args = new object[1];
                                args.Args[0] = GLib.Marshaller.Utf8PtrToString(arg1);
-                               ErrorHandler handler = (ErrorHandler) sig.Handler;
+                               GlibErrorHandler handler = (GlibErrorHandler) sig.Handler;
                                handler(GLib.Object.GetObject(arg0), args);
                        } catch(Exception e) {
                                GLib.ExceptionManager.RaiseUnhandledException(e, false);
@@ -118,7 +118,7 @@ namespace LongoMatch.Video.Remuxer {
                }
 
                [GLib.Signal("error")]
-               public event ErrorHandler GstError {
+               public event GlibErrorHandler GstError {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "error", new 
ErrorSignalDelegate(ErrorSignalCallback));
                                sig.AddDelegate(value);
@@ -169,7 +169,7 @@ namespace LongoMatch.Video.Remuxer {
                }
 
                [GLib.Signal("percent_completed")]
-               public event PercentCompletedHandler PercentCompleted {
+               public event GlibPercentCompletedHandler PercentCompleted {
                        add {
                                GLib.Signal sig = GLib.Signal.Lookup(this, "percent_completed", 
typeof(PercentCompletedArgs));
                                sig.AddDelegate(value);
diff --git a/LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs b/LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs
index 15af04f..7555ca9 100644
--- a/LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs
+++ b/LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs
@@ -26,6 +26,7 @@ using LongoMatch.Store;
 using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Handlers;
 using LongoMatch.Video.Utils;
+using LongoMatch.Multimedia.Utils;
 
 namespace LongoMatch.Video.Remuxer
 {
@@ -93,7 +94,7 @@ namespace LongoMatch.Video.Remuxer
                        if (ret != 0) {
                                if (Error != null) {
                                        GtkHelpers.CallFromAppThread (delegate {
-                                               Error (this, "Unkown error");});
+                                               Error ("Unkown error");});
                                }
                        } else {
                                if (Progress != null) {
diff --git a/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs b/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
index 6774008..4f17229 100644
--- a/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
+++ b/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
@@ -20,7 +20,6 @@ using System;
 using System.Runtime.InteropServices;
 
 using LongoMatch.Interfaces.Multimedia;
-using LongoMatch.Multimedia.Interfaces;
 using LongoMatch.Store;
 using LongoMatch.Video;
 using LongoMatch.Video.Common;
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index e3e6bc9..d7642d1 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -45,8 +45,8 @@ namespace LongoMatch.Services
                IGUIToolkit guiToolkit;
                IAnalysisWindow analysisWindow;
                IProjectOptionsController poController;
-               IPlayer player;
-               ICapturer capturer;
+               IPlayerBin player;
+               ICapturerBin capturer;
                IRenderingJobsManager renderer;
 
                public EventsManager(IGUIToolkit guiToolkit, IRenderingJobsManager renderer,
diff --git a/LongoMatch.Services/Services/GameUnitsManager.cs 
b/LongoMatch.Services/Services/GameUnitsManager.cs
index c669f0f..029de87 100644
--- a/LongoMatch.Services/Services/GameUnitsManager.cs
+++ b/LongoMatch.Services/Services/GameUnitsManager.cs
@@ -27,7 +27,7 @@ namespace LongoMatch.Services
        public class GameUnitsManager
        {
                IAnalysisWindow analysisWindow;
-               IPlayer player;
+               IPlayerBin player;
                Project openedProject;
                Dictionary<GameUnit, Time> gameUnitsStarted;
                ushort fps;
diff --git a/LongoMatch.Services/Services/PlaylistManager.cs b/LongoMatch.Services/Services/PlaylistManager.cs
index 05aebb3..5bb2893 100644
--- a/LongoMatch.Services/Services/PlaylistManager.cs
+++ b/LongoMatch.Services/Services/PlaylistManager.cs
@@ -33,7 +33,7 @@ namespace LongoMatch.Services
                IGUIToolkit guiToolkit;
                IPlaylistWidget playlistWidget;
                IPlayList playlist;
-               IPlayer player;
+               IPlayerBin player;
                IRenderingJobsManager videoRenderer;
                IAnalysisWindow analysisWindow;
                /* FIXME */
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index 4184069..de977b7 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -75,12 +75,12 @@ namespace LongoMatch.Services
                        set;
                }
                
-               public ICapturer Capturer {
+               public ICapturerBin Capturer {
                        set;
                        get;
                }
                
-               public IPlayer Player {
+               public IPlayerBin Player {
                        get;
                        set;
                }
diff --git a/LongoMatch.Services/Services/RenderingJobsManager.cs 
b/LongoMatch.Services/Services/RenderingJobsManager.cs
index 2701c7d..d9c6f80 100644
--- a/LongoMatch.Services/Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/Services/RenderingJobsManager.cs
@@ -316,7 +316,7 @@ namespace LongoMatch.Services
                        }
                }
                
-               protected void OnError (object o, string message)
+               protected void OnError (string message)
                {
                        HandleError ();
                }



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