[banshee/windows: 6/7] Only run gst path setup fu when on Windows



commit 2cec5b2ade7d81ccc70c268b987e9d17f599b746
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Apr 29 18:12:55 2009 -0500

    Only run gst path setup fu when on Windows
---
 libbanshee/banshee-gst.h                           |    5 +++
 libbanshee/banshee-player-private.h                |    6 +++
 .../Banshee.GStreamer/Banshee.GStreamer/Service.cs |   38 ++++++++++---------
 .../Banshee.Core/Banshee.Base/PlatformHacks.cs     |    7 ++++
 4 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/libbanshee/banshee-gst.h b/libbanshee/banshee-gst.h
index 3e21455..85662cf 100644
--- a/libbanshee/banshee-gst.h
+++ b/libbanshee/banshee-gst.h
@@ -31,7 +31,12 @@
 
 #include <glib.h>
 
+#ifdef WIN32
 #define MYEXPORT __declspec(dllexport)
+#else
+#define MYEXPORT
+#endif
+
 
 #define BANSHEE_GST_ITERATOR_ITERATE(iter,child_type,child_name,free,block) { \
     gboolean iter##_done = FALSE; \
diff --git a/libbanshee/banshee-player-private.h b/libbanshee/banshee-player-private.h
index 2265080..9ebdde6 100644
--- a/libbanshee/banshee-player-private.h
+++ b/libbanshee/banshee-player-private.h
@@ -53,8 +53,14 @@
 
 #include "banshee-gst.h"
 
+#ifdef WIN32
 #define P_INVOKE __declspec(dllexport)
 #define MYEXPORT __declspec(dllexport)
+#else
+#define P_INVOKE
+#define MYEXPORT
+#endif
+
 #define IS_BANSHEE_PLAYER(e) (e != NULL)
 #define SET_CALLBACK(cb_name) { if(player != NULL) { player->cb_name = cb; } }
 
diff --git a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
index 8504748..c4ebf3c 100644
--- a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
+++ b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
@@ -58,27 +58,29 @@ namespace Banshee.GStreamer
                 native_log_handler = new BansheeLogHandler (NativeLogHandler);
             }
             
-            string [] gst_paths = new String [] {
-            	//"C:\\Program Files\\Songbird\\gst-plugins"
-            	//"/Documents and Settings/Administrator/Desktop/Code/deps/gst-plugins-base/lib/",
-            	//"/Documents and Settings/Administrator/Desktop/Code/deps/gst-plugins-base/lib/gstreamer-0.10/"
-            	//"C:\\Documents and Settings\\Administrator\\Desktop\\Code\\deps\\gst-plugins-base\\lib",
-            	"..\\..\\deps\\gst-plugins-base\\lib"
-            };
-            
-            System.Environment.SetEnvironmentVariable ("GST_PLUGIN_PATH", String.Join (";", gst_paths));
-            System.Environment.SetEnvironmentVariable ("GST_PLUGIN_SYSTEM_PATH", "");
-            System.Environment.SetEnvironmentVariable ("GST_DEBUG", "4");
-            /*string registry = "C:\\Documents and Settings\\Administrator\\Desktop\\Code\\banshee.git\\bin\\registry.bin";
-            if (!System.IO.File.Exists (registry))
-            	System.IO.File.Create (registry).Close ();
-            System.Environment.SetEnvironmentVariable ("GST_REGISTRY", registry);*/
-            //System.Environment.SetEnvironmentVariable ("GST_REGISTRY_FORK", "no");
-            Console.WriteLine ("GST_PLUGIN_PATH = {0}", System.Environment.GetEnvironmentVariable ("GST_PLUGIN_PATH"));
+            // Setup the gst plugins/registry paths if running Windows
+            if (!Banshee.Base.PlatformHacks.IsRunningUnix) {
+                string [] gst_paths = new String [] {
+                    "..\\..\\deps\\gst-plugins-base\\lib"
+                };
+            
+                System.Environment.SetEnvironmentVariable ("GST_PLUGIN_PATH", String.Join (";", gst_paths));
+                System.Environment.SetEnvironmentVariable ("GST_PLUGIN_SYSTEM_PATH", "");
+                System.Environment.SetEnvironmentVariable ("GST_DEBUG", "4");
+
+                string registry = "registry.bin";
+                if (!System.IO.File.Exists (registry)) {
+                    System.IO.File.Create (registry).Close ();
+                }
+
+                System.Environment.SetEnvironmentVariable ("GST_REGISTRY", registry);
+
+                //System.Environment.SetEnvironmentVariable ("GST_REGISTRY_FORK", "no");
+                Console.WriteLine ("GST_PLUGIN_PATH = {0}", System.Environment.GetEnvironmentVariable ("GST_PLUGIN_PATH"));
+            }
+
             gstreamer_initialize (debugging, native_log_handler);
             
-            System.Environment.Exit (0);
-            
             MediaProfileManager profile_manager = ServiceManager.MediaProfileManager;
             if (profile_manager != null) {
                 Pipeline.AddSExprFunction ("gst-element-is-available", SExprTestElement);
diff --git a/src/Core/Banshee.Core/Banshee.Base/PlatformHacks.cs b/src/Core/Banshee.Core/Banshee.Base/PlatformHacks.cs
index d11073e..2a4357e 100644
--- a/src/Core/Banshee.Core/Banshee.Base/PlatformHacks.cs
+++ b/src/Core/Banshee.Core/Banshee.Base/PlatformHacks.cs
@@ -34,6 +34,13 @@ namespace Banshee.Base
 {
     public static class PlatformHacks
     {
+        public static bool IsRunningUnix {
+            get {
+                int p = (int) System.Environment.OSVersion.Platform;
+                return (p == 4) || (p == 6) || (p == 128);
+            }
+        }
+
         // For the SEGV trap hack (see below)
         [DllImport ("libc")]
         private static extern int sigaction (Mono.Unix.Native.Signum sig, IntPtr act, IntPtr oact);



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