[longomatch] Use a new API for the IPlayer and ICapturer



commit b2a1eaffab24beddbec9ada2b360028820fa47be
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Mar 29 20:15:38 2014 +0100

    Use a new API for the IPlayer and ICapturer
    
    Remove the dependency in gtk, leaving to the PlayerBin
    the creation of the drawing window

 LongoMatch.Core/Handlers/Multimedia.cs             |   11 +-
 LongoMatch.Core/Interfaces/GUI/ICapturer.cs        |    9 +-
 LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs      |    4 +-
 LongoMatch.Core/Interfaces/GUI/IPlayer.cs          |   41 +-
 .../Interfaces/Multimedia/IFramesCapturer.cs       |   10 +-
 LongoMatch.Core/Store/Drawing.cs                   |   19 +
 LongoMatch.Core/Store/Time.cs                      |   22 +-
 LongoMatch.GUI.Helpers/AssemblyInfo.cs             |   44 +
 .../FileChooserHelper.cs                           |    0
 LongoMatch.GUI.Helpers/LongoMatch.GUI.Helpers.mdp  |   29 +
 .../MessagesHelpers.cs                             |    6 +-
 .../Gui/Helpers => LongoMatch.GUI.Helpers}/Misc.cs |   31 +
 LongoMatch.GUI.Helpers/MyClass.cs                  |   29 +
 LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs       |  183 +-
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs         |  461 +--
 LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs |  158 +-
 .../Gui}/Utils/FramesCapturer.cs                   |   34 +-
 .../LongoMatch.GUI.Multimedia.mdp                  |    2 +
 .../gtk-gui/LongoMatch.Gui.CapturerBin.cs          |  126 +-
 .../gtk-gui/LongoMatch.Gui.PlayerBin.cs            |  326 +-
 .../gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs    |    2 -
 LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic       |   52 +-
 LongoMatch.GUI.Multimedia/gtk-gui/objects.xml      |   24 +-
 LongoMatch.GUI/Gui/Component/AnalysisComponent.cs  |   26 +-
 LongoMatch.GUI/Gui/Dialog/DrawingTool.cs           |    6 +-
 LongoMatch.GUI/Gui/GUIToolkit.cs                   |   16 +-
 LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs        |   17 +-
 LongoMatch.GUI/LongoMatch.GUI.mdp                  |    8 +-
 .../LongoMatch.Gui.Component.AnalysisComponent.cs  |    2 -
 .../gtk-gui/LongoMatch.Gui.MainWindow.cs           |    2 +-
 LongoMatch.GUI/gtk-gui/gui.stetic                  |    3 +-
 LongoMatch.GUI/gtk-gui/objects.xml                 |  227 +-
 LongoMatch.Multimedia/Capturer/FakeCapturer.cs     |   19 +-
 .../Capturer/GstCameraCapturer.cs                  |  282 +-
 LongoMatch.Multimedia/Common/Enum.cs               |    2 -
 LongoMatch.Multimedia/Common/Handlers.cs           |   23 +-
 LongoMatch.Multimedia/Interfaces/ICapturer.cs      |   45 +-
 LongoMatch.Multimedia/Interfaces/IPlayer.cs        |  112 +-
 LongoMatch.Multimedia/LongoMatch.Multimedia.mdp    |    6 +-
 LongoMatch.Multimedia/Player/GstPlayer.cs          | 1181 +-----
 LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs       |   10 +-
 LongoMatch.Multimedia/Utils/GStreamer.cs           |   13 -
 LongoMatch.Multimedia/Utils/MultimediaFactory.cs   |   52 +-
 LongoMatch.Multimedia/Utils/PreviewMediaFile.cs    |    3 +-
 LongoMatch.Multimedia/Utils/Seeker.cs              |   11 +-
 LongoMatch.Services/LongoMatch.Services.mdp        |    1 -
 LongoMatch.Services/Services/EventsManager.cs      |   37 +-
 LongoMatch.Services/Services/GameUnitsManager.cs   |   10 +-
 LongoMatch.Services/Services/PlaylistManager.cs    |   10 +-
 LongoMatch.Services/Services/ProjectsManager.cs    |  101 +-
 .../Services/RenderingJobsManager.cs               |    2 +-
 LongoMatch.Services/Services/ToolsManager.cs       |    2 +-
 .../Services/VideoDrawingsManager.cs               |  170 -
 LongoMatch.mds                                     |    4 +
 LongoMatch/LongoMatchGtk.mdp                       |    1 +
 libcesarplayer/Makefile.am                         |    4 +-
 libcesarplayer/bacon-video-widget-gst-0.10.c       | 4843 --------------------
 libcesarplayer/bacon-video-widget.h                |  418 --
 libcesarplayer/baconvideowidget-marshal.list       |    2 +-
 libcesarplayer/gst-camera-capturer.c               |  563 +--
 libcesarplayer/gst-camera-capturer.h               |   56 +-
 libcesarplayer/lgm-video-player.c                  | 1127 +++++
 libcesarplayer/lgm-video-player.h                  |  122 +
 libcesarplayer/liblongomatch.mdp                   |    6 +-
 libcesarplayer/test-capturer.c                     |   66 +-
 libcesarplayer/test-discoverer.c                   |    2 +-
 libcesarplayer/video-utils.c                       |  248 +-
 libcesarplayer/video-utils.h                       |   33 +-
 68 files changed, 2727 insertions(+), 8790 deletions(-)
---
diff --git a/LongoMatch.Core/Handlers/Multimedia.cs b/LongoMatch.Core/Handlers/Multimedia.cs
index f8f24f1..7ddce57 100644
--- a/LongoMatch.Core/Handlers/Multimedia.cs
+++ b/LongoMatch.Core/Handlers/Multimedia.cs
@@ -19,26 +19,27 @@
 using System;
 
 using LongoMatch.Common;
+using LongoMatch.Store;
 
 namespace LongoMatch.Handlers
 {
        public delegate void PlayListSegmentDoneHandler();
        public delegate void SegmentClosedHandler();
        public delegate void SegmentDoneHandler();
-       public delegate void SeekEventHandler(long pos);
+       public delegate void SeekEventHandler(Time pos);
        public delegate void VolumeChangedHandler(double level);
        public delegate void NextButtonClickedHandler();
        public delegate void PrevButtonClickedHandler();
        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 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, long currentTime, long streamLength,
-               float currentPosition, bool seekable);
+       public delegate void TickHandler(object o, Time currentTime, Time streamLength,
+               double currentPosition);
 }
diff --git a/LongoMatch.Core/Interfaces/GUI/ICapturer.cs b/LongoMatch.Core/Interfaces/GUI/ICapturer.cs
index 28d46be..1f5d338 100644
--- a/LongoMatch.Core/Interfaces/GUI/ICapturer.cs
+++ b/LongoMatch.Core/Interfaces/GUI/ICapturer.cs
@@ -19,6 +19,7 @@ using System;
 
 using LongoMatch.Common;
 using LongoMatch.Handlers;
+using LongoMatch.Store;
 
 namespace LongoMatch.Interfaces.GUI
 {
@@ -27,17 +28,15 @@ namespace LongoMatch.Interfaces.GUI
                event EventHandler CaptureFinished;
                event ErrorHandler Error;
                
-               CapturerType Type {set;}
                string Logo {set;}
-               int CurrentTime {get;}
+               Time CurrentTime {get;}
                bool Capturing {get;}
-               CaptureSettings CaptureProperties {set; get;}
                Image CurrentMiniatureFrame {get;}
+               CaptureSettings CaptureSettings {get;}
 
+               void Run (CapturerType type, CaptureSettings settings);
                void Start();
                void TogglePause();
-               void Stop();
-               void Run();
                void Close();
        }
 }
diff --git a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
index bab74ae..a8474a1 100644
--- a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
@@ -79,12 +79,14 @@ namespace LongoMatch.Interfaces.GUI
                void ManageJobs ();
                
                void TagPlay(Play play, Categories categories, TeamTemplate local, TeamTemplate visitor, bool 
showAllTags);
-               void DrawingTool(Image pixbuf, Play play, int stopTime);
+               void DrawingTool(Image pixbuf, Play play, Time stopTime);
                
                string RemuxFile (string filePath, string outputFile, VideoMuxerType muxer);
                
                DateTime SelectDate (DateTime date, object widget);
                
+               EndCaptureResponse EndCapture (string filepath);
+
        }
 }
 
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlayer.cs b/LongoMatch.Core/Interfaces/GUI/IPlayer.cs
index 3842cd4..f06ad09 100644
--- a/LongoMatch.Core/Interfaces/GUI/IPlayer.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IPlayer.cs
@@ -18,6 +18,7 @@
 using System;
 using LongoMatch.Common;
 using LongoMatch.Handlers;
+using LongoMatch.Store;
 
 namespace LongoMatch.Interfaces.GUI
 {
@@ -34,45 +35,29 @@ namespace LongoMatch.Interfaces.GUI
                event DetachPlayerHandler Detach;
                event PlaybackRateChangedHandler PlaybackRateChanged;
                
-               long AccurateCurrentTime {get;}
-               int CurrentTime {get;}
-               long StreamLength {get;}
-               
+               Time CurrentTime {get;}
+               Time StreamLength {get;}
                Image CurrentMiniatureFrame {get;}
                Image CurrentFrame {get;}
-               Image LogoPixbuf {set;}
-               Image DrawingPixbuf {set;}
-               bool DrawingMode {set;}
-               bool LogoMode {set;}
-               bool ExpandLogo {set; get;}
                bool Opened {get;}
-               bool FullScreen {set;}
-               float Rate {get;set;}
                bool Detached {get;set;}
                bool SeekingEnabled {set;}
+               bool Sensitive {set; get;}
 
-               void Open(string mrl);
-               void Play();
-               void Pause();
-               void TogglePlay();
-               void SetLogo(string filename);
-               void ResetGui();
-               void SetPlayListElement(string fileName,long start, long stop, float rate, bool hasNext);
+               void Open (string mrl);
                void Close();
-               void SeekTo(long time, bool accurate);
-               void SeekInSegment(long pos);
-               void SeekToNextFrame(bool in_segment);
-               void SeekToPreviousFrame(bool in_segment);
+               void Play ();
+               void Pause ();
+               void TogglePlay ();
+               void ResetGui();
+               void Seek (Time time, bool accurate);
                void StepForward();
                void StepBackward();
                void FramerateUp();
                void FramerateDown();
-               void UpdateSegmentStartTime(long start);
-               void UpdateSegmentStopTime(long stop);
-               void SetStartStop(long start, long stop, float rate=1);
-               void CloseActualSegment();
-               void SetSensitive();
-               void UnSensitive();
+               void LoadPlay (string fileName, Play play);
+               void LoadPlayListPlay (PlayListPlay play, bool hasNext);
+               void CloseSegment();
        }
 }
 
diff --git a/LongoMatch.Core/Interfaces/Multimedia/IFramesCapturer.cs 
b/LongoMatch.Core/Interfaces/Multimedia/IFramesCapturer.cs
index 05dd869..98eb8f1 100644
--- a/LongoMatch.Core/Interfaces/Multimedia/IFramesCapturer.cs
+++ b/LongoMatch.Core/Interfaces/Multimedia/IFramesCapturer.cs
@@ -21,6 +21,7 @@
 using System;
 
 using LongoMatch.Common;
+using LongoMatch.Store;
 
 namespace LongoMatch.Interfaces.Multimedia
 {
@@ -28,11 +29,10 @@ namespace LongoMatch.Interfaces.Multimedia
 
        public interface IFramesCapturer
        {
-               bool Open(string mrl);
-               bool SeekTime(long time, bool accurate);
-               void Pause();
+               bool Open (string uri);
+               bool Seek (Time time, bool accurate);
+               void Pause ();
                void Dispose();
-               Image GetCurrentFrame(int outwidth, int outheight);
-               Image GetCurrentFrame();
+               Image GetCurrentFrame (int outwidth=-1, int outheight=-1);
        }
 }
diff --git a/LongoMatch.Core/Store/Drawing.cs b/LongoMatch.Core/Store/Drawing.cs
index 2a35671..d47de2d 100644
--- a/LongoMatch.Core/Store/Drawing.cs
+++ b/LongoMatch.Core/Store/Drawing.cs
@@ -18,6 +18,7 @@
 
 using System;
 using System.Drawing.Imaging;
+using Newtonsoft.Json;
 
 using LongoMatch.Common;
 
@@ -57,6 +58,23 @@ namespace LongoMatch.Store
                /// <summary>
                /// Render time of the drawing
                /// </summary>
+               public Time Render {
+                       get;
+                       set;
+               }
+
+               /// <summary>
+               /// Time to pause the playback and display the drawing
+               /// </summary>
+               public Time Pause {
+                       set;
+                       get;
+               }
+               
+               /// <summary>
+               /// Render time of the drawing
+               /// </summary>
+               [JsonIgnore]
                public int RenderTime {
                        get;
                        set;
@@ -65,6 +83,7 @@ namespace LongoMatch.Store
                /// <summary>
                /// Time to pause the playback and display the drawing
                /// </summary>
+               [JsonIgnore]
                public int PauseTime {
                        set;
                        get;
diff --git a/LongoMatch.Core/Store/Time.cs b/LongoMatch.Core/Store/Time.cs
index 3127453..2de8962 100644
--- a/LongoMatch.Core/Store/Time.cs
+++ b/LongoMatch.Core/Store/Time.cs
@@ -19,6 +19,7 @@
 //
 
 using System;
+using Newtonsoft.Json;
 
 namespace LongoMatch.Store
 {
@@ -32,6 +33,7 @@ namespace LongoMatch.Store
        {
                private const int MS = 1000000 ;
                public const int SECONDS_TO_TIME = 1000;
+               public const int TIME_TO_NSECONDS = 1000000;
 
                #region Constructors
                public Time() {
@@ -53,7 +55,8 @@ namespace LongoMatch.Store
 
                /// <summary>
                /// Time in seconds
-               /// </summary>
+               /// </summary>          
+               [JsonIgnore]
                public int Seconds {
                        get {
                                return MSeconds/SECONDS_TO_TIME;
@@ -62,6 +65,19 @@ namespace LongoMatch.Store
                                MSeconds = value * SECONDS_TO_TIME;
                        }
                }
+               
+               /// <summary>
+               /// Time in nano seconds
+               /// </summary>          
+               [JsonIgnore]
+               public long NSeconds {
+                       get {
+                               return  (long)MSeconds * TIME_TO_NSECONDS;
+                       }
+                       set {
+                               MSeconds = (int) (value / TIME_TO_NSECONDS);
+                       }
+               }
                #endregion
 
                #region Public methods
@@ -160,6 +176,10 @@ namespace LongoMatch.Store
                public static Time operator *(Time t1, double t2) {
                        return new Time {MSeconds = (int) (t1.MSeconds * t2)};
                }
+               
+               public static Time operator /(Time t1, int t2) {
+                       return new Time {MSeconds = (int) (t1.MSeconds / t2)};
+               }
                #endregion
        }
 }
\ No newline at end of file
diff --git a/LongoMatch.GUI.Helpers/AssemblyInfo.cs b/LongoMatch.GUI.Helpers/AssemblyInfo.cs
new file mode 100644
index 0000000..dd8215f
--- /dev/null
+++ b/LongoMatch.GUI.Helpers/AssemblyInfo.cs
@@ -0,0 +1,44 @@
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes. 
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("LongoMatch.GUI.Helpers")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Andoni Morales Alastruey")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly, 
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/LongoMatch.GUI/Gui/Helpers/FileChooserHelper.cs b/LongoMatch.GUI.Helpers/FileChooserHelper.cs
similarity index 100%
rename from LongoMatch.GUI/Gui/Helpers/FileChooserHelper.cs
rename to LongoMatch.GUI.Helpers/FileChooserHelper.cs
diff --git a/LongoMatch.GUI.Helpers/LongoMatch.GUI.Helpers.mdp 
b/LongoMatch.GUI.Helpers/LongoMatch.GUI.Helpers.mdp
new file mode 100644
index 0000000..9318b1f
--- /dev/null
+++ b/LongoMatch.GUI.Helpers/LongoMatch.GUI.Helpers.mdp
@@ -0,0 +1,29 @@
+<Project name="LongoMatch.GUI.Helpers" fileversion="2.0" DefaultNamespace="LongoMatch.GUI.Helpers" 
language="C#" targetFramework="4.0" ctype="DotNetProject">
+  <Configurations active="Release">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="../bin" assembly="LongoMatch.GUI.Helpers" />
+      <Build debugmode="True" target="Library" />
+      <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" />
+      <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" 
generateoverflowchecks="False" definesymbols="DEBUG;" generatexmldocumentation="False" 
ctype="CSharpCompilerParameters" />
+    </Configuration>
+    <Configuration name="Release" ctype="DotNetProjectConfiguration">
+      <Output directory="../bin" assembly="LongoMatch.GUI.Helpers" />
+      <Build debugmode="False" target="Library" />
+      <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" />
+      <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" 
generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <Contents>
+    <File subtype="Code" buildaction="Compile" name="FileChooserHelper.cs" />
+    <File subtype="Code" buildaction="Compile" name="MessagesHelpers.cs" />
+    <File subtype="Code" buildaction="Compile" name="Misc.cs" />
+  </Contents>
+  <References>
+    <ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
+    <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
+    <ProjectReference specificVersion="False" type="Gac" localcopy="False" refto="Mono.Posix, 
Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
+    <ProjectReference type="Gac" localcopy="False" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
+    <ProjectReference type="Project" localcopy="True" refto="LongoMatch.Core" />
+    <ProjectReference specificVersion="False" type="Gac" localcopy="False" refto="System.Drawing, 
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  </References>
+</Project>
\ No newline at end of file
diff --git a/LongoMatch.GUI/Gui/Helpers/MessagesHelpers.cs b/LongoMatch.GUI.Helpers/MessagesHelpers.cs
similarity index 92%
rename from LongoMatch.GUI/Gui/Helpers/MessagesHelpers.cs
rename to LongoMatch.GUI.Helpers/MessagesHelpers.cs
index 626b172..8452752 100644
--- a/LongoMatch.GUI/Gui/Helpers/MessagesHelpers.cs
+++ b/LongoMatch.GUI.Helpers/MessagesHelpers.cs
@@ -52,7 +52,7 @@ namespace LongoMatch.Gui.Helpers
                                                             MessageType.Question, ButtonsType.YesNo,
                                                             question);
                                
-                       md.Icon =  Stetic.IconLoader.LoadIcon(md, "longomatch", IconSize.Button);
+                       md.Icon =  Misc.LoadIcon(md, "longomatch", IconSize.Button);
                        md.Title = title;
                        var res = md.Run();
                        md.Destroy();
@@ -73,7 +73,7 @@ namespace LongoMatch.Gui.Helpers
                                                             type,
                                                             ButtonsType.Ok,
                                                             errorMessage);
-                       md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
+                       md.Icon = Misc.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
                        ret = md.Run();
                        md.Destroy();
                        return ret;
@@ -95,7 +95,7 @@ namespace LongoMatch.Gui.Helpers
             dialog.AddButton (Catalog.GetString("Add"), ResponseType.Ok);
                        dialog.VBox.PackStart (label, false, false, 0);
                        dialog.VBox.PackStart (entry, true, true, 0);
-                       dialog.Icon = Stetic.IconLoader.LoadIcon (parent, "longomatch", Gtk.IconSize.Dialog);
+                       dialog.Icon = Misc.LoadIcon (parent, "longomatch", Gtk.IconSize.Dialog);
                        dialog.ShowAll ();
                        if (dialog.Run () == (int) ResponseType.Ok) {
                                ret = entry.Text;
diff --git a/LongoMatch.GUI/Gui/Helpers/Misc.cs b/LongoMatch.GUI.Helpers/Misc.cs
similarity index 78%
rename from LongoMatch.GUI/Gui/Helpers/Misc.cs
rename to LongoMatch.GUI.Helpers/Misc.cs
index 46cca3d..7fc60de 100644
--- a/LongoMatch.GUI/Gui/Helpers/Misc.cs
+++ b/LongoMatch.GUI.Helpers/Misc.cs
@@ -143,6 +143,37 @@ namespace LongoMatch.Gui.Helpers
                        qualityBox.Active = active;
                        return qualityStore;
                }
+               
+               public static Gdk.Pixbuf LoadIcon (Gtk.Widget widget, string name, Gtk.IconSize size)
+               {
+                       Gdk.Pixbuf res = widget.RenderIcon (name, size, null);
+                       if ((res != null)) {
+                               return res;
+                       } else {
+                               int sz;
+                               int sy;
+                               global::Gtk.Icon.SizeLookup (size, out  sz, out  sy);
+                               try {
+                                       return Gtk.IconTheme.Default.LoadIcon (name, sz, 0);
+                               } catch (System.Exception) {
+                                       if ((name != "gtk-missing-image")) {
+                                               return LoadIcon (widget, "gtk-missing-image", size);
+                                       } else {
+                                               Gdk.Pixmap pmap = new Gdk.Pixmap 
(Gdk.Screen.Default.RootWindow, sz, sz);
+                                               Gdk.GC gc = new Gdk.GC (pmap);
+                                               gc.RgbFgColor = new Gdk.Color (255, 255, 255);
+                                               pmap.DrawRectangle (gc, true, 0, 0, sz, sz);
+                                               gc.RgbFgColor = new Gdk.Color (0, 0, 0);
+                                               pmap.DrawRectangle (gc, false, 0, 0, (sz - 1), (sz - 1));
+                                               gc.SetLineAttributes (3, Gdk.LineStyle.Solid, 
Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
+                                               gc.RgbFgColor = new Gdk.Color (255, 0, 0);
+                                               pmap.DrawLine (gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), 
((sz - 1) - (sz / 4)));
+                                               pmap.DrawLine (gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), 
((sz - 1) - (sz / 4)));
+                                               return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 
0, sz, sz);
+                                       }
+                               }
+                       }
+               }
        }
 }
 
diff --git a/LongoMatch.GUI.Helpers/MyClass.cs b/LongoMatch.GUI.Helpers/MyClass.cs
new file mode 100644
index 0000000..17673af
--- /dev/null
+++ b/LongoMatch.GUI.Helpers/MyClass.cs
@@ -0,0 +1,29 @@
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+
+namespace LongoMatch.GUI.Helpers
+{
+               public class MyClass
+               {
+                               public MyClass ()
+                               {
+                               }
+               }
+}
+
diff --git a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
index dd0cb13..93c3e71 100644
--- a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
@@ -25,11 +25,13 @@ using Image = LongoMatch.Common.Image;
 using LongoMatch.Common;
 using LongoMatch.Handlers;
 using LongoMatch.Interfaces.GUI;
+using LongoMatch.Gui.Helpers;
 using LongoMatch.Video;
 using LongoMatch.Video.Common;
 using LongoMatch.Video.Capturer;
 using LongoMatch.Video.Utils;
 using Mono.Unix;
+using LongoMatch.Store;
 
 namespace LongoMatch.Gui
 {
@@ -42,46 +44,26 @@ namespace LongoMatch.Gui
                public event EventHandler CaptureFinished;
                public event LongoMatch.Handlers.ErrorHandler Error;
 
-               private Image logopix;
-               private CaptureSettings captureProps;
-               private CapturerType capturerType;
-               private bool captureStarted;
-               private bool capturing;
-               private const int THUMBNAIL_MAX_WIDTH = 100;
-
+               Image logopix;
+               CaptureSettings settings;
+               CapturerType type;
+               bool captureStarted, capturing, delayStart;
                LongoMatch.Multimedia.Interfaces.ICapturer capturer;
 
                public CapturerBin()
                {
                        this.Build();
-                       captureProps = CaptureSettings.DefaultSettings();
-                       Type = CapturerType.Fake;
-               }
-
-               public CapturerType Type {
-                       set {
-                               /* Close any previous instance of the capturer */
-                               Close();
-
-                               MultimediaToolkit factory = new MultimediaToolkit();
-                               capturer = factory.GetCapturer(value);
-                               capturer.EllapsedTime += OnTick;
-                               if(value != CapturerType.Fake) {
-                                       capturer.Error += OnError;
-                                       capturer.DeviceChange += OnDeviceChange;
-                                       capturerhbox.Add((Widget)capturer);
-                                       (capturer as Widget).Visible = true;
-                                       capturerhbox.Visible = true;
-                                       logodrawingarea.Visible = false;
-                               }
-                               else {
-                                       logodrawingarea.Visible = true;
-                                       capturerhbox.Visible = false;
+                       recbutton.Clicked += OnRecbuttonClicked;
+                       pausebutton.Clicked += OnPausebuttonClicked;
+                       stopbutton.Clicked += OnStopbuttonClicked;
+                       videodrawingarea.CanFocus = false;
+                       
+                       videodrawingarea.Realized += (sender, e) => {
+                               if (delayStart) {
+                                       Configure ();
+                                       capturer.Run ();
                                }
-                               SetProperties();
-                               capturerType = value;
-                       }
-
+                       };
                }
 
                public string Logo {
@@ -94,10 +76,10 @@ namespace LongoMatch.Gui
                        }
                }
 
-               public int CurrentTime {
+               public Time CurrentTime {
                        get {
                                if(capturer == null)
-                                       return -1;
+                                       return new Time (-1);
                                return capturer.CurrentTime;
                        }
                }
@@ -107,12 +89,10 @@ namespace LongoMatch.Gui
                                return capturing;
                        }
                }
-
-               public CaptureSettings CaptureProperties {
-                       set {
-                               captureProps = value;
-                       } get {
-                               return captureProps;
+               
+               public CaptureSettings CaptureSettings {
+                       get {
+                               return settings;
                        }
                }
 
@@ -133,12 +113,8 @@ namespace LongoMatch.Gui
                                return;
 
                        if (capturing) {
-                               MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, 
DialogFlags.Modal,
-                                                                    MessageType.Question, ButtonsType.YesNo,
-                                                                    Catalog.GetString("Do you want to pause 
the recording?"));
-                               var res = md.Run();
-                               md.Destroy();
-                               if(res == (int)ResponseType.No) {
+                               string msg = Catalog.GetString("Do you want to pause the recording?");
+                               if (!MessagesHelpers.QuestionMessage (this, msg)) {
                                        return;
                                }
                        }                               
@@ -148,19 +124,29 @@ namespace LongoMatch.Gui
                        capturer.TogglePause();
                }
 
-               public void Stop() {
-                       if(capturer != null) {
-                               capturing = false;
-                               capturer.Stop();
-                               capturer.Close();
+               public void Run (CapturerType type, CaptureSettings settings) {
+                       /* Close any previous instance of the capturer */
+                       Close ();
+
+                       MultimediaToolkit factory = new MultimediaToolkit();
+                       capturer = factory.GetCapturer(type);
+                       capturer.EllapsedTime += OnTick;
+                       this.settings = settings;
+                       if (type != CapturerType.Live) {
+                               capturer.Error += OnError;
+                               capturer.DeviceChange += OnDeviceChange;
+                               videodrawingarea.DoubleBuffered = true;
+                       } else {
+                               videodrawingarea.DoubleBuffered = false;
                        }
-               }
-
-               public void Run() {
-                       if(capturer != null)
+                       if (videodrawingarea.IsRealized) {
+                               Configure();
                                capturer.Run();
+                       } else {
+                               delayStart = true;
+                       }
                }
-
+               
                public void Close() {
                        /* resetting common properties */
                        pausebutton.Visible = false;
@@ -177,14 +163,15 @@ namespace LongoMatch.Gui
                        try {
                                capturer.Stop();
                                capturer.Close();
-                               if(capturerType == CapturerType.Live) {
+                               if (type == CapturerType.Live) {
                                        /* release and dispose live capturer */
                                        capturer.Error -= OnError;
-                                       capturer.DeviceChange += OnDeviceChange;
-                                       capturerhbox.Remove(capturer as Gtk.Widget);
+                                       capturer.DeviceChange -= OnDeviceChange;
                                        capturer.Dispose();
                                }
-                       } catch(Exception) {}
+                       } catch(Exception ex) {
+                               Log.Exception (ex);
+                       }
                        capturer = null;
                }
 
@@ -193,36 +180,31 @@ namespace LongoMatch.Gui
                                if(capturer == null)
                                        return null;
 
-                               Image image = new Image(capturer.CurrentFrame);
+                               Image image = capturer.CurrentFrame;
 
                                if(image.Value == null)
                                        return null;
-                               image.Scale(THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_WIDTH);
+                               image.Scale (Constants.MAX_THUMBNAIL_SIZE, Constants.MAX_THUMBNAIL_SIZE);
                                return image;
                        }
                }
 
-               private void SetProperties() {
+               void Configure () {
                        VideoMuxerType muxer;
+                       IntPtr windowHandle;
                        
                        if(capturer == null)
                                return;
                        
                        /* We need to use Matroska for live replay and remux when the capture is done */
-                       muxer = captureProps.EncodingSettings.EncodingProfile.Muxer;
-                       if (muxer == VideoMuxerType.Avi || muxer == VideoMuxerType.Mp4)
-                               muxer = VideoMuxerType.Matroska;
+                       muxer = settings.EncodingSettings.EncodingProfile.Muxer;
+                       if (muxer == VideoMuxerType.Avi || muxer == VideoMuxerType.Mp4) {
+                               settings.EncodingSettings.EncodingProfile.Muxer = VideoMuxerType.Matroska;
+                       }
                                
-                       capturer.DeviceID = captureProps.DeviceID;
-                       capturer.OutputFile = captureProps.EncodingSettings.OutputFile;
-                       capturer.OutputHeight = captureProps.EncodingSettings.VideoStandard.Height;
-                       capturer.OutputWidth = captureProps.EncodingSettings.VideoStandard.Width;
-                       capturer.SetVideoEncoder(captureProps.EncodingSettings.EncodingProfile.VideoEncoder);
-                       capturer.SetAudioEncoder(captureProps.EncodingSettings.EncodingProfile.AudioEncoder);
-                       capturer.SetVideoMuxer(muxer);
-                       capturer.SetSource(captureProps.CaptureSourceType, captureProps.SourceElement);
-                       capturer.VideoQuality = captureProps.EncodingSettings.EncodingQuality.VideoQuality;
-                       capturer.AudioQuality = captureProps.EncodingSettings.EncodingQuality.AudioQuality;
+                       windowHandle = GtkHelpers.GetWindowHandle (videodrawingarea.GdkWindow);
+                       capturer.Configure (settings, windowHandle); 
+                       delayStart = false;
                }
 
                protected virtual void OnRecbuttonClicked(object sender, System.EventArgs e)
@@ -247,18 +229,14 @@ namespace LongoMatch.Gui
 
                protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e)
                {
-                       int res;
+                       string msg;
 
                        if(capturer == null)
                                return;
 
-                       MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, 
MessageType.Question, ButtonsType.YesNo,
-                                                            Catalog.GetString("You are going to stop and 
finish the current capture."+"\n"+
-                                                                            "Do you want to proceed?"));
-                       res = md.Run();
-                       md.Destroy();
-                       if(res == (int)ResponseType.Yes) {
-                               Stop();
+                       msg = Catalog.GetString("Do you want to stop and finish the current capture?");
+                       if (MessagesHelpers.QuestionMessage (this, msg, null)) {
+                               Close();
                                recbutton.Visible = true;
                                pausebutton.Visible = false;
                                stopbutton.Visible = false;
@@ -270,44 +248,35 @@ namespace LongoMatch.Gui
                
                protected virtual void OnTick(int ellapsedTime) {
                        timelabel.Markup = String.Format("<span font=\"20px bold\">Time --> {0}</span> ", 
-                                                      TimeString.MSecondsToSecondsString(CurrentTime));
+                                                        CurrentTime.ToSecondsString());
                }
 
                protected virtual void OnError(object o, ErrorArgs args)
                {
                        if(Error != null)
                                Error(o, args.Message);
-
                        Close();
                }
 
                protected virtual void OnDeviceChange(object o, DeviceChangeArgs args)
                {
+                       string msg;
                        /* device disconnected, pause capture */
                        if(args.DeviceChange == -1) {
                                if(capturing)
                                        TogglePause();
 
                                recbutton.Sensitive = false;
-
-                               MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, 
DialogFlags.Modal,
-                                                                    MessageType.Question, ButtonsType.Ok,
-                                                                    Catalog.GetString("Device disconnected. 
" +
-                                                                                    "The capture will be 
paused"));
-                               md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
-                               md.Run();
-                               md.Destroy();
+                               msg = Catalog.GetString("Device disconnected. " +
+                                                       "The capture will be paused");
+                               MessagesHelpers.WarningMessage (this, msg);
                        } else {
                                recbutton.Sensitive = true;
-                               MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, 
DialogFlags.Modal,
-                                                                    MessageType.Question, ButtonsType.YesNo,
-                                                                    Catalog.GetString("Device reconnected." +
-                                                                                    "Do you want to restart 
the capture?"));
-                               md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
-                               if(md.Run() == (int)ResponseType.Yes) {
-                                       TogglePause();
+                               msg = Catalog.GetString("Device reconnected." +
+                                                       "Do you want to restart the capture?");
+                               if (MessagesHelpers.QuestionMessage (this, msg, null)) {
+                                       TogglePause ();
                                }
-                               md.Destroy();
                        }
                }
 
@@ -323,11 +292,11 @@ namespace LongoMatch.Gui
                        
                        logo = logopix.Value;
 
-                       win = logodrawingarea.GdkWindow;
+                       win = videodrawingarea.GdkWindow;
                        width = logo.Width;
                        height = logo.Height;
-                       allocWidth = logodrawingarea.Allocation.Width;
-                       allocHeight = logodrawingarea.Allocation.Height;
+                       allocWidth = videodrawingarea.Allocation.Width;
+                       allocHeight = videodrawingarea.Allocation.Height;
 
                        /* Checking if allocated space is smaller than our logo */
                        if((float) allocWidth / width > (float) allocHeight / height) {
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index eeae115..20302fb 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -31,6 +31,8 @@ using LongoMatch.Video;
 using LongoMatch.Video.Common;
 using LongoMatch.Video.Player;
 using LongoMatch.Video.Utils;
+using LongoMatch.Store;
+
 
 namespace LongoMatch.Gui
 {
@@ -39,6 +41,10 @@ namespace LongoMatch.Gui
 
        public partial class PlayerBin : Gtk.Bin, LongoMatch.Interfaces.GUI.IPlayer
        {
+               struct Segment {
+                       public Time Start;
+                       public Time Stop;
+               }       
 
                public event SegmentClosedHandler SegmentClosedEvent;
                public event LongoMatch.Handlers.TickHandler Tick;
@@ -51,41 +57,34 @@ namespace LongoMatch.Gui
                public event DetachPlayerHandler Detach;
                public event PlaybackRateChangedHandler PlaybackRateChanged;
 
-               private const int THUMBNAIL_MAX_WIDTH = 100;
+               const int THUMBNAIL_MAX_WIDTH = 100;
                const int SCALE_FPS = 25;
-               private LongoMatch.Video.Common.TickHandler tickHandler;
-               private LongoMatch.Multimedia.Interfaces.IPlayer player;
-               private long length=0;
-               private string slength;
-               private long segmentStartTime;
-               private long segmentStopTime;
-               private bool seeking=false;
-               private double[] seeksQueue;
-               private bool IsPlayingPrevState = false;
-               private float rate=1;
-               private double previousVLevel = 1;
-               private bool muted=false;
-               bool emitRateScale = true;
-               private object[] pendingSeek=null; //{start,stop,rate}
-               //the player.mrl is diferent from the filename as it's an uri eg:file:///foo.avi
-               private string filename = null;
+               LongoMatch.Video.Common.TickHandler tickHandler;
+               LongoMatch.Multimedia.Interfaces.IPlayer player;
+               Time length;
+               bool seeking, IsPlayingPrevState, muted, emitRateScale, readyToSeek;
+               string filename;
+               double previousVLevel = 1;
+               double[] seeksQueue;
+               object[] pendingSeek; //{start,stop,rate}
                protected VolumeWindow vwin;
-               bool readyToSeek = false;
                Seeker seeker;
+               Segment segment;
 
 
                #region Constructors
                public PlayerBin()
                {
                        this.Build();
-                       PlayerInit();
                        vwin = new VolumeWindow();
                        vwin.VolumeChanged += new VolumeChangedHandler(OnVolumeChanged);
+                       tickHandler = new LongoMatch.Video.Common.TickHandler(OnTick);
                        controlsbox.Visible = false;
                        UnSensitive();
                        timescale.Adjustment.PageIncrement = 0.01;
                        timescale.Adjustment.StepIncrement = 0.0001;
                        playbutton.CanFocus = false;
+                       pausebutton.CanFocus = false;
                        prevbutton.CanFocus = false;
                        nextbutton.CanFocus = false;
                        jumpspinbutton.CanFocus = false;
@@ -100,39 +99,28 @@ namespace LongoMatch.Gui
                        detachbutton.Clicked += (sender, e) => EmitDetach();
                        seeker = new Seeker();
                        seeker.SeekEvent += HandleSeekEvent;
+                       segment.Start = new Time(-1);
+                       segment.Stop = new Time(int.MaxValue);
+                       
+                       CreatePlayer ();
                }
 
                #endregion
 
                #region Properties
 
-               public long AccurateCurrentTime {
-                       get {
-                               return player.AccurateCurrentTime;
-                       }
-               }
-
-               public int CurrentTime {
+               public Time CurrentTime {
                        get {
-                               return (int) player.CurrentTime;
+                               return player.CurrentTime;
                        }
                }
 
-               public long StreamLength {
+               public Time StreamLength {
                        get {
                                return player.StreamLength;
                        }
                }
 
-               public float Rate {
-                       get {
-                               return rate;
-                       }
-                       set {
-                               SetScaleValue ((int)(value*SCALE_FPS));
-                       }
-               }
-               
                public bool SeekingEnabled {
                        set {
                                timescale.Sensitive = value;
@@ -160,39 +148,6 @@ namespace LongoMatch.Gui
                        }
                }
 
-               public Image LogoPixbuf {
-                       set {
-                               player.LogoPixbuf = value;
-                       }
-               }
-
-               public bool DrawingMode {
-                       set {
-                               player.DrawingMode= value;
-                       }
-               }
-
-               public Image DrawingPixbuf {
-                       set {
-                               player.DrawingPixbuf=value;
-                       }
-               }
-
-               public bool LogoMode {
-                       set {
-                               player.LogoMode = value;
-                       }
-               }
-
-               public bool ExpandLogo {
-                       get {
-                               return player.ExpandLogo;
-                       }
-                       set {
-                               player.ExpandLogo = value;
-                       }
-               }
-
                public bool Opened {
                        get {
                                return filename != null;
@@ -213,27 +168,27 @@ namespace LongoMatch.Gui
 
                #region Public methods
 
-               public void Open(string mrl) {
-                       filename = mrl;
+               public void Open(string filename) {
                        ResetGui();
-                       CloseActualSegment();
-                       try {
-                               player.Open(mrl);
-                       }
-                       catch {
-                               //We handle this error async
+                       CloseSegment();
+                       if (filename != this.filename) {
+                               readyToSeek = false;
+                               this.filename = filename;
+                               try {
+                                       player.Open(filename);
+                               }
+                               catch (Exception ex) {
+                                       Log.Exception (ex);
+                                       //We handle this error async
+                               }
+                       } else {
+                               player.Seek (new Time (0), true);
                        }
                        detachbutton.Sensitive = true;
-                       readyToSeek = false;
                }
 
                public void Play() {
                        player.Play();
-                       float val = GetRateFromScale();
-                       if(segmentStartTime == 0 && segmentStopTime==0)
-                               player.SetRate(val);
-                       else
-                               player.SetRateInSegment(val,segmentStopTime);
                }
 
                public void Pause() {
@@ -247,40 +202,30 @@ namespace LongoMatch.Gui
                                Play();
                }
 
-               public void SetLogo(string filename) {
-                       player.Logo=filename;
-               }
-
                public void ResetGui() {
                        closebutton.Hide();
                        SetSensitive();
                        timescale.Value=0;
                        timelabel.Text="";
                        SeekingEnabled = true;
-                       player.CancelProgramedStop();
+                       seeking=false;
+                       IsPlayingPrevState = false;
+                       muted=false;
+                       emitRateScale = true;
+                       readyToSeek = false;
                }
 
-               public void SetPlayListElement(string fileName,long start, long stop, float rate, bool 
hasNext) {
+               public void LoadPlayListPlay (PlayListPlay play, bool hasNext) {
                        if(hasNext)
                                nextbutton.Sensitive = true;
                        else
                                nextbutton.Sensitive = false;
 
-                       if(fileName != filename) {
-                               Open(fileName);
-                               //Wait until the pipeline is prerolled and ready to seek
-                               pendingSeek = new object[3] {start,stop,rate};
-                       }
-                       else {
-                        player.SegmentSeek(start,stop,rate);
-                        player.Play();
-                       }
-
-                       segmentStartTime = start;
-                       segmentStopTime = stop;
-                       player.LogoMode = false;
-                       Rate = rate;
-                       detachbutton.Sensitive = true;
+                       LoadSegment (play.MediaFile.FilePath, play.Start, play.Stop, play.Rate);
+               }
+               
+               public void LoadPlay (string filename, Play play) {
+                       LoadSegment (filename, play.Start, play.Stop, play.Rate);
                }
 
                public void Close() {
@@ -290,34 +235,23 @@ namespace LongoMatch.Gui
                        UnSensitive();
                }
 
-               public void SeekTo(long time, bool accurate) {
-                       player.SeekTime(time,1,accurate);
-                       if(SeekEvent != null)
-                               SeekEvent(time);
-               }
-
-               public void SeekInSegment(long pos) {
-                       player.SeekInSegment(pos, GetRateFromScale());
+               public void Seek (Time time, bool accurate) {
+                       player.Seek (time, accurate);
                        if(SeekEvent != null)
-                               SeekEvent(pos);
+                               SeekEvent (time);
                }
 
-               public void SeekToNextFrame(bool in_segment) {
-                       int currentTime = (int)player.CurrentTime;
-                       if(segmentStopTime==0 | currentTime < segmentStopTime) {
-                               if(player.Playing)
-                                       player.Pause();
-                               player.SeekToNextFrame(GetRateFromScale(), in_segment);
+               public void SeekToNextFrame () {
+                       if (player.CurrentTime < segment.Stop) {
+                               player.SeekToNextFrame ();
                                if(SeekEvent != null)
-                                       SeekEvent(currentTime);
+                                       SeekEvent (player.CurrentTime);
                        }
-
                }
 
-               public void SeekToPreviousFrame(bool in_segment) {
-                       long currentTime = player.CurrentTime;
-                       if (currentTime > segmentStartTime) {
-                               seeker.Seek (SeekType.StepDown, GetRateFromScale(), in_segment);
+               public void SeekToPreviousFrame () {
+                       if (player.CurrentTime > segment.Start) {
+                               seeker.Seek (SeekType.StepDown);
                        }
                }
 
@@ -337,42 +271,13 @@ namespace LongoMatch.Gui
                        vscale1.Adjustment.Value -= vscale1.Adjustment.StepIncrement;
                }
 
-               public void UpdateSegmentStartTime(long start) {
-                       segmentStartTime = start;
-                       player.SegmentStartUpdate(start, GetRateFromScale());
-                       if(SeekEvent != null)
-                               SeekEvent(start);
-               }
-
-               public void UpdateSegmentStopTime(long stop) {
-                       segmentStopTime = stop;
-                       player.SegmentStopUpdate(stop, GetRateFromScale());
-                       if(SeekEvent != null)
-                               SeekEvent(stop);
-               }
-
-               public void SetStartStop(long start, long stop, float rate = 1) {
-                       segmentStartTime = start;
-                       segmentStopTime = stop;
-                       closebutton.Show();
-                       SetScaleValue ((int) (rate * SCALE_FPS));
-                       if (readyToSeek) {
-                               player.SegmentSeek(start, stop, rate);
-                               player.Play();
-                       } else {
-                               pendingSeek = new object[3] {start, stop, rate};
-                       }
-               }
-
-               public void CloseActualSegment() {
+               public void CloseSegment() {
                        closebutton.Hide();
-                       segmentStartTime = 0;
-                       segmentStopTime = 0;
+                       segment.Start = new Time (-1);
+                       segment.Stop = new Time (int.MaxValue);
                        SetScaleValue (SCALE_FPS);
                        //timescale.Sensitive = true;
-                       slength = TimeString.MSecondsToSecondsString(length);
                        SegmentClosedEvent();
-                       player.CancelProgramedStop();
                }
 
                public void SetSensitive() {
@@ -389,13 +294,36 @@ namespace LongoMatch.Gui
 
                #region Private methods
 
+               bool SegmentLoaded {
+                       get {
+                               return segment.Start.MSeconds != -1;
+                       }
+               }
+               
+               void LoadSegment (string filename, Time start, Time stop, float rate = 1) {
+                       Open (filename);
+                       segment.Start = start;
+                       segment.Stop = stop;
+                       rate = rate == 0 ? 1 : rate;
+                       closebutton.Show();
+                       if (readyToSeek) {
+                               SetScaleValue ((int) (rate * SCALE_FPS));
+                               player.Rate = (double) rate;
+                               player.Seek (start, true);
+                               player.Play ();
+                       } else {
+                               pendingSeek = new object[3] {start, stop, rate};
+                       }
+               }
+
+
                void SetScaleValue (int value) {
                        emitRateScale = false;
                        vscale1.Value = value;
                        emitRateScale = true;
                }
                
-               private float GetRateFromScale() {
+               float GetRateFromScale() {
                        VScale scale= vscale1;
                        double val = scale.Value;
 
@@ -408,52 +336,25 @@ namespace LongoMatch.Gui
                        return (float)val;
                }
 
-               private bool InSegment() {
-                       return  !(segmentStopTime == 0 && segmentStartTime ==0) ;
+               void Jump (int jump) {
+                       Time pos = CurrentTime + (jump * 1000);
+                       if (pos.MSeconds < 0)
+                               pos.MSeconds = 0;
+                       Log.Debug (String.Format("Stepping {0} seconds from {1} to {2}", jump, CurrentTime, 
pos));
+                       Seek (pos, true);
                }
 
-               private void PlayerInit() {
-                       MultimediaToolkit factory;
-                       Widget playerWidget;
-
-                       factory= new MultimediaToolkit();
-                       player = factory.GetPlayer(320,280);
-
-                       tickHandler = new LongoMatch.Video.Common.TickHandler(OnTick);
-                       player.Tick += tickHandler;
-                       player.StateChange += OnStateChanged;
-                       player.Eos += OnEndOfStream;
-                       player.Error += OnError;
-                       player.ReadyToSeek += OnReadyToSeek;
-
-                       playerWidget = (Widget)player;
-                       playerWidget.ButtonPressEvent += OnVideoboxButtonPressEvent;
-                       playerWidget.ScrollEvent += OnVideoboxScrollEvent;
-                       playerWidget.Show();
-                       videobox.Add(playerWidget);
-
-               }
-               
-               void Jump(int jump) {
-                       long pos = Math.Max(CurrentTime + (jump * 1000), 0);
-                       Log.Debug(String.Format("Stepping {0} seconds from {1} to {2}", jump, CurrentTime, 
pos));
-                       if (InSegment())
-                               SeekInSegment(pos);
-                       else
-                               SeekTo(pos, true);
-               }
-
-               private void SeekFromTimescale(double pos) {
-                       if(InSegment()) {
-                               long seekPos = segmentStartTime + 
(long)(pos*(segmentStopTime-segmentStartTime));
-                               seeker.Seek (SeekType.Keyframe, GetRateFromScale(), true, seekPos);
-                               timelabel.Text= TimeString.MSecondsToMSecondsString(seekPos) + "/" +
-                                               
TimeString.MSecondsToMSecondsString(segmentStopTime-segmentStartTime);
+               void SeekFromTimescale (double pos) {
+                       if(SegmentLoaded) {
+                               Time duration = segment.Stop - segment.Start;
+                               Time seekPos = segment.Start + duration * pos;
+                               seeker.Seek (SeekType.Keyframe, seekPos);
+                               timelabel.Text = seekPos.ToMSecondsString() + "/" + 
duration.ToMSecondsString();
                        }
                        else {
-                               seeker.Seek (SeekType.Keyframe, GetRateFromScale(), true, (int) (pos * 
length));
-                               timelabel.Text= TimeString.MSecondsToMSecondsString(player.CurrentTime) + "/" 
+ slength;
-                               Rate = 1;
+                               seeker.Seek (SeekType.Keyframe, length * pos);
+                               timelabel.Text = player.CurrentTime.ToMSecondsString () + "/" +
+                                       length.ToMSecondsString();
                        }
                }
                
@@ -462,10 +363,34 @@ namespace LongoMatch.Gui
                                Detach(!Detached);
                }
                
+               void CreatePlayer ()
+               {
+                       MultimediaToolkit factory = new MultimediaToolkit();
+                       videodrawingarea.DoubleBuffered = false;
+                       player = factory.GetPlayer ();
+
+                       player.Tick += OnTick;
+                       player.StateChange += OnStateChanged;
+                       player.Eos += OnEndOfStream;
+                       player.Error += OnError;
+                       player.ReadyToSeek += OnReadyToSeek;
+
+                       videoeventbox.ButtonPressEvent += OnVideoboxButtonPressEvent;
+                       videoeventbox.ScrollEvent += OnVideoboxScrollEvent;
+                       videodrawingarea.Realized += HandleRealized;
+                       videodrawingarea.ExposeEvent += HandleExposeEvent;
+                       videodrawingarea.CanFocus = false;
+               }
+
                #endregion
 
                #region Callbacks
-               protected virtual void OnStateChanged(object o, StateChangeArgs args) {
+               void HandleExposeEvent (object o, ExposeEventArgs args)
+               {
+                       player.Expose();
+               }
+               
+               void OnStateChanged(object o, StateChangeArgs args) {
                        if(args.Playing) {
                                playbutton.Hide();
                                pausebutton.Show();
@@ -478,42 +403,47 @@ namespace LongoMatch.Gui
                                PlayStateChanged(this,args.Playing);
                }
 
-               protected void OnReadyToSeek(object o, EventArgs args) {
+               void OnReadyToSeek(object o, EventArgs args) {
                        readyToSeek = true;
                        if(pendingSeek != null) {
-                               player.SegmentSeek((long)pendingSeek[0],
-                                                  (long)pendingSeek[1],
-                                                  (float)pendingSeek[2]);
+                               player.Rate = (float) pendingSeek [2];
+                               player.Seek ((Time)pendingSeek[0], true);
                                player.Play();
                                pendingSeek = null;
                        }
                }
 
-               protected virtual void OnTick(object o,TickArgs args) {
-                       long currentTime = args.CurrentTime;
-                       float currentposition = args.CurrentPosition;
-                       long streamLength = args.StreamLength;
+               void OnTick (object o, TickArgs args) {
+                       Time currentTime = args.CurrentTime;
+                       Time streamLength = args.StreamLength;
+                       double currentposition = args.CurrentPosition;
+                       string slength;
 
-                       //Console.WriteLine ("Current Time:{0}\n Length:{1}\n",currentTime, streamLength);
-                       if(length != streamLength) {
+                       if (length != streamLength) {
                                length = streamLength;
-                               slength = TimeString.MSecondsToSecondsString(length);
                        }
 
-                       if(InSegment()) {
-                               currentTime -= segmentStartTime;
-                               currentposition = 
(float)currentTime/(float)(segmentStopTime-segmentStartTime);
-                               slength = 
TimeString.MSecondsToMSecondsString(segmentStopTime-segmentStartTime);
+                       if (SegmentLoaded) {
+                               Time duration = segment.Stop - segment.Start;
+                               if (currentTime > segment.Stop) {
+                                       player.Pause ();
+                               }
+                               currentTime -= segment.Start;
+                               currentposition = (float)currentTime.MSeconds/(float)(duration.MSeconds);
+                               slength = duration.ToMSecondsString();
+                               
+                       } else {
+                               slength = length.ToMSecondsString ();
                        }
 
-                       timelabel.Text = TimeString.MSecondsToMSecondsString(currentTime) + "/" + slength;
+                       timelabel.Text = currentTime.ToMSecondsString() + "/" + slength;
                        timescale.Value = currentposition;
-                       if(Tick != null)
-                               Tick(o, args.CurrentTime, args.StreamLength, args.CurrentPosition, 
args.Seekable);
+                       if (Tick != null)
+                               Tick (o, currentTime, streamLength, currentposition);
 
                }
 
-               protected virtual void OnTimescaleAdjustBounds(object o, Gtk.AdjustBoundsArgs args)
+               void OnTimescaleAdjustBounds(object o, Gtk.AdjustBoundsArgs args)
                {
                        double pos;
 
@@ -533,7 +463,7 @@ namespace LongoMatch.Gui
                        SeekFromTimescale(pos);
                }
 
-               protected virtual void OnTimescaleValueChanged(object sender, System.EventArgs e)
+               void OnTimescaleValueChanged(object sender, System.EventArgs e)
                {
                        if(seeking) {
                                /* Releasing the timescale always report value different from the real one.
@@ -546,28 +476,23 @@ namespace LongoMatch.Gui
                        }
                }
 
-               protected virtual void OnPlaybuttonClicked(object sender, System.EventArgs e)
+               void OnPlaybuttonClicked(object sender, System.EventArgs e)
                {
                        Play();
                }
 
-               protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e)
-               {
-                       player.SeekTime(segmentStartTime,1,true);
-               }
-
-               protected virtual void OnVolumebuttonClicked(object sender, System.EventArgs e)
+               void OnVolumebuttonClicked(object sender, System.EventArgs e)
                {
                        vwin.SetLevel(player.Volume);
                        vwin.Show();
                }
 
-               protected virtual void OnDestroyEvent(object o, Gtk.DestroyEventArgs args)
+               void OnDestroyEvent(object o, Gtk.DestroyEventArgs args)
                {
                        player.Dispose();
                }
 
-               protected virtual void OnVolumeChanged(double level) {
+               void OnVolumeChanged(double level) {
                        player.Volume = level;
                        if(level == 0)
                                muted = true;
@@ -575,42 +500,42 @@ namespace LongoMatch.Gui
                                muted = false;
                }
 
-               protected virtual void OnPausebuttonClicked(object sender, System.EventArgs e)
+               void OnPausebuttonClicked(object sender, System.EventArgs e)
                {
                        player.Pause();
                }
 
-               protected virtual void OnEndOfStream(object o, EventArgs args) {
-                       player.SeekInSegment(0, GetRateFromScale());
+               void OnEndOfStream(object o, EventArgs args) {
+                       player.Seek (new Time (0), true);
                        player.Pause();
                }
 
-
-               protected virtual void OnError(object o, ErrorArgs args) {
+               void OnError(object o, ErrorArgs args) {
                        if(Error != null)
                                Error(o, args.Message);
                }
 
-               protected virtual void OnClosebuttonClicked(object sender, System.EventArgs e)
+               void OnClosebuttonClicked(object sender, System.EventArgs e)
                {
-                       CloseActualSegment();
+                       CloseSegment();
+                       player.Play ();
                }
 
-               protected virtual void OnPrevbuttonClicked(object sender, System.EventArgs e)
+               void OnPrevbuttonClicked(object sender, System.EventArgs e)
                {
-                       if (InSegment())
-                               SeekInSegment (segmentStartTime);
+                       if (segment.Start.MSeconds > 0)
+                               Seek (segment.Start, true);
                        if(Prev != null)
                                Prev();
                }
 
-               protected virtual void OnNextbuttonClicked(object sender, System.EventArgs e)
+               void OnNextbuttonClicked(object sender, System.EventArgs e)
                {
                        if(Next != null)
                                Next();
                }
 
-               protected virtual void OnVscale1FormatValue(object o, Gtk.FormatValueArgs args)
+               void OnVscale1FormatValue(object o, Gtk.FormatValueArgs args)
                {
                        double val = args.Value;
                        if(val >= SCALE_FPS) {
@@ -621,7 +546,7 @@ namespace LongoMatch.Gui
                        }
                }
 
-               protected virtual void OnVscale1ValueChanged(object sender, System.EventArgs e)
+               void OnVscale1ValueChanged(object sender, System.EventArgs e)
                {
                        float val = GetRateFromScale();
 
@@ -635,18 +560,13 @@ namespace LongoMatch.Gui
                        else if(val ==1)
                                player.Volume = previousVLevel;
 
-                       if(InSegment()) {
-                               player.SetRateInSegment(val,segmentStopTime);
-                       }
-                       else
-                               player.SetRate(val);
-                       rate = val;
+                       player.Rate = val;
                        if (PlaybackRateChanged != null && emitRateScale) {
-                               PlaybackRateChanged (rate);
+                               PlaybackRateChanged (val);
                        }
                }
 
-               protected virtual void OnVideoboxButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
+               void OnVideoboxButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
                {
                        if(filename == null)
                                return;
@@ -660,14 +580,14 @@ namespace LongoMatch.Gui
                                Pause();
                }
 
-               protected virtual void OnVideoboxScrollEvent(object o, Gtk.ScrollEventArgs args)
+               void OnVideoboxScrollEvent(object o, Gtk.ScrollEventArgs args)
                {
                        switch(args.Event.Direction) {
                        case ScrollDirection.Down:
-                               SeekToPreviousFrame(InSegment());
+                               SeekToPreviousFrame ();
                                break;
                        case ScrollDirection.Up:
-                               SeekToNextFrame(InSegment());
+                               SeekToNextFrame ();
                                break;
                        case ScrollDirection.Left:
                                StepBackward();
@@ -678,38 +598,35 @@ namespace LongoMatch.Gui
                        }
                }
 
-               protected virtual void OnDrawButtonClicked(object sender, System.EventArgs e)
+               void OnDrawButtonClicked(object sender, System.EventArgs e)
                {
-                       int currentTime;
-
-                       currentTime = (int)AccurateCurrentTime;
-                       // If the player has reached the end of the segment the current time
-                       // will be unseekable and it's not possible to get a frame at this
-                       // instant. If we exceed the segment stop time, decrease in a
-                       // milisecond the position.
-                       if(InSegment() && currentTime >= segmentStopTime)
-                               currentTime -= 1;
                        if(DrawFrame != null)
-                               DrawFrame(currentTime);
+                               DrawFrame (CurrentTime);
+               }
+               
+               void HandleRealized (object sender, EventArgs e)
+               {
+                       player.WindowHandle = GtkHelpers.GetWindowHandle (videodrawingarea.GdkWindow);
                }
                
-               void HandleSeekEvent (SeekType type, float rate, bool inSegment, long start, long stop)
+               void HandleSeekEvent (SeekType type, Time start, float rate)
                {
                        /* We only use it for backwards framestepping for now */
                        if (type == SeekType.StepDown || type == SeekType.StepUp) {
                                if(player.Playing)
                                        player.Pause ();
                                if (type == SeekType.StepDown)
-                                       player.SeekToPreviousFrame (rate, inSegment);
+                                       player.SeekToPreviousFrame ();
                                else
-                                       player.SeekToNextFrame (rate, inSegment);
+                                       player.SeekToNextFrame ();
                                if (SeekEvent != null)
-                                       SeekEvent ((int)AccurateCurrentTime);
+                                       SeekEvent (CurrentTime);
                        }
                        if (type == SeekType.Accurate || type == SeekType.Keyframe) {
-                               player.SeekTime (start, rate, type == SeekType.Accurate);
+                               player.Rate = (double) rate;
+                               player.Seek (start, type == SeekType.Accurate);
                                if (SeekEvent != null)
-                                       SeekEvent ((int)start);
+                                       SeekEvent (start);
                        }
                }
 
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs 
b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
index 6f13d35..ec26cd4 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
@@ -20,6 +20,7 @@ using System;
 using LongoMatch.Handlers;
 using LongoMatch.Interfaces.GUI;
 using LongoMatch.Common;
+using LongoMatch.Store;
 
 namespace LongoMatch.Gui
 {
@@ -51,7 +52,6 @@ namespace LongoMatch.Gui
                }
                
                PlayerOperationMode mode;
-               CaptureSettings captureSettings;
                bool backLoaded = false;
                
                public PlayerCapturerBin ()
@@ -64,7 +64,6 @@ namespace LongoMatch.Gui
                        set {
                                mode = value;
                                if (mode == PlayerOperationMode.Player) {
-                                       playerbin.ExpandLogo = true;
                                        ShowPlayer();
                                } else {
                                        ShowCapturer();
@@ -89,7 +88,7 @@ namespace LongoMatch.Gui
                }
                
 #region Common
-               public int CurrentTime {
+               public Time CurrentTime {
                        get {
                                if (mode == PlayerOperationMode.Player)
                                        return playerbin.CurrentTime;
@@ -115,30 +114,21 @@ namespace LongoMatch.Gui
 #endregion
 
 #region Capturer
-               public CapturerType Type {
-                       set {
-                               capturerbin.Type = value;
-                       }
-               }
-               
                public string Logo {
                        set {
                                capturerbin.Logo = value;
                        }
                }
                
-               public bool Capturing {
+               public CaptureSettings CaptureSettings {
                        get {
-                               return capturerbin.Capturing;
+                               return capturerbin.CaptureSettings;
                        }
                }
                
-               public CaptureSettings CaptureProperties {
-                       set {
-                               captureSettings = value;
-                               capturerbin.CaptureProperties = value;
-                       } get {
-                               return captureSettings;
+               public bool Capturing {
+                       get {
+                               return capturerbin.Capturing;
                        }
                }
                
@@ -150,12 +140,8 @@ namespace LongoMatch.Gui
                        capturerbin.TogglePause ();
                }
                
-               public void Stop () {
-                       capturerbin.Stop ();
-               }
-               
-               public void Run () {
-                       capturerbin.Run ();
+               public void Run (CapturerType type, CaptureSettings settings) {
+                       capturerbin.Run (type, settings);
                }
 #endregion
                
@@ -177,13 +163,7 @@ namespace LongoMatch.Gui
                        }
                }
                
-               public long AccurateCurrentTime {
-                       get {
-                               return playerbin.AccurateCurrentTime;
-                       }
-               }
-               
-               public long StreamLength {
+               public Time StreamLength {
                        get {
                                return playerbin.StreamLength;
                        }
@@ -195,40 +175,6 @@ namespace LongoMatch.Gui
                        }
                }
                
-               public Image LogoPixbuf {
-                       set {
-                               playerbin.LogoPixbuf = value;
-                       }
-               }
-               
-               public Image DrawingPixbuf {
-                       set {
-                               playerbin.DrawingPixbuf = value;
-                       }
-               }
-               
-               public bool DrawingMode {
-                       set {
-                               playerbin.DrawingMode = value;
-                       }
-               }
-               
-               public bool LogoMode {
-                       set {
-                               playerbin.LogoMode = value;
-                       }
-               }
-               
-               public bool ExpandLogo {
-                       set {
-                               playerbin.ExpandLogo = value;
-                       }
-                       
-                       get {
-                               return playerbin.ExpandLogo;
-                       }
-               }
-               
                public bool Opened {
                        get {
                                return playerbin.Opened;
@@ -241,15 +187,6 @@ namespace LongoMatch.Gui
                        }
                }
                
-               public float Rate {
-                       get {
-                               return playerbin.Rate;
-                       }
-                       set {
-                               playerbin.Rate = value;
-                       }
-               }
-
                public void Open (string mrl) {
                        playerbin.Open (mrl);
                }
@@ -266,32 +203,33 @@ namespace LongoMatch.Gui
                        playerbin.TogglePlay ();
                }
                
-               public void SetLogo (string filename) {
-                       playerbin.SetLogo (filename);
-               }
-               
                public void ResetGui () {
                        playerbin.ResetGui ();
                }
                
-               public void SetPlayListElement (string fileName,long start, long stop, float rate, bool 
hasNext) {
-                       playerbin.SetPlayListElement (fileName, start, stop, rate, hasNext);
+               public void LoadPlayListPlay (PlayListPlay play, bool hasNext) {
+                       playerbin.LoadPlayListPlay (play, hasNext);
                }
                
-               public void SeekTo (long time, bool accurate) {
-                       playerbin.SeekTo (time, accurate);
+               public void LoadPlay (string filename, Play play) {
+                       if (mode == PlayerOperationMode.PreviewCapturer) {
+                               backtolivebutton.Visible = true;
+                               ShowPlayer ();
+                               LoadBackgroundPlayer(filename);
+                       }
+                       playerbin.LoadPlay (filename, play);
                }
                
-               public void SeekInSegment (long pos) {
-                       playerbin.SeekInSegment (pos);
+               public void Seek (Time time, bool accurate) {
+                       playerbin.Seek (time, accurate);
                }
                
-               public void SeekToNextFrame (bool in_segment) {
-                       playerbin.SeekToNextFrame (in_segment);
+               public void SeekToNextFrame () {
+                       playerbin.SeekToNextFrame ();
                }
                
-               public void SeekToPreviousFrame (bool in_segment) {
-                       playerbin.SeekToPreviousFrame (in_segment);
+               public void SeekToPreviousFrame () {
+                       playerbin.SeekToPreviousFrame ();
                }
                
                public void StepForward () {
@@ -310,25 +248,8 @@ namespace LongoMatch.Gui
                        playerbin.FramerateDown ();
                }
                
-               public void UpdateSegmentStartTime (long start) {
-                       playerbin.UpdateSegmentStartTime (start);
-               }
-               
-               public void UpdateSegmentStopTime (long stop) {
-                       playerbin.UpdateSegmentStopTime (stop);
-               }
-               
-               public void SetStartStop (long start, long stop, float rate=1) {
-                       if (mode == PlayerOperationMode.PreviewCapturer) {
-                               backtolivebutton.Visible = true;
-                               LoadBackgroundPlayer();
-                               ShowPlayer ();
-                       }
-                       playerbin.SetStartStop (start, stop, rate);
-               }
-               
-               public void CloseActualSegment () {
-                       playerbin.CloseActualSegment ();
+               public void CloseSegment () {
+                       playerbin.CloseSegment ();
                }
                
                public void SetSensitive () {
@@ -368,10 +289,9 @@ namespace LongoMatch.Gui
                                        SegmentClosedEvent ();
                        };
                        
-                       playerbin.Tick += delegate (object o, long currentTime, long streamLength,
-                                                   float currentPosition, bool seekable) {
+                       playerbin.Tick += delegate (object o, Time t, Time s, double p) {
                                if (Tick != null)
-                                       Tick (o, currentTime, streamLength, currentPosition, seekable);
+                                       Tick (o, t, s, p);
                        };
                        
                        playerbin.PlayStateChanged += delegate (object sender, bool playing) {
@@ -389,12 +309,12 @@ namespace LongoMatch.Gui
                                        Prev ();
                        };
                        
-                       playerbin.DrawFrame += delegate (int time) {
+                       playerbin.DrawFrame += delegate (Time time) {
                                if (DrawFrame != null)
                                        DrawFrame (time);
                        };
                        
-                       playerbin.SeekEvent += delegate (long pos) {
+                       playerbin.SeekEvent += delegate (Time pos) {
                                if (SeekEvent != null)
                                        SeekEvent (pos);
                        };
@@ -410,20 +330,16 @@ namespace LongoMatch.Gui
                        };
                }
                
-               void LoadBackgroundPlayer () {
+               void LoadBackgroundPlayer (string filename) {
                        if (backLoaded)
                                return;
                                
-                       if (mode == PlayerOperationMode.PreviewCapturer) {
-                               /* The output video file is now created, it's time to 
+                       /* The output video file is now created, it's time to 
                                 * load it in the player */
-                               playerbin.SetSensitive ();
-                               playerbin.Open (captureSettings.EncodingSettings.OutputFile);
-                               playerbin.LogoMode = false;
-                               playerbin.SeekingEnabled = false;
-                               Log.Debug ("Loading encoded file in the backround player");
-                               backLoaded = true;
-                       }
+                       playerbin.Open (filename);
+                       playerbin.SeekingEnabled = false;
+                       Log.Debug ("Loading encoded file in the backround player");
+                       backLoaded = true;
                }
        }
 }
diff --git a/LongoMatch.Multimedia/Utils/FramesCapturer.cs 
b/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
similarity index 80%
rename from LongoMatch.Multimedia/Utils/FramesCapturer.cs
rename to LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
index 4bb43f3..e854ae0 100644
--- a/LongoMatch.Multimedia/Utils/FramesCapturer.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/Utils/FramesCapturer.cs
@@ -20,12 +20,12 @@
 
 using System;
 using System.Threading;
-using Gtk;
 
 using LongoMatch.Common;
 using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Video;
 using LongoMatch.Video.Common;
+using LongoMatch.Store;
 
 namespace LongoMatch.Video.Utils
 {
@@ -34,8 +34,8 @@ namespace LongoMatch.Video.Utils
        public class FramesSeriesCapturer
        {
                IFramesCapturer capturer;
-               long start;
-               long stop;
+               Time start;
+               Time stop;
                uint interval;
                int totalFrames;
                string seriesName;
@@ -46,7 +46,7 @@ namespace LongoMatch.Video.Utils
 
                public event LongoMatch.Handlers.FramesProgressHandler Progress;
 
-               public FramesSeriesCapturer(string videoFile,long start, long stop, uint interval, string 
outputDir)
+               public FramesSeriesCapturer(string videoFile, Time start, Time stop, uint interval, string 
outputDir)
                {
                        MultimediaFactory mf= new MultimediaFactory();
                        this.capturer=mf.GetFramesCapturer();
@@ -56,7 +56,7 @@ namespace LongoMatch.Video.Utils
                        this.interval = interval;
                        this.outputDir = outputDir;
                        this.seriesName = System.IO.Path.GetFileName(outputDir);
-                       this.totalFrames = (int)Math.Floor((double)((stop - start) / interval))+1;
+                       this.totalFrames = (int)Math.Floor((double)((stop - start).MSeconds / interval))+1;
                }
 
                public void Cancel() {
@@ -69,20 +69,21 @@ namespace LongoMatch.Video.Utils
                }
 
                public void CaptureFrames() {
-                       long pos;
+                       Time pos;
                        LongoMatch.Common.Image frame;
                        int i = 0;
 
                        System.IO.Directory.CreateDirectory(outputDir);
 
                        pos = start;
-                       if(Progress != null)
-                               Application.Invoke(delegate {
-                               Progress(0,totalFrames,null);
-                       });
+                       if(Progress != null) {
+                               GtkHelpers.CallFromAppThread (delegate {
+                                       Progress(0,totalFrames,null);
+                               });
+                       }
                        while(pos <= stop) {
                                if(!cancel) {
-                                       capturer.SeekTime(pos,true);
+                                       capturer.Seek (pos, true);
                                        capturer.Pause();
                                        frame = capturer.GetCurrentFrame();
                                        if(frame != null) {
@@ -90,11 +91,12 @@ namespace LongoMatch.Video.Utils
                                                frame.Scale(THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_HEIGHT);
                                        }
 
-                                       if(Progress != null)
-                                               Application.Invoke(delegate {
-                                               Progress(i+1, totalFrames, frame);
-                                       });
-                                       pos += interval;
+                                       if(Progress != null) {
+                                               GtkHelpers.CallFromAppThread (delegate {
+                                                       Progress(i+1, totalFrames, frame);
+                                               });
+                                       }
+                                       pos.MSeconds += (int) interval;
                                        i++;
                                }
                                else {
diff --git a/LongoMatch.GUI.Multimedia/LongoMatch.GUI.Multimedia.mdp 
b/LongoMatch.GUI.Multimedia/LongoMatch.GUI.Multimedia.mdp
index 33dfc11..958170a 100644
--- a/LongoMatch.GUI.Multimedia/LongoMatch.GUI.Multimedia.mdp
+++ b/LongoMatch.GUI.Multimedia/LongoMatch.GUI.Multimedia.mdp
@@ -30,6 +30,7 @@
     <File subtype="Directory" buildaction="Compile" name="Gui/Utils" />
     <File subtype="Code" buildaction="Compile" name="Gui/Utils/Remuxer.cs" />
     <File subtype="Code" buildaction="Compile" name="MultimediaToolkit.cs" />
+    <File subtype="Code" buildaction="Compile" name="Gui/Utils/FramesCapturer.cs" />
   </Contents>
   <MonoDevelop.Autotools.MakefileInfo RelativeMakefileName="Makefile.am" RelativeConfigureInPath="../">
     <BuildFilesVar Name="FILES" />
@@ -49,6 +50,7 @@
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=0738eb9f132ed756" />
     <ProjectReference type="Gac" localcopy="True" refto="System.Drawing, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a" />
+    <ProjectReference type="Project" localcopy="True" refto="LongoMatch.GUI.Helpers" />
   </References>
   <LanguageParameters ApplicationIcon="." CodePage="65001" ctype="CSharpProjectParameters" />
 </Project>
\ No newline at end of file
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.CapturerBin.cs 
b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.CapturerBin.cs
index e4b3fe5..5df4fc9 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.CapturerBin.cs
@@ -5,8 +5,7 @@ namespace LongoMatch.Gui
        public partial class CapturerBin
        {
                private global::Gtk.VBox vbox1;
-               private global::Gtk.HBox capturerhbox;
-               private global::Gtk.DrawingArea logodrawingarea;
+               private global::Gtk.DrawingArea videodrawingarea;
                private global::Gtk.HBox hbox2;
                private global::Gtk.HBox buttonsbox;
                private global::Gtk.Button recbutton;
@@ -25,19 +24,12 @@ namespace LongoMatch.Gui
                        this.vbox1.Name = "vbox1";
                        this.vbox1.Spacing = 6;
                        // Container child vbox1.Gtk.Box+BoxChild
-                       this.capturerhbox = new global::Gtk.HBox ();
-                       this.capturerhbox.Name = "capturerhbox";
-                       this.capturerhbox.Spacing = 6;
-                       this.vbox1.Add (this.capturerhbox);
-                       global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.capturerhbox]));
+                       this.videodrawingarea = new global::Gtk.DrawingArea ();
+                       this.videodrawingarea.Name = "videodrawingarea";
+                       this.vbox1.Add (this.videodrawingarea);
+                       global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.videodrawingarea]));
                        w1.Position = 0;
                        // Container child vbox1.Gtk.Box+BoxChild
-                       this.logodrawingarea = new global::Gtk.DrawingArea ();
-                       this.logodrawingarea.Name = "logodrawingarea";
-                       this.vbox1.Add (this.logodrawingarea);
-                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.logodrawingarea]));
-                       w2.Position = 1;
-                       // Container child vbox1.Gtk.Box+BoxChild
                        this.hbox2 = new global::Gtk.HBox ();
                        this.hbox2.Name = "hbox2";
                        this.hbox2.Spacing = 6;
@@ -51,91 +43,91 @@ namespace LongoMatch.Gui
                        this.recbutton.Name = "recbutton";
                        this.recbutton.UseUnderline = true;
                        // Container child recbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w3 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w2 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w4 = new global::Gtk.HBox ();
-                       w4.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w5 = new global::Gtk.Image ();
-                       w5.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-record", 
global::Gtk.IconSize.Dialog);
-                       w4.Add (w5);
+                       global::Gtk.HBox w3 = new global::Gtk.HBox ();
+                       w3.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w7 = new global::Gtk.Label ();
-                       w4.Add (w7);
+                       global::Gtk.Image w4 = new global::Gtk.Image ();
+                       w4.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-record", 
global::Gtk.IconSize.Dialog);
                        w3.Add (w4);
-                       this.recbutton.Add (w3);
+                       // Container child GtkHBox.Gtk.Container+ContainerChild
+                       global::Gtk.Label w6 = new global::Gtk.Label ();
+                       w3.Add (w6);
+                       w2.Add (w3);
+                       this.recbutton.Add (w2);
                        this.buttonsbox.Add (this.recbutton);
-                       global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.recbutton]));
-                       w11.Position = 0;
-                       w11.Expand = false;
-                       w11.Fill = false;
+                       global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.recbutton]));
+                       w10.Position = 0;
+                       w10.Expand = false;
+                       w10.Fill = false;
                        // Container child buttonsbox.Gtk.Box+BoxChild
                        this.pausebutton = new global::Gtk.Button ();
                        this.pausebutton.TooltipMarkup = "Pause capture";
                        this.pausebutton.Name = "pausebutton";
                        this.pausebutton.UseUnderline = true;
                        // Container child pausebutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w12 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w11 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w13 = new global::Gtk.HBox ();
-                       w13.Spacing = 2;
+                       global::Gtk.HBox w12 = new global::Gtk.HBox ();
+                       w12.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w14 = new global::Gtk.Image ();
-                       w14.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-pause", 
global::Gtk.IconSize.Dialog);
-                       w13.Add (w14);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w16 = new global::Gtk.Label ();
-                       w13.Add (w16);
+                       global::Gtk.Image w13 = new global::Gtk.Image ();
+                       w13.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-pause", 
global::Gtk.IconSize.Dialog);
                        w12.Add (w13);
-                       this.pausebutton.Add (w12);
+                       // Container child GtkHBox.Gtk.Container+ContainerChild
+                       global::Gtk.Label w15 = new global::Gtk.Label ();
+                       w12.Add (w15);
+                       w11.Add (w12);
+                       this.pausebutton.Add (w11);
                        this.buttonsbox.Add (this.pausebutton);
-                       global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.pausebutton]));
-                       w20.Position = 1;
-                       w20.Expand = false;
-                       w20.Fill = false;
+                       global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.pausebutton]));
+                       w19.Position = 1;
+                       w19.Expand = false;
+                       w19.Fill = false;
                        // Container child buttonsbox.Gtk.Box+BoxChild
                        this.stopbutton = new global::Gtk.Button ();
                        this.stopbutton.TooltipMarkup = "Stop and close capture";
                        this.stopbutton.Name = "stopbutton";
                        this.stopbutton.UseUnderline = true;
                        // Container child stopbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w21 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w20 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w22 = new global::Gtk.HBox ();
-                       w22.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w23 = new global::Gtk.Image ();
-                       w23.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-stop", 
global::Gtk.IconSize.Dialog);
-                       w22.Add (w23);
+                       global::Gtk.HBox w21 = new global::Gtk.HBox ();
+                       w21.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w25 = new global::Gtk.Label ();
-                       w22.Add (w25);
+                       global::Gtk.Image w22 = new global::Gtk.Image ();
+                       w22.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-stop", 
global::Gtk.IconSize.Dialog);
                        w21.Add (w22);
-                       this.stopbutton.Add (w21);
+                       // Container child GtkHBox.Gtk.Container+ContainerChild
+                       global::Gtk.Label w24 = new global::Gtk.Label ();
+                       w21.Add (w24);
+                       w20.Add (w21);
+                       this.stopbutton.Add (w20);
                        this.buttonsbox.Add (this.stopbutton);
-                       global::Gtk.Box.BoxChild w29 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.stopbutton]));
-                       w29.Position = 2;
+                       global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.stopbutton]));
+                       w28.Position = 2;
+                       w28.Expand = false;
+                       w28.Fill = false;
+                       this.hbox2.Add (this.buttonsbox);
+                       global::Gtk.Box.BoxChild w29 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.buttonsbox]));
+                       w29.Position = 0;
                        w29.Expand = false;
                        w29.Fill = false;
-                       this.hbox2.Add (this.buttonsbox);
-                       global::Gtk.Box.BoxChild w30 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.buttonsbox]));
-                       w30.Position = 0;
-                       w30.Expand = false;
-                       w30.Fill = false;
                        // Container child hbox2.Gtk.Box+BoxChild
                        this.timelabel = new global::Gtk.Label ();
                        this.timelabel.Name = "timelabel";
                        this.timelabel.LabelProp = "Time: 0:00:00";
                        this.timelabel.UseMarkup = true;
                        this.hbox2.Add (this.timelabel);
-                       global::Gtk.Box.BoxChild w31 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.timelabel]));
-                       w31.PackType = ((global::Gtk.PackType)(1));
-                       w31.Position = 1;
+                       global::Gtk.Box.BoxChild w30 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.timelabel]));
+                       w30.PackType = ((global::Gtk.PackType)(1));
+                       w30.Position = 1;
                        this.vbox1.Add (this.hbox2);
-                       global::Gtk.Box.BoxChild w32 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox2]));
-                       w32.Position = 2;
-                       w32.Expand = false;
-                       w32.Fill = false;
+                       global::Gtk.Box.BoxChild w31 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox2]));
+                       w31.Position = 1;
+                       w31.Expand = false;
+                       w31.Fill = false;
                        this.Add (this.vbox1);
                        if ((this.Child != null)) {
                                this.Child.ShowAll ();
@@ -143,10 +135,6 @@ namespace LongoMatch.Gui
                        this.pausebutton.Hide ();
                        this.stopbutton.Hide ();
                        this.Show ();
-                       this.logodrawingarea.ExposeEvent += new global::Gtk.ExposeEventHandler 
(this.OnLogodrawingareaExposeEvent);
-                       this.recbutton.Clicked += new global::System.EventHandler (this.OnRecbuttonClicked);
-                       this.pausebutton.Clicked += new global::System.EventHandler 
(this.OnPausebuttonClicked);
-                       this.stopbutton.Clicked += new global::System.EventHandler (this.OnStopbuttonClicked);
                }
        }
 }
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs 
b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
index adaa5c3..3aec695 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
@@ -8,6 +8,9 @@ namespace LongoMatch.Gui
                private global::Gtk.HBox mainbox;
                private global::Gtk.VBox vbox2;
                private global::Gtk.HBox videobox;
+               private global::Gtk.HBox hbox2;
+               private global::Gtk.EventBox videoeventbox;
+               private global::Gtk.DrawingArea videodrawingarea;
                private global::Gtk.VBox vbox5;
                private global::Gtk.VScale vscale1;
                private global::Gtk.HBox controlsbox;
@@ -49,12 +52,29 @@ namespace LongoMatch.Gui
                        this.videobox = new global::Gtk.HBox ();
                        this.videobox.Name = "videobox";
                        this.videobox.Spacing = 6;
+                       // Container child videobox.Gtk.Box+BoxChild
+                       this.hbox2 = new global::Gtk.HBox ();
+                       this.hbox2.Name = "hbox2";
+                       this.hbox2.Spacing = 6;
+                       // Container child hbox2.Gtk.Box+BoxChild
+                       this.videoeventbox = new global::Gtk.EventBox ();
+                       this.videoeventbox.Name = "videoeventbox";
+                       // Container child videoeventbox.Gtk.Container+ContainerChild
+                       this.videodrawingarea = new global::Gtk.DrawingArea ();
+                       this.videodrawingarea.Name = "videodrawingarea";
+                       this.videoeventbox.Add (this.videodrawingarea);
+                       this.hbox2.Add (this.videoeventbox);
+                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.videoeventbox]));
+                       w2.Position = 0;
+                       this.videobox.Add (this.hbox2);
+                       global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.videobox 
[this.hbox2]));
+                       w3.Position = 0;
                        this.vbox2.Add (this.videobox);
-                       global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.videobox]));
-                       w1.Position = 0;
+                       global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.videobox]));
+                       w4.Position = 0;
                        this.mainbox.Add (this.vbox2);
-                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.mainbox [this.vbox2]));
-                       w2.Position = 0;
+                       global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.mainbox [this.vbox2]));
+                       w5.Position = 0;
                        // Container child mainbox.Gtk.Box+BoxChild
                        this.vbox5 = new global::Gtk.VBox ();
                        this.vbox5.Name = "vbox5";
@@ -76,16 +96,16 @@ namespace LongoMatch.Gui
                        this.vscale1.Digits = 0;
                        this.vscale1.ValuePos = ((global::Gtk.PositionType)(3));
                        this.vbox5.Add (this.vscale1);
-                       global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.vscale1]));
-                       w3.Position = 0;
+                       global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.vscale1]));
+                       w6.Position = 0;
                        this.mainbox.Add (this.vbox5);
-                       global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.mainbox [this.vbox5]));
-                       w4.Position = 1;
-                       w4.Expand = false;
-                       w4.Fill = false;
+                       global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.mainbox [this.vbox5]));
+                       w7.Position = 1;
+                       w7.Expand = false;
+                       w7.Fill = false;
                        this.vbox3.Add (this.mainbox);
-                       global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.mainbox]));
-                       w5.Position = 0;
+                       global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.mainbox]));
+                       w8.Position = 0;
                        // Container child vbox3.Gtk.Box+BoxChild
                        this.controlsbox = new global::Gtk.HBox ();
                        this.controlsbox.Name = "controlsbox";
@@ -99,120 +119,120 @@ namespace LongoMatch.Gui
                        this.closebutton.Name = "closebutton";
                        this.closebutton.UseUnderline = true;
                        // Container child closebutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w6 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w9 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w7 = new global::Gtk.HBox ();
-                       w7.Spacing = 2;
+                       global::Gtk.HBox w10 = new global::Gtk.HBox ();
+                       w10.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w8 = new global::Gtk.Image ();
-                       w8.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-close", 
global::Gtk.IconSize.Dnd);
-                       w7.Add (w8);
+                       global::Gtk.Image w11 = new global::Gtk.Image ();
+                       w11.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-close", 
global::Gtk.IconSize.Dnd);
+                       w10.Add (w11);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w10 = new global::Gtk.Label ();
-                       w7.Add (w10);
-                       w6.Add (w7);
-                       this.closebutton.Add (w6);
+                       global::Gtk.Label w13 = new global::Gtk.Label ();
+                       w10.Add (w13);
+                       w9.Add (w10);
+                       this.closebutton.Add (w9);
                        this.buttonsbox.Add (this.closebutton);
-                       global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.closebutton]));
-                       w14.Position = 0;
-                       w14.Expand = false;
-                       w14.Fill = false;
+                       global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.closebutton]));
+                       w17.Position = 0;
+                       w17.Expand = false;
+                       w17.Fill = false;
                        // Container child buttonsbox.Gtk.Box+BoxChild
                        this.drawbutton = new global::Gtk.Button ();
                        this.drawbutton.Name = "drawbutton";
                        this.drawbutton.UseUnderline = true;
                        this.drawbutton.Relief = ((global::Gtk.ReliefStyle)(2));
                        // Container child drawbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w15 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w18 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w16 = new global::Gtk.HBox ();
-                       w16.Spacing = 2;
+                       global::Gtk.HBox w19 = new global::Gtk.HBox ();
+                       w19.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w17 = new global::Gtk.Image ();
-                       w17.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-select-color", 
global::Gtk.IconSize.Menu);
-                       w16.Add (w17);
+                       global::Gtk.Image w20 = new global::Gtk.Image ();
+                       w20.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-select-color", 
global::Gtk.IconSize.Menu);
+                       w19.Add (w20);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w19 = new global::Gtk.Label ();
-                       w16.Add (w19);
-                       w15.Add (w16);
-                       this.drawbutton.Add (w15);
+                       global::Gtk.Label w22 = new global::Gtk.Label ();
+                       w19.Add (w22);
+                       w18.Add (w19);
+                       this.drawbutton.Add (w18);
                        this.buttonsbox.Add (this.drawbutton);
-                       global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.drawbutton]));
-                       w23.Position = 1;
-                       w23.Expand = false;
-                       w23.Fill = false;
+                       global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.drawbutton]));
+                       w26.Position = 1;
+                       w26.Expand = false;
+                       w26.Fill = false;
                        // Container child buttonsbox.Gtk.Box+BoxChild
                        this.playbutton = new global::Gtk.Button ();
                        this.playbutton.Name = "playbutton";
                        this.playbutton.UseUnderline = true;
                        this.playbutton.Relief = ((global::Gtk.ReliefStyle)(2));
                        // Container child playbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w24 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w27 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w25 = new global::Gtk.HBox ();
-                       w25.Spacing = 2;
+                       global::Gtk.HBox w28 = new global::Gtk.HBox ();
+                       w28.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w26 = new global::Gtk.Image ();
-                       w26.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-play", 
global::Gtk.IconSize.Button);
-                       w25.Add (w26);
+                       global::Gtk.Image w29 = new global::Gtk.Image ();
+                       w29.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-play", 
global::Gtk.IconSize.Button);
+                       w28.Add (w29);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w28 = new global::Gtk.Label ();
-                       w25.Add (w28);
-                       w24.Add (w25);
-                       this.playbutton.Add (w24);
+                       global::Gtk.Label w31 = new global::Gtk.Label ();
+                       w28.Add (w31);
+                       w27.Add (w28);
+                       this.playbutton.Add (w27);
                        this.buttonsbox.Add (this.playbutton);
-                       global::Gtk.Box.BoxChild w32 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.playbutton]));
-                       w32.Position = 2;
-                       w32.Expand = false;
-                       w32.Fill = false;
+                       global::Gtk.Box.BoxChild w35 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.playbutton]));
+                       w35.Position = 2;
+                       w35.Expand = false;
+                       w35.Fill = false;
                        // Container child buttonsbox.Gtk.Box+BoxChild
                        this.pausebutton = new global::Gtk.Button ();
                        this.pausebutton.Name = "pausebutton";
                        this.pausebutton.UseUnderline = true;
                        this.pausebutton.Relief = ((global::Gtk.ReliefStyle)(2));
                        // Container child pausebutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w33 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w36 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w34 = new global::Gtk.HBox ();
-                       w34.Spacing = 2;
+                       global::Gtk.HBox w37 = new global::Gtk.HBox ();
+                       w37.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w35 = new global::Gtk.Image ();
-                       w35.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-pause", 
global::Gtk.IconSize.Button);
-                       w34.Add (w35);
+                       global::Gtk.Image w38 = new global::Gtk.Image ();
+                       w38.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-pause", 
global::Gtk.IconSize.Button);
+                       w37.Add (w38);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w37 = new global::Gtk.Label ();
-                       w34.Add (w37);
-                       w33.Add (w34);
-                       this.pausebutton.Add (w33);
+                       global::Gtk.Label w40 = new global::Gtk.Label ();
+                       w37.Add (w40);
+                       w36.Add (w37);
+                       this.pausebutton.Add (w36);
                        this.buttonsbox.Add (this.pausebutton);
-                       global::Gtk.Box.BoxChild w41 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.pausebutton]));
-                       w41.Position = 3;
-                       w41.Expand = false;
-                       w41.Fill = false;
+                       global::Gtk.Box.BoxChild w44 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.pausebutton]));
+                       w44.Position = 3;
+                       w44.Expand = false;
+                       w44.Fill = false;
                        // Container child buttonsbox.Gtk.Box+BoxChild
                        this.prevbutton = new global::Gtk.Button ();
                        this.prevbutton.Name = "prevbutton";
                        this.prevbutton.UseUnderline = true;
                        this.prevbutton.Relief = ((global::Gtk.ReliefStyle)(2));
                        // Container child prevbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w42 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w45 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w43 = new global::Gtk.HBox ();
-                       w43.Spacing = 2;
+                       global::Gtk.HBox w46 = new global::Gtk.HBox ();
+                       w46.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w44 = new global::Gtk.Image ();
-                       w44.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-previous", 
global::Gtk.IconSize.Button);
-                       w43.Add (w44);
+                       global::Gtk.Image w47 = new global::Gtk.Image ();
+                       w47.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-previous", 
global::Gtk.IconSize.Button);
+                       w46.Add (w47);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w46 = new global::Gtk.Label ();
-                       w43.Add (w46);
-                       w42.Add (w43);
-                       this.prevbutton.Add (w42);
+                       global::Gtk.Label w49 = new global::Gtk.Label ();
+                       w46.Add (w49);
+                       w45.Add (w46);
+                       this.prevbutton.Add (w45);
                        this.buttonsbox.Add (this.prevbutton);
-                       global::Gtk.Box.BoxChild w50 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.prevbutton]));
-                       w50.Position = 4;
-                       w50.Expand = false;
-                       w50.Fill = false;
+                       global::Gtk.Box.BoxChild w53 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.prevbutton]));
+                       w53.Position = 4;
+                       w53.Expand = false;
+                       w53.Fill = false;
                        // Container child buttonsbox.Gtk.Box+BoxChild
                        this.nextbutton = new global::Gtk.Button ();
                        this.nextbutton.Sensitive = false;
@@ -220,29 +240,29 @@ namespace LongoMatch.Gui
                        this.nextbutton.UseUnderline = true;
                        this.nextbutton.Relief = ((global::Gtk.ReliefStyle)(2));
                        // Container child nextbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w51 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w54 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w52 = new global::Gtk.HBox ();
-                       w52.Spacing = 2;
+                       global::Gtk.HBox w55 = new global::Gtk.HBox ();
+                       w55.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w53 = new global::Gtk.Image ();
-                       w53.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-next", 
global::Gtk.IconSize.Button);
-                       w52.Add (w53);
+                       global::Gtk.Image w56 = new global::Gtk.Image ();
+                       w56.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-next", 
global::Gtk.IconSize.Button);
+                       w55.Add (w56);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w55 = new global::Gtk.Label ();
-                       w52.Add (w55);
-                       w51.Add (w52);
-                       this.nextbutton.Add (w51);
+                       global::Gtk.Label w58 = new global::Gtk.Label ();
+                       w55.Add (w58);
+                       w54.Add (w55);
+                       this.nextbutton.Add (w54);
                        this.buttonsbox.Add (this.nextbutton);
-                       global::Gtk.Box.BoxChild w59 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.nextbutton]));
-                       w59.Position = 5;
-                       w59.Expand = false;
-                       w59.Fill = false;
+                       global::Gtk.Box.BoxChild w62 = ((global::Gtk.Box.BoxChild)(this.buttonsbox 
[this.nextbutton]));
+                       w62.Position = 5;
+                       w62.Expand = false;
+                       w62.Fill = false;
                        this.controlsbox.Add (this.buttonsbox);
-                       global::Gtk.Box.BoxChild w60 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.buttonsbox]));
-                       w60.Position = 0;
-                       w60.Expand = false;
-                       w60.Fill = false;
+                       global::Gtk.Box.BoxChild w63 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.buttonsbox]));
+                       w63.Position = 0;
+                       w63.Expand = false;
+                       w63.Fill = false;
                        // Container child controlsbox.Gtk.Box+BoxChild
                        this.hbox1 = new global::Gtk.HBox ();
                        this.hbox1.Name = "hbox1";
@@ -252,10 +272,10 @@ namespace LongoMatch.Gui
                        this.jumplabel.Name = "jumplabel";
                        this.jumplabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Jump (s):");
                        this.hbox1.Add (this.jumplabel);
-                       global::Gtk.Box.BoxChild w61 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.jumplabel]));
-                       w61.Position = 0;
-                       w61.Expand = false;
-                       w61.Fill = false;
+                       global::Gtk.Box.BoxChild w64 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.jumplabel]));
+                       w64.Position = 0;
+                       w64.Expand = false;
+                       w64.Fill = false;
                        // Container child hbox1.Gtk.Box+BoxChild
                        this.jumpspinbutton = new global::Gtk.SpinButton (1, 100, 1);
                        this.jumpspinbutton.TooltipMarkup = "Jump in seconds. Hold the Shift key with the 
direction keys to activate it.";
@@ -265,24 +285,24 @@ namespace LongoMatch.Gui
                        this.jumpspinbutton.Numeric = true;
                        this.jumpspinbutton.Value = 10;
                        this.hbox1.Add (this.jumpspinbutton);
-                       global::Gtk.Box.BoxChild w62 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.jumpspinbutton]));
-                       w62.Position = 1;
-                       w62.Expand = false;
-                       w62.Fill = false;
+                       global::Gtk.Box.BoxChild w65 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.jumpspinbutton]));
+                       w65.Position = 1;
+                       w65.Expand = false;
+                       w65.Fill = false;
                        this.controlsbox.Add (this.hbox1);
-                       global::Gtk.Box.BoxChild w63 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.hbox1]));
-                       w63.Position = 1;
-                       w63.Expand = false;
-                       w63.Fill = false;
+                       global::Gtk.Box.BoxChild w66 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.hbox1]));
+                       w66.Position = 1;
+                       w66.Expand = false;
+                       w66.Fill = false;
                        // Container child controlsbox.Gtk.Box+BoxChild
                        this.tlabel = new global::Gtk.Label ();
                        this.tlabel.Name = "tlabel";
                        this.tlabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Time:");
                        this.controlsbox.Add (this.tlabel);
-                       global::Gtk.Box.BoxChild w64 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.tlabel]));
-                       w64.Position = 2;
-                       w64.Expand = false;
-                       w64.Fill = false;
+                       global::Gtk.Box.BoxChild w67 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.tlabel]));
+                       w67.Position = 2;
+                       w67.Expand = false;
+                       w67.Fill = false;
                        // Container child controlsbox.Gtk.Box+BoxChild
                        this.timescale = new global::Gtk.HScale (null);
                        this.timescale.Name = "timescale";
@@ -295,68 +315,68 @@ namespace LongoMatch.Gui
                        this.timescale.Digits = 0;
                        this.timescale.ValuePos = ((global::Gtk.PositionType)(2));
                        this.controlsbox.Add (this.timescale);
-                       global::Gtk.Box.BoxChild w65 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.timescale]));
-                       w65.Position = 3;
+                       global::Gtk.Box.BoxChild w68 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.timescale]));
+                       w68.Position = 3;
                        // Container child controlsbox.Gtk.Box+BoxChild
                        this.timelabel = new global::Gtk.Label ();
                        this.timelabel.Name = "timelabel";
                        this.controlsbox.Add (this.timelabel);
-                       global::Gtk.Box.BoxChild w66 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.timelabel]));
-                       w66.Position = 4;
-                       w66.Expand = false;
+                       global::Gtk.Box.BoxChild w69 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.timelabel]));
+                       w69.Position = 4;
+                       w69.Expand = false;
                        // Container child controlsbox.Gtk.Box+BoxChild
                        this.volumebutton = new global::Gtk.Button ();
                        this.volumebutton.Name = "volumebutton";
                        this.volumebutton.UseUnderline = true;
                        this.volumebutton.Relief = ((global::Gtk.ReliefStyle)(2));
                        // Container child volumebutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w67 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w70 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w68 = new global::Gtk.HBox ();
-                       w68.Spacing = 2;
+                       global::Gtk.HBox w71 = new global::Gtk.HBox ();
+                       w71.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w69 = new global::Gtk.Image ();
-                       w69.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "stock_volume", 
global::Gtk.IconSize.Button);
-                       w68.Add (w69);
+                       global::Gtk.Image w72 = new global::Gtk.Image ();
+                       w72.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "stock_volume", 
global::Gtk.IconSize.Button);
+                       w71.Add (w72);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w71 = new global::Gtk.Label ();
-                       w68.Add (w71);
-                       w67.Add (w68);
-                       this.volumebutton.Add (w67);
+                       global::Gtk.Label w74 = new global::Gtk.Label ();
+                       w71.Add (w74);
+                       w70.Add (w71);
+                       this.volumebutton.Add (w70);
                        this.controlsbox.Add (this.volumebutton);
-                       global::Gtk.Box.BoxChild w75 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.volumebutton]));
-                       w75.Position = 5;
-                       w75.Expand = false;
-                       w75.Fill = false;
+                       global::Gtk.Box.BoxChild w78 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.volumebutton]));
+                       w78.Position = 5;
+                       w78.Expand = false;
+                       w78.Fill = false;
                        // Container child controlsbox.Gtk.Box+BoxChild
                        this.detachbutton = new global::Gtk.Button ();
                        this.detachbutton.Name = "detachbutton";
                        this.detachbutton.UseUnderline = true;
                        this.detachbutton.Relief = ((global::Gtk.ReliefStyle)(2));
                        // Container child detachbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w76 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       global::Gtk.Alignment w79 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
                        // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w77 = new global::Gtk.HBox ();
-                       w77.Spacing = 2;
+                       global::Gtk.HBox w80 = new global::Gtk.HBox ();
+                       w80.Spacing = 2;
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w78 = new global::Gtk.Image ();
-                       w78.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-disconnect", 
global::Gtk.IconSize.Menu);
-                       w77.Add (w78);
+                       global::Gtk.Image w81 = new global::Gtk.Image ();
+                       w81.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-disconnect", 
global::Gtk.IconSize.Menu);
+                       w80.Add (w81);
                        // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w80 = new global::Gtk.Label ();
-                       w77.Add (w80);
-                       w76.Add (w77);
-                       this.detachbutton.Add (w76);
+                       global::Gtk.Label w83 = new global::Gtk.Label ();
+                       w80.Add (w83);
+                       w79.Add (w80);
+                       this.detachbutton.Add (w79);
                        this.controlsbox.Add (this.detachbutton);
-                       global::Gtk.Box.BoxChild w84 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.detachbutton]));
-                       w84.Position = 6;
-                       w84.Expand = false;
-                       w84.Fill = false;
+                       global::Gtk.Box.BoxChild w87 = ((global::Gtk.Box.BoxChild)(this.controlsbox 
[this.detachbutton]));
+                       w87.Position = 6;
+                       w87.Expand = false;
+                       w87.Fill = false;
                        this.vbox3.Add (this.controlsbox);
-                       global::Gtk.Box.BoxChild w85 = ((global::Gtk.Box.BoxChild)(this.vbox3 
[this.controlsbox]));
-                       w85.Position = 1;
-                       w85.Expand = false;
-                       w85.Fill = false;
+                       global::Gtk.Box.BoxChild w88 = ((global::Gtk.Box.BoxChild)(this.vbox3 
[this.controlsbox]));
+                       w88.Position = 1;
+                       w88.Expand = false;
+                       w88.Fill = false;
                        this.Add (this.vbox3);
                        if ((this.Child != null)) {
                                this.Child.ShowAll ();
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs 
b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
index df32a8c..7bc09bc 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
@@ -28,8 +28,6 @@ namespace LongoMatch.Gui
                        this.playerbin = new global::LongoMatch.Gui.PlayerBin ();
                        this.playerbin.Events = ((global::Gdk.EventMask)(256));
                        this.playerbin.Name = "playerbin";
-                       this.playerbin.Rate = 0F;
-                       this.playerbin.ExpandLogo = false;
                        this.playerbin.Detached = false;
                        this.hbox4.Add (this.playerbin);
                        global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox4 
[this.playerbin]));
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
index 5e8830d..9f2d562 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
@@ -7,6 +7,7 @@
   <import>
     <widget-library name="../../bin/LongoMatch.Multimedia.dll" />
     <widget-library name="../../bin/LongoMatch.dll" />
+    <widget-library name="../../bin/LongoMatch.GUI.Helpers.dll" />
     <widget-library name="../../bin/LongoMatch.GUI.Multimedia.dll" internal="true" />
   </import>
   <widget class="Gtk.Window" id="LongoMatch.Gui.VolumeWindow" design-size="31 204">
@@ -74,7 +75,7 @@
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Bin" id="LongoMatch.Gui.PlayerBin" design-size="798 300">
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.PlayerBin" design-size="922 521">
     <property name="MemberName" />
     <child>
       <widget class="Gtk.VBox" id="vbox3">
@@ -93,7 +94,31 @@
                     <property name="MemberName" />
                     <property name="Spacing">6</property>
                     <child>
-                      <placeholder />
+                      <widget class="Gtk.HBox" id="hbox2">
+                        <property name="MemberName" />
+                        <property name="Spacing">6</property>
+                        <child>
+                          <widget class="Gtk.EventBox" id="videoeventbox">
+                            <property name="MemberName" />
+                            <child>
+                              <widget class="Gtk.DrawingArea" id="videodrawingarea">
+                                <property name="MemberName" />
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="Position">0</property>
+                            <property name="AutoSize">True</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <placeholder />
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="Position">0</property>
+                        <property name="AutoSize">True</property>
+                      </packing>
                     </child>
                   </widget>
                   <packing>
@@ -406,25 +431,11 @@
         <property name="MemberName" />
         <property name="Spacing">6</property>
         <child>
-          <widget class="Gtk.HBox" id="capturerhbox">
+          <widget class="Gtk.DrawingArea" id="videodrawingarea">
             <property name="MemberName" />
-            <property name="Spacing">6</property>
-            <child>
-              <placeholder />
-            </child>
           </widget>
           <packing>
             <property name="Position">0</property>
-            <property name="AutoSize">False</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="Gtk.DrawingArea" id="logodrawingarea">
-            <property name="MemberName" />
-            <signal name="ExposeEvent" handler="OnLogodrawingareaExposeEvent" />
-          </widget>
-          <packing>
-            <property name="Position">1</property>
             <property name="AutoSize">True</property>
           </packing>
         </child>
@@ -444,7 +455,6 @@
                     <property name="Icon">stock:gtk-media-record Dialog</property>
                     <property name="Label" translatable="yes" />
                     <property name="UseUnderline">True</property>
-                    <signal name="Clicked" handler="OnRecbuttonClicked" />
                   </widget>
                   <packing>
                     <property name="Position">0</property>
@@ -462,7 +472,6 @@
                     <property name="Icon">stock:gtk-media-pause Dialog</property>
                     <property name="Label" translatable="yes" />
                     <property name="UseUnderline">True</property>
-                    <signal name="Clicked" handler="OnPausebuttonClicked" />
                   </widget>
                   <packing>
                     <property name="Position">1</property>
@@ -480,7 +489,6 @@
                     <property name="Icon">stock:gtk-media-stop Dialog</property>
                     <property name="Label" translatable="yes" />
                     <property name="UseUnderline">True</property>
-                    <signal name="Clicked" handler="OnStopbuttonClicked" />
                   </widget>
                   <packing>
                     <property name="Position">2</property>
@@ -511,7 +519,7 @@
             </child>
           </widget>
           <packing>
-            <property name="Position">2</property>
+            <property name="Position">1</property>
             <property name="AutoSize">False</property>
             <property name="Expand">False</property>
             <property name="Fill">False</property>
@@ -535,8 +543,6 @@
               <widget class="LongoMatch.Gui.PlayerBin" id="playerbin">
                 <property name="MemberName" />
                 <property name="Events">ButtonPressMask</property>
-                <property name="Rate">0</property>
-                <property name="ExpandLogo">False</property>
                 <property name="Detached">False</property>
               </widget>
               <packing>
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml b/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
index 4e9df92..d673b49 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
@@ -8,19 +8,19 @@
       </itemgroup>
     </signals>
   </object>
-  <object type="LongoMatch.Gui.PlayerBin" palette-category="LongoMatch" allow-children="false" 
base-type="Gtk.Bin">
+  <object type="LongoMatch.Gui.PlayerCapturerBin" palette-category="LongoMatch" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups>
-      <itemgroup label="PlayerBin Properties">
-        <property name="Rate" />
-        <property name="ExpandLogo" />
+      <itemgroup label="PlayerCapturerBin Properties">
         <property name="Detached" />
+        <property name="Sensitive" />
       </itemgroup>
     </itemgroups>
     <signals>
-      <itemgroup label="PlayerBin Signals">
+      <itemgroup label="PlayerCapturerBin Signals">
+        <signal name="Error" />
+        <signal name="CaptureFinished" />
         <signal name="SegmentClosedEvent" />
         <signal name="Tick" />
-        <signal name="Error" />
         <signal name="PlayStateChanged" />
         <signal name="Next" />
         <signal name="Prev" />
@@ -31,20 +31,18 @@
       </itemgroup>
     </signals>
   </object>
-  <object type="LongoMatch.Gui.PlayerCapturerBin" palette-category="LongoMatch" allow-children="false" 
base-type="Gtk.Bin">
+  <object type="LongoMatch.Gui.PlayerBin" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups>
-      <itemgroup label="PlayerCapturerBin Properties">
+      <itemgroup label="IPlayer Properties">
         <property name="Detached" />
-        <property name="ExpandLogo" />
-        <property name="Rate" />
+        <property name="Sensitive" />
       </itemgroup>
     </itemgroups>
     <signals>
-      <itemgroup label="PlayerCapturerBin Signals">
-        <signal name="Error" />
-        <signal name="CaptureFinished" />
+      <itemgroup label="IPlayer Signals">
         <signal name="SegmentClosedEvent" />
         <signal name="Tick" />
+        <signal name="Error" />
         <signal name="PlayStateChanged" />
         <signal name="Next" />
         <signal name="Prev" />
diff --git a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs 
b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
index df79861..313ea39 100644
--- a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
+++ b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
@@ -26,7 +26,7 @@ using System.Collections.Generic;
 using Gdk;
 using Gtk;
 using LongoMatch.Gui.Helpers;
-using Mono.Posix;
+using Mono.Unix;
 
 namespace LongoMatch.Gui.Component
 {
@@ -91,8 +91,6 @@ namespace LongoMatch.Gui.Component
                        downbox.PackStart(guTimeline, true, true, 0);
                        
                        playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.Player;
-                       playercapturer.SetLogo(System.IO.Path.Combine(Config.ImagesDir,"background.png"));
-                       playercapturer.LogoMode = true;
                        playercapturer.Tick += OnTick;
                        playercapturer.Detach += DetachPlayer;
                        playercapturer.Logo = System.IO.Path.Combine(Config.ImagesDir,"background.png");
@@ -347,18 +345,13 @@ namespace LongoMatch.Gui.Component
                {
                        bool isLive = false;
                        
-                       /* Update tabs labels */
-                       var desc = project.Description;
-                       
                        if(projectType == ProjectType.FileProject) {
-                               playercapturer.LogoMode = false;
                                timeline.SetProject (project, filter);
                                guTimeline.Project = project;
-
+                               playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.Player;
                        } else {
                                isLive = true;
                                if(projectType == ProjectType.FakeCaptureProject) {
-                                       playercapturer.Type = CapturerType.Fake;
                                        playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.Capturer;
                                } else {
                                        playercapturer.Mode = 
PlayerCapturerBin.PlayerOperationMode.PreviewCapturer;
@@ -410,7 +403,6 @@ namespace LongoMatch.Gui.Component
                private void ResetGUI() {
                        bool playlistVisible = playlist.Visible;
                        playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.Player;
-                       playercapturer.LogoMode = true;
                        ClearWidgets();
                        HideWidgets();
                        SetPlaylistVisibility (playlistVisible);
@@ -467,13 +459,13 @@ namespace LongoMatch.Gui.Component
                                        if(modifier == Constants.STEP)
                                                playercapturer.StepForward();
                                        else
-                                               playercapturer.SeekToNextFrame(selectedTimeNode != null);
+                                               playercapturer.SeekToNextFrame();
                                        break;
                                case Constants.SEEK_BACKWARD:
                                        if(modifier == Constants.STEP)
                                                playercapturer.StepBackward();
                                        else
-                                               playercapturer.SeekToPreviousFrame(selectedTimeNode != null);
+                                               playercapturer.SeekToPreviousFrame();
                                        break;
                                case Constants.FRAMERATE_UP:
                                        playercapturer.FramerateUp();
@@ -509,15 +501,15 @@ namespace LongoMatch.Gui.Component
                        selectedTimeNode = null;
                }
                
-               protected virtual void OnTick(object o, long currentTime, long streamLength,
-                       float currentPosition, bool seekable)
+               protected virtual void OnTick (object o, Time currentTime, Time streamLength,
+                       double currentPosition)
                {
-                       if(currentTime != 0 && timeline != null && openedProject != null) {
-                               uint frame = (uint)(currentTime * openedProject.Description.File.Fps / 1000);
+                       if (currentTime.MSeconds != 0 && timeline != null && openedProject != null) {
+                               uint frame = (uint) (currentTime .MSeconds * 
openedProject.Description.File.Fps / 1000);
                                timeline.CurrentFrame = frame;
                                guTimeline.CurrentFrame = frame;
                        }
-                       gameunitstaggerwidget1.CurrentTime = new Time{MSeconds = (int)currentTime};
+                       gameunitstaggerwidget1.CurrentTime = currentTime;
                }
                
                protected virtual void OnMultimediaError(object o, string message)
diff --git a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
index c77656d..f59428a 100644
--- a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
+++ b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
@@ -34,7 +34,7 @@ namespace LongoMatch.Gui.Dialog
        public partial class DrawingTool : Gtk.Dialog
        {
                Play play;
-               int stopTime;
+               Time stopTime;
 
                public DrawingTool()
                {
@@ -59,7 +59,7 @@ namespace LongoMatch.Gui.Dialog
                        }
                }
 
-               public void SetPlay(Play play,int stopTime) {
+               public void SetPlay(Play play, Time stopTime) {
                        this.play = play;
                        this.stopTime = stopTime;
                        savetoprojectbutton.Visible = true;
@@ -113,7 +113,7 @@ namespace LongoMatch.Gui.Dialog
                        string tempFile = System.IO.Path.GetTempFileName();
                        drawingwidget1.SaveDrawings(tempFile);
                        Pixbuf frame = new Pixbuf(tempFile);
-                       play.KeyFrameDrawing = new Drawing { Pixbuf= new Image(frame), RenderTime = stopTime};
+                       play.KeyFrameDrawing = new Drawing { Pixbuf= new Image(frame), Render = stopTime};
                        drawingwidget1.SaveAll(tempFile);
                        frame.Dispose();
                        play.Miniature = new Image(new Pixbuf(tempFile));
diff --git a/LongoMatch.GUI/Gui/GUIToolkit.cs b/LongoMatch.GUI/Gui/GUIToolkit.cs
index 3fe174f..577bb48 100644
--- a/LongoMatch.GUI/Gui/GUIToolkit.cs
+++ b/LongoMatch.GUI/Gui/GUIToolkit.cs
@@ -192,8 +192,7 @@ namespace LongoMatch.Gui
                                sd.Destroy();
                                outDir = System.IO.Path.Combine(snapshotsDir, seriesName);
                                var fsc = new FramesSeriesCapturer(openedProject.Description.File.FilePath,
-                                                              play.Start.MSeconds, play.Stop.MSeconds,
-                                                              interval, outDir);
+                                                              play.Start, play.Stop, interval, outDir);
                                var fcpd = new FramesCaptureProgressDialog(fsc);
                                fcpd.TransientFor = mainWindow as Gtk.Window;
                                fcpd.Run();
@@ -211,13 +210,13 @@ namespace LongoMatch.Gui
                        tg.Destroy();
                }
 
-               public void DrawingTool (Image image, Play play, int stopTime) {
+               public void DrawingTool (Image image, Play play, Time stopTime) {
                        DrawingTool dialog = new DrawingTool();
 
                        Log.Information ("Drawing tool");
                        dialog.Image = image.Value;
                        if (play != null)
-                               dialog.SetPlay(play, stopTime);
+                               dialog.SetPlay (play, stopTime);
                        dialog.TransientFor = mainWindow as Gtk.Window;
                        image.Dispose();
                        dialog.Run();
@@ -335,6 +334,15 @@ namespace LongoMatch.Gui
                        return date;
                }
                
+               public EndCaptureResponse EndCapture (string filepath) {
+                       int res;
+                       EndCaptureDialog dialog = new EndCaptureDialog (filepath);
+                       dialog.TransientFor = mainWindow.Toplevel as Gtk.Window;
+                       res = dialog.Run();
+                       dialog.Destroy();
+                       return (EndCaptureResponse)res;
+               }
+               
                public void Quit () {
                        Log.Information ("Quit application");
                        Gtk.Application.Quit ();
diff --git a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
index d947105..700d40c 100644
--- a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
@@ -264,13 +264,24 @@ namespace LongoMatch.Gui.Panel
                        encSettings = new EncodingSettings();
                        captureSettings = new CaptureSettings();
                                
-                       encSettings.OutputFile = fileEntry.Text;
+                       encSettings.OutputFile = outfileEntry.Text;
+                       
+                       if (p.Description.File == null) {
+                               p.Description.File = new MediaFile ();
+                               p.Description.File.Fps = (ushort) (Config.FPS_N / Config.FPS_D);
+                               p.Description.File.FilePath = outfileEntry.Text;
+                       }
                        if (projectType == ProjectType.CaptureProject) {
-                               captureSettings.CaptureSourceType = 
videoDevices[devicecombobox.Active].DeviceType;
-                               captureSettings.DeviceID = videoDevices[devicecombobox.Active].ID;
+                               Device device = videoDevices[devicecombobox.Active];
+                               captureSettings.CaptureSourceType = device.DeviceType;
+                               captureSettings.DeviceID = device.ID;
+                               captureSettings.SourceElement = device.SourceElement;
                        } else if (projectType == ProjectType.URICaptureProject) {
                                captureSettings.CaptureSourceType = CaptureSourceType.URI;
                                captureSettings.DeviceID = urientry.Text;
+                       }else if (projectType == ProjectType.FakeCaptureProject) {
+                               captureSettings.CaptureSourceType = CaptureSourceType.None;
+                               p.Description.File.FilePath = Constants.FAKE_PROJECT;
                        }
                                
                        /* Get quality info */
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index 7f8125c..b98f29c 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -134,10 +134,6 @@
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Dialog.VideoConversionTool.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Dialog/DatabasesManager.cs" />
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Dialog.DatabasesManager.cs" />
-    <File subtype="Directory" buildaction="Compile" name="Gui/Helpers" />
-    <File subtype="Code" buildaction="Compile" name="Gui/Helpers/Misc.cs" />
-    <File subtype="Code" buildaction="Compile" name="Gui/Helpers/FileChooserHelper.cs" />
-    <File subtype="Code" buildaction="Compile" name="Gui/Helpers/MessagesHelpers.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/CoordinatesTagger.cs" />
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.CoordinatesTagger.cs" 
/>
     <File subtype="Code" buildaction="Compile" name="Gui/Component/GeneralPreferencesPanel.cs" />
@@ -181,7 +177,6 @@
     <File subtype="Directory" buildaction="Compile" name="Gui/Panel" />
     <File subtype="Code" buildaction="Compile" name="Gui/Panel/WelcomePanel.cs" />
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Panel.WelcomePanel.cs" />
-    <File subtype="Code" buildaction="Compile" name="Gui/Component/BackgroundWidget.cs" />
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.BackgroundWidget.cs" />
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/background.png" />
     <File subtype="Code" buildaction="Compile" name="Gui/Panel/OpenProjectPanel.cs" />
@@ -201,6 +196,8 @@
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Dialog.CalendarDialog.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/AnalysisTemplateEditor.cs" />
     <File subtype="Code" buildaction="Compile" 
name="gtk-gui/LongoMatch.Gui.Component.AnalysisTemplateEditor.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Gui/Helpers" />
+    <File subtype="Code" buildaction="Compile" name="Gui/Component/BackgroundWidget.cs" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
@@ -217,6 +214,7 @@
     <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
     <ProjectReference type="Gac" localcopy="True" refto="System.Drawing, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a" />
     <ProjectReference type="Project" localcopy="True" refto="OxyPlotMono" />
+    <ProjectReference type="Project" localcopy="True" refto="LongoMatch.GUI.Helpers" />
   </References>
   <LanguageParameters ApplicationIcon="." CodePage="65001" ctype="CSharpProjectParameters" />
 </Project>
\ No newline at end of file
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs
index adc7ad8..589e751 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs
@@ -75,8 +75,6 @@ namespace LongoMatch.Gui.Component
                        this.playercapturer.Events = ((global::Gdk.EventMask)(256));
                        this.playercapturer.Name = "playercapturer";
                        this.playercapturer.Detached = false;
-                       this.playercapturer.ExpandLogo = false;
-                       this.playercapturer.Rate = 0F;
                        this.videowidgetsbox.Add (this.playercapturer);
                        global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.videowidgetsbox 
[this.playercapturer]));
                        w4.Position = 1;
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
index da25c3a..a5d4dbd 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
@@ -131,7 +131,7 @@ namespace LongoMatch.Gui
                        this.ManualTaggingViewAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Free 
Capture Mode");
                        w1.Add (this.ManualTaggingViewAction, "<Control>f");
                        this.GameUnitsViewAction = new global::Gtk.RadioAction ("GameUnitsViewAction", 
global::Mono.Unix.Catalog.GetString ("Game units view"), null, null, 0);
-                       this.GameUnitsViewAction.Group = this.TaggingViewAction.Group;
+                       this.GameUnitsViewAction.Group = this.ManualTaggingViewAction.Group;
                        this.GameUnitsViewAction.Sensitive = false;
                        this.GameUnitsViewAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Game 
units view");
                        w1.Add (this.GameUnitsViewAction, null);
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 7e6f9aa..c7806ba 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -8,6 +8,7 @@
     <widget-library name="../../bin/LongoMatch.GUI.Multimedia.dll" />
     <widget-library name="../../bin/LongoMatch.Multimedia.dll" />
     <widget-library name="../../bin/LongoMatch.dll" />
+    <widget-library name="../../bin/LongoMatch.GUI.Helpers.dll" />
     <widget-library name="../../bin/LongoMatch.Gui.dll" internal="true" />
   </import>
   <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.ProjectListWidget" design-size="572 300">
@@ -6794,8 +6795,6 @@ Defining &lt;b&gt; Game Units &lt;/b&gt; will help you during the analysis to in
                         <property name="MemberName" />
                         <property name="Events">ButtonPressMask</property>
                         <property name="Detached">False</property>
-                        <property name="ExpandLogo">False</property>
-                        <property name="Rate">0</property>
                       </widget>
                       <packing>
                         <property name="Position">1</property>
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index e37beda..a56f237 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -1,5 +1,5 @@
 <objects attr-sync="on">
-  <object type="LongoMatch.Gui.Component.PlayersFilterTreeView" palette-category="General" 
allow-children="false" base-type="Gtk.TreeView">
+  <object type="LongoMatch.Gui.Component.Stats.SubCategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals />
   </object>
@@ -186,6 +186,18 @@
     <itemgroups />
     <signals />
   </object>
+  <object type="LongoMatch.Gui.Component.TeamTemplateEditor" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+    <itemgroups>
+      <itemgroup label="TeamTemplateEditor Properties">
+        <property name="Edited" />
+      </itemgroup>
+    </itemgroups>
+    <signals>
+      <itemgroup label="TeamTemplateEditor Signals">
+        <signal name="TemplateSaved" />
+      </itemgroup>
+    </signals>
+  </object>
   <object type="LongoMatch.Gui.Component.RenderingStateBar" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
     <itemgroups>
       <itemgroup label="IRenderingStateBar Properties">
@@ -255,14 +267,18 @@
         <signal name="PlaySelected" />
         <signal name="PlayCategoryChanged" />
         <signal name="PlayListNodeAdded" />
+        <signal name="TimeNodeChanged" />
         <signal name="SnapshotSeries" />
         <signal name="RenderPlaylist" />
         <signal name="TagPlay" />
-        <signal name="TimeNodeChanged" />
         <signal name="DuplicatePlay" />
       </itemgroup>
     </signals>
   </object>
+  <object type="LongoMatch.Gui.Component.PlayersFilterTreeView" palette-category="General" 
allow-children="false" base-type="Gtk.TreeView">
+    <itemgroups />
+    <signals />
+  </object>
   <object type="LongoMatch.Gui.Component.CategoriesFilterTreeView" palette-category="General" 
allow-children="false" base-type="Gtk.TreeView">
     <itemgroups />
     <signals />
@@ -291,85 +307,25 @@
     <itemgroups />
     <signals />
   </object>
-  <object type="LongoMatch.Gui.CapturerBin" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
-    <itemgroups />
-    <signals>
-      <itemgroup label="ICapturer Signals">
-        <signal name="CaptureFinished" />
-        <signal name="Error" />
-      </itemgroup>
-    </signals>
-  </object>
-  <object type="LongoMatch.Gui.PlayerBin" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
-    <itemgroups>
-      <itemgroup label="IPlayer Properties">
-        <property name="Rate" />
-        <property name="ExpandLogo" />
-        <property name="Detached" />
-      </itemgroup>
-    </itemgroups>
-    <signals>
-      <itemgroup label="IPlayer Signals">
-        <signal name="SegmentClosedEvent" />
-        <signal name="Tick" />
-        <signal name="Error" />
-        <signal name="PlayStateChanged" />
-        <signal name="Next" />
-        <signal name="Prev" />
-        <signal name="DrawFrame" />
-        <signal name="SeekEvent" />
-        <signal name="Detach" />
-        <signal name="PlaybackRateChanged" />
-      </itemgroup>
-    </signals>
-  </object>
-  <object type="LongoMatch.Gui.PlayerCapturerBin" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
-    <itemgroups>
-      <itemgroup label="IPlayer Properties">
-        <property name="Detached" />
-        <property name="ExpandLogo" />
-        <property name="Rate" />
-      </itemgroup>
-    </itemgroups>
-    <signals>
-      <itemgroup label="ICapturer Signals">
-        <signal name="Error" />
-        <signal name="CaptureFinished" />
-        <signal name="SegmentClosedEvent" />
-        <signal name="Tick" />
-        <signal name="PlayStateChanged" />
-        <signal name="Next" />
-        <signal name="Prev" />
-        <signal name="DrawFrame" />
-        <signal name="SeekEvent" />
-        <signal name="Detach" />
-        <signal name="PlaybackRateChanged" />
-      </itemgroup>
-    </signals>
-  </object>
-  <object type="LongoMatch.Gui.Component.Stats.Plotter" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+  <object type="LongoMatch.Gui.Component.Stats.CategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
     <itemgroups>
-      <itemgroup label="Plotter Properties">
+      <itemgroup label="CategoryViewer Properties">
         <property name="HomeName" />
         <property name="AwayName" />
-        <property name="ShowTeams" />
       </itemgroup>
     </itemgroups>
     <signals />
   </object>
-  <object type="LongoMatch.Gui.Component.Stats.CategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+  <object type="LongoMatch.Gui.Component.Stats.Plotter" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups>
-      <itemgroup label="CategoryViewer Properties">
+      <itemgroup label="Plotter Properties">
+        <property name="ShowTeams" />
         <property name="HomeName" />
         <property name="AwayName" />
       </itemgroup>
     </itemgroups>
     <signals />
   </object>
-  <object type="LongoMatch.Gui.Component.Stats.SubCategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
   <object type="LongoMatch.Gui.Component.Stats.CategoriesViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals />
@@ -378,47 +334,22 @@
     <itemgroups />
     <signals />
   </object>
-  <object type="LongoMatch.Gui.Component.Stats.PlayersViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
-  <object type="LongoMatch.Gui.Component.Stats.PlayerCategoriesViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
-  <object type="LongoMatch.Gui.Component.Stats.PlayerCategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups>
-    </itemgroups>
-    <signals />
-  </object>
-  <object type="LongoMatch.Gui.Component.Stats.PlayerSubcategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
-  <object type="LongoMatch.Gui.Component.ButtonTagger" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
-    <itemgroups />
-    <signals>
-      <itemgroup label="ButtonTagger Signals">
-        <signal name="NewTag" />
-        <signal name="NewTagStart" />
-        <signal name="NewTagStop" />
-        <signal name="NewTagCancel" />
-      </itemgroup>
-    </signals>
-  </object>
   <object type="LongoMatch.Gui.Component.AnalysisComponent" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals>
       <itemgroup label="IAnalysisWindow Signals">
+        <signal name="CloseOpenedProjectEvent" />
         <signal name="NewTagEvent" />
         <signal name="NewTagStartEvent" />
         <signal name="NewTagStopEvent" />
+        <signal name="NewTagCancelEvent" />
         <signal name="PlaySelectedEvent" />
         <signal name="NewTagAtFrameEvent" />
         <signal name="TagPlayEvent" />
         <signal name="PlaysDeletedEvent" />
         <signal name="TimeNodeChanged" />
         <signal name="PlayCategoryChanged" />
+        <signal name="DuplicatePlay" />
         <signal name="RenderPlaylistEvent" />
         <signal name="PlayListNodeAddedEvent" />
         <signal name="PlayListNodeSelectedEvent" />
@@ -432,17 +363,37 @@
         <signal name="UnitDeleted" />
         <signal name="UnitAdded" />
         <signal name="KeyPressed" />
-        <signal name="CloseOpenedProjectEvent" />
-        <signal name="NewTagCancelEvent" />
-        <signal name="DuplicatePlay" />
       </itemgroup>
     </signals>
   </object>
-  <object type="LongoMatch.Gui.Panel.WelcomePanel" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+  <object type="LongoMatch.Gui.Component.Stats.PlayersViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals />
   </object>
-  <object type="LongoMatch.Gui.Component.BackgroundWidget" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+  <object type="LongoMatch.Gui.Component.Stats.PlayerCategoriesViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
+  <object type="LongoMatch.Gui.Component.Stats.PlayerCategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
+  <object type="LongoMatch.Gui.Component.Stats.PlayerSubcategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
+  <object type="LongoMatch.Gui.Component.ButtonTagger" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+    <itemgroups />
+    <signals>
+      <itemgroup label="ButtonTagger Signals">
+        <signal name="NewTag" />
+        <signal name="NewTagStart" />
+        <signal name="NewTagStop" />
+        <signal name="NewTagCancel" />
+      </itemgroup>
+    </signals>
+  </object>
+  <object type="LongoMatch.Gui.Panel.WelcomePanel" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups />
     <signals />
   </object>
@@ -458,9 +409,9 @@
   <object type="LongoMatch.Gui.Panel.NewProjectPanel" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups />
     <signals>
-      <itemgroup label="NewProjectPanel Signals">
-        <signal name="OpenNewProjectEvent" />
+      <itemgroup label="IPanel Signals">
         <signal name="BackEvent" />
+        <signal name="OpenNewProjectEvent" />
       </itemgroup>
     </signals>
   </object>
@@ -471,23 +422,11 @@
   <object type="LongoMatch.Gui.Panel.TeamsTemplatesPanel" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups />
     <signals>
-      <itemgroup label="TeamsTemplatesPanel Signals">
+      <itemgroup label="IPanel Signals">
         <signal name="BackEvent" />
       </itemgroup>
     </signals>
   </object>
-  <object type="LongoMatch.Gui.Component.TeamTemplateEditor" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups>
-      <itemgroup label="TeamTemplateEditor Properties">
-        <property name="Edited" />
-      </itemgroup>
-    </itemgroups>
-    <signals>
-      <itemgroup label="TeamTemplateEditor Signals">
-        <signal name="TemplateSaved" />
-      </itemgroup>
-    </signals>
-  </object>
   <object type="LongoMatch.Gui.Panel.ProjectsManagerPanel" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups />
     <signals>
@@ -512,4 +451,62 @@
     </itemgroups>
     <signals />
   </object>
+  <object type="LongoMatch.Gui.CapturerBin" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+    <itemgroups />
+    <signals>
+      <itemgroup label="ICapturer Signals">
+        <signal name="CaptureFinished" />
+        <signal name="Error" />
+      </itemgroup>
+    </signals>
+  </object>
+  <object type="LongoMatch.Gui.PlayerCapturerBin" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+    <itemgroups>
+      <itemgroup label="IPlayer Properties">
+        <property name="Detached" />
+        <property name="Sensitive" />
+      </itemgroup>
+    </itemgroups>
+    <signals>
+      <itemgroup label="ICapturer Signals">
+        <signal name="Error" />
+        <signal name="CaptureFinished" />
+        <signal name="SegmentClosedEvent" />
+        <signal name="Tick" />
+        <signal name="PlayStateChanged" />
+        <signal name="Next" />
+        <signal name="Prev" />
+        <signal name="DrawFrame" />
+        <signal name="SeekEvent" />
+        <signal name="Detach" />
+        <signal name="PlaybackRateChanged" />
+      </itemgroup>
+    </signals>
+  </object>
+  <object type="LongoMatch.Gui.PlayerBin" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+    <itemgroups>
+      <itemgroup label="IPlayer Properties">
+        <property name="Detached" />
+        <property name="Sensitive" />
+      </itemgroup>
+    </itemgroups>
+    <signals>
+      <itemgroup label="IPlayer Signals">
+        <signal name="SegmentClosedEvent" />
+        <signal name="Tick" />
+        <signal name="Error" />
+        <signal name="PlayStateChanged" />
+        <signal name="Next" />
+        <signal name="Prev" />
+        <signal name="DrawFrame" />
+        <signal name="SeekEvent" />
+        <signal name="Detach" />
+        <signal name="PlaybackRateChanged" />
+      </itemgroup>
+    </signals>
+  </object>
+  <object type="LongoMatch.Gui.Component.BackgroundWidget" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
 </objects>
\ No newline at end of file
diff --git a/LongoMatch.Multimedia/Capturer/FakeCapturer.cs b/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
index 88a12c1..e17f17f 100644
--- a/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
+++ b/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
@@ -22,13 +22,14 @@ using GLib;
 using LongoMatch.Common;
 using LongoMatch.Multimedia.Interfaces;
 using LongoMatch.Video.Common;
-using Gdk;
+using LongoMatch.Store;
+using Image = LongoMatch.Common.Image;
 
 namespace LongoMatch.Video.Capturer
 {
 
 
-       public class FakeCapturer : Gtk.Bin, ICapturer
+       public class FakeCapturer : ICapturer
        {
                public event EllpasedTimeHandler EllapsedTime;
                public event ErrorHandler Error;
@@ -44,13 +45,21 @@ namespace LongoMatch.Video.Capturer
                                        EllapsedTime(ellapsedTime);
                        };
                }
+               
 
-               public int CurrentTime {
+               public Time CurrentTime {
                        get {
-                               return timer.CurrentTime;
+                               return new Time (timer.CurrentTime);
                        }
                }
 
+               public void Configure (CaptureSettings settings, IntPtr window_handle) {
+               }
+               
+               public void Dispose () {
+                       Stop ();
+               }
+
                public void Run() {
                }
 
@@ -104,7 +113,7 @@ namespace LongoMatch.Video.Capturer
                        set {}
                }
 
-               public Pixbuf CurrentFrame {
+               public Image CurrentFrame {
                        get {
                                return null;
                        }
diff --git a/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs 
b/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
index 6b659a0..489544b 100644
--- a/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
+++ b/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
@@ -16,32 +16,58 @@
 //
 //
 
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using Mono.Unix;
+using GLib;
+
+using LongoMatch.Common;
+using LongoMatch.Multimedia.Interfaces;
+using LongoMatch.Video.Common;
+using LongoMatch.Store;
+
 namespace LongoMatch.Video.Capturer {
 
-       using System;
-       using System.Collections;
-       using System.Collections.Generic;
-       using System.Runtime.InteropServices;
-       using Mono.Unix;
-       
-       using LongoMatch.Common;
-       using LongoMatch.Multimedia.Interfaces;
-       using LongoMatch.Video.Common;
        
 
        #region Autogenerated code
-       public  class GstCameraCapturer : Gtk.HBox, ICapturer {
+       public  class GstCameraCapturer : GLib.Object, ICapturer {
 
                public event EllpasedTimeHandler EllapsedTime;
 
                private LiveSourceTimer timer;
 
-               [Obsolete]
-               protected GstCameraCapturer(GLib.GType gtype) : base(gtype) {}
-               public GstCameraCapturer(IntPtr raw) : base(raw) {}
-
                [DllImport("libcesarplayer.dll")]
-               static extern unsafe IntPtr gst_camera_capturer_new(IntPtr filename, out IntPtr err);
+               static extern unsafe IntPtr gst_camera_capturer_new(out IntPtr err);
+               [DllImport("libcesarplayer.dll")]
+               static extern unsafe IntPtr gst_camera_capturer_configure (
+                       IntPtr raw, IntPtr output_file, int type, IntPtr source_element,
+                       IntPtr device_id, int video_encoder, int audio_encoder, int muxer,
+                       uint video_bitrate, uint audio_bitrate, bool record_audio,
+                       uint output_width, uint output_height, IntPtr window_handle,
+                       out IntPtr err);
+               [DllImport("libcesarplayer.dll")]
+               static extern void gst_camera_capturer_stop(IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern void gst_camera_capturer_toggle_pause(IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern void gst_camera_capturer_start(IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern void gst_camera_capturer_run(IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern void gst_camera_capturer_close(IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern IntPtr gst_camera_capturer_get_type();
+               [DllImport("libcesarplayer.dll")]
+               static extern IntPtr gst_camera_capturer_enum_audio_devices();
+               [DllImport("libcesarplayer.dll")]
+               static extern IntPtr gst_camera_capturer_enum_video_devices(string devname);
+               [DllImport("libcesarplayer.dll")]
+               static extern IntPtr gst_camera_capturer_get_current_frame(IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern IntPtr gst_camera_capturer_unref_pixbuf(IntPtr raw);
 
                public unsafe GstCameraCapturer(string filename) : base(IntPtr.Zero)
                {
@@ -49,7 +75,7 @@ namespace LongoMatch.Video.Capturer {
                                throw new InvalidOperationException("Can't override this constructor.");
                        }
                        IntPtr error = IntPtr.Zero;
-                       Raw = gst_camera_capturer_new(GLib.Marshaller.StringToPtrGStrdup(filename), out 
error);
+                       Raw = gst_camera_capturer_new (out error);
                        if(error != IntPtr.Zero) throw new GLib.GException(error);
 
                        timer = new LiveSourceTimer();
@@ -59,96 +85,6 @@ namespace LongoMatch.Video.Capturer {
                        };
                }
 
-               [GLib.Property("output_height")]
-               public uint OutputHeight {
-                       get {
-                               GLib.Value val = GetProperty("output_height");
-                               uint ret = (uint) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("output_height", val);
-                               val.Dispose();
-                       }
-               }
-
-               [GLib.Property("output_width")]
-               public uint OutputWidth {
-                       get {
-                               GLib.Value val = GetProperty("output_width");
-                               uint ret = (uint) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("output_width", val);
-                               val.Dispose();
-                       }
-               }
-
-               [GLib.Property("video_quality")]
-               public uint VideoQuality {
-                       get {
-                               GLib.Value val = GetProperty("video_quality");
-                               uint ret = (uint) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("video_quality", val);
-                               val.Dispose();
-                       }
-               }
-
-               [GLib.Property("output_file")]
-               public string OutputFile {
-                       get {
-                               GLib.Value val = GetProperty("output_file");
-                               string ret = (string) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("output_file", val);
-                               val.Dispose();
-                       }
-               }
-
-               [GLib.Property("audio_quality")]
-               public uint AudioQuality {
-                       get {
-                               GLib.Value val = GetProperty("audio_quality");
-                               uint ret = (uint) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("audio_quality", val);
-                               val.Dispose();
-                       }
-               }
-
-               [GLib.Property("device_id")]
-               public string DeviceID {
-                       get {
-                               GLib.Value val = GetProperty("device_id");
-                               string ret = (string) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("device_id", val);
-                               val.Dispose();
-                       }
-               }
-
 #pragma warning disable 0169
                [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
                delegate void ErrorSignalDelegate(IntPtr arg0, IntPtr arg1, IntPtr gch);
@@ -336,120 +272,63 @@ namespace LongoMatch.Video.Capturer {
                }
 #pragma warning restore 0169
 
-               [DllImport("libcesarplayer.dll")]
-               static extern void gst_camera_capturer_init_backend(out int argc, IntPtr argv);
-
-               public static int InitBackend(string argv) {
-                       int argc;
-                       gst_camera_capturer_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
-                       return argc;
+               public void Configure (CaptureSettings settings, IntPtr window_handle) {
+                       IntPtr err = IntPtr.Zero;
+                       EncodingQuality qual = settings.EncodingSettings.EncodingQuality;
+                       EncodingProfile enc;
+                       VideoStandard std;
+                       IntPtr outFile, sourceElement, deviceID;
+                       
+                       enc = settings.EncodingSettings.EncodingProfile;
+                       std = settings.EncodingSettings.VideoStandard;
+                       
+                       outFile = Marshaller.StringToPtrGStrdup (settings.EncodingSettings.OutputFile);
+                       sourceElement = Marshaller.StringToPtrGStrdup (settings.SourceElement);
+                       deviceID = Marshaller.StringToPtrGStrdup (settings.DeviceID);
+                       
+                       gst_camera_capturer_configure (Handle, outFile, (int) settings.CaptureSourceType,
+                                                      sourceElement, deviceID,
+                                                      (int) enc.VideoEncoder, (int) enc.AudioEncoder,
+                                                      (int) enc.Muxer, qual.VideoQuality,
+                                                      qual.AudioQuality,
+                                                      settings.EncodingSettings.EnableAudio,
+                                                      std.Width, std.Height, window_handle,
+                                                      out err);
+                       Marshaller.Free (outFile);
+                       Marshaller.Free (sourceElement);
+                       Marshaller.Free (deviceID);
+                       if(err != IntPtr.Zero) throw new GLib.GException(err);
                }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void gst_camera_capturer_stop(IntPtr raw);
-
+               
                public void Stop() {
                        timer.Stop();
                        gst_camera_capturer_stop(Handle);
                }
 
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void gst_camera_capturer_toggle_pause(IntPtr raw);
-
                public void TogglePause() {
                        timer.TogglePause();
                        gst_camera_capturer_toggle_pause(Handle);
                }
 
-               public int CurrentTime {
+               public Time CurrentTime {
                        get {
-                               return timer.CurrentTime;
+                               return  new Time (timer.CurrentTime);
                        }
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern void gst_camera_capturer_start(IntPtr raw);
-
                public void Start() {
                        timer.Start();
                        gst_camera_capturer_start(Handle);
                }
 
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void gst_camera_capturer_run(IntPtr raw);
-
                public void Run() {
                        gst_camera_capturer_run(Handle);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern void gst_camera_capturer_close(IntPtr raw);
-
                public void Close() {
                        gst_camera_capturer_close(Handle);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern bool gst_camera_capturer_set_video_muxer(IntPtr raw, int type, out IntPtr 
error);
-
-               public bool SetVideoMuxer(VideoMuxerType type) {
-                       IntPtr error = IntPtr.Zero;
-                       bool raw_ret = gst_camera_capturer_set_video_muxer(Handle, (int) type, out error);
-                       if(error != IntPtr.Zero) throw new GLib.GException(error);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool gst_camera_capturer_set_video_encoder(IntPtr raw, int type, out IntPtr 
error);
-
-               public bool SetVideoEncoder(VideoEncoderType type) {
-                       IntPtr error = IntPtr.Zero;
-                       bool raw_ret = gst_camera_capturer_set_video_encoder(Handle, (int) type, out error);
-                       if(error != IntPtr.Zero) throw new GLib.GException(error);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool gst_camera_capturer_set_audio_encoder(IntPtr raw, int type, out IntPtr 
error);
-
-               public bool SetAudioEncoder(AudioEncoderType type) {
-                       IntPtr error = IntPtr.Zero;
-                       bool raw_ret = gst_camera_capturer_set_audio_encoder(Handle, (int) type, out error);
-                       if(error != IntPtr.Zero) throw new GLib.GException(error);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool gst_camera_capturer_set_source(IntPtr raw, int type, string element, out 
IntPtr error);
-
-               public bool SetSource(CaptureSourceType type, string sourceElement) {
-                       IntPtr error = IntPtr.Zero;
-                       bool raw_ret = gst_camera_capturer_set_source(Handle, (int) type, sourceElement, out 
error);
-                       if(error != IntPtr.Zero) throw new GLib.GException(error);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr gst_camera_capturer_get_type();
-
-               public static new GLib.GType GType {
-                       get {
-                               IntPtr raw_ret = gst_camera_capturer_get_type();
-                               GLib.GType ret = new GLib.GType(raw_ret);
-                               return ret;
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr gst_camera_capturer_enum_audio_devices();
-
                public static string[] AudioDevices {
                        get {
                                IntPtr raw_ret = gst_camera_capturer_enum_audio_devices();
@@ -457,20 +336,13 @@ namespace LongoMatch.Video.Capturer {
                        }
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr gst_camera_capturer_enum_video_devices(string devname);
-
                public static string[] ListVideoDevices (string devname) {
                        IntPtr raw_ret = gst_camera_capturer_enum_video_devices(devname);
                        return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List),  true, 
false, typeof(String));
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr gst_camera_capturer_get_current_frame(IntPtr raw);
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr gst_camera_capturer_unref_pixbuf(IntPtr raw);
 
-               public Gdk.Pixbuf CurrentFrame {
+               public Image CurrentFrame {
                        get {
                                IntPtr raw_ret = gst_camera_capturer_get_current_frame(Handle);
                                Gdk.Pixbuf p = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
@@ -478,7 +350,15 @@ namespace LongoMatch.Video.Capturer {
                                 * so that p.Dipose() sets it to 0 and triggers the pixbuf destroy function
                                 * that frees the associated data*/
                                gst_camera_capturer_unref_pixbuf(raw_ret);
-                               return p;
+                               return new Image (p);
+                       }
+               }
+
+               public static new GLib.GType GType {
+                       get {
+                               IntPtr raw_ret = gst_camera_capturer_get_type();
+                               GLib.GType ret = new GLib.GType(raw_ret);
+                               return ret;
                        }
                }
 
diff --git a/LongoMatch.Multimedia/Common/Enum.cs b/LongoMatch.Multimedia/Common/Enum.cs
index 006456b..2641225 100644
--- a/LongoMatch.Multimedia/Common/Enum.cs
+++ b/LongoMatch.Multimedia/Common/Enum.cs
@@ -66,9 +66,7 @@ namespace LongoMatch.Video.Common
 
        public enum PlayerUseType {
                Video,
-               Audio,
                Capture,
-               Metadata,
        }
 
        public enum VideoProperty {
diff --git a/LongoMatch.Multimedia/Common/Handlers.cs b/LongoMatch.Multimedia/Common/Handlers.cs
index 9f63c3d..831dbbf 100644
--- a/LongoMatch.Multimedia/Common/Handlers.cs
+++ b/LongoMatch.Multimedia/Common/Handlers.cs
@@ -17,7 +17,8 @@
 //
 
 using System;
-using Gdk;
+using LongoMatch.Store;
+using LongoMatch.Common;
 
 namespace LongoMatch.Video.Common
 {
@@ -31,7 +32,7 @@ namespace LongoMatch.Video.Common
        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, float rate, bool inSegment, long start, long stop);
+       public delegate void SeekHandler (SeekType type, Time start, float rate);
 
 
 
@@ -62,27 +63,21 @@ namespace LongoMatch.Video.Common
        }
 
        public class TickArgs : GLib.SignalArgs {
-               public long CurrentTime {
+               public Time CurrentTime {
                        get {
-                               return (long) Args[0];
+                               return new Time {NSeconds = (long) Args[0]};
                        }
                }
 
-               public long StreamLength {
+               public Time StreamLength {
                        get {
-                               return (long) Args[1];
+                               return new Time {NSeconds = (long) Args[1]};
                        }
                }
 
-               public float CurrentPosition {
+               public double CurrentPosition {
                        get {
-                               return (float) Args[2];
-                       }
-               }
-
-               public bool Seekable {
-                       get {
-                               return (bool) Args[3];
+                               return (double) Args[2];
                        }
                }
        }
diff --git a/LongoMatch.Multimedia/Interfaces/ICapturer.cs b/LongoMatch.Multimedia/Interfaces/ICapturer.cs
index 0c2535b..3256317 100644
--- a/LongoMatch.Multimedia/Interfaces/ICapturer.cs
+++ b/LongoMatch.Multimedia/Interfaces/ICapturer.cs
@@ -21,7 +21,8 @@
 using System;
 using LongoMatch.Common;
 using LongoMatch.Video.Common;
-using Gdk;
+using LongoMatch.Store;
+using Image = LongoMatch.Common.Image;
 
 namespace LongoMatch.Multimedia.Interfaces
 {
@@ -33,52 +34,16 @@ namespace LongoMatch.Multimedia.Interfaces
                event ErrorHandler Error;
                event DeviceChangeHandler DeviceChange;
 
-               uint OutputWidth {
-                       get ;
-                       set ;
-               }
-
-               uint OutputHeight {
-                       get;
-                       set ;
-               }
+               void Configure (CaptureSettings settings, IntPtr window_handle);
 
-               string OutputFile {
+               Time CurrentTime {
                        get ;
-                       set ;
                }
 
-               uint VideoQuality {
+               Image CurrentFrame {
                        get;
-                       set ;
-               }
-
-               uint AudioQuality {
-                       get ;
-                       set ;
-               }
-
-               int CurrentTime {
-                       get ;
                }
 
-               Pixbuf CurrentFrame {
-                       get;
-               }
-
-               string DeviceID {
-                       set;
-                       get;
-               }
-
-               bool SetVideoEncoder(VideoEncoderType type);
-
-               bool SetAudioEncoder(AudioEncoderType type);
-
-               bool SetVideoMuxer(VideoMuxerType type);
-
-               bool SetSource(CaptureSourceType type, string sourceElement);
-
                void TogglePause();
 
                void Start();
diff --git a/LongoMatch.Multimedia/Interfaces/IPlayer.cs b/LongoMatch.Multimedia/Interfaces/IPlayer.cs
index 3269cf1..a69d397 100644
--- a/LongoMatch.Multimedia/Interfaces/IPlayer.cs
+++ b/LongoMatch.Multimedia/Interfaces/IPlayer.cs
@@ -19,8 +19,8 @@
 //
 
 using System;
-using Gtk;
 using LongoMatch.Video.Common;
+using LongoMatch.Store;
 using Image = LongoMatch.Common.Image;
 
 
@@ -33,109 +33,27 @@ namespace LongoMatch.Multimedia.Interfaces
                event         System.EventHandler Eos;
                event         StateChangeHandler StateChange;
                event         TickHandler Tick;
-               event         System.EventHandler GotDuration;
-               event         System.EventHandler SegmentDone;
                event         System.EventHandler ReadyToSeek;
 
+               Time StreamLength {get;}
+               Time CurrentTime {get;}
+               double Position {get;set;}
+               double Volume {get;set;}
+               bool Playing {get;}
+               double Rate {set;}
+               IntPtr WindowHandle {set;}
 
-               long StreamLength {
-                       get;
-               }
-
-
-
-               long CurrentTime {
-                       get;
-
-               }
-
-               double Position {
-                       get;
-                       set;
-
-               }
-
-               bool LogoMode {
-                       get;
-                       set;
-               }
-
-               bool DrawingMode {
-                       set;
-               }
-
-               Image DrawingPixbuf {
-                       set;
-               }
-
-               bool ExpandLogo {
-                       get;
-                       set;
-               }
-
-               double Volume {
-                       get;
-                       set;
-               }
-
-               bool Playing {
-                       get;
-               }
-
-               string Logo {
-                       set;
-               }
-
-               Image LogoPixbuf {
-                       set;
-               }
-
-               long AccurateCurrentTime {
-                       get;
-               }
-
-               bool SeekTime(long time,float rate, bool accurate);
-
-               bool Play();
-
-               bool Open(string mrl);
-
-               bool SetRate(float rate);
-
-               bool SetRateInSegment(float rate, long stopTime);
-
-
-
+               bool Open (string mrl);
+               void Play();
                void TogglePlay();
-
                void Pause();
-
                void Stop();
-
                void Close();
-
-
+               bool Seek (Time time, bool accurate);
+               bool SeekToNextFrame();
+               bool SeekToPreviousFrame();
+               Image GetCurrentFrame (int width=-1, int height=-1);
+               void Expose ();
                void Dispose();
-
-               bool SegmentSeek(long start, long stop,float rate);
-
-               bool SeekInSegment(long pos,float rate);
-
-               bool NewFileSeek(long start, long stop,float rate);
-
-               bool SegmentStartUpdate(long start,float rate);
-
-               bool SegmentStopUpdate(long stop,float rate);
-
-               bool SeekToNextFrame(float rate,bool in_segment);
-
-               bool SeekToPreviousFrame(float rate,bool in_segment);
-
-               Image GetCurrentFrame(int outwidth, int outheight);
-
-               Image GetCurrentFrame();
-
-               void CancelProgramedStop();
-
        }
 }
diff --git a/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp b/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
index bd357a0..0b9a8d8 100644
--- a/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
+++ b/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
@@ -27,7 +27,6 @@
     <File subtype="Code" buildaction="Compile" name="Capturer/LiveSourceTimer.cs" />
     <File subtype="Directory" buildaction="Compile" name="Utils" />
     <File subtype="Code" buildaction="Compile" name="Utils/TimeString.cs" />
-    <File subtype="Code" buildaction="Compile" name="Utils/FramesCapturer.cs" />
     <File subtype="Code" buildaction="Compile" name="Utils/IMetadataReader.cs" />
     <File subtype="Code" buildaction="Compile" name="Utils/PreviewMediaFile.cs" />
     <File subtype="Directory" buildaction="Compile" name="Utils" />
@@ -62,6 +61,9 @@
     <File subtype="Code" buildaction="Compile" name="Utils/Seeker.cs" />
     <File subtype="Code" buildaction="Compile" name="Remuxer/MpegRemuxer.cs" />
     <File subtype="Code" buildaction="Compile" name="Utils/MultimediaFactory.cs" />
+    <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" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="libcesarplayer" />
@@ -69,7 +71,7 @@
     <ProjectReference type="Project" localcopy="True" refto="LongoMatch.Core" />
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=0738eb9f132ed756" />
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
-    <ProjectReference type="Gac" localcopy="False" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
     <ProjectReference type="Gac" localcopy="False" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
+    <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
   </References>
 </Project>
\ No newline at end of file
diff --git a/LongoMatch.Multimedia/Player/GstPlayer.cs b/LongoMatch.Multimedia/Player/GstPlayer.cs
index 6135393..cf5dc71 100644
--- a/LongoMatch.Multimedia/Player/GstPlayer.cs
+++ b/LongoMatch.Multimedia/Player/GstPlayer.cs
@@ -15,164 +15,75 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 //
 //
+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;
 
-namespace LongoMatch.Video.Player {
 
-       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;
+namespace LongoMatch.Video.Player {
 
        #region Autogenerated code
-       public class GstPlayer : Gtk.EventBox,IPlayer, IMetadataReader, IFramesCapturer {
-
-               [Obsolete]
-               protected GstPlayer(GLib.GType gtype) : base(gtype) {}
-               public GstPlayer(IntPtr raw) : base(raw) {}
+       public class GstPlayer : GLib.Object, IPlayer, IFramesCapturer {
 
                [DllImport("libcesarplayer.dll")]
-               static extern unsafe IntPtr bacon_video_widget_new(int width, int height, int type, out 
IntPtr error);
-
-               public unsafe GstPlayer(int width, int height, PlayerUseType type) : base(IntPtr.Zero)
-               {
-                       if(GetType() != typeof(GstPlayer)) {
-                               throw new InvalidOperationException("Can't override this constructor.");
-                       }
-                       IntPtr error = IntPtr.Zero;
-                       Raw = bacon_video_widget_new(width, height, (int) type, out error);
-                       if(error != IntPtr.Zero) throw new GLib.GException(error);
-               }
-
-               [GLib.Property("seekable")]
-               public bool Seekable {
-                       get {
-                               GLib.Value val = GetProperty("seekable");
-                               bool ret = (bool) val;
-                               val.Dispose();
-                               return ret;
-                       }
-               }
-
+               static extern IntPtr lgm_video_player_get_type ();
                [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_get_logo_mode(IntPtr raw);
-
+               static extern unsafe IntPtr lgm_video_player_new (int use_type, out IntPtr error);
                [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_logo_mode(IntPtr raw, bool logo_mode);
-
-               [GLib.Property("logo_mode")]
-               public bool LogoMode {
-                       get  {
-                               bool raw_ret = bacon_video_widget_get_logo_mode(Handle);
-                               bool ret = raw_ret;
-                               return ret;
-                       }
-                       set  {
-                               bacon_video_widget_set_logo_mode(Handle, value);
-                       }
-               }
-
-               [GLib.Property("expand_logo")]
-               public bool ExpandLogo {
-                       get {
-                               GLib.Value val = GetProperty("expand_logo");
-                               bool ret = (bool) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("expand_logo", val);
-                               val.Dispose();
-                       }
-               }
-
+               static extern unsafe IntPtr lgm_video_player_set_window_handle (IntPtr raw, IntPtr 
window_handle);
                [DllImport("libcesarplayer.dll")]
-               static extern long bacon_video_widget_get_stream_length(IntPtr raw);
-
-               [GLib.Property("stream_length")]
-               public long StreamLength {
-                       get  {
-                               long raw_ret = bacon_video_widget_get_stream_length(Handle);
-                               long ret = raw_ret;
-                               return ret;
-                       }
-               }
-
+               static extern bool lgm_video_player_open (IntPtr raw, IntPtr uri, out IntPtr error);
                [DllImport("libcesarplayer.dll")]
-               static extern double bacon_video_widget_get_volume(IntPtr raw);
-
+               static extern bool lgm_video_player_play (IntPtr raw);
                [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_volume(IntPtr raw, double volume);
-
-               [GLib.Property("volume")]
-               public double Volume {
-                       get  {
-                               double raw_ret = bacon_video_widget_get_volume(Handle);
-                               double ret = raw_ret;
-                               return ret;
-                       }
-                       set  {
-                               bacon_video_widget_set_volume(Handle, value);
-                       }
-               }
-
-               [GLib.Property("showcursor")]
-               public bool Showcursor {
-                       get {
-                               GLib.Value val = GetProperty("showcursor");
-                               bool ret = (bool) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("showcursor", val);
-                               val.Dispose();
-                       }
-               }
-
-               [GLib.Property("playing")]
-               public bool Playing {
-                       get {
-                               GLib.Value val = GetProperty("playing");
-                               bool ret = (bool) val;
-                               val.Dispose();
-                               return ret;
-                       }
-               }
-
+               static extern bool lgm_video_player_is_playing (IntPtr raw);
                [DllImport("libcesarplayer.dll")]
-               static extern double bacon_video_widget_get_position(IntPtr raw);
-
-               [GLib.Property("position")]
-               public double Position {
-                       get  {
-                               double raw_ret = bacon_video_widget_get_position(Handle);
-                               double ret = raw_ret;
-                               return ret;
-                       }
-                       set {
-                               this.Seek(value,1);
-                       }
-
-               }
+               static extern void lgm_video_player_pause (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern void lgm_video_player_stop (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern void lgm_video_player_close (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern bool lgm_video_player_seek (IntPtr raw, double position);
+               [DllImport("libcesarplayer.dll")]
+               static extern bool lgm_video_player_seek_time (IntPtr raw, long time, bool accurate);
+               [DllImport("libcesarplayer.dll")]
+               static extern bool lgm_video_player_seek_to_next_frame (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern bool lgm_video_player_seek_to_previous_frame (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern double lgm_video_player_get_position (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern long lgm_video_player_get_current_time (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern long lgm_video_player_get_stream_length (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern bool lgm_video_player_set_rate (IntPtr raw, double rate);
+               [DllImport("libcesarplayer.dll")]
+               static extern void lgm_video_player_set_volume (IntPtr raw, double volume);
+               [DllImport("libcesarplayer.dll")]
+               static extern double lgm_video_player_get_volume (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern IntPtr lgm_video_player_get_current_frame (IntPtr raw);
+               [DllImport("libcesarplayer.dll")]
+               static extern void lgm_video_player_unref_pixbuf (IntPtr pixbuf);
+               [DllImport("libcesarplayer.dll")]
+               static extern void lgm_video_player_expose (IntPtr pixbuf);
 
-               [GLib.Property("mediadev")]
-               public string Mediadev {
-                       get {
-                               GLib.Value val = GetProperty("mediadev");
-                               string ret = (string) val;
-                               val.Dispose();
-                               return ret;
-                       }
-                       set {
-                               GLib.Value val = new GLib.Value(value);
-                               SetProperty("mediadev", val);
-                               val.Dispose();
+               public unsafe GstPlayer(PlayerUseType type) : base(IntPtr.Zero)
+               {
+                       if(GetType() != typeof(GstPlayer)) {
+                               throw new InvalidOperationException("Can't override this constructor.");
                        }
+                       IntPtr error = IntPtr.Zero;
+                       Raw = lgm_video_player_new ((int) type, out error);
+                       if (error != IntPtr.Zero) throw new GLib.GException(error);
                }
 
 #pragma warning disable 0169
@@ -272,102 +183,6 @@ namespace LongoMatch.Video.Player {
                        }
                }
 
-               /*[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-               delegate void GotRedirectVMDelegate (IntPtr bvw, IntPtr mrl);
-
-               static GotRedirectVMDelegate GotRedirectVMCallback;
-
-               static void gotredirect_cb (IntPtr bvw, IntPtr mrl)
-               {
-                       try {
-                               GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
-                               bvw_managed.OnGotRedirect (GLib.Marshaller.Utf8PtrToString (mrl));
-                       } catch (Exception e) {
-                               GLib.ExceptionManager.RaiseUnhandledException (e, false);
-                       }
-               }
-
-               private static void OverrideGotRedirect (GLib.GType gtype)
-               {
-                       if (GotRedirectVMCallback == null)
-                               GotRedirectVMCallback = new GotRedirectVMDelegate (gotredirect_cb);
-                       OverrideVirtualMethod (gtype, "got-redirect", GotRedirectVMCallback);
-               }
-
-               [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), 
ConnectionMethod="OverrideGotRedirect")]
-               protected virtual void OnGotRedirect (string mrl)
-               {
-                       GLib.Value ret = GLib.Value.Empty;
-                       GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
-                       GLib.Value[] vals = new GLib.Value [2];
-                       vals [0] = new GLib.Value (this);
-                       inst_and_params.Append (vals [0]);
-                       vals [1] = new GLib.Value (mrl);
-                       inst_and_params.Append (vals [1]);
-                       g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
-                       foreach (GLib.Value v in vals)
-                               v.Dispose ();
-               }
-
-               [GLib.Signal("got-redirect")]
-               public event GotRedirectHandler GotRedirect {
-                       add {
-                               GLib.Signal sig = GLib.Signal.Lookup (this, "got-redirect", typeof 
(LongoMatch.GotRedirectArgs));
-                               sig.AddDelegate (value);
-                       }
-                       remove {
-                               GLib.Signal sig = GLib.Signal.Lookup (this, "got-redirect", typeof 
(LongoMatch.GotRedirectArgs));
-                               sig.RemoveDelegate (value);
-                       }
-               }*/
-
-               [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-               delegate void SegmentDoneVMDelegate(IntPtr bvw);
-
-               static SegmentDoneVMDelegate SegmentDoneVMCallback;
-
-               static void segmentdone_cb(IntPtr bvw)
-               {
-                       try {
-                               GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
-                               bvw_managed.OnSegmentDone();
-                       } catch(Exception e) {
-                               GLib.ExceptionManager.RaiseUnhandledException(e, false);
-                       }
-               }
-
-               private static void OverrideSegmentDone(GLib.GType gtype)
-               {
-                       if(SegmentDoneVMCallback == null)
-                               SegmentDoneVMCallback = new SegmentDoneVMDelegate(segmentdone_cb);
-                       OverrideVirtualMethod(gtype, "segment_done", SegmentDoneVMCallback);
-               }
-
-               [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), 
ConnectionMethod="OverrideSegmentDone")]
-               protected virtual void OnSegmentDone()
-               {
-                       GLib.Value ret = GLib.Value.Empty;
-                       GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
-                       GLib.Value[] vals = new GLib.Value [1];
-                       vals [0] = new GLib.Value(this);
-                       inst_and_params.Append(vals [0]);
-                       g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
-                       foreach(GLib.Value v in vals)
-                               v.Dispose();
-               }
-
-               [GLib.Signal("segment_done")]
-               public event System.EventHandler SegmentDone {
-                       add {
-                               GLib.Signal sig = GLib.Signal.Lookup(this, "segment_done");
-                               sig.AddDelegate(value);
-                       }
-                       remove {
-                               GLib.Signal sig = GLib.Signal.Lookup(this, "segment_done");
-                               sig.RemoveDelegate(value);
-                       }
-               }
-
                [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
                delegate void EosVMDelegate(IntPtr bvw);
 
@@ -464,159 +279,16 @@ namespace LongoMatch.Video.Player {
                        }
                }
 
-               /*[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-               delegate void BufferingVMDelegate (IntPtr bvw, uint progress);
-
-               static BufferingVMDelegate BufferingVMCallback;
-
-               static void buffering_cb (IntPtr bvw, uint progress)
-               {
-                       try {
-                               GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
-                               bvw_managed.OnBuffering (progress);
-                       } catch (Exception e) {
-                               GLib.ExceptionManager.RaiseUnhandledException (e, false);
-                       }
-               }
-
-               private static void OverrideBuffering (GLib.GType gtype)
-               {
-                       if (BufferingVMCallback == null)
-                               BufferingVMCallback = new BufferingVMDelegate (buffering_cb);
-                       OverrideVirtualMethod (gtype, "buffering", BufferingVMCallback);
-               }
-
-               [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), 
ConnectionMethod="OverrideBuffering")]
-               protected virtual void OnBuffering (uint progress)
-               {
-                       GLib.Value ret = GLib.Value.Empty;
-                       GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
-                       GLib.Value[] vals = new GLib.Value [2];
-                       vals [0] = new GLib.Value (this);
-                       inst_and_params.Append (vals [0]);
-                       vals [1] = new GLib.Value (progress);
-                       inst_and_params.Append (vals [1]);
-                       g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
-                       foreach (GLib.Value v in vals)
-                               v.Dispose ();
-               }
-
-               [GLib.Signal("buffering")]
-               public event LongoMatch.BufferingHandler Buffering {
-                       add {
-                               GLib.Signal sig = GLib.Signal.Lookup (this, "buffering", typeof 
(LongoMatch.BufferingArgs));
-                               sig.AddDelegate (value);
-                       }
-                       remove {
-                               GLib.Signal sig = GLib.Signal.Lookup (this, "buffering", typeof 
(LongoMatch.BufferingArgs));
-                               sig.RemoveDelegate (value);
-                       }
-               }*/
-
-               [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-               delegate void ChannelsChangeVMDelegate(IntPtr bvw);
-
-               static ChannelsChangeVMDelegate ChannelsChangeVMCallback;
-
-               static void channelschange_cb(IntPtr bvw)
-               {
-                       try {
-                               GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
-                               bvw_managed.OnChannelsChange();
-                       } catch(Exception e) {
-                               GLib.ExceptionManager.RaiseUnhandledException(e, false);
-                       }
-               }
-
-               private static void OverrideChannelsChange(GLib.GType gtype)
-               {
-                       if(ChannelsChangeVMCallback == null)
-                               ChannelsChangeVMCallback = new ChannelsChangeVMDelegate(channelschange_cb);
-                       OverrideVirtualMethod(gtype, "channels-change", ChannelsChangeVMCallback);
-               }
-
-               [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), 
ConnectionMethod="OverrideChannelsChange")]
-               protected virtual void OnChannelsChange()
-               {
-                       GLib.Value ret = GLib.Value.Empty;
-                       GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
-                       GLib.Value[] vals = new GLib.Value [1];
-                       vals [0] = new GLib.Value(this);
-                       inst_and_params.Append(vals [0]);
-                       g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
-                       foreach(GLib.Value v in vals)
-                               v.Dispose();
-               }
-
-               [GLib.Signal("channels-change")]
-               public event System.EventHandler ChannelsChange {
-                       add {
-                               GLib.Signal sig = GLib.Signal.Lookup(this, "channels-change");
-                               sig.AddDelegate(value);
-                       }
-                       remove {
-                               GLib.Signal sig = GLib.Signal.Lookup(this, "channels-change");
-                               sig.RemoveDelegate(value);
-                       }
-               }
-
                [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-               delegate void GotMetadataVMDelegate(IntPtr bvw);
-
-               static GotMetadataVMDelegate GotMetadataVMCallback;
-
-               static void gotmetadata_cb(IntPtr bvw)
-               {
-                       try {
-                               GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
-                               bvw_managed.OnGotMetadata();
-                       } catch(Exception e) {
-                               GLib.ExceptionManager.RaiseUnhandledException(e, false);
-                       }
-               }
-
-               private static void OverrideGotMetadata(GLib.GType gtype)
-               {
-                       if(GotMetadataVMCallback == null)
-                               GotMetadataVMCallback = new GotMetadataVMDelegate(gotmetadata_cb);
-                       OverrideVirtualMethod(gtype, "got-metadata", GotMetadataVMCallback);
-               }
-
-               [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), 
ConnectionMethod="OverrideGotMetadata")]
-               protected virtual void OnGotMetadata()
-               {
-                       GLib.Value ret = GLib.Value.Empty;
-                       GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
-                       GLib.Value[] vals = new GLib.Value [1];
-                       vals [0] = new GLib.Value(this);
-                       inst_and_params.Append(vals [0]);
-                       g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
-                       foreach(GLib.Value v in vals)
-                               v.Dispose();
-               }
-
-               [GLib.Signal("got-metadata")]
-               public event System.EventHandler GotMetadata {
-                       add {
-                               GLib.Signal sig = GLib.Signal.Lookup(this, "got-metadata");
-                               sig.AddDelegate(value);
-                       }
-                       remove {
-                               GLib.Signal sig = GLib.Signal.Lookup(this, "got-metadata");
-                               sig.RemoveDelegate(value);
-                       }
-               }
-
-               [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-               delegate void TickVMDelegate(IntPtr bvw, long current_time, long stream_length, float 
current_position, bool seekable);
+               delegate void TickVMDelegate(IntPtr bvw, long current_time, long stream_length, double 
current_position);
 
                static TickVMDelegate TickVMCallback;
 
-               static void tick_cb(IntPtr bvw, long current_time, long stream_length, float 
current_position, bool seekable)
+               static void tick_cb(IntPtr bvw, long current_time, long stream_length, double 
current_position)
                {
                        try {
                                GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
-                               bvw_managed.OnTick(current_time, stream_length, current_position, seekable);
+                               bvw_managed.OnTick(current_time, stream_length, current_position);
                        } catch(Exception e) {
                                GLib.ExceptionManager.RaiseUnhandledException(e, false);
                        }
@@ -630,7 +302,7 @@ namespace LongoMatch.Video.Player {
                }
 
                [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), 
ConnectionMethod="OverrideTick")]
-               protected virtual void OnTick(long current_time, long stream_length, float current_position, 
bool seekable)
+               protected virtual void OnTick(long current_time, long stream_length, double current_position)
                {
                        GLib.Value ret = GLib.Value.Empty;
                        GLib.ValueArray inst_and_params = new GLib.ValueArray(5);
@@ -643,8 +315,6 @@ namespace LongoMatch.Video.Player {
                        inst_and_params.Append(vals [2]);
                        vals [3] = new GLib.Value(current_position);
                        inst_and_params.Append(vals [3]);
-                       vals [4] = new GLib.Value(seekable);
-                       inst_and_params.Append(vals [4]);
                        g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
                        foreach(GLib.Value v in vals)
                                v.Dispose();
@@ -662,480 +332,111 @@ namespace LongoMatch.Video.Player {
                        }
                }
 
-               /*[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-               delegate void TitleChangeVMDelegate (IntPtr bvw, IntPtr title);
-
-               static TitleChangeVMDelegate TitleChangeVMCallback;
-
-               static void titlechange_cb (IntPtr bvw, IntPtr title)
-               {
-                       try {
-                               GstPlayer bvw_managed = GLib.Object.GetObject (bvw, false) as GstPlayer;
-                               bvw_managed.OnTitleChange (GLib.Marshaller.Utf8PtrToString (title));
-                       } catch (Exception e) {
-                               GLib.ExceptionManager.RaiseUnhandledException (e, false);
-                       }
-               }
-
-               private static void OverrideTitleChange (GLib.GType gtype)
-               {
-                       if (TitleChangeVMCallback == null)
-                               TitleChangeVMCallback = new TitleChangeVMDelegate (titlechange_cb);
-                       OverrideVirtualMethod (gtype, "title-change", TitleChangeVMCallback);
-               }
-
-               [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), 
ConnectionMethod="OverrideTitleChange")]
-               protected virtual void OnTitleChange (string title)
-               {
-                       GLib.Value ret = GLib.Value.Empty;
-                       GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
-                       GLib.Value[] vals = new GLib.Value [2];
-                       vals [0] = new GLib.Value (this);
-                       inst_and_params.Append (vals [0]);
-                       vals [1] = new GLib.Value (title);
-                       inst_and_params.Append (vals [1]);
-                       g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
-                       foreach (GLib.Value v in vals)
-                               v.Dispose ();
-               }
-
-               [GLib.Signal("title-change")]
-               public event TitleChangeHandler TitleChange {
-                       add {
-                               GLib.Signal sig = GLib.Signal.Lookup (this, "title-change", typeof 
(LongoMatch.TitleChangeArgs));
-                               sig.AddDelegate (value);
-                       }
-                       remove {
-                               GLib.Signal sig = GLib.Signal.Lookup (this, "title-change", typeof 
(LongoMatch.TitleChangeArgs));
-                               sig.RemoveDelegate (value);
-                       }
-               }*/
-
-               [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-               delegate void GotDurationVMDelegate(IntPtr bvw);
-
-               static GotDurationVMDelegate GotDurationVMCallback;
-
-               static void gotduration_cb(IntPtr bvw)
-               {
-                       try {
-                               GstPlayer bvw_managed = GLib.Object.GetObject(bvw, false) as GstPlayer;
-                               bvw_managed.OnGotDuration();
-                       } catch(Exception e) {
-                               GLib.ExceptionManager.RaiseUnhandledException(e, false);
-                       }
-               }
-
-               private static void OverrideGotDuration(GLib.GType gtype)
-               {
-                       if(GotDurationVMCallback == null)
-                               GotDurationVMCallback = new GotDurationVMDelegate(gotduration_cb);
-                       OverrideVirtualMethod(gtype, "got_duration", GotDurationVMCallback);
-               }
-
-               [GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Player.GstPlayer), 
ConnectionMethod="OverrideGotDuration")]
-               protected virtual void OnGotDuration()
-               {
-                       GLib.Value ret = GLib.Value.Empty;
-                       GLib.ValueArray inst_and_params = new GLib.ValueArray(1);
-                       GLib.Value[] vals = new GLib.Value [1];
-                       vals [0] = new GLib.Value(this);
-                       inst_and_params.Append(vals [0]);
-                       g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
-                       foreach(GLib.Value v in vals)
-                               v.Dispose();
-               }
-
-               [GLib.Signal("got_duration")]
-               public event System.EventHandler GotDuration {
-                       add {
-                               GLib.Signal sig = GLib.Signal.Lookup(this, "got_duration");
-                               sig.AddDelegate(value);
-                       }
-                       remove {
-                               GLib.Signal sig = GLib.Signal.Lookup(this, "got_duration");
-                               sig.RemoveDelegate(value);
-                       }
-               }
 #pragma warning restore 0169
 
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr bacon_video_widget_get_backend_name(IntPtr raw);
-
-               public string BackendName {
-                       get {
-                               IntPtr raw_ret = bacon_video_widget_get_backend_name(Handle);
-                               string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
-                               return ret;
+               public IntPtr WindowHandle {
+                       set {
+                               lgm_video_player_set_window_handle (Handle, value);
                        }
                }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_set_rate(IntPtr raw, float rate);
-
-               public bool SetRate(float rate) {
-                       bool raw_ret = bacon_video_widget_set_rate(Handle, rate);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_is_playing(IntPtr raw);
-
-               public bool IsPlaying {
+               
+               public Time CurrentTime {
                        get {
-                               bool raw_ret = bacon_video_widget_is_playing(Handle);
-                               bool ret = raw_ret;
-                               return ret;
+                               long ret = lgm_video_player_get_current_time (Handle);
+                               return new Time {NSeconds=ret};
                        }
                }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_get_auto_resize(IntPtr raw);
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_auto_resize(IntPtr raw, bool auto_resize);
-
-               public bool AutoResize {
-                       get {
-                               bool raw_ret = bacon_video_widget_get_auto_resize(Handle);
-                               bool ret = raw_ret;
-                               return ret;
-                       }
-                       set {
-                               bacon_video_widget_set_auto_resize(Handle, value);
+               
+               public Time StreamLength {
+                       get  {
+                               long ret = lgm_video_player_get_stream_length (Handle);
+                               return new Time {NSeconds=ret};
                        }
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_seek(IntPtr raw, double position, float rate);
-
-               public bool Seek(double position, float rate) {
-                       bool raw_ret = bacon_video_widget_seek(Handle, position, rate);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_get_show_cursor(IntPtr raw);
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_show_cursor(IntPtr raw, bool show_cursor);
-
-               public bool ShowCursor {
-                       get {
-                               bool raw_ret = bacon_video_widget_get_show_cursor(Handle);
-                               bool ret = raw_ret;
-                               return ret;
+               public double Position {
+                       get  {
+                               return lgm_video_player_get_position (Handle);
                        }
                        set {
-                               bacon_video_widget_set_show_cursor(Handle, value);
+                               Seek (value);
                        }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_init_backend(out int argc, IntPtr argv);
 
-               public static int InitBackend(string argv) {
-                       int argc;
-                       bacon_video_widget_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
-                       return argc;
                }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_pause(IntPtr raw);
-
-               public void Pause() {
-                       bacon_video_widget_pause(Handle);
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern double bacon_video_widget_get_zoom(IntPtr raw);
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_zoom(IntPtr raw, double zoom);
-
-               public double Zoom {
+               
+               public double Volume {
                        get {
-                               double raw_ret = bacon_video_widget_get_zoom(Handle);
-                               double ret = raw_ret;
-                               return ret;
+                               return lgm_video_player_get_volume (Handle);
                        }
                        set {
-                               bacon_video_widget_set_zoom(Handle, value);
+                               lgm_video_player_set_volume (Handle, value);
                        }
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_seek_in_segment(IntPtr raw, long pos, float rate);
-
-               public bool SeekInSegment(long pos, float rate) {
-                       bool raw_ret = bacon_video_widget_seek_in_segment(Handle, pos, rate);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_segment_seek(IntPtr raw, long start, long stop, float 
rate);
-
-               public bool SegmentSeek(long start, long stop, float rate) {
-                       bool raw_ret = bacon_video_widget_segment_seek(Handle, start, stop, rate);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_stop(IntPtr raw);
-
-               public void Stop() {
-                       bacon_video_widget_stop(Handle);
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_has_next_track(IntPtr raw);
-
-               public bool HasNextTrack {
+               public bool Playing {
                        get {
-                               bool raw_ret = bacon_video_widget_has_next_track(Handle);
-                               bool ret = raw_ret;
-                               return ret;
+                               return lgm_video_player_is_playing (Handle);
                        }
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_subtitle_font(IntPtr raw, IntPtr font);
-
-               public string SubtitleFont {
+               public double Rate {
                        set {
-                               IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup(value);
-                               bacon_video_widget_set_subtitle_font(Handle, native_value);
-                               GLib.Marshaller.Free(native_value);
+                               lgm_video_player_set_rate (Handle, value);
                        }
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_set_visuals(IntPtr raw, IntPtr name);
-
-               public bool SetVisuals(string name) {
-                       IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
-                       bool raw_ret = bacon_video_widget_set_visuals(Handle, native_name);
-                       bool ret = raw_ret;
-                       GLib.Marshaller.Free(native_name);
-                       return ret;
+               public bool Seek (double position) {
+                       return lgm_video_player_seek (Handle, position);
                }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern long bacon_video_widget_get_accurate_current_time(IntPtr raw);
-
-               public long AccurateCurrentTime {
-                       get {
-                               long raw_ret = bacon_video_widget_get_accurate_current_time(Handle);
-                               long ret = raw_ret;
-                               return ret;
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern int bacon_video_widget_get_video_property(IntPtr raw, int type);
-
-               public int GetVideoProperty(VideoProperty type) {
-                       int raw_ret = bacon_video_widget_get_video_property(Handle, (int) type);
-                       int ret = raw_ret;
-                       return ret;
+               
+               public bool Seek (Time time, bool accurate) {
+                       return lgm_video_player_seek_time (Handle, time.NSeconds, accurate);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern int bacon_video_widget_get_language(IntPtr raw);
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_language(IntPtr raw, int language);
-
-               public int Language {
-                       get {
-                               int raw_ret = bacon_video_widget_get_language(Handle);
-                               int ret = raw_ret;
-                               return ret;
-                       }
-                       set {
-                               bacon_video_widget_set_language(Handle, value);
-                       }
+               public bool SeekToPreviousFrame() {
+                       return lgm_video_player_seek_to_previous_frame (Handle);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_seek_time(IntPtr raw, long time, float rate, bool 
accurate);
-
-               public bool SeekTime(long time, float rate, bool accurate) {
-                       bool raw_ret = bacon_video_widget_seek_time(Handle, time, rate, accurate);
-                       bool ret = raw_ret;
-                       return ret;
+               public bool SeekToNextFrame() {
+                       return lgm_video_player_seek_to_next_frame (Handle);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_is_seekable(IntPtr raw);
-
-               public bool IsSeekable {
-                       get {
-                               bool raw_ret = bacon_video_widget_is_seekable(Handle);
-                               bool ret = raw_ret;
-                               return ret;
-                       }
+               public void Play() {
+                       lgm_video_player_play (Handle);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern unsafe bool bacon_video_widget_can_get_frames(IntPtr raw, out IntPtr error);
-
-               public unsafe bool CanGetFrames() {
-                       IntPtr error = IntPtr.Zero;
-                       bool raw_ret = bacon_video_widget_can_get_frames(Handle, out error);
-                       bool ret = raw_ret;
-                       if(error != IntPtr.Zero) throw new GLib.GException(error);
-                       return ret;
+               public void Pause() {
+                       lgm_video_player_pause (Handle);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern long bacon_video_widget_get_current_time(IntPtr raw);
-
-               public long CurrentTime {
-                       get {
-                               long raw_ret = bacon_video_widget_get_current_time(Handle);
-                               long ret = raw_ret;
-                               return ret;
+               public void  TogglePlay() {
+                       if(!this.Playing) {
+                               this.Play();
                        }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_seek_to_previous_frame(IntPtr raw, float rate, bool 
in_segment);
-
-               public bool SeekToPreviousFrame(float rate, bool in_segment) {
-                       bool raw_ret = bacon_video_widget_seek_to_previous_frame(Handle, rate, in_segment);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr bacon_video_widget_get_type();
-
-               public static new GLib.GType GType {
-                       get {
-                               IntPtr raw_ret = bacon_video_widget_get_type();
-                               GLib.GType ret = new GLib.GType(raw_ret);
-                               return ret;
+                       else {
+                               this.Pause();
                        }
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr bacon_video_widget_get_languages(IntPtr raw);
-
-               public GLib.List Languages {
-                       get {
-                               IntPtr raw_ret = bacon_video_widget_get_languages(Handle);
-                               GLib.List ret = new GLib.List(raw_ret);
-                               return ret;
-                       }
+               public void Stop() {
+                       lgm_video_player_stop (Handle);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_fullscreen(IntPtr raw, bool fullscreen);
-
-               public bool Fullscreen {
-                       set {
-                               bacon_video_widget_set_fullscreen(Handle, value);
-                       }
+               public void Close() {
+                       lgm_video_player_close (Handle);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_set_audio_out_type(IntPtr raw, int type);
-
-               public bool SetAudioOutType(AudioOutType type) {
-                       bool raw_ret = bacon_video_widget_set_audio_out_type(Handle, (int) type);
-                       bool ret = raw_ret;
+               public bool Open (string uri) {
+                       IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
+                       IntPtr error = IntPtr.Zero;
+                       bool ret = lgm_video_player_open (Handle, native_uri, out error);
+                       GLib.Marshaller.Free(native_uri);
+                       if(error != IntPtr.Zero) throw new GLib.GException(error);
                        return ret;
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_has_previous_track(IntPtr raw);
-
-               public bool HasPreviousTrack {
-                       get {
-                               bool raw_ret = bacon_video_widget_has_previous_track(Handle);
-                               bool ret = raw_ret;
-                               return ret;
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_logo_pixbuf(IntPtr raw, IntPtr logo);
-
-               public LongoMatch.Common.Image LogoPixbuf {
-                       set {
-                               bacon_video_widget_set_logo_pixbuf(Handle, value.Value == null ? IntPtr.Zero 
: value.Value.Handle);
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_drawing_pixbuf(IntPtr raw, IntPtr drawing_mode);
-
-               public LongoMatch.Common.Image DrawingPixbuf {
-                       set  {
-                               bacon_video_widget_set_drawing_pixbuf(Handle, value.Value == null ? 
IntPtr.Zero : value.Value.Handle);
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_drawing_mode(IntPtr raw, bool drawing_mode);
-
-               public bool DrawingMode {
-                       set  {
-                               bacon_video_widget_set_drawing_mode(Handle, value);
-                       }
-               }
-
-               /*[DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_visuals_quality(IntPtr raw, int quality);
-
-               public GstVisualsQuality VisualsQuality {
-                       set {
-                               bacon_video_widget_set_visuals_quality(Handle, (int) value);
-                       }
-               }*/
-
-               [DllImport("libcesarplayer.dll")]
-               static extern int bacon_video_widget_get_connection_speed(IntPtr raw);
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_connection_speed(IntPtr raw, int speed);
-
-               public int ConnectionSpeed {
-                       get {
-                               int raw_ret = bacon_video_widget_get_connection_speed(Handle);
-                               int ret = raw_ret;
-                               return ret;
-                       }
-                       set {
-                               bacon_video_widget_set_connection_speed(Handle, value);
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr bacon_video_widget_get_subtitles(IntPtr raw);
-
-               public GLib.List Subtitles {
-                       get {
-                               IntPtr raw_ret = bacon_video_widget_get_subtitles(Handle);
-                               GLib.List ret = new GLib.List(raw_ret);
-                               return ret;
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr bacon_video_widget_get_current_frame(IntPtr raw);
-
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr bacon_video_widget_unref_pixbuf(IntPtr raw);
-
-
-               public LongoMatch.Common.Image GetCurrentFrame(int outwidth, int outheight) {
-                       IntPtr raw_ret = bacon_video_widget_get_current_frame(Handle);
+               public Image GetCurrentFrame (int outwidth=-1, int outheight=-1) {
+                       IntPtr raw_ret = lgm_video_player_get_current_frame (Handle);
                        Gdk.Pixbuf unmanaged = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
                        if(unmanaged == null)
                                return null;
@@ -1153,235 +454,17 @@ namespace LongoMatch.Video.Player {
                        }
                        managed = unmanaged.ScaleSimple(outwidth,outheight,Gdk.InterpType.Bilinear);
                        unmanaged.Dispose();
-                       bacon_video_widget_unref_pixbuf(raw_ret);
-                       return  new LongoMatch.Common.Image(managed);
-               }
-
-               public LongoMatch.Common.Image GetCurrentFrame() {
-                       return GetCurrentFrame(-1,-1);
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern IntPtr bacon_video_widget_get_visuals_list(IntPtr raw);
-
-               public GLib.List VisualsList {
-                       get {
-                               IntPtr raw_ret = bacon_video_widget_get_visuals_list(Handle);
-                               GLib.List ret = new GLib.List(raw_ret);
-                               return ret;
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_segment_stop_update(IntPtr raw, long stop, float rate);
-
-               public bool SegmentStopUpdate(long stop, float rate) {
-                       bool raw_ret = bacon_video_widget_segment_stop_update(Handle, stop, rate);
-                       bool ret = raw_ret;
-                       return ret;
+                       lgm_video_player_unref_pixbuf (raw_ret);
+                       return new Image(managed);
                }
 
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_subtitle_encoding(IntPtr raw, IntPtr encoding);
-
-               public string SubtitleEncoding {
-                       set {
-                               IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup(value);
-                               bacon_video_widget_set_subtitle_encoding(Handle, native_value);
-                               GLib.Marshaller.Free(native_value);
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_aspect_ratio(IntPtr raw, int ratio);
-
-               public AspectRatio AspectRatio {
-                       set {
-                               bacon_video_widget_set_aspect_ratio(Handle, (int) value);
-                       }
+               public void Expose () {
+                       lgm_video_player_expose (Handle);
                }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_video_property(IntPtr raw, int type, int value);
-
-               public void SetVideoProperty(VideoProperty type, int value) {
-                       bacon_video_widget_set_video_property(Handle, (int) type, value);
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_get_deinterlacing(IntPtr raw);
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_deinterlacing(IntPtr raw, bool deinterlace);
-
-               public bool Deinterlacing {
-                       get {
-                               bool raw_ret = bacon_video_widget_get_deinterlacing(Handle);
-                               bool ret = raw_ret;
-                               return ret;
-                       }
-                       set {
-                               bacon_video_widget_set_deinterlacing(Handle, value);
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_set_rate_in_segment(IntPtr raw, float rate, long stop);
-
-               public bool SetRateInSegment(float rate, long stop) {
-                       bool raw_ret = bacon_video_widget_set_rate_in_segment(Handle, rate, stop);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_get_metadata(IntPtr raw, int type, IntPtr val);
-
-               public object GetMetadata(MetadataType type) {
-                       GLib.Value val = new GLib.Value();
-                       IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc(val);
-                       bacon_video_widget_get_metadata(Handle, (int) type, native_value);
-                       val = (GLib.Value) Marshal.PtrToStructure(native_value, typeof(GLib.Value));
-                       Marshal.FreeHGlobal(native_value);
-                       return val.Val;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_can_set_volume(IntPtr raw);
-
-               public bool CanSetVolume() {
-                       bool raw_ret = bacon_video_widget_can_set_volume(Handle);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_can_direct_seek(IntPtr raw);
-
-               public bool CanDirectSeek() {
-                       bool raw_ret = bacon_video_widget_can_direct_seek(Handle);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_close(IntPtr raw);
-
-               public void Close() {
-                       bacon_video_widget_close(Handle);
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_play(IntPtr raw);
-
-               public bool Play() {
-                       bool raw_ret = bacon_video_widget_play(Handle);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern int bacon_video_widget_get_subtitle(IntPtr raw);
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_subtitle(IntPtr raw, int subtitle);
-
-               public int Subtitle {
+               
+               public static new GLib.GType GType {
                        get {
-                               int raw_ret = bacon_video_widget_get_subtitle(Handle);
-                               int ret = raw_ret;
-                               return ret;
-                       }
-                       set {
-                               bacon_video_widget_set_subtitle(Handle, value);
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern int bacon_video_widget_error_quark();
-
-               public static int ErrorQuark() {
-                       int raw_ret = bacon_video_widget_error_quark();
-                       int ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern unsafe bool bacon_video_widget_open(IntPtr raw, IntPtr mrl, IntPtr 
subtitle_uri, out IntPtr error);
-
-               public unsafe bool Open(string mrl, string subtitle_uri) {
-                       IntPtr native_mrl = GLib.Marshaller.StringToPtrGStrdup(mrl);
-                       IntPtr native_subtitle_uri = GLib.Marshaller.StringToPtrGStrdup(subtitle_uri);
-                       IntPtr error = IntPtr.Zero;
-                       bool raw_ret = bacon_video_widget_open(Handle, native_mrl, native_subtitle_uri, out 
error);
-                       bool ret = raw_ret;
-                       GLib.Marshaller.Free(native_mrl);
-                       GLib.Marshaller.Free(native_subtitle_uri);
-                       if(error != IntPtr.Zero) throw new GLib.GException(error);
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_new_file_seek(IntPtr raw, long start,long stop,float 
rate);
-
-               public bool NewFileSeek(long start, long stop,float rate) {
-                       bool raw_ret = bacon_video_widget_new_file_seek(Handle,start,stop,rate);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_segment_start_update(IntPtr raw, long start, float 
rate);
-
-               public bool SegmentStartUpdate(long start, float rate) {
-                       bool raw_ret = bacon_video_widget_segment_start_update(Handle, start, rate);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_can_deinterlace(IntPtr raw);
-
-               public bool CanDeinterlace() {
-                       bool raw_ret = bacon_video_widget_can_deinterlace(Handle);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_show_visuals(IntPtr raw, bool show_visuals);
-
-               public bool ShowVisuals {
-                       set {
-                               bacon_video_widget_set_show_visuals(Handle, value);
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_logo(IntPtr raw, IntPtr filename);
-
-               public string Logo {
-                       set {
-                               bacon_video_widget_set_logo(Handle, 
GLib.Marshaller.StringToPtrGStrdup(value));
-                       }
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern bool bacon_video_widget_seek_to_next_frame(IntPtr raw, float rate, bool 
in_segment);
-
-               public bool SeekToNextFrame(float rate, bool in_segment) {
-                       bool raw_ret = bacon_video_widget_seek_to_next_frame(Handle, rate, in_segment);
-                       bool ret = raw_ret;
-                       return ret;
-               }
-
-               [DllImport("libcesarplayer.dll")]
-               static extern void bacon_video_widget_set_scale_ratio(IntPtr raw, float ratio);
-
-               public float ScaleRatio {
-                       set {
-                               bacon_video_widget_set_scale_ratio(Handle, value);
+                               return new GLib.GType (lgm_video_player_get_type ());
                        }
                }
 
@@ -1389,29 +472,7 @@ namespace LongoMatch.Video.Player {
                {
                        LongoMatch.GtkSharp.Video.ObjectManager.Initialize();
                }
-               #endregion
-
-               public bool SeekTime(long time, bool accurate) {
-                       return SeekTime(time,1,accurate);
-               }
-
-
-               public void  TogglePlay() {
-                       if(!this.Playing) {
-                               this.Play();
-                       }
-                       else {
-                               this.Pause();
-                       }
-               }
 
-               public bool Open(string mrl) {
-                       return Open(mrl, null);
-               }
-
-               public void CancelProgramedStop() {
-                       this.SegmentSeek(this.CurrentTime,this.StreamLength,1);
-               }
-               
+               #endregion
        }
 }
diff --git a/LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs b/LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs
index e93b7b7..15af04f 100644
--- a/LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs
+++ b/LongoMatch.Multimedia/Remuxer/MpegRemuxer.cs
@@ -25,7 +25,7 @@ using GLib;
 using LongoMatch.Store;
 using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Handlers;
-using Gtk;
+using LongoMatch.Video.Utils;
 
 namespace LongoMatch.Video.Remuxer
 {
@@ -89,14 +89,16 @@ namespace LongoMatch.Video.Remuxer
                                ret = LaunchRemuxer ();
                        }
                        
+                       /* FIXME: not called from main thread */
                        if (ret != 0) {
                                if (Error != null) {
-                                       Application.Invoke (delegate {Error (this, "Unkown error");});
+                                       GtkHelpers.CallFromAppThread (delegate {
+                                               Error (this, "Unkown error");});
                                }
                        } else {
                                if (Progress != null) {
-                                       Application.Invoke (delegate {Progress (1);});
-                                       Progress (1);
+                                       GtkHelpers.CallFromAppThread (delegate {
+                                               Progress (1);});
                                }
                        }
                }
diff --git a/LongoMatch.Multimedia/Utils/GStreamer.cs b/LongoMatch.Multimedia/Utils/GStreamer.cs
index f4f16bd..dbc82a6 100644
--- a/LongoMatch.Multimedia/Utils/GStreamer.cs
+++ b/LongoMatch.Multimedia/Utils/GStreamer.cs
@@ -18,7 +18,6 @@
 using System;
 using System.IO;
 using System.Runtime.InteropServices;
-using Gtk;
 using LongoMatch.Video;
 using Mono.Unix;
 using LongoMatch.Common;
@@ -58,7 +57,6 @@ namespace LongoMatch.Multimedia.Utils
                                return true;
                        
                        if (!CheckBasicPlugins()) {
-                               HandleInstallationError();
                                return false;
                        }
                        return true;
@@ -120,17 +118,6 @@ namespace LongoMatch.Multimedia.Utils
                        return ret;
                }
                
-               private static void HandleInstallationError () {
-                       File.Delete(GetRegistryPath());
-                       MessageDialog md = new MessageDialog(null, DialogFlags.Modal,
-                                                            MessageType.Error, ButtonsType.Ok,
-                                                            Catalog.GetString("An error has been detected in 
the current " +
-                                                                              "installation.") + "\n" +
-                                                            Catalog.GetString(String.Format ("Try restarting 
{0} and contact with" +
-                                                               "the development team if the problem 
persists.", Constants.SOFTWARE_NAME)));
-                       md.Run();
-                       md.Destroy();
-               }
        }
 }
 
diff --git a/LongoMatch.Multimedia/Utils/MultimediaFactory.cs 
b/LongoMatch.Multimedia/Utils/MultimediaFactory.cs
index f54208b..0583725 100644
--- a/LongoMatch.Multimedia/Utils/MultimediaFactory.cs
+++ b/LongoMatch.Multimedia/Utils/MultimediaFactory.cs
@@ -41,64 +41,20 @@ namespace LongoMatch.Video
        public class MultimediaFactory
        {
 
-               OperatingSystem oS;
-
                public MultimediaFactory()
                {
-                       oS = Environment.OSVersion;
-               }
-
-               public IPlayer GetPlayer(int width, int height) {
-                       switch(oS.Platform) {
-                       case PlatformID.Unix:
-                               return new GstPlayer(width,height,PlayerUseType.Video);
-
-                       case PlatformID.Win32NT:
-                               return new GstPlayer(width,height,PlayerUseType.Video);
-
-                       default:
-                               return new GstPlayer(width,height,PlayerUseType.Video);
-                       }
                }
 
-               public IMetadataReader GetMetadataReader() {
-
-                       switch(oS.Platform) {
-                       case PlatformID.Unix:
-                               return new GstPlayer(1,1,PlayerUseType.Metadata);
-
-                       case PlatformID.Win32NT:
-                               return new GstPlayer(1,1,PlayerUseType.Metadata);
-
-                       default:
-                               return new GstPlayer(1,1,PlayerUseType.Metadata);
-                       }
+               public IPlayer GetPlayer () {
+                       return new GstPlayer (PlayerUseType.Video);
                }
 
                public IFramesCapturer GetFramesCapturer() {
-                       switch(oS.Platform) {
-                       case PlatformID.Unix:
-                               return new GstPlayer(1,1,PlayerUseType.Capture);
-
-                       case PlatformID.Win32NT:
-                               return new GstPlayer(1,1,PlayerUseType.Capture);
-
-                       default:
-                               return new GstPlayer(1,1,PlayerUseType.Capture);
-                       }
+                       return new GstPlayer (PlayerUseType.Capture);
                }
 
                public IVideoEditor GetVideoEditor() {
-                       switch(oS.Platform) {
-                       case PlatformID.Unix:
-                               return new GstVideoSplitter();
-
-                       case PlatformID.Win32NT:
-                               return new GstVideoSplitter();
-
-                       default:
-                               return new GstVideoSplitter();
-                       }
+                       return new GstVideoSplitter();
                }
 
                public IVideoConverter GetVideoConverter(string filename) {
diff --git a/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs b/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
index f78b78e..6774008 100644
--- a/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
+++ b/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
@@ -26,7 +26,6 @@ using LongoMatch.Video;
 using LongoMatch.Video.Common;
 using LongoMatch.Video.Player;
 using Mono.Unix;
-using Gdk;
 using GLib;
 
 namespace LongoMatch.Video.Utils
@@ -83,7 +82,7 @@ namespace LongoMatch.Video.Utils
                                        factory = new MultimediaFactory ();
                                        thumbnailer = factory.GetFramesCapturer();
                                        thumbnailer.Open(filePath);
-                                       thumbnailer.SeekTime(1000,false);
+                                       thumbnailer.Seek (new Time {Seconds = 2}, false);
                                        preview = 
thumbnailer.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
                                        thumbnailer.Dispose();
                                }
diff --git a/LongoMatch.Multimedia/Utils/Seeker.cs b/LongoMatch.Multimedia/Utils/Seeker.cs
index 8ef468b..433b5cd 100644
--- a/LongoMatch.Multimedia/Utils/Seeker.cs
+++ b/LongoMatch.Multimedia/Utils/Seeker.cs
@@ -17,6 +17,7 @@
 //
 using System;
 using LongoMatch.Video.Common;
+using LongoMatch.Store;
 
 namespace LongoMatch.Video.Utils
 {
@@ -26,9 +27,8 @@ namespace LongoMatch.Video.Utils
                
                uint timeout;
                int pendingSeekId;
-               long start, stop;
+               Time start;
                float rate;
-               bool inSegment;
                SeekType seekType;
                
                public Seeker (uint timeoutMS=80)
@@ -38,27 +38,24 @@ namespace LongoMatch.Video.Utils
                        seekType = SeekType.None;
                }
                
-               public void Seek (SeekType seekType, float rate=1, bool inSegment=false, long start=0, long 
stop=0)
+               public void Seek (SeekType seekType, Time start=null, float rate=1)
                {
                        this.seekType = seekType;
                        this.start = start;
-                       this.stop = stop;
                        this.rate = rate;
-                       this.inSegment = inSegment;
                        
                        if (pendingSeekId != -1)
                                return;
                        
                        HandleSeekTimeout ();
                        pendingSeekId = (int) GLib.Timeout.Add (timeout, HandleSeekTimeout);
-                       
                }
                
                public bool HandleSeekTimeout () {
                        pendingSeekId = -1;
                        if (seekType != SeekType.None) {
                                if (SeekEvent != null) {
-                                       SeekEvent (seekType, rate, inSegment, start, stop);
+                                       SeekEvent (seekType, start, rate);
                                }
                                seekType = SeekType.None;
                        }
diff --git a/LongoMatch.Services/LongoMatch.Services.mdp b/LongoMatch.Services/LongoMatch.Services.mdp
index b7e4e2a..b015ba0 100644
--- a/LongoMatch.Services/LongoMatch.Services.mdp
+++ b/LongoMatch.Services/LongoMatch.Services.mdp
@@ -19,7 +19,6 @@
     <File subtype="Code" buildaction="Compile" name="Services/Core.cs" />
     <File subtype="Code" buildaction="Compile" name="Services/HotKeysManager.cs" />
     <File subtype="Code" buildaction="Compile" name="Services/EventsManager.cs" />
-    <File subtype="Code" buildaction="Compile" name="Services/VideoDrawingsManager.cs" />
     <File subtype="Code" buildaction="Compile" name="Services/PlaylistManager.cs" />
     <File subtype="Code" buildaction="Compile" name="Services/ProjectsManager.cs" />
     <File subtype="Directory" buildaction="Compile" name="." />
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index 6fe4458..e3e6bc9 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -32,12 +32,8 @@ using LongoMatch.Stats;
 namespace LongoMatch.Services
 {
 
-
        public class EventsManager
        {
-
-               private VideoDrawingsManager drawingManager;
-
                /* Current play loaded. null if no play is loaded */
                TimeNode selectedTimeNode=null;
                /* current project in use */
@@ -59,7 +55,6 @@ namespace LongoMatch.Services
                        this.guiToolkit = guiToolkit;
                        this.renderer = renderer;
                        pManager.OpenedProjectChanged += HandleOpenedProjectChanged;
-                       drawingManager = new VideoDrawingsManager(pManager);
                        catsTime = new Dictionary<Category, Time>();
                }
 
@@ -181,7 +176,7 @@ namespace LongoMatch.Services
                           projectType == ProjectType.URICaptureProject) {
                                fStop = stop;
                        } else {
-                               length = new Time {MSeconds = (int)player.StreamLength};
+                               length = player.StreamLength;
                                fStop = (stop > length) ? length: stop;
                        }
                        AddNewPlay(fStart, fStop, category);
@@ -230,8 +225,8 @@ namespace LongoMatch.Services
 
                protected virtual void OnNewTagAtFrame(Category category, int frame) {
                        Time pos = new Time { MSeconds = frame*1000/openedProject.Description.File.Fps};
-                       player.CloseActualSegment();
-                       player.SeekTo((long)pos.MSeconds, true);
+                       player.CloseSegment();
+                       player.Seek (pos, true);
                        ProcessNewTag(category,pos);
                }
 
@@ -241,15 +236,15 @@ namespace LongoMatch.Services
                        if(projectType == ProjectType.FakeCaptureProject ||
                           projectType == ProjectType.CaptureProject ||
                           projectType == ProjectType.URICaptureProject) {
-                               pos =  new Time { MSeconds = (int)capturer.CurrentTime};
+                               pos =  capturer.CurrentTime;
                        } else {
-                               pos = new Time {MSeconds = (int)player.CurrentTime};
+                               pos = player.CurrentTime;
                        }
                        ProcessNewTag(category,pos);
                }
 
                public virtual void OnNewPlayStart (Category category) {
-                       Time startTime = new Time {MSeconds = (int)player.CurrentTime};
+                       Time startTime = player.CurrentTime;
                        catsTime.Add (category, startTime);
                        Log.Debug("New play start time: " + startTime);
                }
@@ -264,7 +259,7 @@ namespace LongoMatch.Services
                        }
                        startTime = catsTime[category];
                        catsTime.Remove (category);
-                       stopTime = new Time {MSeconds = (int)player.CurrentTime};
+                       stopTime = player.CurrentTime;
 
                        Log.Debug("New play stop time: " + stopTime);
                        diff = stopTime.MSeconds - startTime.MSeconds;
@@ -309,8 +304,7 @@ namespace LongoMatch.Services
                {
                        Log.Debug("Play selected: " + play);
                        selectedTimeNode = play;
-                       player.SetStartStop(play.Start.MSeconds,play.Stop.MSeconds, play.Rate);
-                       drawingManager.Play=play;
+                       player.LoadPlay (openedProject.Description.File.FilePath, play);
                        analysisWindow.UpdateSelectedPlay(play);
                }
 
@@ -321,12 +315,7 @@ namespace LongoMatch.Services
                                if(tNode != selectedTimeNode)
                                        OnPlaySelected((Play)tNode);
                                Time pos = (Time)val;
-                               if(pos == tNode.Start) {
-                                       player.UpdateSegmentStartTime(pos.MSeconds);
-                               }
-                               else {
-                                       player.UpdateSegmentStopTime(pos.MSeconds);
-                               }
+                               player.Seek (pos, true);
                        }
                        else if(tNode is Category) {
                                analysisWindow.UpdateCategories(openedProject.Categories);
@@ -341,7 +330,7 @@ namespace LongoMatch.Services
                        openedProject.RemovePlays(plays);
 
                        if(projectType == ProjectType.FileProject) {
-                               player.CloseActualSegment();
+                               player.CloseSegment ();
                                Save (openedProject);
                        }
                        filter.Update();
@@ -373,14 +362,14 @@ namespace LongoMatch.Services
 
                protected virtual void OnTimeline2PositionChanged(Time pos)
                {
-                       player.SeekInSegment(pos.MSeconds);
+                       player.Seek (pos, false);
                }
 
-               protected virtual void OnDrawFrame(int time) {
+               protected virtual void OnDrawFrame (Time time) {
                        Image pixbuf = null;
                        player.Pause();
                        pixbuf = player.CurrentFrame;
-                       guiToolkit.DrawingTool(pixbuf, selectedTimeNode as Play, time);
+                       guiToolkit.DrawingTool (pixbuf, selectedTimeNode as Play, time);
                }
 
                protected virtual void OnTagPlay(Play play) {
diff --git a/LongoMatch.Services/Services/GameUnitsManager.cs 
b/LongoMatch.Services/Services/GameUnitsManager.cs
index a1b34f7..c669f0f 100644
--- a/LongoMatch.Services/Services/GameUnitsManager.cs
+++ b/LongoMatch.Services/Services/GameUnitsManager.cs
@@ -64,7 +64,7 @@ namespace LongoMatch.Services
                        if (gameUnitsStarted.ContainsKey(gameUnit)){
                                Log.Warning("Trying to start a game unit that was already started");
                        } else {
-                               gameUnitsStarted.Add(gameUnit, new Time{MSeconds=(int)player.CurrentTime});
+                               gameUnitsStarted.Add(gameUnit, player.CurrentTime);
                        }
                }
                
@@ -87,7 +87,7 @@ namespace LongoMatch.Services
                        }
                        
                        start = gameUnitsStarted[gameUnit];
-                       stop = new Time{MSeconds=(int)player.CurrentTime};
+                       stop = player.CurrentTime;
                        timeInfo = new TimelineNode {Name=gameUnit.Name, Fps=fps, Start=start, Stop=stop};
                        
                        gameUnit.Add(timeInfo);
@@ -120,7 +120,7 @@ namespace LongoMatch.Services
                void HandleUnitSelected (GameUnit gameUnit, TimelineNode unit)
                {
                        unit.Selected = true;
-                       player.SetStartStop(unit.Start.MSeconds, unit.Stop.MSeconds);
+                       //player.SetStartStop(unit.Start.MSeconds, unit.Stop.MSeconds);
                }
 
                void HandleUnitDeleted (GameUnit gameUnit, List<TimelineNode> units)
@@ -131,9 +131,9 @@ namespace LongoMatch.Services
 
                void HandleUnitChanged (GameUnit gameUnit, TimelineNode unit, Time time)
                {
-                       player.CloseActualSegment();
+                       //player.CloseActualSegment();
                        player.Pause();
-                       player.SeekTo(time.MSeconds, true);
+                       //player.SeekTo(time.MSeconds, true);
                }
 
                void HandleUnitAdded (GameUnit gameUnit, int frame)
diff --git a/LongoMatch.Services/Services/PlaylistManager.cs b/LongoMatch.Services/Services/PlaylistManager.cs
index 6595205..05aebb3 100644
--- a/LongoMatch.Services/Services/PlaylistManager.cs
+++ b/LongoMatch.Services/Services/PlaylistManager.cs
@@ -124,8 +124,7 @@ namespace LongoMatch.Services
                        }
                        
                        StartClock();
-                       player.SetPlayListElement(play.MediaFile.FilePath, play.Start.MSeconds,
-                                                 play.Stop.MSeconds, play.Rate, playlist.HasNext());
+                       player.LoadPlayListPlay (play, playlist.HasNext());
                        selectedTimeNode = play;
                        playlist.SetActive (play);
                        playlistWidget.SetActivePlay(play, playlist.GetCurrentIndex());
@@ -148,15 +147,14 @@ namespace LongoMatch.Services
 
                private void Prev() {
                        /* Select the previous element if we haven't played 500ms */
-                       if ((player.AccurateCurrentTime - selectedTimeNode.Start.MSeconds) < 500) {
+                       if ((player.CurrentTime - selectedTimeNode.Start).MSeconds < 500) {
                                if (playlist.HasPrev()) {
                                        var play = playlist.Prev();
                                        LoadPlaylistPlay(play);
                                }
                        } else {
                                /* Seek to the beginning of the segment */
-                               player.SeekTo(selectedTimeNode.Start.MSeconds,true);
-                               player.Rate = selectedTimeNode.Rate;
+                               player.Seek (selectedTimeNode.Start, true);
                        }
                }
                
@@ -175,7 +173,7 @@ namespace LongoMatch.Services
                }
 
                private void CheckStopTime(object self) {
-                       if(player.AccurateCurrentTime >= selectedTimeNode.Stop.MSeconds-200)
+                       if(player.CurrentTime >= selectedTimeNode.Stop - new Time  {MSeconds=200})
                                Next();
                        return;
                }
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index 7392cd7..4184069 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -42,14 +42,12 @@ namespace LongoMatch.Services
                IMainController mainController;
                IAnalysisWindow analysisWindow;
                IProjectOptionsController projectOptionsController;
-               TemplatesService ts;
                IDatabase DB;
                
                public ProjectsManager (IGUIToolkit guiToolkit, IMultimediaToolkit multimediaToolkit,
                                       TemplatesService ts) {
                        this.multimediaToolkit = multimediaToolkit;
                        this.guiToolkit = guiToolkit;
-                       this.ts =ts;
                        mainController = guiToolkit.MainController;
                        DB = Config.DatabaseManager.ActiveDB;
                        ConnectSignals();
@@ -87,7 +85,7 @@ namespace LongoMatch.Services
                        set;
                }
                
-               private void EmitProjectChanged() {
+               void EmitProjectChanged() {
                        if (OpenedProjectChanged != null)
                                OpenedProjectChanged (OpenedProject, OpenedProjectType, PlaysFilter,
                                                      analysisWindow, projectOptionsController);
@@ -134,14 +132,15 @@ namespace LongoMatch.Services
                        }
                }
 
-               private void SaveCaptureProject(Project project) {
+               void SaveCaptureProject(Project project) {
+                       Guid projectID = project.UUID;
                        string filePath = project.Description.File.FilePath;
 
                        /* scan the new file to build a new PreviewMediaFile with all the metadata */
                        try {
-                               Log.Debug ("Saving capture project: " + project);
+                               Log.Debug ("Saving capture project: " + project.UUID);
                        
-                               RemuxOutputFile (Capturer.CaptureProperties.EncodingSettings);
+                               RemuxOutputFile (Capturer.CaptureSettings.EncodingSettings);
                        
                                Log.Debug("Reloading saved file: " + filePath);
                                project.Description.File = multimediaToolkit.DiscoverFile(filePath);
@@ -163,24 +162,35 @@ namespace LongoMatch.Services
                                        "saved. Try to import it later:\n")+
                                        filePath+"\n"+projectFile);
                        }
-                       /* we need to set the opened project to null to avoid calling again 
CloseOpendProject() */
-                       OpenedProject = null;
-                       SetProject(project, ProjectType.FileProject, new CaptureSettings());
+                       CloseOpenedProject (false);
+                       OpenProjectID (projectID);
                }
        
                private bool SetProject(Project project, ProjectType projectType, CaptureSettings props)
                {
+                       IAnalysisWindow newAnalysiswindow;
+                       IProjectOptionsController newController;
+                       
                        if (OpenedProject != null) {
                                CloseOpenedProject(true);
                        }
+                       
+                       Log.Debug ("Loading project " + project.UUID + " " + projectType);
                                
                        PlaysFilter = new PlaysFilter(project);
                        guiToolkit.OpenProject (project, projectType, props, PlaysFilter,
-                                               out analysisWindow, out projectOptionsController);
-                       Player = analysisWindow.Player;
-                       Capturer = analysisWindow.Capturer;
-                       projectOptionsController.CloseOpenedProjectEvent += () => {PromptCloseProject ();};
-                       projectOptionsController.SaveProjectEvent += SaveProject;
+                                               out newAnalysiswindow, out newController);
+                       Player = newAnalysiswindow.Player;
+                       Capturer = newAnalysiswindow.Capturer;
+                       if (newAnalysiswindow != analysisWindow) {
+                               analysisWindow = newAnalysiswindow;
+                               analysisWindow.CloseOpenedProjectEvent += () => {SaveCaptureProject 
(OpenedProject);};
+                       }
+                       if (newController != projectOptionsController) {
+                               projectOptionsController = newController;
+                               projectOptionsController.CloseOpenedProjectEvent += () => {PromptCloseProject 
();};
+                               projectOptionsController.SaveProjectEvent += SaveProject;
+                       }
                        OpenedProject = project;
                        OpenedProjectType = projectType;
 
@@ -203,19 +213,20 @@ namespace LongoMatch.Services
                                }
 
                        } else {
+                               CapturerType type;
                                if(projectType == ProjectType.CaptureProject ||
                                   projectType == ProjectType.URICaptureProject) {
-                                       Capturer.CaptureProperties = props;
-                                       try {
-                                               Capturer.Type = CapturerType.Live;
-                                       } catch(Exception ex) {
-                                               guiToolkit.ErrorMessage(ex.Message);
-                                               CloseOpenedProject (false);
-                                               return false;
-                                       }
-                               } else
-                                       Capturer.Type = CapturerType.Fake;
-                               Capturer.Run();
+                                       type = CapturerType.Live;
+                               } else {
+                                       type = CapturerType.Fake;
+                               }
+                               try {
+                                       Capturer.Run(type, props);
+                               } catch(Exception ex) {
+                                       guiToolkit.ErrorMessage(ex.Message);
+                                       CloseOpenedProject (false);
+                                       return false;
+                               }
                        }
 
                        EmitProjectChanged();
@@ -250,9 +261,6 @@ namespace LongoMatch.Services
                }*/
 
                private bool PromptCloseProject() {
-                       int res;
-                       //EndCaptureDialog dialog;
-
                        if(OpenedProject == null)
                                return true;
 
@@ -265,27 +273,25 @@ namespace LongoMatch.Services
                                        return true;
                                }
                                return false;
-                       }
+                       } else {
+                               EndCaptureResponse res;
+                               
+                               res = guiToolkit.EndCapture (OpenedProject.Description.File.FilePath);
 
-                       res = 0;
-                       /* Capture project */
-                       /*dialog = new EndCaptureDialog();
-                       dialog.TransientFor = (Gtk.Window)this.Toplevel;
-                       
-                       res = dialog.Run();
-                       dialog.Destroy();
+                               /* Close project wihtout saving */
+                               if (res == EndCaptureResponse.Quit) {
+                                       CloseOpenedProject (false);
+                                       return true;
+                               } else if(res == EndCaptureResponse.Save) {
+                                       /* Close and save project */
+                                       CloseOpenedProject (true);
+                                       return true;
+                               } else {
+                                       /* Continue with the current project */
+                                       return false;
+                               }
+                       }
 
-                       /* Close project wihtout saving */
-                       if(res == (int)EndCaptureResponse.Quit) {
-                               CloseOpenedProject (false);
-                               return true;
-                       } else if(res == (int)EndCaptureResponse.Save) {
-                               /* Close and save project */
-                               CloseOpenedProject (true);
-                               return true;
-                       } else
-                               /* Continue with the current project */
-                               return false;
                }
 
                private void CloseOpenedProject (bool save) {
@@ -295,6 +301,7 @@ namespace LongoMatch.Services
                        if (save)
                                SaveProject(OpenedProject, OpenedProjectType);
                        
+                       Log.Debug ("Closing project " + OpenedProject.UUID);
                        if(OpenedProjectType != ProjectType.FileProject)
                                Capturer.Close();
                        else
diff --git a/LongoMatch.Services/Services/RenderingJobsManager.cs 
b/LongoMatch.Services/Services/RenderingJobsManager.cs
index 463c9d4..2701c7d 100644
--- a/LongoMatch.Services/Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/Services/RenderingJobsManager.cs
@@ -223,7 +223,7 @@ namespace LongoMatch.Services
                        string path = System.IO.Path.GetTempFileName().Replace(@"\", @"\\");
                        
                        capturer.Open(filename);
-                       capturer.SeekTime(drawing.RenderTime, true);
+                       capturer.Seek (drawing.Render, true);
                        frame = capturer.GetCurrentFrame();
                        final_image = Image.Composite(frame, drawing.Pixbuf);
                        final_image.Save(path);
diff --git a/LongoMatch.Services/Services/ToolsManager.cs b/LongoMatch.Services/Services/ToolsManager.cs
index 53575d1..7668152 100644
--- a/LongoMatch.Services/Services/ToolsManager.cs
+++ b/LongoMatch.Services/Services/ToolsManager.cs
@@ -156,7 +156,7 @@ namespace LongoMatch.Services {
                        capturer.Open(project.Description.File.FilePath);
                        foreach(Play play in project.AllPlays()) {
                                try {
-                                       capturer.SeekTime(play.Start.MSeconds + ((play.Stop - 
play.Start).MSeconds/2),
+                                       capturer.Seek (play.Start + ((play.Stop - play.Start) / 2),
                                                          true);
                                        play.Miniature = capturer.GetCurrentFrame (
                                                Constants.MAX_THUMBNAIL_SIZE,
diff --git a/LongoMatch.mds b/LongoMatch.mds
index c02365d..ae74955 100644
--- a/LongoMatch.mds
+++ b/LongoMatch.mds
@@ -29,6 +29,7 @@
       <Entry build="True" name="LongoMatch.Plugins" configuration="Debug" />
       <Entry build="True" name="OxyPlotMono" configuration="Debug" />
       <Entry build="True" name="Tests" configuration="Debug" />
+      <Entry build="True" name="LongoMatch.GUI.Helpers" configuration="Debug" />
     </Configuration>
     <Configuration name="Release" ctype="CombineConfiguration">
       <Entry build="True" name="LongoMatch.GUI" configuration="Release" />
@@ -42,6 +43,7 @@
       <Entry build="True" name="LongoMatch.Plugins" configuration="Release" />
       <Entry build="True" name="OxyPlotMono" configuration="Release" />
       <Entry build="True" name="Tests" configuration="Release" />
+      <Entry build="True" name="LongoMatch.GUI.Helpers" configuration="Release" />
     </Configuration>
   </Configurations>
   <StartMode startupentry="LongoMatchGtk" single="True">
@@ -56,6 +58,7 @@
     <Execute type="None" entry="LongoMatch.Plugins" />
     <Execute type="None" entry="OxyPlotMono" />
     <Execute type="None" entry="Tests" />
+    <Execute type="None" entry="LongoMatch.GUI.Helpers" />
   </StartMode>
   <Entries>
     <Entry filename="LongoMatch.GUI/LongoMatch.GUI.mdp" />
@@ -69,5 +72,6 @@
     <Entry filename="LongoMatch.Plugins/LongoMatch.Plugins.mdp" />
     <Entry filename="oxyplot/OxyPlotMono/OxyPlotMono.csproj" />
     <Entry filename="Tests/Tests.mdp" />
+    <Entry filename="LongoMatch.GUI.Helpers/LongoMatch.GUI.Helpers.mdp" />
   </Entries>
 </Combine>
\ No newline at end of file
diff --git a/LongoMatch/LongoMatchGtk.mdp b/LongoMatch/LongoMatchGtk.mdp
index 71066c9..cbaacdd 100644
--- a/LongoMatch/LongoMatchGtk.mdp
+++ b/LongoMatch/LongoMatchGtk.mdp
@@ -33,5 +33,6 @@
     <ProjectReference type="Project" localcopy="True" refto="LongoMatch.Core" />
     <ProjectReference type="Project" localcopy="True" refto="LongoMatch.Addins" />
     <ProjectReference type="Project" localcopy="True" refto="LongoMatch.GUI.Multimedia" />
+    <ProjectReference type="Project" localcopy="True" refto="LongoMatch.GUI.Helpers" />
   </References>
 </Project>
\ No newline at end of file
diff --git a/libcesarplayer/Makefile.am b/libcesarplayer/Makefile.am
index 39349fe..7a9f0a8 100644
--- a/libcesarplayer/Makefile.am
+++ b/libcesarplayer/Makefile.am
@@ -31,8 +31,8 @@ pkglib_LTLIBRARIES = \
 libcesarplayer_la_SOURCES = \
        $(BVWMARSHALFILES) \
        common.h\
-       bacon-video-widget.h\
-       bacon-video-widget-gst-0.10.c\
+       lgm-video-player.h\
+       lgm-video-player.c\
        gstscreenshot.c \
        gstscreenshot.h \
        gst-camera-capturer.c\
diff --git a/libcesarplayer/baconvideowidget-marshal.list b/libcesarplayer/baconvideowidget-marshal.list
index 195033e..edfa31c 100644
--- a/libcesarplayer/baconvideowidget-marshal.list
+++ b/libcesarplayer/baconvideowidget-marshal.list
@@ -1,4 +1,4 @@
 VOID:INT64,INT64,DOUBLE,BOOLEAN
 VOID:STRING,BOOLEAN,BOOLEAN
 BOOLEAN:BOXED,BOXED,BOOLEAN
-VOID:INT64,INT64,FLOAT,BOOLEAN
+VOID:INT64,INT64,DOUBLE
diff --git a/libcesarplayer/gst-camera-capturer.c b/libcesarplayer/gst-camera-capturer.c
index 2b2fd64..9616413 100644
--- a/libcesarplayer/gst-camera-capturer.c
+++ b/libcesarplayer/gst-camera-capturer.c
@@ -37,17 +37,6 @@
 #include "video-utils.h"
 
 
-/* gtk+/gnome */
-#include <gdk/gdk.h>
-#if defined (GDK_WINDOWING_X11)
-#include <gdk/gdkx.h>
-#elif defined (GDK_WINDOWING_WIN32)
-#include <gdk/gdkwin32.h>
-#elif defined (GDK_WINDOWING_QUARTZ)
-#include <gdk/gdkquartz.h>
-#endif
-#include <gtk/gtk.h>
-
 GST_DEBUG_CATEGORY (_cesarplayer_gst_debug_cat);
 #define GST_CAT_DEFAULT _cesarplayer_gst_debug_cat
 
@@ -61,19 +50,6 @@ enum
   LAST_SIGNAL
 };
 
-/* Properties */
-enum
-{
-  PROP_0,
-  PROP_OUTPUT_HEIGHT,
-  PROP_OUTPUT_WIDTH,
-  PROP_VIDEO_QUALITY,
-  PROP_AUDIO_QUALITY,
-  PROP_AUDIO_ENABLED,
-  PROP_OUTPUT_FILE,
-  PROP_DEVICE_ID,
-};
-
 struct GstCameraCapturerPrivate
 {
 
@@ -94,13 +70,8 @@ struct GstCameraCapturerPrivate
   /*Video input info */
   gint video_width;             /* Movie width */
   gint video_height;            /* Movie height */
-  const GValue *movie_par;      /* Movie pixel aspect ratio */
-  gint video_width_pixels;      /* Scaled movie width */
-  gint video_height_pixels;     /* Scaled movie height */
   gint video_fps_n;
   gint video_fps_d;
-  gboolean media_has_video;
-  gboolean media_has_audio;
 
   /* Snapshots */
   GstBuffer *last_buffer;
@@ -131,17 +102,12 @@ struct GstCameraCapturerPrivate
   GstClockTime current_recording_start_ts;
   GstClockTime last_video_buf_ts;
   GstClockTime last_audio_buf_ts;
-  GMutex *recording_lock;
+  GMutex recording_lock;
 
   /*Overlay */
   GstXOverlay *xoverlay;        /* protect with lock */
   guintptr window_handle;
 
-  /*Videobox */
-  gboolean logo_mode;
-  GdkPixbuf *logo_pixbuf;
-  gboolean expand_logo;
-
   /*GStreamer bus */
   GstBus *bus;
   gulong sig_bus_async;
@@ -157,191 +123,12 @@ static int gcc_signals[LAST_SIGNAL] = { 0 };
 static void gcc_error_msg (GstCameraCapturer * gcc, GstMessage * msg);
 static void gcc_bus_message_cb (GstBus * bus, GstMessage * message,
     gpointer data);
-static void gst_camera_capturer_get_property (GObject * object,
-    guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_camera_capturer_set_property (GObject * object,
-    guint property_id, const GValue * value, GParamSpec * pspec);
 static void gcc_element_msg_sync (GstBus * bus, GstMessage * msg,
     gpointer data);
-static int gcc_get_video_stream_info (GstCameraCapturer * gcc);
-
-G_DEFINE_TYPE (GstCameraCapturer, gst_camera_capturer, GTK_TYPE_DRAWING_AREA);
-
-/***********************************
-*
-*           GTK Widget
-*
-************************************/
-
-static gboolean
-gst_camera_capturer_configure_event (GtkWidget * widget,
-    GdkEventConfigure * event, GstCameraCapturer * gcc)
-{
-  GstXOverlay *xoverlay = NULL;
-
-  g_return_val_if_fail (gcc != NULL, FALSE);
-  g_return_val_if_fail (GST_IS_CAMERA_CAPTURER (gcc), FALSE);
-
-  xoverlay = gcc->priv->xoverlay;
-
-  if (xoverlay != NULL && GST_IS_X_OVERLAY (xoverlay)) {
-    gst_x_overlay_expose (xoverlay);
-  }
-
-  return FALSE;
-}
-
-static void
-gst_camera_capturer_realize_event (GtkWidget * widget)
-{
-  GstCameraCapturer *gcc = GST_CAMERA_CAPTURER (widget);
-  GdkWindow *window = gtk_widget_get_window (widget);
-
-  if (!gdk_window_ensure_native (window))
-    g_error ("Couldn't create native window needed for GstXOverlay!");
-
-  /* Connect to configure event on the top level window */
-  g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)),
-      "configure-event", G_CALLBACK (gst_camera_capturer_configure_event), gcc);
-
-  gcc->priv->window_handle = gst_get_window_handle (window);
-}
-
-static gboolean
-gst_camera_capturer_expose_event (GtkWidget * widget, GdkEventExpose * event)
-{
-  GstCameraCapturer *gcc = GST_CAMERA_CAPTURER (widget);
-  GstXOverlay *xoverlay;
-  gboolean draw_logo;
-  GdkWindow *win;
-
-  if (event && event->count > 0)
-    return TRUE;
-
-  if (event == NULL)
-    return TRUE;
-
-  xoverlay = gcc->priv->xoverlay;
-  if (xoverlay != NULL) {
-    gst_object_ref (xoverlay);
-    gst_set_window_handle (xoverlay, gcc->priv->window_handle);
-  }
-
-  win = gtk_widget_get_window (widget);
-
-  /* if there's only audio and no visualisation, draw the logo as well */
-  draw_logo = gcc->priv->media_has_audio && !gcc->priv->media_has_video;
-
-  if (gcc->priv->logo_mode || draw_logo) {
-    /* Start with a nice black canvas */
-    gdk_draw_rectangle (win, gtk_widget_get_style (widget)->black_gc, TRUE, 0,
-        0, widget->allocation.width, widget->allocation.height);
-
-    if (gcc->priv->logo_pixbuf != NULL) {
-      GdkPixbuf *frame;
-      /*GdkPixbuf *drawing;*/
-      guchar *pixels;
-      int rowstride;
-      gint width, height, alloc_width, alloc_height, logo_x, logo_y;
-      gfloat ratio;
-
-      /* Checking if allocated space is smaller than our logo */
-
-
-      width = gdk_pixbuf_get_width (gcc->priv->logo_pixbuf);
-      height = gdk_pixbuf_get_height (gcc->priv->logo_pixbuf);
-      alloc_width = widget->allocation.width;
-      alloc_height = widget->allocation.height;
-
-      if ((gfloat) alloc_width / width > (gfloat) alloc_height / height) {
-        ratio = (gfloat) alloc_height / height;
-      } else {
-        ratio = (gfloat) alloc_width / width;
-      }
-
-      width *= ratio;
-      height *= ratio;
-
-      logo_x = (alloc_width / 2) - (width / 2);
-      logo_y = (alloc_height / 2) - (height / 2);
-
-
-      /* Drawing our frame */
-
-      if (gcc->priv->expand_logo) { // && !gcc->priv->drawing_mode) {
-        /* Scaling to available space */
-
-        frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
-            FALSE, 8, widget->allocation.width, widget->allocation.height);
-
-        gdk_pixbuf_composite (gcc->priv->logo_pixbuf,
-            frame,
-            0, 0,
-            alloc_width, alloc_height,
-            logo_x, logo_y, ratio, ratio, GDK_INTERP_BILINEAR, 255);
-
-        rowstride = gdk_pixbuf_get_rowstride (frame);
-
-        pixels = gdk_pixbuf_get_pixels (frame) +
-            rowstride * event->area.y + event->area.x * 3;
-
-        gdk_draw_rgb_image_dithalign (widget->window,
-            widget->style->black_gc,
-            event->area.x, event->area.y,
-            event->area.width,
-            event->area.height,
-            GDK_RGB_DITHER_NORMAL, pixels,
-            rowstride, event->area.x, event->area.y);
-
-        g_object_unref (frame);
-      } else {
-        if (width <= 1 || height <= 1) {
-          if (xoverlay != NULL)
-            gst_object_unref (xoverlay);
-          gdk_window_end_paint (win);
-          return TRUE;
-        }
-
-        frame = gdk_pixbuf_scale_simple (gcc->priv->logo_pixbuf,
-            width, height, GDK_INTERP_BILINEAR);
-        gdk_draw_pixbuf (win, gtk_widget_get_style (widget)->fg_gc[0],
-            frame, 0, 0, logo_x, logo_y, width, height,
-            GDK_RGB_DITHER_NONE, 0, 0);
-
-        /*if (gcc->priv->drawing_mode && bvw->priv->drawing_pixbuf != NULL) {*/
-          /*drawing =*/
-              /*gdk_pixbuf_scale_simple (gcc->priv->drawing_pixbuf, width,*/
-              /*height, GDK_INTERP_BILINEAR);*/
-          /*gdk_draw_pixbuf (win,*/
-              /*gtk_widget_get_style (widget)->fg_gc[0],*/
-              /*drawing, 0, 0, logo_x, logo_y, width,*/
-              /*height, GDK_RGB_DITHER_NONE, 0, 0);*/
-          /*g_object_unref (drawing);*/
-        /*}*/
-
-        g_object_unref (frame);
-      }
-    } else if (win) {
-      /* No pixbuf, just draw a black background then */
-      gdk_window_clear_area (win,
-          0, 0, widget->allocation.width, widget->allocation.height);
-    }
-  } else {
-    /* no logo, pass the expose to gst */
-    if (xoverlay != NULL && GST_IS_X_OVERLAY (xoverlay)){
-      gst_x_overlay_expose (xoverlay);
-    }
-    else {
-      /* No xoverlay to expose yet */
-      gdk_window_clear_area (win,
-          0, 0, widget->allocation.width, widget->allocation.height);
-    }
-  }
-  if (xoverlay != NULL)
-    gst_object_unref (xoverlay);
+static gboolean gcc_get_video_stream_info (GstPad *pad, GstPad *peer,
+    GstCameraCapturer * gcc);
 
-  return TRUE;
-}
+G_DEFINE_TYPE (GstCameraCapturer, gst_camera_capturer, G_TYPE_OBJECT);
 
 /***********************************
 *
@@ -357,35 +144,24 @@ gst_camera_capturer_init (GstCameraCapturer * object)
       G_TYPE_INSTANCE_GET_PRIVATE (object, GST_TYPE_CAMERA_CAPTURER,
       GstCameraCapturerPrivate);
 
-  GTK_WIDGET_SET_FLAGS (GTK_WIDGET (object), GTK_CAN_FOCUS);
-  GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (object), GTK_DOUBLE_BUFFERED);
-
   priv->output_height = 480;
   priv->output_width = 640;
   priv->audio_quality = 50;
   priv->video_quality = 50;
   priv->last_buffer = NULL;
-  priv->expand_logo = TRUE;
   priv->current_recording_start_ts = GST_CLOCK_TIME_NONE;
   priv->accum_recorded_ts = GST_CLOCK_TIME_NONE;
   priv->last_accum_recorded_ts = GST_CLOCK_TIME_NONE;
   priv->last_video_buf_ts = GST_CLOCK_TIME_NONE;
   priv->last_audio_buf_ts = GST_CLOCK_TIME_NONE;
   priv->is_recording = FALSE;
-  priv->recording_lock = g_mutex_new();
+  g_mutex_init (&priv->recording_lock);
 
   priv->video_encoder_type = VIDEO_ENCODER_VP8;
   priv->audio_encoder_type = AUDIO_ENCODER_VORBIS;
   priv->video_muxer_type = VIDEO_MUXER_WEBM;
   priv->source_type = CAPTURE_SOURCE_TYPE_SYSTEM;
   priv->source_element_name = SYSVIDEOSRC;
-
-  gtk_widget_add_events (GTK_WIDGET (object),
-      GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-      | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
-
-  g_signal_connect (GTK_WIDGET (object), "realize",
-      G_CALLBACK (gst_camera_capturer_realize_event), NULL);
 }
 
 void
@@ -424,13 +200,15 @@ gst_camera_capturer_finalize (GObject * object)
     gcc->priv->device_id = NULL;
   }
 
-  if (gcc->priv->logo_pixbuf) {
-    g_object_unref (gcc->priv->logo_pixbuf);
-    gcc->priv->logo_pixbuf = NULL;
+  if (gcc->priv->last_buffer != NULL) {
+    gst_buffer_unref (gcc->priv->last_buffer);
+    gcc->priv->last_buffer = NULL;
   }
 
-  if (gcc->priv->last_buffer != NULL)
-    gst_buffer_unref (gcc->priv->last_buffer);
+  if (gcc->priv->xoverlay != NULL) {
+    gst_object_unref (gcc->priv->xoverlay);
+    gcc->priv->xoverlay = NULL;
+  }
 
   if (gcc->priv->main_pipeline != NULL
       && GST_IS_ELEMENT (gcc->priv->main_pipeline)) {
@@ -439,164 +217,24 @@ gst_camera_capturer_finalize (GObject * object)
     gcc->priv->main_pipeline = NULL;
   }
 
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_camera_capturer_set_video_quality (GstCameraCapturer * gcc, gint quality)
-{
-  gcc->priv->video_quality = quality;
-  GST_INFO_OBJECT (gcc, "Changed video quality to: %d",
-      gcc->priv->video_quality);
-}
-
-static void
-gst_camera_capturer_set_audio_quality (GstCameraCapturer * gcc, gint quality)
-{
-
-  gcc->priv->audio_quality = quality;
-  GST_INFO_OBJECT (gcc, "Changed audio quality to: %d",
-      gcc->priv->audio_quality);
-}
-
-static void
-gst_camera_capturer_set_audio_enabled (GstCameraCapturer * gcc,
-    gboolean enabled)
-{
-  gcc->priv->audio_enabled = enabled;
-  GST_INFO_OBJECT (gcc, "Audio is %s", enabled ? "enabled": "disabled");
-}
-
-static void
-gst_camera_capturer_set_output_file (GstCameraCapturer * gcc,
-    const gchar * file)
-{
-  gcc->priv->output_file = g_strdup (file);
-  GST_INFO_OBJECT (gcc, "Changed output filename to: %s", file);
-}
-
-static void
-gst_camera_capturer_set_device_id (GstCameraCapturer * gcc,
-    const gchar * device_id)
-{
-  gcc->priv->device_id = g_strdup (device_id);
-  GST_INFO_OBJECT (gcc, "Changed device id/name to: %s", gcc->priv->device_id);
-}
-
-static void
-gst_camera_capturer_set_property (GObject * object, guint property_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstCameraCapturer *gcc;
+  g_mutex_clear (&gcc->priv->recording_lock);
 
-  gcc = GST_CAMERA_CAPTURER (object);
-
-  switch (property_id) {
-    case PROP_OUTPUT_HEIGHT:
-      gcc->priv->output_height = g_value_get_uint (value);
-      break;
-    case PROP_OUTPUT_WIDTH:
-      gcc->priv->output_width = g_value_get_uint (value);
-      break;
-    case PROP_VIDEO_QUALITY:
-      gst_camera_capturer_set_video_quality (gcc, g_value_get_uint (value));
-      break;
-    case PROP_AUDIO_QUALITY:
-      gst_camera_capturer_set_audio_quality (gcc, g_value_get_uint (value));
-      break;
-    case PROP_AUDIO_ENABLED:
-      gst_camera_capturer_set_audio_enabled (gcc, g_value_get_boolean (value));
-      break;
-    case PROP_OUTPUT_FILE:
-      gst_camera_capturer_set_output_file (gcc, g_value_get_string (value));
-      break;
-    case PROP_DEVICE_ID:
-      gst_camera_capturer_set_device_id (gcc, g_value_get_string (value));
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_camera_capturer_get_property (GObject * object, guint property_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstCameraCapturer *gcc;
-
-  gcc = GST_CAMERA_CAPTURER (object);
-
-  switch (property_id) {
-    case PROP_OUTPUT_HEIGHT:
-      g_value_set_uint (value, gcc->priv->output_height);
-      break;
-    case PROP_OUTPUT_WIDTH:
-      g_value_set_uint (value, gcc->priv->output_width);
-      break;
-    case PROP_AUDIO_QUALITY:
-      g_value_set_uint (value, gcc->priv->audio_quality);
-      break;
-    case PROP_VIDEO_QUALITY:
-      g_value_set_uint (value, gcc->priv->video_quality);
-      break;
-    case PROP_AUDIO_ENABLED:
-      g_value_set_boolean (value, gcc->priv->audio_enabled);
-      break;
-    case PROP_OUTPUT_FILE:
-      g_value_set_string (value, gcc->priv->output_file);
-      break;
-    case PROP_DEVICE_ID:
-      g_value_set_string (value, gcc->priv->device_id);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-  }
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
 gst_camera_capturer_class_init (GstCameraCapturerClass * klass)
 {
   GObjectClass *object_class;
-  GtkWidgetClass *widget_class;
 
   object_class = (GObjectClass *) klass;
-  widget_class = (GtkWidgetClass *) klass;
   parent_class = g_type_class_peek_parent (klass);
 
   g_type_class_add_private (object_class, sizeof (GstCameraCapturerPrivate));
 
-  /* GtkWidget */
-  widget_class->expose_event = gst_camera_capturer_expose_event;
-
   /* GObject */
-  object_class->set_property = gst_camera_capturer_set_property;
-  object_class->get_property = gst_camera_capturer_get_property;
   object_class->finalize = gst_camera_capturer_finalize;
 
-  /* Properties */
-  g_object_class_install_property (object_class, PROP_OUTPUT_HEIGHT,
-      g_param_spec_uint ("output_height", NULL,
-          NULL, 0, 5600, 576, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_OUTPUT_WIDTH,
-      g_param_spec_uint ("output_width", NULL,
-          NULL, 0, 5600, 720, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_VIDEO_QUALITY,
-      g_param_spec_uint ("video_quality", NULL,
-          NULL, 100, G_MAXUINT, 1000, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_AUDIO_QUALITY,
-      g_param_spec_uint ("audio_quality", NULL,
-          NULL, 12, G_MAXUINT, 128, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_AUDIO_ENABLED,
-      g_param_spec_boolean ("audio_enabled", NULL,
-          NULL, FALSE, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_OUTPUT_FILE,
-      g_param_spec_string ("output_file", NULL,
-          NULL, FALSE, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_DEVICE_ID,
-      g_param_spec_string ("device_id", NULL, NULL, FALSE, G_PARAM_READWRITE));
-
   /* Signals */
   gcc_signals[SIGNAL_ERROR] =
       g_signal_new ("error",
@@ -627,12 +265,6 @@ gst_camera_capturer_class_init (GstCameraCapturerClass * klass)
 *
 ************************************/
 
-void
-gst_camera_capturer_init_backend (int *argc, char ***argv)
-{
-  gst_init (argc, argv);
-}
-
 GQuark
 gst_camera_capturer_error_quark (void)
 {
@@ -644,23 +276,6 @@ gst_camera_capturer_error_quark (void)
   return q;
 }
 
-gboolean
-gst_camera_capture_videosrc_buffer_probe (GstPad * pad, GstBuffer * buf,
-    gpointer data)
-{
-  GstCameraCapturer *gcc = GST_CAMERA_CAPTURER (data);
-
-  if (gcc->priv->last_buffer) {
-    gst_buffer_unref (gcc->priv->last_buffer);
-    gcc->priv->last_buffer = NULL;
-  }
-
-  gst_buffer_ref (buf);
-  gcc->priv->last_buffer = buf;
-
-  return TRUE;
-}
-
 static void
 gst_camera_capturer_update_device_id (GstCameraCapturer *gcc)
 {
@@ -982,7 +597,7 @@ gst_camera_capturer_encoding_retimestamper (GstCameraCapturer *gcc,
   GstClockTime buf_ts, new_buf_ts, duration;
   GstBuffer *enc_buf;
 
-  g_mutex_lock(gcc->priv->recording_lock);
+  g_mutex_lock (&gcc->priv->recording_lock);
 
   if (!gcc->priv->is_recording) {
     /* Drop buffers if we are not recording */
@@ -1059,7 +674,7 @@ gst_camera_capturer_encoding_retimestamper (GstCameraCapturer *gcc,
 
 done:
   {
-    g_mutex_unlock(gcc->priv->recording_lock);
+    g_mutex_unlock (&gcc->priv->recording_lock);
     return TRUE;
   }
 }
@@ -1136,7 +751,6 @@ gst_camera_capturer_create_decoder_bin (GstCameraCapturer *gcc)
   v_prev_queue_pad = gst_element_get_static_pad(v_prev_queue, "src");
   gst_pad_add_buffer_probe(v_prev_queue_pad, (GCallback) gst_camera_capturer_video_encoding_probe, gcc);
   gst_object_unref(v_prev_queue_pad);
-
   if (gcc->priv->audio_enabled) {
     GstElement *a_queue, *a_prev_queue;
     GstPad *a_dec_pad, *a_queue_pad, *a_prev_queue_pad;
@@ -1241,10 +855,10 @@ gst_camera_capturer_link_preview (GstCameraCapturer *gcc)
 static gboolean
 cb_last_buffer (GstPad *pad, GstBuffer *buf, GstCameraCapturer *gcc){
   if (buf != NULL) {
-    if (gcc->priv->last_buffer != NULL)
-      gst_buffer_unref(buf);
-    gst_buffer_ref(buf);
-    gcc->priv->last_buffer = buf;
+    if (gcc->priv->last_buffer != NULL) {
+      gst_buffer_unref(gcc->priv->last_buffer);
+    }
+    gcc->priv->last_buffer =  gst_buffer_ref(buf);
   }
   return TRUE;
 }
@@ -1276,6 +890,8 @@ gst_camera_capturer_create_preview(GstCameraCapturer *gcc)
   g_signal_connect (v_decoder, "pad-added", G_CALLBACK (cb_new_prev_pad), video_bin);
 
   video_pad = gst_element_get_static_pad(video_bin, "sink");
+  g_signal_connect (video_pad, "notify::caps",
+      G_CALLBACK (gcc_get_video_stream_info), gcc);
   gst_pad_add_buffer_probe (video_pad, (GCallback) cb_last_buffer, gcc);
   gst_object_unref(video_pad);
 
@@ -1589,10 +1205,6 @@ gcc_bus_message_cb (GstBus * bus, GstMessage * message, gpointer data)
       /* we only care about playbin (pipeline) state changes */
       if (GST_MESSAGE_SRC (message) != GST_OBJECT (gcc->priv->main_pipeline))
         break;
-
-      if (old_state == GST_STATE_PAUSED && new_state == GST_STATE_PLAYING) {
-        gcc_get_video_stream_info (gcc);
-      }
     }
 
     case GST_MESSAGE_ELEMENT:
@@ -1676,24 +1288,21 @@ gcc_element_msg_sync (GstBus * bus, GstMessage * msg, gpointer data)
     g_return_if_fail (gcc->priv->window_handle != 0);
 
     g_object_set (GST_ELEMENT (gcc->priv->xoverlay), "force-aspect-ratio", TRUE, NULL);
-    gst_set_window_handle (gcc->priv->xoverlay, gcc->priv->window_handle);
-    gtk_widget_queue_draw (GTK_WIDGET(gcc));
+    lgm_set_window_handle (gcc->priv->xoverlay, gcc->priv->window_handle);
   }
 }
 
-static int
-gcc_get_video_stream_info (GstCameraCapturer * gcc)
+static gboolean
+gcc_get_video_stream_info (GstPad *pad, GstPad *peer, GstCameraCapturer * gcc)
 {
-  GstPad *sourcepad;
-  GstCaps *caps;
   GstStructure *s;
+  GstCaps *caps;
 
-  sourcepad = gst_element_get_pad (gcc->priv->decoder_bin, "video");
-  caps = gst_pad_get_negotiated_caps (sourcepad);
+  caps = gst_pad_get_negotiated_caps (pad);
 
   if (!(caps)) {
     GST_WARNING_OBJECT (gcc, "Could not get stream info");
-    return -1;
+    return FALSE;
   }
 
   /* Get the source caps */
@@ -1705,11 +1314,9 @@ gcc_get_video_stream_info (GstCameraCapturer * gcc)
             (s, "framerate", &gcc->priv->video_fps_n, &gcc->priv->video_fps_d)
             && gst_structure_get_int (s, "width", &gcc->priv->video_width)
             && gst_structure_get_int (s, "height", &gcc->priv->video_height)))
-      return -1;
-    /* Get the source PAR if available */
-    gcc->priv->movie_par = gst_structure_get_value (s, "pixel-aspect-ratio");
+      return FALSE;
   }
-  return 1;
+  return FALSE;
 }
 
 /*****************************************************
@@ -1769,6 +1376,13 @@ finish:
   }
 }
 
+
+/*******************************************
+ *
+ *         Public methods
+ *
+ * ****************************************/
+
 GList *
 gst_camera_capturer_enum_video_devices (const gchar *device)
 {
@@ -1781,12 +1395,6 @@ gst_camera_capturer_enum_audio_devices (const gchar *device)
   return gst_camera_capturer_enum_devices (device);
 }
 
-/*******************************************
- *
- *         Public methods
- *
- * ****************************************/
-
 void
 gst_camera_capturer_run (GstCameraCapturer * gcc)
 {
@@ -1805,6 +1413,10 @@ gst_camera_capturer_close (GstCameraCapturer * gcc)
 
   gst_element_set_state (gcc->priv->main_pipeline, GST_STATE_NULL);
   gst_element_get_state (gcc->priv->main_pipeline, NULL, NULL, -1);
+  if (gcc->priv->xoverlay != NULL) {
+    gst_object_unref (gcc->priv->xoverlay);
+    gcc->priv->xoverlay = NULL;
+  }
 }
 
 void
@@ -1814,13 +1426,13 @@ gst_camera_capturer_start (GstCameraCapturer * gcc)
   g_return_if_fail (GST_IS_CAMERA_CAPTURER (gcc));
 
   GST_INFO_OBJECT(gcc, "Started capture");
-  g_mutex_lock(gcc->priv->recording_lock);
+  g_mutex_lock (&gcc->priv->recording_lock);
   if (!gcc->priv->is_recording && gcc->priv->accum_recorded_ts == GST_CLOCK_TIME_NONE) {
     gcc->priv->accum_recorded_ts = 0;
     gcc->priv->is_recording = TRUE;
     gst_camera_capturer_link_encoder_bin (gcc);
   }
-  g_mutex_unlock(gcc->priv->recording_lock);
+  g_mutex_unlock (&gcc->priv->recording_lock);
 }
 
 void
@@ -1829,7 +1441,7 @@ gst_camera_capturer_toggle_pause (GstCameraCapturer * gcc)
   g_return_if_fail (gcc != NULL);
   g_return_if_fail (GST_IS_CAMERA_CAPTURER (gcc));
 
-  g_mutex_lock(gcc->priv->recording_lock);
+  g_mutex_lock (&gcc->priv->recording_lock);
   if (!gcc->priv->is_recording) {
     gcc->priv->current_recording_start_ts = GST_CLOCK_TIME_NONE;
     gcc->priv->is_recording = TRUE;
@@ -1837,64 +1449,11 @@ gst_camera_capturer_toggle_pause (GstCameraCapturer * gcc)
     gcc->priv->is_recording = FALSE;
     gcc->priv->video_synced = FALSE;
   }
-  g_mutex_unlock(gcc->priv->recording_lock);
+  g_mutex_unlock (&gcc->priv->recording_lock);
 
   GST_INFO_OBJECT(gcc, "Capture state changed to %s", gcc->priv->is_recording ? "recording": "paused");
 }
 
-void
-gst_camera_capturer_set_source (GstCameraCapturer * gcc, CaptureSourceType source,
-    const gchar *source_element_name)
-{
-  g_return_if_fail (gcc != NULL);
-  g_return_if_fail (GST_IS_CAMERA_CAPTURER (gcc));
-
-  gcc->priv->source_type = source;
-  gcc->priv->source_element_name = g_strdup (source_element_name);
-}
-
-void
-gst_camera_capturer_set_video_encoder (GstCameraCapturer * gcc, VideoEncoderType encoder)
-{
-  g_return_if_fail (gcc != NULL);
-  g_return_if_fail (GST_IS_CAMERA_CAPTURER (gcc));
-
-  gcc->priv->video_encoder_type = encoder;
-}
-
-void
-gst_camera_capturer_set_audio_encoder (GstCameraCapturer * gcc, AudioEncoderType encoder)
-{
-  g_return_if_fail (gcc != NULL);
-  g_return_if_fail (GST_IS_CAMERA_CAPTURER (gcc));
-
-  gcc->priv->audio_encoder_type = encoder;
-}
-
-void
-gst_camera_capturer_set_video_muxer (GstCameraCapturer * gcc, VideoMuxerType muxer)
-{
-  g_return_if_fail (gcc != NULL);
-  g_return_if_fail (GST_IS_CAMERA_CAPTURER (gcc));
-
-  gcc->priv->video_muxer_type = muxer;
-}
-
-gboolean
-gst_camera_capturer_can_get_frames (GstCameraCapturer * gcc, GError ** error)
-{
-  g_return_val_if_fail (gcc != NULL, FALSE);
-  g_return_val_if_fail (GST_IS_CAMERA_CAPTURER (gcc), FALSE);
-
-  /* check for video */
-  if (!gcc->priv->media_has_video) {
-    g_set_error_literal (error, GCC_ERROR, GST_ERROR_GENERIC,
-        "Media contains no supported video streams.");
-    return FALSE;
-  }
-  return TRUE;
-}
-
 static void
 destroy_pixbuf (guchar * pix, gpointer data)
 {
@@ -2025,25 +1584,47 @@ gst_camera_capturer_stop (GstCameraCapturer * gcc)
 #endif
 
   GST_INFO_OBJECT(gcc, "Closing capture");
-  g_mutex_lock(gcc->priv->recording_lock);
+  g_mutex_lock (&gcc->priv->recording_lock);
   gcc->priv->closing_recording = TRUE;
   gcc->priv->is_recording = FALSE;
-  g_mutex_unlock(gcc->priv->recording_lock);
+  g_mutex_unlock (&gcc->priv->recording_lock);
 
   gcc_encoder_send_event(gcc, gst_event_new_eos());
 }
 
+void
+gst_camera_capturer_configure (GstCameraCapturer *gcc,
+    const gchar * filename, CaptureSourceType source,
+    const gchar *source_element, const gchar *device_id,
+    VideoEncoderType video_encoder, AudioEncoderType audio_encoder,
+    VideoMuxerType muxer, guint video_bitrate, guint audio_bitrate,
+    guint record_audio, guint output_width, guint output_height,
+    guintptr window_handle)
+{
+  gcc->priv->output_file = g_strdup (filename);
+  gcc->priv->source_type = source;
+  gcc->priv->device_id = g_strdup (device_id);
+  gcc->priv->source_element_name = g_strdup (source_element);
+  gcc->priv->video_encoder_type = video_encoder;
+  gcc->priv->audio_encoder_type = audio_encoder;
+  gcc->priv->video_muxer_type = muxer;
+  gcc->priv->video_quality = video_bitrate;
+  gcc->priv->audio_quality = audio_bitrate;
+  gcc->priv->audio_enabled = record_audio;
+  gcc->priv->output_height = output_height;
+  gcc->priv->output_width = output_width;
+  gcc->priv->window_handle = window_handle;
+}
+
 GstCameraCapturer *
-gst_camera_capturer_new (gchar * filename, GError ** err)
+gst_camera_capturer_new (GError ** err)
 {
   GstCameraCapturer *gcc = NULL;
 
-#ifndef GST_DISABLE_GST_INFO
   if (_cesarplayer_gst_debug_cat == NULL) {
     GST_DEBUG_CATEGORY_INIT (_cesarplayer_gst_debug_cat, "longomatch", 0,
         "LongoMatch GStreamer Backend");
   }
-#endif
 
   gcc = g_object_new (GST_TYPE_CAMERA_CAPTURER, NULL);
 
diff --git a/libcesarplayer/gst-camera-capturer.h b/libcesarplayer/gst-camera-capturer.h
index 704ca83..2b0e233 100644
--- a/libcesarplayer/gst-camera-capturer.h
+++ b/libcesarplayer/gst-camera-capturer.h
@@ -50,39 +50,55 @@ typedef struct GstCameraCapturerPrivate GstCameraCapturerPrivate;
 
 struct _GstCameraCapturerClass
 {
-  GtkDrawingAreaClass parent_class;
+  GObjectClass parent_class;
 
   void (*eos) (GstCameraCapturer * gcc);
   void (*error) (GstCameraCapturer * gcc, const char *message);
   void (*device_change) (GstCameraCapturer * gcc, gint *device_change);
-  void (*invalidsource) (GstCameraCapturer * gcc);
 };
 
 struct _GstCameraCapturer
 {
-  GtkDrawingArea parent;
+  GObject parent;
   GstCameraCapturerPrivate *priv;
 };
 
 EXPORT GType gst_camera_capturer_get_type (void) G_GNUC_CONST;
 
-EXPORT void gst_camera_capturer_init_backend (int *argc, char ***argv);
-EXPORT GstCameraCapturer *gst_camera_capturer_new (gchar *filename, GError ** err);
-EXPORT void gst_camera_capturer_run (GstCameraCapturer * gcc);
-EXPORT void gst_camera_capturer_close (GstCameraCapturer * gcc);
-EXPORT void gst_camera_capturer_start (GstCameraCapturer * gcc);
-EXPORT void gst_camera_capturer_toggle_pause (GstCameraCapturer * gcc);
-EXPORT void gst_camera_capturer_stop (GstCameraCapturer * gcc);
-EXPORT void gst_camera_capturer_set_source (GstCameraCapturer * gcc, CaptureSourceType source, const gchar 
*source_element);
-EXPORT void gst_camera_capturer_set_video_encoder (GstCameraCapturer * gcc, VideoEncoderType encoder);
-EXPORT void gst_camera_capturer_set_audio_encoder (GstCameraCapturer * gcc, AudioEncoderType encoder);
-EXPORT void gst_camera_capturer_set_video_muxer (GstCameraCapturer * gcc, VideoMuxerType muxer);
-EXPORT GList *gst_camera_capturer_enum_audio_devices (const gchar *device);
-EXPORT GList *gst_camera_capturer_enum_video_devices (const gchar *device);
-EXPORT GdkPixbuf *gst_camera_capturer_get_current_frame (GstCameraCapturer
-    * gcc);
-EXPORT void gst_camera_capturer_unref_pixbuf (GdkPixbuf * pixbuf);
-EXPORT void gst_camera_capturer_finalize (GObject * object);
+EXPORT GstCameraCapturer *gst_camera_capturer_new         (GError ** err);
+
+EXPORT void gst_camera_capturer_configure                (GstCameraCapturer *gcc,
+                                                          const gchar *output_file,
+                                                          CaptureSourceType source,
+                                                          const gchar *source_element,
+                                                          const gchar *device_id,
+                                                          VideoEncoderType video_encoder,
+                                                          AudioEncoderType audio_encoder,
+                                                          VideoMuxerType muxer,
+                                                          guint video_bitrate,
+                                                          guint audio_bitrate,
+                                                          guint record_audio,
+                                                          guint output_width,
+                                                          guint output_height,
+                                                          guintptr window_handle);
+
+EXPORT void gst_camera_capturer_run                       (GstCameraCapturer * gcc);
+
+EXPORT void gst_camera_capturer_close                     (GstCameraCapturer * gcc);
+
+EXPORT void gst_camera_capturer_start                     (GstCameraCapturer * gcc);
+
+EXPORT void gst_camera_capturer_toggle_pause              (GstCameraCapturer * gcc);
+
+EXPORT void gst_camera_capturer_stop                      (GstCameraCapturer * gcc);
+
+EXPORT GList *gst_camera_capturer_enum_audio_devices      (const gchar *device);
+
+EXPORT GList *gst_camera_capturer_enum_video_devices      (const gchar *device);
+
+EXPORT GdkPixbuf *gst_camera_capturer_get_current_frame   (GstCameraCapturer * gcc);
+
+EXPORT void gst_camera_capturer_unref_pixbuf               (GdkPixbuf * pixbuf);
 
 G_END_DECLS
 #endif /* _GST_CAMERA_CAPTURER_H_ */
diff --git a/libcesarplayer/lgm-video-player.c b/libcesarplayer/lgm-video-player.c
new file mode 100644
index 0000000..df1915d
--- /dev/null
+++ b/libcesarplayer/lgm-video-player.c
@@ -0,0 +1,1127 @@
+/* 
+ * Copyright (C) 2014  Andoni Morales Alastruey <ylatuya gmail com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#include <gst/gst.h>
+#include <gst/interfaces/xoverlay.h>
+
+/* gtk+/gnome */
+#include <gdk/gdk.h>
+#if defined (GDK_WINDOWING_X11)
+#include <gdk/gdkx.h>
+#elif defined (GDK_WINDOWING_WIN32)
+#include <gdk/gdkwin32.h>
+#elif defined (GDK_WINDOWING_QUARTZ)
+#include <gdk/gdkquartz.h>
+#endif
+#include <gtk/gtk.h>
+
+#include <gio/gio.h>
+#include <glib/gi18n.h>
+
+#include "lgm-video-player.h"
+#include "baconvideowidget-marshal.h"
+#include "common.h"
+#include "gstscreenshot.h"
+#include "video-utils.h"
+
+#define LGM_PLAY_TIMEOUT 20
+#define LGM_PAUSE_TIMEOUT 100
+
+#define is_error(e, d, c) \
+  (e->domain == GST_##d##_ERROR && \
+   e->code == GST_##d##_ERROR_##c)
+
+GST_DEBUG_CATEGORY (_lgm_debug_cat);
+#define GST_CAT_DEFAULT _lgm_debug_cat
+
+G_DEFINE_TYPE (LgmVideoPlayer, lgm_video_player, GST_TYPE_ELEMENT)
+
+/* Signals */
+enum
+{
+  SIGNAL_ERROR,
+  SIGNAL_EOS,
+  SIGNAL_TICK,
+  SIGNAL_STATE_CHANGE,
+  SIGNAL_READY_TO_SEEK,
+  LAST_SIGNAL
+};
+
+typedef enum {
+  GST_PLAY_FLAG_VIDEO         = (1 << 0),
+  GST_PLAY_FLAG_AUDIO         = (1 << 1),
+  GST_PLAY_FLAG_TEXT          = (1 << 2),
+  GST_PLAY_FLAG_VIS           = (1 << 3),
+  GST_PLAY_FLAG_SOFT_VOLUME   = (1 << 4),
+  GST_PLAY_FLAG_NATIVE_AUDIO  = (1 << 5),
+  GST_PLAY_FLAG_NATIVE_VIDEO  = (1 << 6),
+  GST_PLAY_FLAG_DOWNLOAD      = (1 << 7),
+  GST_PLAY_FLAG_BUFFERING     = (1 << 8),
+  GST_PLAY_FLAG_DEINTERLACE   = (1 << 9),
+  GST_PLAY_FLAG_SOFT_COLORBALANCE = (1 << 10)
+} GstPlayFlags;
+
+
+struct LgmVideoPlayerPrivate
+{
+  gchar *uri;
+  LgmUseType use_type;
+
+  GstElement *play;
+  GstElement *video_sink;
+  GstXOverlay *xoverlay;
+  guintptr window_handle;
+  GMutex overlay_lock;
+
+  guint update_id;
+
+  gint64 stream_length;
+  gint64 current_time;
+  gdouble current_position;
+  gdouble rate;
+
+  GstBus *bus;
+  gulong sig_bus_async;
+  gulong sig_bus_sync;
+
+  gint video_fps_d;
+  gint video_fps_n;
+
+  GstState target_state;
+};
+
+static void lgm_video_player_finalize (GObject * object);
+static gboolean lgm_query_timeout (LgmVideoPlayer * lvp);
+
+static GError *lgm_error_from_gst_error (LgmVideoPlayer * lvp,
+    GstMessage * m);
+
+static GstElementClass *parent_class = NULL;
+
+static int lgm_signals[LAST_SIGNAL] = { 0 };
+
+static void
+lgm_error_msg (LgmVideoPlayer * lvp, GstMessage * msg)
+{
+  GError *err = NULL;
+  gchar *dbg = NULL;
+
+  gst_message_parse_error (msg, &err, &dbg);
+  if (err) {
+    GST_ERROR ("message = %s", GST_STR_NULL (err->message));
+    GST_ERROR ("domain  = %d (%s)", err->domain,
+        GST_STR_NULL (g_quark_to_string (err->domain)));
+    GST_ERROR ("code    = %d", err->code);
+    GST_ERROR ("debug   = %s", GST_STR_NULL (dbg));
+    GST_ERROR ("source  = %" GST_PTR_FORMAT, msg->src);
+    GST_ERROR ("uri     = %s", GST_STR_NULL (lvp->priv->uri));
+
+    g_message ("Error: %s\n%s\n", GST_STR_NULL (err->message),
+        GST_STR_NULL (dbg));
+
+    g_error_free (err);
+  }
+  g_free (dbg);
+}
+
+static void
+lgm_reconfigure_tick_timeout (LgmVideoPlayer * lvp, guint msecs)
+{
+  if (lvp->priv->update_id != 0) {
+    g_source_remove (lvp->priv->update_id);
+    lvp->priv->update_id = 0;
+  }
+  if (msecs > 0) {
+    lvp->priv->update_id =
+        g_timeout_add (msecs, (GSourceFunc) lgm_query_timeout, lvp);
+  }
+}
+
+static void
+lgm_element_msg_sync_cb (GstBus * bus, GstMessage * msg, gpointer data)
+{
+  LgmVideoPlayer *lvp = LGM_VIDEO_PLAYER (data);
+
+  g_assert (msg->type == GST_MESSAGE_ELEMENT);
+  if (msg->structure == NULL)
+    return;
+
+  if (gst_structure_has_name (msg->structure, "prepare-xwindow-id")) {
+    GstObject *sender = GST_MESSAGE_SRC (msg);
+
+    if (sender && GST_IS_X_OVERLAY (sender)) {
+      g_mutex_lock (&lvp->priv->overlay_lock);
+      if (lvp->priv->xoverlay != NULL) {
+        gst_object_unref (lvp->priv->xoverlay);
+      }
+      lvp->priv->xoverlay = gst_object_ref (GST_X_OVERLAY (sender));
+      g_object_set (GST_ELEMENT (lvp->priv->xoverlay), "force-aspect-ratio",
+          TRUE, NULL);
+      lgm_set_window_handle(lvp->priv->xoverlay, lvp->priv->window_handle);
+      g_mutex_unlock (&lvp->priv->overlay_lock);
+    }
+  }
+}
+
+static void
+lgm_bus_message_cb (GstBus * bus, GstMessage * message, gpointer data)
+{
+  LgmVideoPlayer *lvp = (LgmVideoPlayer *) data;
+  GstMessageType msg_type;
+
+  g_return_if_fail (lvp != NULL);
+  g_return_if_fail (LGM_IS_VIDEO_WIDGET (lvp));
+
+  msg_type = GST_MESSAGE_TYPE (message);
+
+  switch (msg_type) {
+    case GST_MESSAGE_ERROR:
+    {
+      GError *error;
+      lgm_error_msg (lvp, message);
+
+      error = lgm_error_from_gst_error (lvp, message);
+
+      lvp->priv->target_state = GST_STATE_NULL;
+      if (lvp->priv->play)
+        gst_element_set_state (lvp->priv->play, GST_STATE_NULL);
+
+      g_signal_emit (lvp, lgm_signals[SIGNAL_ERROR], 0,
+        error->message, TRUE, FALSE);
+      g_error_free (error);
+      break;
+    }
+    case GST_MESSAGE_WARNING:
+    {
+      GST_WARNING ("Warning message: %" GST_PTR_FORMAT, message);
+      break;
+    }
+    case GST_MESSAGE_EOS:
+      GST_DEBUG ("EOS message");
+      lgm_query_timeout (lvp);
+      g_signal_emit (lvp, lgm_signals[SIGNAL_EOS], 0, FALSE);
+      break;
+    case GST_MESSAGE_STATE_CHANGED:
+    {
+      GstState old_state, new_state;
+      gchar *src_name;
+
+      gst_message_parse_state_changed (message, &old_state, &new_state, NULL);
+
+      if (old_state == new_state)
+        break;
+
+      if (GST_MESSAGE_SRC (message) != GST_OBJECT (lvp->priv->play))
+        break;
+
+      src_name = gst_object_get_name (message->src);
+      g_free (src_name);
+
+      if (new_state <= GST_STATE_PAUSED) {
+        lgm_query_timeout (lvp);
+        lgm_reconfigure_tick_timeout (lvp, 0);
+        g_signal_emit (lvp, lgm_signals[SIGNAL_STATE_CHANGE], 0, FALSE);
+      } else if (new_state == GST_STATE_PAUSED) {
+        lgm_reconfigure_tick_timeout (lvp, LGM_PAUSE_TIMEOUT);
+        g_signal_emit (lvp, lgm_signals[SIGNAL_STATE_CHANGE], 0, FALSE);
+      } else if (new_state > GST_STATE_PAUSED) {
+        lgm_reconfigure_tick_timeout (lvp, LGM_PLAY_TIMEOUT);
+        g_signal_emit (lvp, lgm_signals[SIGNAL_STATE_CHANGE], 0, TRUE);
+      }
+      if (old_state == GST_STATE_READY && new_state == GST_STATE_PAUSED) {
+        lvp->priv->stream_length = 0;
+        g_signal_emit (lvp, lgm_signals[SIGNAL_READY_TO_SEEK], 0, FALSE);
+      }
+      break;
+    }
+
+    default:
+      GST_LOG ("Unhandled message: %" GST_PTR_FORMAT, message);
+      break;
+  }
+}
+
+static void
+got_time_tick (GstElement * play, gint64 time_nanos, LgmVideoPlayer * lvp)
+{
+  g_return_if_fail (lvp != NULL);
+  g_return_if_fail (LGM_IS_VIDEO_WIDGET (lvp));
+
+  lvp->priv->current_time = time_nanos;
+
+  if (lvp->priv->stream_length == 0) {
+    lvp->priv->current_position = 0;
+  } else {
+    lvp->priv->current_position =
+        (gdouble) lvp->priv->current_time / lvp->priv->stream_length;
+  }
+
+  g_signal_emit (lvp, lgm_signals[SIGNAL_TICK], 0,
+      lvp->priv->current_time, lvp->priv->stream_length,
+      lvp->priv->current_position);
+}
+
+static gboolean
+lgm_query_timeout (LgmVideoPlayer * lvp)
+{
+  GstFormat fmt = GST_FORMAT_TIME;
+  gint64 pos = -1, len = -1;
+
+  if (gst_element_query_duration (lvp->priv->play, &fmt, &len)) {
+    if (len != -1 && fmt == GST_FORMAT_TIME) {
+      lvp->priv->stream_length = len;
+    }
+  } else {
+    GST_INFO ("could not get duration");
+  }
+
+  if (gst_element_query_position (lvp->priv->play, &fmt, &pos)) {
+    if (pos != -1 && fmt == GST_FORMAT_TIME) {
+      got_time_tick (GST_ELEMENT (lvp->priv->play), pos, lvp);
+    }
+  } else {
+    GST_INFO ("could not get position");
+  }
+
+  return TRUE;
+}
+
+static void
+lgm_parse_stream_caps (GstPad *pad, GstPad *peer,
+    LgmVideoPlayer *lvp)
+{
+  GstCaps *caps;
+  GstStructure *s;
+
+  caps = gst_pad_get_negotiated_caps (pad);
+  if (caps == NULL || gst_caps_is_empty (caps)) {
+    return;
+  }
+
+  s = gst_caps_get_structure (caps, 0);
+  if (gst_structure_has_field (s, "framerate")) {
+    gst_structure_get_fraction (s, "framerate",
+        &lvp->priv->video_fps_n, &lvp->priv->video_fps_d);
+  }
+}
+
+/* ============================================================= */
+/*                                                               */
+/*                       Public Methods                          */
+/*                                                               */
+/* ============================================================= */
+
+
+/* =========================================== */
+/*                                             */
+/*               Play/Pause, Stop              */
+/*                                             */
+/* =========================================== */
+
+static GError *
+lgm_error_from_gst_error (LgmVideoPlayer * lvp, GstMessage * err_msg)
+{
+  const gchar *src_typename;
+  GError *ret = NULL;
+  GError *e = NULL;
+
+  GST_LOG ("resolving error message %" GST_PTR_FORMAT, err_msg);
+
+  src_typename = (err_msg->src) ? G_OBJECT_TYPE_NAME (err_msg->src) : NULL;
+
+  gst_message_parse_error (err_msg, &e, NULL);
+
+  if (is_error (e, RESOURCE, NOT_FOUND) || is_error (e, RESOURCE, OPEN_READ)) {
+      if (e->code == GST_RESOURCE_ERROR_NOT_FOUND) {
+        ret = g_error_new_literal (LGM_ERROR, GST_ERROR_FILE_NOT_FOUND,
+            _("Location not found."));
+      } else {
+        ret = g_error_new_literal (LGM_ERROR, GST_ERROR_FILE_PERMISSION,
+            _("Could not open location; "
+                "you might not have permission to open the file."));
+      }
+  } else if (e->domain == GST_RESOURCE_ERROR) {
+    ret = g_error_new_literal (LGM_ERROR, GST_ERROR_FILE_GENERIC, e->message);
+  } else if (is_error (e, CORE, MISSING_PLUGIN) ||
+      is_error (e, STREAM, CODEC_NOT_FOUND)) {
+    gchar *msg = "The playback of this movie requires a plugin which is not installed.";
+    ret = g_error_new_literal (LGM_ERROR, GST_ERROR_CODEC_NOT_HANDLED, msg);
+  } else if (is_error (e, STREAM, WRONG_TYPE) ||
+      is_error (e, STREAM, NOT_IMPLEMENTED)) {
+    if (src_typename) {
+      ret = g_error_new (LGM_ERROR, GST_ERROR_CODEC_NOT_HANDLED, "%s: %s",
+          src_typename, e->message);
+    } else {
+      ret = g_error_new_literal (LGM_ERROR, GST_ERROR_CODEC_NOT_HANDLED,
+          e->message);
+    }
+  } else {
+    /* generic error, no code; take message */
+    ret = g_error_new_literal (LGM_ERROR, GST_ERROR_GENERIC, e->message);
+  }
+  g_error_free (e);
+
+  return ret;
+}
+
+
+static gboolean
+poll_for_state_change_full (LgmVideoPlayer * lvp, GstElement * element,
+    GstState state, GstMessage ** err_msg, gint64 timeout)
+{
+  GstBus *bus;
+  GstMessageType events;
+
+  bus = gst_element_get_bus (element);
+  events = GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_EOS;
+
+  while (TRUE) {
+    GstMessage *message;
+    GstElement *src;
+
+    message = gst_bus_poll (bus, events, timeout);
+
+    if (!message)
+      goto timed_out;
+
+    src = (GstElement *) GST_MESSAGE_SRC (message);
+
+    switch (GST_MESSAGE_TYPE (message)) {
+      case GST_MESSAGE_STATE_CHANGED:
+      {
+        GstState old, new, pending;
+
+        if (src == element) {
+          gst_message_parse_state_changed (message, &old, &new, &pending);
+          if (new == state) {
+            gst_message_unref (message);
+            goto success;
+          }
+        }
+        break;
+      }
+      case GST_MESSAGE_ERROR:
+      {
+        lgm_error_msg (lvp, message);
+        *err_msg = message;
+        message = NULL;
+        goto error;
+        break;
+      }
+      case GST_MESSAGE_EOS:
+      {
+        GError *e = NULL;
+
+        gst_message_unref (message);
+        e = g_error_new_literal (LGM_ERROR, GST_ERROR_FILE_GENERIC,
+            _("Media file could not be played."));
+        *err_msg =
+            gst_message_new_error (GST_OBJECT (lvp->priv->play), e, NULL);
+        g_error_free (e);
+        goto error;
+        break;
+      }
+      default:
+        g_assert_not_reached ();
+        break;
+    }
+
+    gst_message_unref (message);
+  }
+
+  g_assert_not_reached ();
+
+success:
+  GST_DEBUG ("state change to %s succeeded",
+      gst_element_state_get_name (state));
+  return TRUE;
+
+timed_out:
+  GST_DEBUG ("state change to %s timed out, returning success and handling "
+      "errors asynchronously", gst_element_state_get_name (state));
+  return TRUE;
+
+error:
+  GST_DEBUG ("error while waiting for state change to %s: %" GST_PTR_FORMAT,
+      gst_element_state_get_name (state), *err_msg);
+  return FALSE;
+}
+
+gboolean
+lgm_video_player_open (LgmVideoPlayer * lvp,
+    const gchar * uri, GError ** error)
+{
+  GstMessage *err_msg = NULL;
+  gboolean ret;
+
+  g_return_val_if_fail (lvp != NULL, FALSE);
+  g_return_val_if_fail (uri != NULL, FALSE);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), FALSE);
+  g_return_val_if_fail (lvp->priv->play != NULL, FALSE);
+
+  /* So we aren't closed yet... */
+  if (lvp->priv->uri) {
+    lgm_video_player_close (lvp);
+  }
+
+  GST_DEBUG ("uri = %s", GST_STR_NULL (uri));
+
+  lvp->priv->uri = lgm_filename_to_uri (uri);
+  g_object_set (lvp->priv->play, "uri", lvp->priv->uri, NULL);
+
+  lvp->priv->stream_length = 0;
+  lvp->priv->rate = 1.0;
+  lvp->priv->target_state = GST_STATE_PAUSED;
+
+  gst_element_set_state (lvp->priv->play, GST_STATE_PAUSED);
+
+  if (lvp->priv->use_type == LGM_USE_TYPE_VIDEO) {
+    ret = TRUE;
+  } else {
+    /* used as thumbnailer, wait for state change to finish. */
+    GST_INFO ("waiting for state changed to PAUSED to complete");
+    ret = poll_for_state_change_full (lvp, lvp->priv->play,
+        GST_STATE_PAUSED, &err_msg, -1);
+    lgm_video_player_get_stream_length (lvp);
+    GST_INFO ("stream length = %u", lvp->priv->stream_length);
+  }
+
+  if (!ret) {
+    GST_INFO ("Error on open: %" GST_PTR_FORMAT, err_msg);
+    lgm_video_player_close (lvp);
+    g_free (lvp->priv->uri);
+    lvp->priv->uri = NULL;
+  }
+
+  if (err_msg != NULL) {
+    if (error) {
+      *error = lgm_error_from_gst_error (lvp, err_msg);
+    } else {
+      GST_WARNING ("Got error, but caller is not collecting error details!");
+    }
+    gst_message_unref (err_msg);
+  }
+  return ret;
+}
+
+gboolean
+lgm_video_player_play (LgmVideoPlayer * lvp)
+{
+
+  GstState cur_state;
+
+  g_return_val_if_fail (lvp != NULL, FALSE);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), FALSE);
+  g_return_val_if_fail (GST_IS_ELEMENT (lvp->priv->play), FALSE);
+  g_return_val_if_fail (lvp->priv->uri != NULL, FALSE);
+
+  lvp->priv->target_state = GST_STATE_PLAYING;
+
+  if (lvp->priv->use_type == LGM_USE_TYPE_CAPTURE) {
+    return TRUE;
+  }
+
+  gst_element_get_state (lvp->priv->play, &cur_state, NULL, 0);
+  gst_element_set_state (lvp->priv->play, GST_STATE_PLAYING);
+
+  return TRUE;
+}
+
+gboolean
+lgm_video_player_seek_time (LgmVideoPlayer * lvp, gint64 time,
+    gboolean accurate)
+{
+  guint32 flags;
+
+  g_return_val_if_fail (lvp != NULL, FALSE);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), FALSE);
+  g_return_val_if_fail (GST_IS_ELEMENT (lvp->priv->play), FALSE);
+
+  GST_DEBUG ("Seeking to %" GST_TIME_FORMAT, GST_TIME_ARGS (time));
+
+  flags = GST_SEEK_FLAG_FLUSH;
+  if (accurate) {
+    flags |= GST_SEEK_FLAG_ACCURATE;
+  } else {
+    flags |= GST_SEEK_FLAG_KEY_UNIT;
+  }
+
+  got_time_tick (lvp->priv->play, time, lvp);
+  gst_element_seek (lvp->priv->play, lvp->priv->rate,
+      GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, time,
+      GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+  return TRUE;
+}
+
+gboolean
+lgm_video_player_set_rate (LgmVideoPlayer * lvp, gdouble rate)
+{
+  guint64 pos;
+
+  g_return_val_if_fail (lvp != NULL, FALSE);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), FALSE);
+  g_return_val_if_fail (GST_IS_ELEMENT (lvp->priv->play), FALSE);
+
+  pos = lgm_video_player_get_current_time (lvp);
+  if (pos == 0)
+    return FALSE;
+
+  GST_DEBUG ("Setting rate to %f", rate);
+  lvp->priv->rate = rate;
+  lgm_video_player_seek_time (lvp, pos, TRUE);
+
+  return TRUE;
+}
+
+gboolean
+lgm_video_player_seek_to_next_frame (LgmVideoPlayer * lvp)
+{
+  gint64 pos = -1;
+  gboolean ret;
+
+  g_return_val_if_fail (lvp != NULL, FALSE);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), FALSE);
+  g_return_val_if_fail (GST_IS_ELEMENT (lvp->priv->play), FALSE);
+
+  GST_DEBUG ("Seeking to next frame");
+
+  pos = lgm_video_player_get_current_time (lvp);
+  if (pos == 0)
+    return FALSE;
+
+  gst_element_send_event (lvp->priv->video_sink,
+      gst_event_new_step (GST_FORMAT_BUFFERS, 1, 1.0, TRUE, FALSE));
+
+  pos = lgm_video_player_get_current_time (lvp);
+  got_time_tick (GST_ELEMENT (lvp->priv->play), pos, lvp);
+  lgm_video_player_expose (lvp);
+
+  return ret;
+}
+
+gboolean
+lgm_video_player_seek_to_previous_frame (LgmVideoPlayer * lvp)
+{
+  gint fps;
+  gint64 pos;
+  gint64 final_pos;
+  gboolean ret;
+
+  g_return_val_if_fail (lvp != NULL, FALSE);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), FALSE);
+  g_return_val_if_fail (GST_IS_ELEMENT (lvp->priv->play), FALSE);
+
+  GST_DEBUG ("Seeking to previous frame");
+  //Round framerate to the nearest integer
+  fps = (lvp->priv->video_fps_n + lvp->priv->video_fps_d / 2) /
+      lvp->priv->video_fps_d;
+  pos = lgm_video_player_get_current_time (lvp);
+  final_pos = pos - 1 * GST_SECOND / fps;
+
+  if (pos == 0)
+    return FALSE;
+
+  if (lgm_video_player_is_playing (lvp))
+    lgm_video_player_pause (lvp);
+
+  lgm_video_player_seek_time (lvp, final_pos, TRUE);
+  got_time_tick (GST_ELEMENT (lvp->priv->play), pos, lvp);
+  lgm_video_player_expose (lvp);
+
+  return ret;
+}
+
+static void
+lgm_stop_play_pipeline (LgmVideoPlayer * lvp)
+{
+  GstState cur_state;
+
+  gst_element_get_state (lvp->priv->play, &cur_state, NULL, 0);
+  if (cur_state > GST_STATE_READY) {
+    GstMessage *msg;
+    GstBus *bus;
+
+    GST_INFO ("stopping");
+    gst_element_set_state (lvp->priv->play, GST_STATE_READY);
+
+    /* process all remaining state-change messages so everything gets
+     * cleaned up properly (before the state change to NULL flushes them) */
+    GST_INFO ("processing pending state-change messages");
+    bus = gst_element_get_bus (lvp->priv->play);
+    while ((msg = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, 0))) {
+      gst_bus_async_signal_func (bus, msg, NULL);
+      gst_message_unref (msg);
+    }
+    gst_object_unref (bus);
+  }
+
+  gst_element_set_state (lvp->priv->play, GST_STATE_NULL);
+  lvp->priv->target_state = GST_STATE_NULL;
+}
+
+void
+lgm_video_player_stop (LgmVideoPlayer * lvp)
+{
+  g_return_if_fail (lvp != NULL);
+  g_return_if_fail (LGM_IS_VIDEO_WIDGET (lvp));
+  g_return_if_fail (GST_IS_ELEMENT (lvp->priv->play));
+
+  gst_element_set_state (lvp->priv->play, GST_STATE_NULL);
+  lvp->priv->target_state = GST_STATE_NULL;
+
+  got_time_tick (GST_ELEMENT (lvp->priv->play), 0, lvp);
+}
+
+void
+lgm_video_player_close (LgmVideoPlayer * lvp)
+{
+  g_return_if_fail (lvp != NULL);
+  g_return_if_fail (LGM_IS_VIDEO_WIDGET (lvp));
+  g_return_if_fail (GST_IS_ELEMENT (lvp->priv->play));
+
+  GST_LOG ("Closing");
+  lgm_stop_play_pipeline (lvp);
+
+  if (lvp->priv->uri != NULL) {
+    g_free (lvp->priv->uri);
+    lvp->priv->uri = NULL;
+  }
+
+  if (lvp->priv->xoverlay != NULL) {
+    gst_object_unref (lvp->priv->xoverlay);
+    lvp->priv->xoverlay = NULL;
+  }
+
+  got_time_tick (GST_ELEMENT (lvp->priv->play), 0, lvp);
+}
+
+void
+lgm_video_player_pause (LgmVideoPlayer * lvp)
+{
+  g_return_if_fail (lvp != NULL);
+  g_return_if_fail (LGM_IS_VIDEO_WIDGET (lvp));
+  g_return_if_fail (GST_IS_ELEMENT (lvp->priv->play));
+  g_return_if_fail (lvp->priv->uri != NULL);
+
+  gst_element_set_state (lvp->priv->play, GST_STATE_PAUSED);
+  lvp->priv->target_state = GST_STATE_PAUSED;
+}
+
+void
+lgm_video_player_set_volume (LgmVideoPlayer * lvp, double volume)
+{
+  g_return_if_fail (LGM_IS_VIDEO_WIDGET (lvp));
+  g_return_if_fail (GST_IS_ELEMENT (lvp->priv->play));
+
+  volume = CLAMP (volume, 0.0, 1.0);
+  g_object_set (lvp->priv->play, "volume", (gdouble) volume, NULL);
+}
+
+gdouble
+lgm_video_player_get_volume (LgmVideoPlayer * lvp)
+{
+  gdouble vol;
+
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), 0.0);
+  g_return_val_if_fail (GST_IS_ELEMENT (lvp->priv->play), 0.0);
+
+  g_object_get (G_OBJECT (lvp->priv->play), "volume", &vol, NULL);
+
+  return vol;
+}
+
+gint64
+lgm_video_player_get_current_time (LgmVideoPlayer * lvp)
+{
+  GstFormat fmt;
+  gint64 pos;
+
+  g_return_val_if_fail (lvp != NULL, -1);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), -1);
+
+  fmt = GST_FORMAT_TIME;
+  pos = -1;
+
+  gst_element_query_position (lvp->priv->play, &fmt, &pos);
+
+  return pos != -1 ? pos : lvp->priv->current_time;
+}
+
+gint64
+lgm_video_player_get_stream_length (LgmVideoPlayer * lvp)
+{
+  g_return_val_if_fail (lvp != NULL, -1);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), -1);
+
+  if (lvp->priv->stream_length == 0 && lvp->priv->play != NULL) {
+    GstFormat fmt = GST_FORMAT_TIME;
+    gint64 len = -1;
+
+    if (gst_element_query_duration (lvp->priv->play, &fmt, &len)
+        && len != -1) {
+      lvp->priv->stream_length = len;
+    }
+  }
+
+  return lvp->priv->stream_length;
+}
+
+gboolean
+lgm_video_player_is_playing (LgmVideoPlayer * lvp)
+{
+  gboolean ret;
+
+  g_return_val_if_fail (lvp != NULL, FALSE);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), FALSE);
+  g_return_val_if_fail (GST_IS_ELEMENT (lvp->priv->play), FALSE);
+
+  ret = (lvp->priv->target_state == GST_STATE_PLAYING);
+  GST_LOG ("%splaying", (ret) ? "" : "not ");
+
+  return ret;
+}
+
+void
+lgm_video_player_expose (LgmVideoPlayer * lvp)
+{
+  g_return_if_fail (lvp != NULL);
+
+  g_mutex_lock (&lvp->priv->overlay_lock);
+  if (lvp->priv->xoverlay != NULL &&
+      GST_IS_X_OVERLAY (lvp->priv->xoverlay)) {
+    gst_x_overlay_expose (lvp->priv->xoverlay);
+  }
+  g_mutex_unlock (&lvp->priv->overlay_lock);
+}
+
+static void
+destroy_pixbuf (guchar * pix, gpointer data)
+{
+  gst_buffer_unref (GST_BUFFER (data));
+}
+
+void
+lgm_video_player_unref_pixbuf (GdkPixbuf * pixbuf)
+{
+  g_object_unref (pixbuf);
+}
+
+GdkPixbuf *
+lgm_video_player_get_current_frame (LgmVideoPlayer * lvp)
+{
+  GstStructure *s;
+  GstBuffer *buf = NULL;
+  GdkPixbuf *pixbuf;
+  GstCaps *to_caps;
+  gint outwidth = 0;
+  gint outheight = 0;
+
+  g_return_val_if_fail (lvp != NULL, NULL);
+  g_return_val_if_fail (LGM_IS_VIDEO_WIDGET (lvp), NULL);
+  g_return_val_if_fail (GST_IS_ELEMENT (lvp->priv->play), NULL);
+
+  gst_element_get_state (lvp->priv->play, NULL, NULL, 1 * GST_SECOND);
+
+  /* get frame */
+  g_object_get (lvp->priv->play, "frame", &buf, NULL);
+
+  if (!buf) {
+    GST_DEBUG ("Could not take screenshot: %s", "no last video frame");
+    return NULL;
+  }
+
+  if (GST_BUFFER_CAPS (buf) == NULL) {
+    GST_DEBUG ("Could not take screenshot: %s", "no caps on buffer");
+    return NULL;
+  }
+
+  /* convert to our desired format (RGB24) */
+  to_caps = gst_caps_new_simple ("video/x-raw-rgb",
+      "bpp", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24,
+      /* Note: we don't ask for a specific width/height here, so that
+       * videoscale can adjust dimensions from a non-1/1 pixel aspect
+       * ratio to a 1/1 pixel-aspect-ratio */
+      "pixel-aspect-ratio", GST_TYPE_FRACTION, 1,
+      1, "endianness", G_TYPE_INT, G_BIG_ENDIAN,
+      "red_mask", G_TYPE_INT, 0xff0000,
+      "green_mask", G_TYPE_INT, 0x00ff00,
+      "blue_mask", G_TYPE_INT, 0x0000ff, NULL);
+
+  GST_DEBUG ("frame caps: %" GST_PTR_FORMAT, GST_BUFFER_CAPS (buf));
+  GST_DEBUG ("pixbuf caps: %" GST_PTR_FORMAT, to_caps);
+
+  buf = bvw_frame_conv_convert (buf, to_caps);
+
+  gst_caps_unref (to_caps);
+
+  if (!buf) {
+    GST_DEBUG ("Could not take screenshot: %s", "conversion failed");
+    return NULL;
+  }
+
+  if (!GST_BUFFER_CAPS (buf)) {
+    GST_DEBUG ("Could not take screenshot: %s", "no caps on output buffer");
+    return NULL;
+  }
+
+  s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
+  gst_structure_get_int (s, "width", &outwidth);
+  gst_structure_get_int (s, "height", &outheight);
+  g_return_val_if_fail (outwidth > 0 && outheight > 0, NULL);
+
+  /* create pixbuf from that - use our own destroy function */
+  pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buf),
+      GDK_COLORSPACE_RGB, FALSE, 8, outwidth,
+      outheight, GST_ROUND_UP_4 (outwidth * 3), destroy_pixbuf, buf);
+
+  if (!pixbuf) {
+    GST_DEBUG ("Could not take screenshot: %s", "could not create pixbuf");
+    gst_buffer_unref (buf);
+  }
+
+  return pixbuf;
+}
+
+void lgm_video_player_set_window_handle (LgmVideoPlayer *lvp,
+    guintptr window_handle)
+{
+  g_mutex_lock (&lvp->priv->overlay_lock);
+  lvp->priv->window_handle = window_handle;
+  if (lvp->priv->xoverlay != NULL) {
+      lgm_set_window_handle(lvp->priv->xoverlay, lvp->priv->window_handle);
+  }
+  g_mutex_unlock (&lvp->priv->overlay_lock);
+}
+
+LgmVideoPlayer *
+lgm_video_player_new (LgmUseType type, GError ** err)
+{
+  LgmVideoPlayer *lvp;
+  GstElement *video_sink, *audio_sink;
+  GstPad *pad;
+  gint flags;
+
+  lvp = g_object_new (lgm_video_player_get_type (), NULL);
+
+  lvp->priv->use_type = type;
+  GST_INFO ("use_type = %d", type);
+
+  lvp->priv->play = gst_element_factory_make ("playbin2", "play");
+  if (!lvp->priv->play) {
+    g_set_error (err, LGM_ERROR, GST_ERROR_PLUGIN_LOAD,
+        _("Failed to create a GStreamer play object. "
+            "Please check your GStreamer installation."));
+    g_object_ref_sink (lvp);
+    g_object_unref (lvp);
+    return NULL;
+  }
+
+  g_object_get (lvp->priv->play, "flags", &flags, NULL);
+  flags |= GST_PLAY_FLAG_DEINTERLACE;
+  g_object_set (lvp->priv->play, "flags", flags, NULL);
+
+  lvp->priv->bus = gst_element_get_bus (lvp->priv->play);
+  gst_bus_add_signal_watch (lvp->priv->bus);
+
+  lvp->priv->sig_bus_async =
+      g_signal_connect (lvp->priv->bus, "message",
+      G_CALLBACK (lgm_bus_message_cb), lvp);
+
+  /* we want to catch "prepare-xwindow-id" element messages synchronously */
+  gst_bus_set_sync_handler (lvp->priv->bus, gst_bus_sync_signal_handler, lvp);
+  lvp->priv->sig_bus_async =
+      g_signal_connect (lvp->priv->bus, "sync-message::element",
+      G_CALLBACK (lgm_element_msg_sync_cb), lvp);
+
+  if (type == LGM_USE_TYPE_VIDEO) {
+    video_sink = gst_element_factory_make ("autovideosink", "video-sink");
+    audio_sink = gst_element_factory_make ("autoaudiosink", "video-sink");
+  } else {
+    video_sink = gst_element_factory_make ("fakesink", "video-fake-sink");
+    audio_sink = gst_element_factory_make ("fakesink", "video-sink");
+    if (video_sink)
+      g_object_set (video_sink, "sync", TRUE, NULL);
+    if (audio_sink)
+      g_object_set (audio_sink, "sync", TRUE, NULL);
+  }
+
+  if (!video_sink  || !audio_sink) {
+    g_set_error (err, LGM_ERROR, GST_ERROR_VIDEO_PLUGIN,
+        _("No valid sink found."));
+    goto sink_error;
+  }
+
+  lvp->priv->video_sink = video_sink;
+  pad = gst_element_get_static_pad (video_sink, "sink");
+  g_signal_connect (pad, "notify::caps",
+      G_CALLBACK (lgm_parse_stream_caps), lvp);
+  gst_object_unref (pad);
+  g_object_set (lvp->priv->play, "video-sink", video_sink, NULL);
+  g_object_set (lvp->priv->play, "audio-sink", audio_sink, NULL);
+
+  return lvp;
+
+  /* errors */
+sink_error:
+  {
+    if (video_sink) {
+      gst_element_set_state (video_sink, GST_STATE_NULL);
+      gst_object_unref (video_sink);
+    }
+    if (audio_sink) {
+      gst_element_set_state (audio_sink, GST_STATE_NULL);
+      gst_object_unref (audio_sink);
+    }
+
+    g_object_ref (lvp);
+    g_object_ref_sink (G_OBJECT (lvp));
+    g_object_unref (lvp);
+    return NULL;
+  }
+}
+
+/* =========================================== */
+/*                                             */
+/*          GObject type                       */
+/*                                             */
+/* =========================================== */
+
+GQuark
+lgm_video_player_error_quark (void)
+{
+  static GQuark q;              /* 0 */
+
+  if (G_UNLIKELY (q == 0)) {
+    q = g_quark_from_static_string ("lvp-error-quark");
+  }
+  return q;
+}
+
+static void
+lgm_video_player_finalize (GObject * object)
+{
+  LgmVideoPlayer *lvp = (LgmVideoPlayer *) object;
+
+  GST_INFO ("finalizing");
+
+  if (lvp->priv->bus) {
+    /* make bus drop all messages to make sure none of our callbacks is ever
+     * called again (main loop might be run again to display error dialog) */
+    gst_bus_set_flushing (lvp->priv->bus, TRUE);
+
+    if (lvp->priv->sig_bus_async)
+      g_signal_handler_disconnect (lvp->priv->bus, lvp->priv->sig_bus_async);
+
+    if (lvp->priv->sig_bus_sync)
+      g_signal_handler_disconnect (lvp->priv->bus, lvp->priv->sig_bus_sync);
+
+    gst_object_unref (lvp->priv->bus);
+    lvp->priv->bus = NULL;
+  }
+
+  if (lvp->priv->uri) {
+    g_free (lvp->priv->uri);
+    lvp->priv->uri = NULL;
+  }
+
+  g_mutex_clear (&lvp->priv->overlay_lock);
+
+  if (lvp->priv->play != NULL && GST_IS_ELEMENT (lvp->priv->play)) {
+    gst_element_set_state (lvp->priv->play, GST_STATE_NULL);
+    gst_object_unref (lvp->priv->play);
+    lvp->priv->play = NULL;
+  }
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+lgm_video_player_init (LgmVideoPlayer * lvp)
+{
+  LgmVideoPlayerPrivate *priv;
+
+  lvp->priv = priv =
+      G_TYPE_INSTANCE_GET_PRIVATE (lvp, LGM_TYPE_VIDEO_WIDGET,
+      LgmVideoPlayerPrivate);
+
+  priv->uri = NULL;
+  priv->video_fps_n = 25;
+  priv->video_fps_d = 1;
+  g_mutex_init (&lvp->priv->overlay_lock);
+}
+
+static void
+lgm_video_player_class_init (LgmVideoPlayerClass * klass)
+{
+  GObjectClass *object_class;
+
+  object_class = (GObjectClass *) klass;
+  parent_class = g_type_class_peek_parent (klass);
+  g_type_class_add_private (object_class, sizeof (LgmVideoPlayerPrivate));
+
+  if (_lgm_debug_cat == NULL) {
+    GST_DEBUG_CATEGORY_INIT (_lgm_debug_cat, "longomatch", 0,
+        "LongoMatch GStreamer Backend");
+  }
+
+  /* GObject */
+  object_class->finalize = lgm_video_player_finalize;
+
+  /* Signals */
+  lgm_signals[SIGNAL_ERROR] =
+      g_signal_new ("error",
+      G_TYPE_FROM_CLASS (object_class),
+      G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (LgmVideoPlayerClass, error),
+      NULL, NULL,
+      g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
+
+  lgm_signals[SIGNAL_EOS] =
+      g_signal_new ("eos",
+      G_TYPE_FROM_CLASS (object_class),
+      G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (LgmVideoPlayerClass, eos),
+      NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+  lgm_signals[SIGNAL_READY_TO_SEEK] =
+      g_signal_new ("ready_to_seek",
+      G_TYPE_FROM_CLASS (object_class),
+      G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (LgmVideoPlayerClass, ready_to_seek),
+      NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+  lgm_signals[SIGNAL_TICK] =
+      g_signal_new ("tick",
+      G_TYPE_FROM_CLASS (object_class),
+      G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (LgmVideoPlayerClass, tick),
+      NULL, NULL,
+      baconvideowidget_marshal_VOID__INT64_INT64_DOUBLE,
+      G_TYPE_NONE, 3, G_TYPE_INT64, G_TYPE_INT64, G_TYPE_DOUBLE);
+
+
+  lgm_signals[SIGNAL_STATE_CHANGE] =
+      g_signal_new ("state_change",
+      G_TYPE_FROM_CLASS (object_class),
+      G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (LgmVideoPlayerClass, state_change),
+      NULL, NULL,
+      g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+}
diff --git a/libcesarplayer/lgm-video-player.h b/libcesarplayer/lgm-video-player.h
new file mode 100644
index 0000000..553d196
--- /dev/null
+++ b/libcesarplayer/lgm-video-player.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2014 Andoni Morales <ylatuya gmail com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HAVE_LGM_VIDEO_PLAYER_H
+#define HAVE_LGM_VIDEO_PLAYER_H
+
+#ifdef WIN32
+#define EXPORT __declspec (dllexport)
+#else
+#define EXPORT
+#endif
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+#define LGM_TYPE_VIDEO_WIDGET              (lgm_video_player_get_type ())
+#define LGM_VIDEO_PLAYER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), lgm_video_player_get_type (), 
LgmVideoPlayer))
+#define LGM_VIDEO_PLAYER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), lgm_video_player_get_type (), 
LgmVideoPlayerClass))
+#define LGM_IS_VIDEO_WIDGET(obj)           (G_TYPE_CHECK_INSTANCE_TYPE (obj, lgm_video_player_get_type ()))
+#define LGM_IS_VIDEO_WIDGET_CLASS(klass)   (G_CHECK_INSTANCE_GET_CLASS ((klass), lgm_video_player_get_type 
()))
+#define LGM_ERROR lgm_video_player_error_quark ()
+typedef struct LgmVideoPlayerPrivate LgmVideoPlayerPrivate;
+
+typedef struct
+{
+  GstElement parent;
+  LgmVideoPlayerPrivate *priv;
+} LgmVideoPlayer;
+
+typedef struct
+{
+  GstElementClass parent_class;
+
+  void (*error) (LgmVideoPlayer * lvp, const char *message);
+  void (*eos) (LgmVideoPlayer * lvp);
+  void (*tick) (LgmVideoPlayer * lvp, gint64 current_time,
+      gint64 stream_length, gdouble current_position);
+  void (*state_change) (LgmVideoPlayer * lvp, gboolean playing);
+  void (*ready_to_seek) (LgmVideoPlayer * lvp);
+} LgmVideoPlayerClass;
+
+
+EXPORT GQuark lgm_video_player_error_quark (void) G_GNUC_CONST;
+EXPORT GType lgm_video_player_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+  LGM_USE_TYPE_VIDEO,
+  LGM_USE_TYPE_CAPTURE,
+} LgmUseType;
+
+
+EXPORT LgmVideoPlayer *lgm_video_player_new               (LgmUseType type,
+                                                           GError ** error);
+
+EXPORT void lgm_video_player_set_window_handle           (LgmVideoPlayer *lvp,
+                                                          guintptr windows_handle);
+
+/* Actions */
+EXPORT gboolean lgm_video_player_open                     (LgmVideoPlayer * lvp,
+                                                           const char *mrl, GError ** error);
+
+EXPORT gboolean lgm_video_player_play                     (LgmVideoPlayer * lvp);
+
+EXPORT void lgm_video_player_pause                        (LgmVideoPlayer * lvp);
+
+EXPORT void lgm_video_player_stop                         (LgmVideoPlayer * lvp);
+
+EXPORT void lgm_video_player_close                        (LgmVideoPlayer * lvp);
+
+EXPORT gboolean lgm_video_player_is_playing               (LgmVideoPlayer * lvp);
+
+/* Seeking and length */
+EXPORT gboolean lgm_video_player_is_seekable              (LgmVideoPlayer * lvp);
+
+EXPORT gboolean lgm_video_player_seek_time                (LgmVideoPlayer * lvp,
+                                                           gint64 time,
+                                                           gboolean accurate);
+
+EXPORT gboolean lgm_video_player_seek_to_next_frame       (LgmVideoPlayer * lvp);
+
+EXPORT gboolean lgm_video_player_seek_to_previous_frame   (LgmVideoPlayer * lvp);
+
+EXPORT gdouble lgm_video_player_get_position              (LgmVideoPlayer * lvp);
+
+EXPORT gint64 lgm_video_player_get_current_time           (LgmVideoPlayer * lvp);
+
+EXPORT gint64 lgm_video_player_get_stream_length          (LgmVideoPlayer * lvp);
+
+EXPORT gboolean lgm_video_player_set_rate                 (LgmVideoPlayer * lvp,
+                                                           gdouble rate);
+
+/* Audio volume */
+EXPORT void lgm_video_player_set_volume                   (LgmVideoPlayer * lvp,
+                                                           gdouble volume);
+
+EXPORT double lgm_video_player_get_volume                 (LgmVideoPlayer * lvp);
+
+/* Screenshot functions */
+EXPORT GdkPixbuf *lgm_video_player_get_current_frame      (LgmVideoPlayer * lvp);
+EXPORT void lgm_video_player_unref_pixbuf                 (GdkPixbuf * pixbuf);
+
+EXPORT void lgm_video_player_expose                       (LgmVideoPlayer * lvp);
+
+G_END_DECLS
+#endif /* HAVE_LGM_VIDEO_PLAYER_H */
diff --git a/libcesarplayer/liblongomatch.mdp b/libcesarplayer/liblongomatch.mdp
index 270dfdc..a2b8e96 100644
--- a/libcesarplayer/liblongomatch.mdp
+++ b/libcesarplayer/liblongomatch.mdp
@@ -15,8 +15,6 @@
   </Configurations>
   <Contents>
     <File subtype="Directory" buildaction="Nothing" name="." />
-    <File subtype="Code" buildaction="Nothing" name="bacon-video-widget.h" />
-    <File subtype="Code" buildaction="Compile" name="bacon-video-widget-gst-0.10.c" />
     <File subtype="Code" buildaction="Nothing" name="common.h" />
     <File subtype="Code" buildaction="Compile" name="gst-camera-capturer.c" />
     <File subtype="Code" buildaction="Nothing" name="gst-camera-capturer.h" />
@@ -37,6 +35,10 @@
     <File subtype="Code" buildaction="Nothing" name="gst-remuxer.h" />
     <File subtype="Code" buildaction="Compile" name="gst-video-encoder.c" />
     <File subtype="Code" buildaction="Nothing" name="gst-video-encoder.h" />
+    <File subtype="Code" buildaction="Nothing" name="lgm-video-player.h" />
+    <File subtype="Code" buildaction="Compile" name="lgm-video-player.c" />
+    <File subtype="Code" buildaction="Compile" name="gst-nle-source.c" />
+    <File subtype="Code" buildaction="Nothing" name="gst-nle-source.h" />
   </Contents>
   <MonoDevelop.Autotools.MakefileInfo RelativeMakefileName="Makefile.am" IsAutotoolsProject="True" 
RelativeConfigureInPath=".">
     <BuildFilesVar />
diff --git a/libcesarplayer/test-capturer.c b/libcesarplayer/test-capturer.c
index 3b2ad5e..c341b3a 100644
--- a/libcesarplayer/test-capturer.c
+++ b/libcesarplayer/test-capturer.c
@@ -21,7 +21,18 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include "gst-camera-capturer.h"
+#include "video-utils.h"
+#if defined (GDK_WINDOWING_X11)
+#include <gdk/gdkx.h>
+#elif defined (GDK_WINDOWING_WIN32)
+#include <gdk/gdkwin32.h>
+#elif defined (GDK_WINDOWING_QUARTZ)
+#include <gdk/gdkquartz.h>
+#endif
 
+static GtkWidget *recbutton, *stopbutton;
+static int sargc;
+static char **sargv;
 
 static void
 rec_clicked_cb (GtkButton *b, GstCameraCapturer *gcc)
@@ -35,10 +46,29 @@ stop_clicked (GtkButton *b, GstCameraCapturer *gcc)
   gst_camera_capturer_stop (gcc);
 }
 
+static void
+on_realized_cb (GtkWidget *video)
+{
+  GstCameraCapturer *gvc;
+  guintptr window;
+  GError *error = NULL;
+
+  window = lgm_get_window_handle (gtk_widget_get_window (video));
+
+  gvc = gst_camera_capturer_new (&error);
+  gst_camera_capturer_configure (gvc, sargv[1], CAPTURE_SOURCE_TYPE_SYSTEM,
+      sargv[2], sargv[3], VIDEO_ENCODER_H264, AUDIO_ENCODER_AAC, VIDEO_MUXER_MP4,
+      1000, 100, FALSE, 320, 240, window);
+  gst_camera_capturer_run(gvc);
+  g_signal_connect (G_OBJECT (recbutton), "clicked",
+      G_CALLBACK (rec_clicked_cb), gvc);
+  g_signal_connect (G_OBJECT (stopbutton), "clicked",
+      G_CALLBACK (stop_clicked), gvc);
+}
 void
-create_window (GstCameraCapturer * gvc)
+create_window (void)
 {
-  GtkWidget *window, *recbutton, *stopbutton, *vbox, *hbox;
+  GtkWidget *window, *vbox, *hbox, *video;
 
   /* Create a new window */
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -47,46 +77,34 @@ create_window (GstCameraCapturer * gvc)
   hbox = gtk_hbox_new (TRUE, 0);
   recbutton = gtk_button_new_from_stock ("gtk-rec");
   stopbutton = gtk_button_new_from_stock ("gtk-stop");
+  video = gtk_drawing_area_new ();
+  GTK_WIDGET_UNSET_FLAGS (video, GTK_DOUBLE_BUFFERED);
 
   gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (vbox));
-  gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET (gvc), TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET (video), TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET (hbox), FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX(hbox), recbutton, TRUE, TRUE, 0);
   gtk_box_pack_start(GTK_BOX(hbox), stopbutton, TRUE, TRUE, 0);
+  g_signal_connect (video, "realize", G_CALLBACK (on_realized_cb), NULL);
   gtk_widget_show_all (window);
-
-  g_signal_connect (G_OBJECT (recbutton), "clicked",
-      G_CALLBACK (rec_clicked_cb), gvc);
-  g_signal_connect (G_OBJECT (stopbutton), "clicked",
-      G_CALLBACK (stop_clicked), gvc);
 }
 
 
+
 int
-main (int argc, char *argv[])
+main (int argc, char **argv)
 {
-  GstCameraCapturer *gvc;
-  GError *error = NULL;
-
   if (argc != 4) {
     g_print("Usage: test-encoder output_file device_type device-id\n");
     return 1;
   }
   gtk_init (&argc, &argv);
+  sargc = argc;
+  sargv = argv;
 
   /*Create GstVideoCapturer */
-  gst_camera_capturer_init_backend (&argc, &argv);
-  gvc = gst_camera_capturer_new ("test", &error);
-
-  gst_camera_capturer_set_source (gvc, atoi(argv[2]), SYSVIDEOSRC);
-  gst_camera_capturer_set_video_encoder (gvc, VIDEO_ENCODER_H264);
-  gst_camera_capturer_set_audio_encoder (gvc, AUDIO_ENCODER_AAC);
-  gst_camera_capturer_set_video_muxer (gvc, VIDEO_MUXER_MP4);
-  g_object_set (gvc, "device-id", argv[3], NULL);
-  g_object_set (gvc, "output_file", argv[1], NULL);
-
-  create_window (gvc);
-  gst_camera_capturer_run(gvc);
+  lgm_init_backend (argc, argv);
+  create_window ();
   gtk_main ();
 
   return 0;
diff --git a/libcesarplayer/test-discoverer.c b/libcesarplayer/test-discoverer.c
index 78933da..89bf58a 100644
--- a/libcesarplayer/test-discoverer.c
+++ b/libcesarplayer/test-discoverer.c
@@ -29,7 +29,7 @@ main (int argc, char *argv[])
   gchar *uri;
   GError *err = NULL;
 
-  init_backend (0, NULL);
+  lgm_init_backend (0, NULL);
 
   if (argc != 2) {
     g_print("Usage: test-discoverer file_uri\n");
diff --git a/libcesarplayer/video-utils.c b/libcesarplayer/video-utils.c
index 7657153..5e6c42f 100644
--- a/libcesarplayer/video-utils.c
+++ b/libcesarplayer/video-utils.c
@@ -1,10 +1,5 @@
 /* 
- * Copyright (C) 2003-2007 the GStreamer project
- *      Julien Moutte <julien moutte net>
- *      Ronald Bultje <rbultje ronald bitfreak net>
- * Copyright (C) 2005-2008 Tim-Philipp Müller <tim centricular net>
- * Copyright (C) 2009 Sebastian Dröge <sebastian droege collabora co uk>
- * Copyright (C) 2009  Andoni Morales Alastruey <ylatuya gmail com> 
+ * Copyright (C) 2009-2014  Andoni Morales Alastruey <ylatuya gmail com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,256 +32,41 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
-
-void
-totem_gdk_window_set_invisible_cursor (GdkWindow * window)
-{
-  GdkCursor *cursor;
-#ifdef WIN32
-  cursor = gdk_cursor_new (GDK_X_CURSOR);
-#else
-  cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
+#if defined (GDK_WINDOWING_X11)
+#include <gdk/gdkx.h>
+#elif defined (GDK_WINDOWING_WIN32)
+#include <gdk/gdkwin32.h>
+#elif defined (GDK_WINDOWING_QUARTZ)
+#include <gdk/gdkquartz.h>
 #endif
-  gdk_window_set_cursor (window, cursor);
-  gdk_cursor_unref (cursor);
-}
-
-void
-totem_gdk_window_set_waiting_cursor (GdkWindow * window)
-{
-  GdkCursor *cursor;
-
-  cursor = gdk_cursor_new (GDK_WATCH);
-  gdk_window_set_cursor (window, cursor);
-  gdk_cursor_unref (cursor);
-
-  gdk_flush ();
-}
-
-gboolean
-totem_display_is_local (void)
-{
-  const char *name, *work;
-  int display, screen;
-  gboolean has_hostname;
-
-  name = gdk_display_get_name (gdk_display_get_default ());
-  if (name == NULL)
-    return TRUE;
-
-  work = strstr (name, ":");
-  if (work == NULL)
-    return TRUE;
-
-  has_hostname = (work - name) > 0;
-
-  /* Get to the character after the colon */
-  work++;
-  if (*work == '\0')
-    return TRUE;
-
-  if (sscanf (work, "%d.%d", &display, &screen) != 2)
-    return TRUE;
-
-  if (has_hostname == FALSE)
-    return TRUE;
-
-  if (display < 10)
-    return TRUE;
-
-  return FALSE;
-}
-
-char *
-totem_time_to_string (gint64 msecs)
-{
-  int sec, min, hour, time;
-
-  time = (int) (msecs / 1000);
-  sec = time % 60;
-  time = time - sec;
-  min = (time % (60 * 60)) / 60;
-  time = time - (min * 60);
-  hour = time / (60 * 60);
-
-  if (hour > 0) {
-    /* hour:minutes:seconds */
-    /* Translators: This is a time format, like "9:05:02" for 9
-     * hours, 5 minutes, and 2 seconds. You may change ":" to
-     * the separator that your locale uses or use "%Id" instead
-     * of "%d" if your locale uses localized digits.
-     */
-    return g_strdup_printf (C_ ("long time format", "%d:%02d:%02d"), hour,
-        min, sec);
-  }
-
-  /* minutes:seconds */
-  /* Translators: This is a time format, like "5:02" for 5
-   * minutes and 2 seconds. You may change ":" to the
-   * separator that your locale uses or use "%Id" instead of
-   * "%d" if your locale uses localized digits.
-   */
-  return g_strdup_printf (C_ ("short time format", "%d:%02d"), min, sec);
-}
-
-gint64
-totem_string_to_time (const char *time_string)
-{
-  int sec, min, hour, args;
-
-  args =
-      sscanf (time_string, C_ ("long time format", "%d:%02d:%02d"), &hour, &min,
-      &sec);
-
-  if (args == 3) {
-    /* Parsed all three arguments successfully */
-    return (hour * (60 * 60) + min * 60 + sec) * 1000;
-  } else if (args == 2) {
-    /* Only parsed the first two arguments; treat hour and min as min and sec, respectively */
-    return (hour * 60 + min) * 1000;
-  } else if (args == 1) {
-    /* Only parsed the first argument; treat hour as sec */
-    return hour * 1000;
-  } else {
-    /* Error! */
-    return -1;
-  }
-}
-
-char *
-totem_time_to_string_text (gint64 msecs)
-{
-  char *secs, *mins, *hours, *string;
-  int sec, min, hour, time;
-
-  time = (int) (msecs / 1000);
-  sec = time % 60;
-  time = time - sec;
-  min = (time % (60 * 60)) / 60;
-  time = time - (min * 60);
-  hour = time / (60 * 60);
-
-  hours = g_strdup_printf (ngettext ("%d hour", "%d hours", hour), hour);
-
-  mins = g_strdup_printf (ngettext ("%d minute", "%d minutes", min), min);
-
-  secs = g_strdup_printf (ngettext ("%d second", "%d seconds", sec), sec);
-
-  if (hour > 0) {
-    /* hour:minutes:seconds */
-    string = g_strdup_printf (_("%s %s %s"), hours, mins, secs);
-  } else if (min > 0) {
-    /* minutes:seconds */
-    string = g_strdup_printf (_("%s %s"), mins, secs);
-  } else if (sec > 0) {
-    /* seconds */
-    string = g_strdup_printf (_("%s"), secs);
-  } else {
-    /* 0 seconds */
-    string = g_strdup (_("0 seconds"));
-  }
-
-  g_free (hours);
-  g_free (mins);
-  g_free (secs);
-
-  return string;
-}
-
-typedef struct _TotemPrefSize
-{
-  gint width, height;
-  gulong sig_id;
-} TotemPrefSize;
-
-static gboolean
-cb_unset_size (gpointer data)
-{
-  GtkWidget *widget = data;
-
-  gtk_widget_queue_resize_no_redraw (widget);
-
-  return FALSE;
-}
-
-static void
-cb_set_preferred_size (GtkWidget * widget, GtkRequisition * req, gpointer data)
-{
-  TotemPrefSize *size = data;
-
-  req->width = size->width;
-  req->height = size->height;
-
-  g_signal_handler_disconnect (widget, size->sig_id);
-  g_free (size);
-  g_idle_add (cb_unset_size, widget);
-}
-
-void
-totem_widget_set_preferred_size (GtkWidget * widget, gint width, gint height)
-{
-  TotemPrefSize *size = g_new (TotemPrefSize, 1);
-
-  size->width = width;
-  size->height = height;
-  size->sig_id = g_signal_connect (widget, "size-request",
-      G_CALLBACK (cb_set_preferred_size), size);
-
-  gtk_widget_queue_resize (widget);
-}
-
-gboolean
-totem_ratio_fits_screen (GdkWindow * video_window, int video_width,
-    int video_height, gfloat ratio)
-{
-  GdkRectangle fullscreen_rect;
-  int new_w, new_h;
-  GdkScreen *screen;
-
-  if (video_width <= 0 || video_height <= 0)
-    return TRUE;
-
-  new_w = video_width * ratio;
-  new_h = video_height * ratio;
-
-  screen = gdk_drawable_get_screen (GDK_DRAWABLE (video_window));
-  gdk_screen_get_monitor_geometry (screen,
-      gdk_screen_get_monitor_at_window
-      (screen, video_window), &fullscreen_rect);
-
-  if (new_w > (fullscreen_rect.width - 128) ||
-      new_h > (fullscreen_rect.height - 128)) {
-    return FALSE;
-  }
-
-  return TRUE;
-}
 
 guintptr
-gst_get_window_handle(GdkWindow *window)
+lgm_get_window_handle(GdkWindow *window)
 {
   guintptr window_handle;
 
+  gdk_window_ensure_native (window);
+
   /* Retrieve window handler from GDK */
 #if defined (GDK_WINDOWING_WIN32)
   window_handle = (guintptr)GDK_WINDOW_HWND (window);
 #elif defined (GDK_WINDOWING_QUARTZ)
-  window_handle = gdk_quartz_window_get_nsview (window);
+  window_handle = (guintptr) gdk_quartz_window_get_nsview (window);
 #elif defined (GDK_WINDOWING_X11)
-  window_handle = GDK_WINDOW_XID (window);
+  window_handle = (guintptr) GDK_WINDOW_XID (window);
 #endif
 
   return window_handle;
 }
 
 void
-gst_set_window_handle(GstXOverlay *xoverlay, guintptr window_handle)
+lgm_set_window_handle(GstXOverlay *xoverlay, guintptr window_handle)
 {
   gst_x_overlay_set_window_handle (xoverlay, window_handle);
 }
 
 void
-init_backend (int argc, char **argv)
+lgm_init_backend (int argc, char **argv)
 {
   gst_init(&argc, &argv);
 }
diff --git a/libcesarplayer/video-utils.h b/libcesarplayer/video-utils.h
index b3092fd..4469559 100644
--- a/libcesarplayer/video-utils.h
+++ b/libcesarplayer/video-utils.h
@@ -31,13 +31,6 @@
 #include <gst/interfaces/xoverlay.h>
 #include <gst/pbutils/pbutils.h>
 #include <gdk/gdk.h>
-#if defined (GDK_WINDOWING_X11)
-#include <gdk/gdkx.h>
-#elif defined (GDK_WINDOWING_WIN32)
-#include <gdk/gdkwin32.h>
-#elif defined (GDK_WINDOWING_QUARTZ)
-#include <gdk/gdkquartz.h>
-#endif
 #include <gtk/gtk.h>
 #include "common.h"
 
@@ -48,27 +41,11 @@
 #define EXPORT
 #endif
 
-#define TOTEM_OBJECT_HAS_SIGNAL(obj, name) (g_signal_lookup (name, g_type_from_name (G_OBJECT_TYPE_NAME 
(obj))) != 0)
-
-void totem_gdk_window_set_invisible_cursor (GdkWindow * window);
-void totem_gdk_window_set_waiting_cursor (GdkWindow * window);
-
-gboolean totem_display_is_local (void);
-
-char *totem_time_to_string (gint64 msecs);
-gint64 totem_string_to_time (const char *time_string);
-char *totem_time_to_string_text (gint64 msecs);
-
-void totem_widget_set_preferred_size (GtkWidget * widget, gint width,
-    gint height);
-gboolean totem_ratio_fits_screen (GdkWindow * window, int video_width,
-    int video_height, gfloat ratio);
-
-EXPORT void init_backend (int argc, char **argv);
-guintptr gst_get_window_handle (GdkWindow *window);
-void gst_set_window_handle (GstXOverlay *overlay, guintptr window_handle);
-void init_debug();
-gchar * lgm_filename_to_uri (const gchar *filena);
+EXPORT void lgm_init_backend (int argc, char **argv);
+EXPORT guintptr lgm_get_window_handle (GdkWindow *window);
+EXPORT void lgm_set_window_handle (GstXOverlay *overlay, guintptr window_handle);
+EXPORT void lgm_init_debug();
+EXPORT gchar * lgm_filename_to_uri (const gchar *filena);
 
 EXPORT GstDiscovererResult lgm_discover_uri (const gchar *uri, guint64 *duration,
     guint *width, guint *height, guint *fps_n, guint *fps_d, guint *par_n,



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