[longomatch] Use the player view a plugable component in the analysis interface
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Use the player view a plugable component in the analysis interface
- Date: Tue, 31 Mar 2015 17:31:08 +0000 (UTC)
commit cc440a63f4eace94387ee7edf161fe19b13c9a5f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Mar 23 12:36:38 2015 +0100
Use the player view a plugable component in the analysis interface
LongoMatch.Addins/AddinsManager.cs | 13 ++++++
LongoMatch.Addins/ExtensionPoints/IGUIBackend.cs | 2 +
LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs | 3 +
LongoMatch.Core/Interfaces/GUI/IPlayerView.cs | 32 +++++++++++++++
LongoMatch.Core/LongoMatch.Core.csproj | 1 +
LongoMatch.Core/Makefile.am | 1 +
LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs | 12 ++++--
LongoMatch.GUI.Multimedia/Gui/PlayerView.cs | 9 ++++-
LongoMatch.GUI.Multimedia/Makefile.am | 4 +-
.../gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs | 43 ++++++++------------
LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic | 9 +----
LongoMatch.GUI/Gui/GUIToolkit.cs | 5 ++
LongoMatch/Main.cs | 3 +
13 files changed, 96 insertions(+), 41 deletions(-)
---
diff --git a/LongoMatch.Addins/AddinsManager.cs b/LongoMatch.Addins/AddinsManager.cs
index 6abda75..4e11565 100644
--- a/LongoMatch.Addins/AddinsManager.cs
+++ b/LongoMatch.Addins/AddinsManager.cs
@@ -136,6 +136,19 @@ namespace LongoMatch.Addins
}
}
+ public static void LoadUIBackendsAddins (IGUIToolkit gtoolkit)
+ {
+ foreach (IGUIBackend backend in AddinManager.GetExtensionObjects<IGUIBackend> ()) {
+ try {
+ Log.Information ("Registering UI backend from plugin: " +
backend.Name);
+ backend.RegisterElements (gtoolkit);
+ } catch (Exception ex) {
+ Log.Error ("Error registering multimedia backend");
+ Log.Exception (ex);
+ }
+ }
+ }
+
public static void ShutdownMultimediaBackends ()
{
foreach (IMultimediaBackend backend in
AddinManager.GetExtensionObjects<IMultimediaBackend> ()) {
diff --git a/LongoMatch.Addins/ExtensionPoints/IGUIBackend.cs
b/LongoMatch.Addins/ExtensionPoints/IGUIBackend.cs
index c75781d..28dae7c 100644
--- a/LongoMatch.Addins/ExtensionPoints/IGUIBackend.cs
+++ b/LongoMatch.Addins/ExtensionPoints/IGUIBackend.cs
@@ -24,6 +24,8 @@ namespace LongoMatch.Addins.ExtensionPoints
[TypeExtensionPoint]
public interface IGUIBackend
{
+ string Name { get; }
+
void RegisterElements (IGUIToolkit gtoolkit);
}
}
diff --git a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
index cc7f25b..a3394cd 100644
--- a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
@@ -31,8 +31,11 @@ namespace LongoMatch.Core.Interfaces.GUI
{
public interface IGUIToolkit
{
+ /* Plugable views */
void Register (int priority, Type interfac, Type elementType);
+ IPlayerView GetPlayerView ();
+
IMainController MainController { get; }
IRenderingStateBar RenderingStateBar { get; }
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlayerView.cs b/LongoMatch.Core/Interfaces/GUI/IPlayerView.cs
new file mode 100644
index 0000000..e0d6d00
--- /dev/null
+++ b/LongoMatch.Core/Interfaces/GUI/IPlayerView.cs
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2015 Fluendo S.A.
+//
+// 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;
+using LongoMatch.Core.Common;
+
+namespace LongoMatch.Core.Interfaces.GUI
+{
+ public interface IPlayerView
+ {
+ IPlayerController Player { get; }
+
+ PlayerViewOperationMode Mode { get; set; }
+
+ bool SupportsMultipleCameras { get; }
+ }
+}
+
diff --git a/LongoMatch.Core/LongoMatch.Core.csproj b/LongoMatch.Core/LongoMatch.Core.csproj
index f8b72a1..055d196 100644
--- a/LongoMatch.Core/LongoMatch.Core.csproj
+++ b/LongoMatch.Core/LongoMatch.Core.csproj
@@ -140,6 +140,7 @@
<Compile Include="Interfaces\IPlayerController.cs" />
<Compile Include="Common\Registry.cs" />
<Compile Include="Common\Seeker.cs" />
+ <Compile Include="Interfaces\GUI\IPlayerView.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Common\" />
diff --git a/LongoMatch.Core/Makefile.am b/LongoMatch.Core/Makefile.am
index 777acb2..ff15d5e 100644
--- a/LongoMatch.Core/Makefile.am
+++ b/LongoMatch.Core/Makefile.am
@@ -45,6 +45,7 @@ SOURCES = Common/Area.cs \
Interfaces/GUI/IMainController.cs \
Interfaces/GUI/IPanel.cs \
Interfaces/GUI/IPlayerBin.cs \
+ Interfaces/GUI/IPlayerView.cs \
Interfaces/GUI/IRenderingStateBar.cs \
Interfaces/IDataBaseManager.cs \
Interfaces/IDatabase.cs \
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
index 41cedd6..9d18fa9 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
@@ -31,6 +31,7 @@ namespace LongoMatch.Gui
public partial class PlayerCapturerBin : Gtk.Bin
{
bool backLoaded = false;
+ IPlayerView playerview;
PlayerViewOperationMode mode;
public PlayerCapturerBin ()
@@ -42,12 +43,15 @@ namespace LongoMatch.Gui
livelabel.ModifyFg (Gtk.StateType.Normal, Misc.ToGdkColor
(Config.Style.PaletteActive));
replaylabel.ModifyFg (Gtk.StateType.Normal, Misc.ToGdkColor
(Config.Style.PaletteActive));
livebox.Visible = replayhbox.Visible = true;
- Player = playerbin.Player;
+ playerview = Config.GUIToolkit.GetPlayerView ();
+ playerbox.PackEnd (playerview as Gtk.Widget);
+ (playerview as Gtk.Widget).ShowAll ();
+ Player = playerview.Player;
}
protected override void OnDestroyed ()
{
- playerbin.Destroy ();
+ (playerview as Gtk.Widget).Destroy ();
capturerbin.Destroy ();
base.OnDestroyed ();
}
@@ -58,7 +62,7 @@ namespace LongoMatch.Gui
}
get {
- return playerbin.Player;
+ return playerview.Player;
}
}
@@ -76,7 +80,7 @@ namespace LongoMatch.Gui
} else {
ShowCapturer ();
}
- playerbin.Mode = value;
+ playerview.Mode = value;
Log.Debug ("CapturerPlayer setting mode " + value);
backLoaded = false;
}
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerView.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerView.cs
index 913eace..09b013b 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerView.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerView.cs
@@ -25,6 +25,7 @@ using Gtk;
using LongoMatch.Core.Common;
using LongoMatch.Core.Handlers;
using LongoMatch.Core.Interfaces;
+using LongoMatch.Core.Interfaces.GUI;
using LongoMatch.Core.Store;
using LongoMatch.Core.Store.Playlists;
using LongoMatch.Drawing.Cairo;
@@ -40,7 +41,7 @@ namespace LongoMatch.Gui
[System.ComponentModel.Category ("LongoMatch")]
[System.ComponentModel.ToolboxItem (true)]
- public partial class PlayerView : Gtk.Bin
+ public partial class PlayerView : Gtk.Bin, IPlayerView
{
const int SCALE_FPS = 25;
IPlayerController player;
@@ -116,6 +117,12 @@ namespace LongoMatch.Gui
#region Properties
+ public bool SupportsMultipleCameras {
+ get {
+ return false;
+ }
+ }
+
public IPlayerController Player {
get {
return player;
diff --git a/LongoMatch.GUI.Multimedia/Makefile.am b/LongoMatch.GUI.Multimedia/Makefile.am
index 51c1bfb..b9bb2e6 100644
--- a/LongoMatch.GUI.Multimedia/Makefile.am
+++ b/LongoMatch.GUI.Multimedia/Makefile.am
@@ -4,16 +4,16 @@ TARGET = library
LINK = $(REF_DEP_LONGOMATCH_GUI_MULTIMEDIA)
SOURCES = Gui/CapturerBin.cs \
- Gui/PlayerBin.cs \
Gui/PlayerCapturerBin.cs \
+ Gui/PlayerView.cs \
Gui/Utils/FramesCapturer.cs \
Gui/Utils/Remuxer.cs \
Gui/VideoWindow.cs \
Gui/VolumeWindow.cs \
MultimediaToolkit.cs \
gtk-gui/LongoMatch.Gui.CapturerBin.cs \
- gtk-gui/LongoMatch.Gui.PlayerBin.cs \
gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs \
+ gtk-gui/LongoMatch.Gui.PlayerView.cs \
gtk-gui/LongoMatch.Gui.VideoWindow.cs \
gtk-gui/LongoMatch.Gui.VolumeWindow.cs \
gtk-gui/generated.cs
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
index 9fb3640..9617b2c 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
@@ -14,8 +14,6 @@ namespace LongoMatch.Gui
private global::Gtk.Label replaylabel;
- private global::LongoMatch.Gui.PlayerView playerbin;
-
private global::Gtk.VBox capturerbox;
private global::Gtk.HBox livebox;
@@ -67,16 +65,9 @@ namespace LongoMatch.Gui
w3.Position = 0;
w3.Expand = false;
w3.Fill = false;
- // Container child playerbox.Gtk.Box+BoxChild
- this.playerbin = new global::LongoMatch.Gui.PlayerView ();
- this.playerbin.Events = ((global::Gdk.EventMask)(256));
- this.playerbin.Name = "playerbin";
- this.playerbox.Add (this.playerbin);
- global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.playerbox
[this.playerbin]));
- w4.Position = 1;
this.hbox4.Add (this.playerbox);
- global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox4
[this.playerbox]));
- w5.Position = 0;
+ global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox4
[this.playerbox]));
+ w4.Position = 0;
// Container child hbox4.Gtk.Box+BoxChild
this.capturerbox = new global::Gtk.VBox ();
this.capturerbox.Name = "capturerbox";
@@ -89,35 +80,35 @@ namespace LongoMatch.Gui
this.liveimage = new global::Gtk.Image ();
this.liveimage.Name = "liveimage";
this.livebox.Add (this.liveimage);
- global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.livebox
[this.liveimage]));
- w6.Position = 0;
- w6.Expand = false;
- w6.Fill = false;
+ global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.livebox
[this.liveimage]));
+ w5.Position = 0;
+ w5.Expand = false;
+ w5.Fill = false;
// Container child livebox.Gtk.Box+BoxChild
this.livelabel = new global::Gtk.Label ();
this.livelabel.Name = "livelabel";
this.livelabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Live");
this.livebox.Add (this.livelabel);
- global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.livebox
[this.livelabel]));
- w7.Position = 1;
+ global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.livebox
[this.livelabel]));
+ w6.Position = 1;
+ w6.Expand = false;
+ w6.Fill = false;
+ this.capturerbox.Add (this.livebox);
+ global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.capturerbox
[this.livebox]));
+ w7.Position = 0;
w7.Expand = false;
w7.Fill = false;
- this.capturerbox.Add (this.livebox);
- global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.capturerbox
[this.livebox]));
- w8.Position = 0;
- w8.Expand = false;
- w8.Fill = false;
// Container child capturerbox.Gtk.Box+BoxChild
this.capturerbin = new global::LongoMatch.Gui.CapturerBin ();
this.capturerbin.Events = ((global::Gdk.EventMask)(256));
this.capturerbin.Name = "capturerbin";
this.capturerbin.Capturing = false;
this.capturerbox.Add (this.capturerbin);
- global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.capturerbox
[this.capturerbin]));
- w9.Position = 1;
+ global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.capturerbox
[this.capturerbin]));
+ w8.Position = 1;
this.hbox4.Add (this.capturerbox);
- global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox4
[this.capturerbox]));
- w10.Position = 1;
+ global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox4
[this.capturerbox]));
+ w9.Position = 1;
this.Add (this.hbox4);
if ((this.Child != null)) {
this.Child.ShowAll ();
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
index c9b72b1..13c7fa0 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
@@ -845,14 +845,7 @@
</packing>
</child>
<child>
- <widget class="LongoMatch.Gui.PlayerBin" id="playerbin">
- <property name="MemberName" />
- <property name="Events">ButtonPressMask</property>
- </widget>
- <packing>
- <property name="Position">1</property>
- <property name="AutoSize">True</property>
- </packing>
+ <placeholder />
</child>
</widget>
<packing>
diff --git a/LongoMatch.GUI/Gui/GUIToolkit.cs b/LongoMatch.GUI/Gui/GUIToolkit.cs
index aa64eb4..a0d9d87 100644
--- a/LongoMatch.GUI/Gui/GUIToolkit.cs
+++ b/LongoMatch.GUI/Gui/GUIToolkit.cs
@@ -88,6 +88,11 @@ namespace LongoMatch.Gui
registry.Register (priority, interfac, elementType);
}
+ public IPlayerView GetPlayerView ()
+ {
+ return registry.GetDefault<IPlayerView> (typeof(IPlayerView));
+ }
+
public void InfoMessage (string message, object parent = null)
{
if (parent == null)
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 71075a3..4de4997 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -27,6 +27,7 @@ using LongoMatch.Gui;
using LongoMatch.Gui.Dialog;
using LongoMatch.Gui.Helpers;
using LongoMatch.Core.Interfaces.Multimedia;
+using LongoMatch.Core.Interfaces.GUI;
using LongoMatch.Multimedia.Utils;
using LongoMatch.Services;
using LongoMatch.Video;
@@ -61,6 +62,8 @@ namespace LongoMatch
bool haveCodecs = AddinsManager.RegisterGStreamerPlugins ();
AddinsManager.LoadExportProjectAddins (Config.GUIToolkit.MainController);
AddinsManager.LoadMultimediaBackendsAddins (Config.MultimediaToolkit);
+ AddinsManager.LoadUIBackendsAddins (Config.GUIToolkit);
+ Config.GUIToolkit.Register (0, typeof(IPlayerView), typeof(PlayerView));
if (!haveCodecs) {
CodecsChoiceDialog ccd = new CodecsChoiceDialog ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]