[banshee/gst#: 2/2] [gst#] Actually plays, reports position/length



commit 61022a19c584e527d8d1f245fe71f79af42a5f6a
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Sat Mar 13 14:27:49 2010 -0800

    [gst#] Actually plays, reports position/length

 Banshee.sln                                        |    9 +-
 build/m4/banshee/gstreamer-sharp.m4                |    6 +
 configure.ac                                       |    3 +
 data/addin-xml-strings.cs                          |    3 +
 .../Banshee.GStreamerSharp.csproj                  |    2 +-
 .../Banshee.GStreamerSharp/PlayerEngine.cs         |   98 +++++++++++++++++++-
 src/Backends/Banshee.GStreamerSharp/Makefile.am    |    2 +-
 src/Backends/Makefile.am                           |    1 +
 8 files changed, 118 insertions(+), 6 deletions(-)
---
diff --git a/Banshee.sln b/Banshee.sln
index 6b6b1d4..b9d3aef 100644
--- a/Banshee.sln
+++ b/Banshee.sln
@@ -176,6 +176,8 @@ Global
 		{05148D80-6C5C-4BE5-9BD7-89613753D027}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{0AB92BF8-3A25-46AD-9748-1236471E9408}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{0AB92BF8-3A25-46AD-9748-1236471E9408}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0AB92BF8-3A25-46AD-9748-1236471E9408}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+		{0AB92BF8-3A25-46AD-9748-1236471E9408}.Release|Any CPU.Build.0 = Debug|Any CPU
 		{0AB92BF8-3A25-46AD-9748-1236471E9408}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
 		{0AB92BF8-3A25-46AD-9748-1236471E9408}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{0DF72691-E61C-4E9C-A1F1-2F7F17958630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -258,7 +260,6 @@ Global
 		{6171E5DE-5B36-4AE4-8707-F6BEE0AD945B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{6171E5DE-5B36-4AE4-8707-F6BEE0AD945B}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{6171E5DE-5B36-4AE4-8707-F6BEE0AD945B}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
-		{6171E5DE-5B36-4AE4-8707-F6BEE0AD945B}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{6B73E278-23FB-4A59-9B44-AB7F0212B936}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{6B73E278-23FB-4A59-9B44-AB7F0212B936}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{6B73E278-23FB-4A59-9B44-AB7F0212B936}.Release|Any CPU.ActiveCfg = Debug|Any CPU
@@ -290,6 +291,8 @@ Global
 		{95374549-9553-4C1E-9D89-667755F90E12}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{9A5328D7-B7FB-4966-BF03-A4BA541541F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{9A5328D7-B7FB-4966-BF03-A4BA541541F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9A5328D7-B7FB-4966-BF03-A4BA541541F5}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+		{9A5328D7-B7FB-4966-BF03-A4BA541541F5}.Release|Any CPU.Build.0 = Debug|Any CPU
 		{9A5328D7-B7FB-4966-BF03-A4BA541541F5}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
 		{9A5328D7-B7FB-4966-BF03-A4BA541541F5}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{9C7B8E9C-A4E6-4459-A2C4-3D2D199EA919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -323,8 +326,8 @@ Global
 		{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}.Release|Any CPU.Build.0 = Release|Any CPU
-		{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}.Windows|Any CPU.ActiveCfg = Debug|Any CPU
-		{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}.Windows|Any CPU.Build.0 = Debug|Any CPU
+		{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
+		{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{BB1D1D81-7A74-4183-B7B1-3E78B32D42F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{BB1D1D81-7A74-4183-B7B1-3E78B32D42F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{BB1D1D81-7A74-4183-B7B1-3E78B32D42F1}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
diff --git a/build/m4/banshee/gstreamer-sharp.m4 b/build/m4/banshee/gstreamer-sharp.m4
new file mode 100644
index 0000000..1eaa02e
--- /dev/null
+++ b/build/m4/banshee/gstreamer-sharp.m4
@@ -0,0 +1,6 @@
+AC_DEFUN([BANSHEE_CHECK_GSTREAMER_SHARP],
+[
+	PKG_CHECK_MODULES(GST_SHARP, gstreamer-sharp-0.10)
+	AC_SUBST(GST_SHARP_LIBS)
+])
+
diff --git a/configure.ac b/configure.ac
index c2d63b1..0ee6aeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,9 @@ dnl libbanshee/native dependencies (required)
 BANSHEE_CHECK_LIBBANSHEE
 BANSHEE_CHECK_GSTREAMER
 
+dnl For the new media backend using gstreamer-sharp
+BANSHEE_CHECK_GSTREAMER_SHARP
+
 BANSHEE_CHECK_NOW_PLAYING_X11
 
 dnl Mono and gmcs
diff --git a/data/addin-xml-strings.cs b/data/addin-xml-strings.cs
index 286261c..91952db 100644
--- a/data/addin-xml-strings.cs
+++ b/data/addin-xml-strings.cs
@@ -13,6 +13,9 @@ internal static class AddinXmlStringCatalog
         // ../src/Backends/Banshee.GStreamer/Banshee.GStreamer.addin.xml
         Catalog.GetString (@"GStreamer multimedia services including playback, CD ripping, and transcoding.");
 
+        // ../src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp.addin.xml
+        Catalog.GetString (@"GStreamer multimedia services including playback, CD ripping, and transcoding.");
+
         // ../src/Backends/Banshee.Hal/Banshee.Hal.addin.xml
         Catalog.GetString (@"Provides hardware support through HAL.");
 
diff --git a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp.csproj b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp.csproj
index 784608f..7b0eaec 100644
--- a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp.csproj
+++ b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp.csproj
@@ -1 +1 @@
-<?xml version="1.0" encoding="utf-8"?><Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>  <PropertyGroup>    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>    <ProductVersion>9.0.21022</ProductVersion>    <SchemaVersion>2.0</SchemaVersion>    <ProjectGuid>{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}</ProjectGuid>    <OutputType>Library</OutputType>    <RootNamespace>Banshee.GStreamerSharp</RootNamespace>    <ReleaseVersion>1.3</ReleaseVersion>    <AssemblyName>Banshee.GStreamerSharp</AssemblyName>    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>  </PropertyGroup>  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">    <DebugSymbols>true</DebugSymbols>    <DebugType>full</DebugType>    <Optimize>false</Optimize>    <OutputPath>bin\Debug</OutputPath>    <DefineConstants>DEBUG</
 DefineConstants>    <ErrorReport>prompt</ErrorReport>    <WarningLevel>4</WarningLevel>    <ConsolePause>false</ConsolePause>  </PropertyGroup>  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">    <DebugType>none</DebugType>    <Optimize>false</Optimize>    <OutputPath>bin\Release</OutputPath>    <ErrorReport>prompt</ErrorReport>    <WarningLevel>4</WarningLevel>    <ConsolePause>false</ConsolePause>  </PropertyGroup>  <ItemGroup>    <Reference Include="System" />    <Reference Include="gstreamer-sharp, Version=0.9.3.0, Culture=neutral, PublicKeyToken=4956b48baf980190" />    <Reference Include="System.Core" />    <Reference Include="Mono.Posix" />  </ItemGroup>  <ItemGroup>    <ProjectReference Include="..\..\Core\Banshee.Services\Banshee.Services.csproj">      <Project>{B28354F0-BA87-44E8-989F-B864A3C7C09F}</Project>      <Name>Banshee.Services</Name>    </ProjectReference>    <ProjectReference Include="..\..\Libraries
 \Hyena\Hyena.csproj">      <Project>{95374549-9553-4C1E-9D89-667755F90E12}</Project>      <Name>Hyena</Name>    </ProjectReference>    <ProjectReference Include="..\..\Core\Banshee.Core\Banshee.Core.csproj">      <Project>{2ADB831A-A050-47D0-B6B9-9C19D60233BB}</Project>      <Name>Banshee.Core</Name>    </ProjectReference>  </ItemGroup>  <ItemGroup>    <EmbeddedResource Include="Banshee.GStreamerSharp.addin.xml" />  </ItemGroup>  <ItemGroup>    <Folder Include="Banshee.GStreamerSharp\" />  </ItemGroup>  <ItemGroup>    <Compile Include="Banshee.GStreamerSharp\PlayerEngine.cs" />  </ItemGroup>  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /></Project>
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?><Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>  <PropertyGroup>    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>    <ProductVersion>9.0.21022</ProductVersion>    <SchemaVersion>2.0</SchemaVersion>    <ProjectGuid>{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}</ProjectGuid>    <OutputType>Library</OutputType>    <RootNamespace>Banshee.GStreamerSharp</RootNamespace>    <ReleaseVersion>1.3</ReleaseVersion>    <AssemblyName>Banshee.GStreamerSharp</AssemblyName>    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>  </PropertyGroup>  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">    <DebugSymbols>true</DebugSymbols>    <DebugType>full</DebugType>    <Optimize>false</Optimize>    <OutputPath>bin\Debug</OutputPath>    <DefineConstants>DEBUG</
 DefineConstants>    <ErrorReport>prompt</ErrorReport>    <WarningLevel>4</WarningLevel>    <ConsolePause>false</ConsolePause>  </PropertyGroup>  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows|AnyCPU' ">    <DebugType>none</DebugType>    <Optimize>false</Optimize>    <OutputPath>bin\Windows</OutputPath>    <DefineConstants>HAVE_GST_SHARP</DefineConstants>    <ErrorReport>prompt</ErrorReport>    <WarningLevel>4</WarningLevel>  </PropertyGroup>  <ItemGroup>    <Reference Include="System" />    <Reference Include="gstreamer-sharp, Version=0.9.3.0, Culture=neutral, PublicKeyToken=4956b48baf980190" />    <Reference Include="System.Core" />    <Reference Include="Mono.Posix" />  </ItemGroup>  <ItemGroup>    <ProjectReference Include="..\..\Core\Banshee.Services\Banshee.Services.csproj">      <Project>{B28354F0-BA87-44E8-989F-B864A3C7C09F}</Project>      <Name>Banshee.Services</Name>    </ProjectReference>    <ProjectReference Include="
 ..\..\Libraries\Hyena\Hyena.csproj">      <Project>{95374549-9553-4C1E-9D89-667755F90E12}</Project>      <Name>Hyena</Name>    </ProjectReference>    <ProjectReference Include="..\..\Core\Banshee.Core\Banshee.Core.csproj">      <Project>{2ADB831A-A050-47D0-B6B9-9C19D60233BB}</Project>      <Name>Banshee.Core</Name>    </ProjectReference>  </ItemGroup>  <ItemGroup>    <EmbeddedResource Include="Banshee.GStreamerSharp.addin.xml" />  </ItemGroup>  <ItemGroup>    <Folder Include="Banshee.GStreamerSharp\" />  </ItemGroup>  <ItemGroup>    <Compile Include="Banshee.GStreamerSharp\PlayerEngine.cs" />  </ItemGroup>  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /></Project>
\ No newline at end of file
diff --git a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
index c8f959c..5c913d6 100644
--- a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
+++ b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
@@ -26,6 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if HAVE_GST_SHARP
+
 using System;
 using System.Collections;
 using System.Runtime.InteropServices;
@@ -34,6 +36,7 @@ using System.Threading;
 using Mono.Unix;
 
 using Gst;
+using Gst.BasePlugins;
 
 using Hyena;
 using Hyena.Data;
@@ -49,6 +52,99 @@ namespace Banshee.GStreamerSharp
 {
     public class PlayerEngine : Banshee.MediaEngine.PlayerEngine
     {
-        //override
+        Pipeline pipeline;
+        PlayBin2 playbin;
+
+        public PlayerEngine ()
+        {
+            Console.WriteLine ("Gst# PlayerEngine ctor - completely experimental, still a WIP");
+            Gst.Application.Init ();
+            pipeline = new Pipeline ();
+            playbin = new PlayBin2 ();
+            pipeline.Add (playbin);
+
+            Banshee.ServiceStack.Application.RunTimeout (200, delegate {
+                OnEventChanged (PlayerEvent.Iterate);
+                return true;
+            });
+
+            OnStateChanged (PlayerState.Ready);
+        }
+
+        protected override void OpenUri (SafeUri uri)
+        {
+            Console.WriteLine ("Gst# PlayerEngine OpenUri: {0}", uri);
+            playbin.Uri = uri.AbsoluteUri;
+        }
+
+        public override void Play ()
+        {
+            Console.WriteLine ("Gst# PlayerEngine play");
+            pipeline.SetState (Gst.State.Playing);
+            OnStateChanged (PlayerState.Playing);
+        }
+
+        public override void Pause ()
+        {
+            Console.WriteLine ("Gst# PlayerEngine pause");
+            pipeline.SetState (Gst.State.Paused);
+            OnStateChanged (PlayerState.Paused);
+        }
+
+        public override ushort Volume {
+            get { return (ushort) Math.Round (playbin.Volume * 100.0); }
+            set { playbin.Volume = (value / 100.0); }
+        }
+
+        public override bool CanSeek {
+            get { return true; }
+        }
+
+        private static Format query_format = Format.Time;
+        public override uint Position {
+            get {
+                long pos;
+                playbin.QueryPosition (ref query_format, out pos);
+                return (uint) ((ulong)pos / Gst.Clock.MSecond);
+            }
+            set {
+                playbin.Seek (Format.Time, SeekFlags.Accurate, (long)(value * Gst.Clock.MSecond));
+            }
+        }
+
+        public override uint Length {
+            get {
+                long duration;
+                playbin.QueryDuration (ref query_format, out duration);
+                return (uint) ((ulong)duration / Gst.Clock.MSecond);
+            }
+        }
+
+        private static string [] source_capabilities = { "file", "http", "cdda" };
+        public override IEnumerable SourceCapabilities {
+            get { return source_capabilities; }
+        }
+
+        private static string [] decoder_capabilities = { "ogg", "wma", "asf", "flac", "mp3", "" };
+        public override IEnumerable ExplicitDecoderCapabilities {
+            get { return decoder_capabilities; }
+        }
+
+        public override string Id {
+            get { return "gstreamer-sharp"; }
+        }
+
+        public override string Name {
+            get { return Catalog.GetString ("GStreamer# 0.10"); }
+        }
+
+        public override bool SupportsEqualizer {
+            get { return false; }
+        }
+
+        public override VideoDisplayContextType VideoDisplayContextType {
+            get { return VideoDisplayContextType.Unsupported; }
+        }
     }
 }
+#endif
\ No newline at end of file
diff --git a/src/Backends/Banshee.GStreamerSharp/Makefile.am b/src/Backends/Banshee.GStreamerSharp/Makefile.am
index d5df468..358ea1b 100644
--- a/src/Backends/Banshee.GStreamerSharp/Makefile.am
+++ b/src/Backends/Banshee.GStreamerSharp/Makefile.am
@@ -1,6 +1,6 @@
 ASSEMBLY = Banshee.GStreamerSharp
 TARGET = library
-LINK = $(REF_BACKEND_GSTREAMER)
+LINK = $(REF_BACKEND_GSTREAMER) $(GST_SHARP_LIBS)
 SOURCES =  \
 	Banshee.GStreamerSharp/PlayerEngine.cs
 
diff --git a/src/Backends/Makefile.am b/src/Backends/Makefile.am
index c7859a3..f1593a0 100644
--- a/src/Backends/Makefile.am
+++ b/src/Backends/Makefile.am
@@ -3,6 +3,7 @@ SUBDIRS = \
 	Banshee.Gio \
 	Banshee.Gnome \
 	Banshee.GStreamer \
+	Banshee.GStreamerSharp \
 	Banshee.Unix \
 	Banshee.NowPlaying.X11 \
 	Banshee.Osx



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