[longomatch] Add support for plugins registering GStreamer elements



commit 1471071cf9eeb7181b079ec3dd9662e11122985e
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Sep 24 21:33:46 2014 +0200

    Add support for plugins registering GStreamer elements

 LongoMatch.Addins/AddinsManager.cs                 |   15 ++++++++++
 .../ExtensionPoints/IGStreamerPluginsProvider.cs   |   28 ++++++++++++++++++++
 LongoMatch.Addins/LongoMatch.Addins.csproj         |    1 +
 LongoMatch/Main.cs                                 |    1 +
 4 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Addins/AddinsManager.cs b/LongoMatch.Addins/AddinsManager.cs
index 8120bed..1c153a0 100644
--- a/LongoMatch.Addins/AddinsManager.cs
+++ b/LongoMatch.Addins/AddinsManager.cs
@@ -37,6 +37,21 @@ namespace LongoMatch.Addins
                        AddinManager.Registry.Update ();
                }
 
+               public bool RegisterGStreamerPlugins ()
+               {
+                       IGStreamerPluginsProvider[] gstPluginsProvider = 
AddinManager.GetExtensionObjects<IGStreamerPluginsProvider> ();
+                       
+                       if (gstPluginsProvider.Length == 0) {
+                               return false;
+                       }
+
+                       foreach (IGStreamerPluginsProvider provider in gstPluginsProvider) {
+                               Log.Information ("Registering GStreamer plugins from plugin: " + 
provider.Name);
+                               provider.RegisterPlugins ();
+                       }
+                       return true; 
+               }
+
                public void LoadConfigModifierAddins ()
                {
                        foreach (IConfigModifier configModifier in 
AddinManager.GetExtensionObjects<IConfigModifier> ()) {
diff --git a/LongoMatch.Addins/ExtensionPoints/IGStreamerPluginsProvider.cs 
b/LongoMatch.Addins/ExtensionPoints/IGStreamerPluginsProvider.cs
new file mode 100644
index 0000000..c11ed8e
--- /dev/null
+++ b/LongoMatch.Addins/ExtensionPoints/IGStreamerPluginsProvider.cs
@@ -0,0 +1,28 @@
+//
+//  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 Mono.Addins;
+
+namespace LongoMatch.Addins.ExtensionPoints
+{
+       [TypeExtensionPoint]
+       public interface IGStreamerPluginsProvider: ILongoMatchPlugin
+       {
+               void RegisterPlugins ();
+       }
+}
+
diff --git a/LongoMatch.Addins/LongoMatch.Addins.csproj b/LongoMatch.Addins/LongoMatch.Addins.csproj
index d9220f2..0eebc22 100644
--- a/LongoMatch.Addins/LongoMatch.Addins.csproj
+++ b/LongoMatch.Addins/LongoMatch.Addins.csproj
@@ -33,6 +33,7 @@
     <Compile Include="ExtensionPoints\IImportProject.cs" />
     <Compile Include="ExtensionPoints\IMultimediaBackend.cs" />
     <Compile Include="ExtensionPoints\ILongoMatchPlugin.cs" />
+    <Compile Include="ExtensionPoints\IGStreamerPluginsProvider.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="Mono.Addins, Version=0.6.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index bbf18c2..3c0e7cb 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -54,6 +54,7 @@ namespace LongoMatch
                        try {
                                manager = new AddinsManager (Config.PluginsConfigDir, Config.PluginsDir);
                                manager.LoadConfigModifierAddins ();
+                               manager.RegisterGStreamerPlugins ();
                                Config.DrawingToolkit = new CairoBackend ();
                                Config.EventsBroker = new EventsBroker ();
                                IMultimediaToolkit multimediaToolkit = new MultimediaToolkit ();


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