banshee r4172 - in trunk/banshee: . gstreamer/equalizer libbanshee src/Core/Banshee.Core/Resources src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Resources



Author: abock
Date: Thu Jun 19 17:02:07 2008
New Revision: 4172
URL: http://svn.gnome.org/viewvc/banshee?rev=4172&view=rev

Log:
2008-06-19  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs:
    * src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml:
    Enabled the equalizer again in the UI

    * gstreamer/equalizer/gstiirequalizer.c:
    * gstreamer/equalizer/remove-n-and-3-bands.diff: Rename the built-in
    equalizer element 'banshee-equalizer' so we don't have to do as much
    inspection at runtime to figure out if the element is built-in or not

    * libbanshee/banshee-player-equalizer.c: Added a _bp_equalizer_new function
    that will always return a non-buggy equalizer or NULL; that is, it will
    check to see if the built-in equalizer is available, and if not, if
    the system equalizer is available /and/ is 0.10.9 or newer; the detection
    state is saved so the probing only needs to be done once

    * libbanshee/banshee-player-pipeline.c: Use _bp_equalizer_new and only
    create the other elements if we were actually given an equalizer (instead
    of always creating the other elements and unreffing if the equalizer was
    not returned)

    * libbanshee/banshee-player-equalizer.h: Expose _bp_equalizer_new    

    * libbanshee/banshee-player-private.h: Added a equalizer_status field to
    the private player structure

    * src/Core/Banshee.Core/Resources/translators.xml: Updated



Added:
   trunk/banshee/libbanshee/banshee-player-equalizer.h
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/gstreamer/equalizer/gstiirequalizer.c
   trunk/banshee/gstreamer/equalizer/remove-n-and-3-bands.diff
   trunk/banshee/libbanshee/Makefile.am
   trunk/banshee/libbanshee/banshee-player-equalizer.c
   trunk/banshee/libbanshee/banshee-player-pipeline.c
   trunk/banshee/libbanshee/banshee-player-private.h
   trunk/banshee/libbanshee/libbanshee.mdp
   trunk/banshee/src/Core/Banshee.Core/Resources/translators.xml
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml

Modified: trunk/banshee/gstreamer/equalizer/gstiirequalizer.c
==============================================================================
--- trunk/banshee/gstreamer/equalizer/gstiirequalizer.c	(original)
+++ trunk/banshee/gstreamer/equalizer/gstiirequalizer.c	Thu Jun 19 17:02:07 2008
@@ -723,7 +723,7 @@
 {
   GST_DEBUG_CATEGORY_INIT (equalizer_debug, "equalizer", 0, "equalizer");
 
-  if (!(gst_element_register (plugin, "equalizer-10bands", GST_RANK_NONE,
+  if (!(gst_element_register (plugin, "banshee-equalizer", GST_RANK_NONE,
               GST_TYPE_IIR_EQUALIZER_10BANDS)))
     return FALSE;
 

Modified: trunk/banshee/gstreamer/equalizer/remove-n-and-3-bands.diff
==============================================================================
--- trunk/banshee/gstreamer/equalizer/remove-n-and-3-bands.diff	(original)
+++ trunk/banshee/gstreamer/equalizer/remove-n-and-3-bands.diff	Thu Jun 19 17:02:07 2008
@@ -1,5 +1,5 @@
---- gstiirequalizer.c.orig	2008-06-18 17:21:37.000000000 -0400
-+++ gstiirequalizer.c	2008-06-18 17:20:51.000000000 -0400
+--- gstiirequalizer.c.orig	2008-06-19 12:45:46.000000000 -0400
++++ gstiirequalizer.c	2008-06-19 12:45:58.000000000 -0400
 @@ -27,8 +27,6 @@
  #include <string.h>
  
@@ -9,7 +9,7 @@
  #include "gstiirequalizer10bands.h"
  
  GST_DEBUG_CATEGORY (equalizer_debug);
-@@ -725,14 +723,6 @@
+@@ -725,15 +723,7 @@
  {
    GST_DEBUG_CATEGORY_INIT (equalizer_debug, "equalizer", 0, "equalizer");
  
@@ -21,6 +21,8 @@
 -              GST_TYPE_IIR_EQUALIZER_3BANDS)))
 -    return FALSE;
 -
-   if (!(gst_element_register (plugin, "equalizer-10bands", GST_RANK_NONE,
+-  if (!(gst_element_register (plugin, "equalizer-10bands", GST_RANK_NONE,
++  if (!(gst_element_register (plugin, "banshee-equalizer", GST_RANK_NONE,
                GST_TYPE_IIR_EQUALIZER_10BANDS)))
      return FALSE;
+ 

Modified: trunk/banshee/libbanshee/Makefile.am
==============================================================================
--- trunk/banshee/libbanshee/Makefile.am	(original)
+++ trunk/banshee/libbanshee/Makefile.am	Thu Jun 19 17:02:07 2008
@@ -25,6 +25,7 @@
 noinst_HEADERS =  \
 	banshee-gst.h \
 	banshee-player-cdda.h \
+	banshee-player-equalizer.h \
 	banshee-player-missing-elements.h \
 	banshee-player-pipeline.h \
 	banshee-player-private.h \

Modified: trunk/banshee/libbanshee/banshee-player-equalizer.c
==============================================================================
--- trunk/banshee/libbanshee/banshee-player-equalizer.c	(original)
+++ trunk/banshee/libbanshee/banshee-player-equalizer.c	Thu Jun 19 17:02:07 2008
@@ -30,6 +30,68 @@
 
 #include "banshee-player-private.h"
 
+enum _BpEqStatus {
+    BP_EQ_STATUS_UNCHECKED,
+    BP_EQ_STATUS_DISABLED,
+    BP_EQ_STATUS_USE_BUILTIN,
+    BP_EQ_STATUS_USE_SYSTEM
+};
+
+// ---------------------------------------------------------------------------
+// Internal Functions
+// ---------------------------------------------------------------------------
+
+GstElement *
+_bp_equalizer_new (BansheePlayer *player)
+{
+    GstElement *equalizer;
+    
+    if (player->equalizer_status == BP_EQ_STATUS_DISABLED) {
+        return NULL;
+    }
+    
+    if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED || 
+        player->equalizer_status == BP_EQ_STATUS_USE_BUILTIN) {
+        equalizer = gst_element_factory_make ("banshee-equalizer", "banshee-equalizer");
+        if (equalizer != NULL) {
+            if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED) {
+                player->equalizer_status = BP_EQ_STATUS_USE_BUILTIN;
+                bp_debug ("Using built-in equalizer element");
+            }
+            
+            return equalizer;
+        }
+    }
+    
+    if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED || 
+        player->equalizer_status == BP_EQ_STATUS_USE_SYSTEM) {
+        equalizer = gst_element_factory_make ("equalizer-10bands", "equalizer-10bands");
+        if (equalizer != NULL) {
+            if (player->equalizer_status == BP_EQ_STATUS_USE_SYSTEM) {
+                return equalizer;
+            }
+            
+            GstElementFactory *efactory = gst_element_get_factory (equalizer);
+            if (gst_plugin_feature_check_version (GST_PLUGIN_FEATURE (efactory), 0, 10, 9)) {
+                bp_debug ("Using system (gst-plugins-good) equalizer element");
+                player->equalizer_status = BP_EQ_STATUS_USE_SYSTEM;
+                return equalizer;
+            }
+            
+            bp_debug ("Buggy system equalizer found. gst-plugins-good 0.10.9 or better "
+                "required, or build Banshee with the built-in equalizer.");
+            gst_object_unref (equalizer);
+        } else {
+            bp_debug ("No system equalizer found");
+        }
+    }
+    
+    bp_debug ("No suitable equalizer element could be found, disabling EQ for this session");
+    player->equalizer_status = BP_EQ_STATUS_DISABLED;
+    return NULL;
+}
+
+
 // ---------------------------------------------------------------------------
 // Public Functions
 // ---------------------------------------------------------------------------

Added: trunk/banshee/libbanshee/banshee-player-equalizer.h
==============================================================================
--- (empty file)
+++ trunk/banshee/libbanshee/banshee-player-equalizer.h	Thu Jun 19 17:02:07 2008
@@ -0,0 +1,36 @@
+//
+// banshee-player-equalizer.h
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#ifndef _BANSHEE_PLAYER_EQUALIZER_H
+#define _BANSHEE_PLAYER_EQUALIZER_H
+
+#include "banshee-player-private.h"
+
+GstElement * _bp_equalizer_new (BansheePlayer *player);
+
+#endif /* _BANSHEE_PLAYER_EQUALIZER_H */

Modified: trunk/banshee/libbanshee/banshee-player-pipeline.c
==============================================================================
--- trunk/banshee/libbanshee/banshee-player-pipeline.c	(original)
+++ trunk/banshee/libbanshee/banshee-player-pipeline.c	Thu Jun 19 17:02:07 2008
@@ -29,6 +29,7 @@
 #include "banshee-player-pipeline.h"
 #include "banshee-player-cdda.h"
 #include "banshee-player-video.h"
+#include "banshee-player-equalizer.h"
 #include "banshee-player-missing-elements.h"
 
 // ---------------------------------------------------------------------------
@@ -174,9 +175,8 @@
     GstPad *teepad;
     GstElement *audiosink;
     GstElement *audiosinkqueue;
-    //GstElement *audioconvert, *audioconvert2;
-    //GstElement *capsfilter = NULL;
-    //gboolean buggy_eq = FALSE;
+    GstElement *eq_audioconvert = NULL;
+    GstElement *eq_audioconvert2 = NULL;
     
     g_return_val_if_fail (IS_BANSHEE_PLAYER (player), FALSE);
     
@@ -213,46 +213,23 @@
     audiosinkqueue = gst_element_factory_make ("queue", "audiosinkqueue");
     g_return_val_if_fail (audiosinkqueue != NULL, FALSE);
 
-    /*audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");
-    audioconvert2 = gst_element_factory_make ("audioconvert", "audioconvert2");
-    player->equalizer = gst_element_factory_make ("equalizer-10bands", "equalizer-10bands");
-    player->preamp = gst_element_factory_make ("volume", "preamp");
-
-    // Workaround for equalizer bug that caused clipping when processing integer samples
+    player->equalizer = _bp_equalizer_new (player);
+    player->preamp = NULL;
     if (player->equalizer != NULL) {
-        GstElementFactory *efactory = gst_element_get_factory (player->equalizer);
-
-        buggy_eq = !gst_plugin_feature_check_version (GST_PLUGIN_FEATURE (efactory), 0, 10, 9);
-
-        if (buggy_eq) {
-            GstCaps *caps;
-
-            capsfilter = gst_element_factory_make ("capsfilter", "capsfilter");
-            caps = gst_caps_new_simple ("audio/x-raw-float", NULL);
-            g_object_set (capsfilter, "caps", caps, NULL);
-            gst_caps_unref (caps);
-        }
-    }*/
-
+        eq_audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");
+        eq_audioconvert2 = gst_element_factory_make ("audioconvert", "audioconvert2");
+        player->preamp = gst_element_factory_make ("volume", "preamp");
+    }
+    
     // Add elements to custom audio sink
     gst_bin_add (GST_BIN (player->audiobin), player->audiotee);
     
-    /*if (player->equalizer != NULL) {
-        gst_bin_add (GST_BIN (player->audiobin), audioconvert);
-        gst_bin_add (GST_BIN (player->audiobin), audioconvert2);
-
-        if (buggy_eq) {
-            gst_bin_add (GST_BIN (player->audiobin), capsfilter);
-        }
-        
+    if (player->equalizer != NULL) {
+        gst_bin_add (GST_BIN (player->audiobin), eq_audioconvert);
+        gst_bin_add (GST_BIN (player->audiobin), eq_audioconvert2);
         gst_bin_add (GST_BIN (player->audiobin), player->equalizer);
         gst_bin_add (GST_BIN (player->audiobin), player->preamp);
-    } else {
-        g_object_unref (player->preamp);
-        player->preamp = NULL;
-        g_object_unref (audioconvert);
-        g_object_unref (audioconvert2);
-    }*/
+    }
     
     gst_bin_add (GST_BIN (player->audiobin), audiosinkqueue);
     gst_bin_add (GST_BIN (player->audiobin), audiosink);
@@ -267,19 +244,14 @@
         gst_element_get_pad (audiosinkqueue, "sink"));
 
     // Link the queue and the actual audio sink
-    /*if (player->equalizer != NULL) {
+    if (player->equalizer != NULL) {
         // link in equalizer, preamp and audioconvert.
-        if (buggy_eq) {
-            gst_element_link_many (audiosinkqueue, audioconvert, player->preamp, 
-                player->equalizer, audioconvert2, audiosink, NULL);
-        } else {
-            gst_element_link_many (audiosinkqueue, audioconvert, capsfilter, 
-                player->preamp, player->equalizer, audioconvert2, audiosink, NULL);
-        }
-    } else {*/
+        gst_element_link_many (audiosinkqueue, eq_audioconvert, player->preamp, 
+            player->equalizer, eq_audioconvert2, audiosink, NULL);
+    } else {
         // link the queue with the real audio sink
         gst_element_link (audiosinkqueue, audiosink);
-    //}
+    }
     
     // Now that our internal audio sink is constructed, tell playbin to use it
     g_object_set (G_OBJECT (player->playbin), "audio-sink", player->audiobin, NULL);

Modified: trunk/banshee/libbanshee/banshee-player-private.h
==============================================================================
--- trunk/banshee/libbanshee/banshee-player-private.h	(original)
+++ trunk/banshee/libbanshee/banshee-player-private.h	Thu Jun 19 17:02:07 2008
@@ -81,6 +81,7 @@
     GstElement *audiobin;
     GstElement *equalizer;
     GstElement *preamp;
+    gint equalizer_status;
     
     // Pipeline/Playback State
     GMutex *mutex;

Modified: trunk/banshee/libbanshee/libbanshee.mdp
==============================================================================
--- trunk/banshee/libbanshee/libbanshee.mdp	(original)
+++ trunk/banshee/libbanshee/libbanshee.mdp	Thu Jun 19 17:02:07 2008
@@ -25,6 +25,7 @@
     <File name="banshee-tagger.c" subtype="Code" buildaction="Compile" />
     <File name="banshee-tagger.h" subtype="Code" buildaction="Nothing" />
     <File name="banshee-gst.h" subtype="Code" buildaction="Nothing" />
+    <File name="banshee-player-equalizer.h" subtype="Code" buildaction="Nothing" />
   </Contents>
   <compiler ctype="GccCompiler" />
   <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">

Modified: trunk/banshee/src/Core/Banshee.Core/Resources/translators.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Resources/translators.xml	(original)
+++ trunk/banshee/src/Core/Banshee.Core/Resources/translators.xml	Thu Jun 19 17:02:07 2008
@@ -39,6 +39,7 @@
   </language>
   <language code="es" name="Spanish">
     <person>Maria Majadas</person>
+    <person>BenjamÃn Valero Espinosa</person>
     <person>AndrÃs Herrera</person>
     <person>Jorge GonzÃlez</person>
     <person>Francisco Javier F. Serrador</person>
@@ -133,7 +134,7 @@
     <person>Clytie Siddall</person>
   </language>
   <language code="zh_CN" name="Simplified Chinese">
-    <person>Funda Wang</person>
+    <person>çé (Lu Gan)</person>
   </language>
   <language code="zh_HK" name="Chinese">
     <person>Hsin-lin Cheng</person>

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/ViewActions.cs	Thu Jun 19 17:02:07 2008
@@ -59,11 +59,11 @@
         {
             Add (new ActionEntry [] {
                 new ActionEntry ("ViewMenuAction", null,
-                    Catalog.GetString ("_View"), null, null, null)/*,
+                    Catalog.GetString ("_View"), null, null, null),
                     
                 new ActionEntry ("ShowEqualizerAction", null,
                    Catalog.GetString ("_Equalizer"), "<control>E",
-                   Catalog.GetString ("View the graphical equalizer"), OnShowEqualizer)*/
+                   Catalog.GetString ("View the graphical equalizer"), OnShowEqualizer)
             });
 
             AddImportant (new ToggleActionEntry [] {
@@ -84,13 +84,12 @@
         
         private void OnPlayerEvent (PlayerEventArgs args)
         {
-            if (((PlayerEventStateChangeArgs)args).Current == PlayerState.Ready && 
-                !ServiceManager.PlayerEngine.SupportsEqualizer) {
-                //Actions["View.ShowEqualizerAction"].Sensitive = false;
+            if (((PlayerEventStateChangeArgs)args).Current == PlayerState.Ready) {
+                Actions["View.ShowEqualizerAction"].Sensitive = ServiceManager.PlayerEngine.SupportsEqualizer;
             }
         }
                 
-        /*private void OnShowEqualizer (object o, EventArgs args)
+        private void OnShowEqualizer (object o, EventArgs args)
         {
             if (EqualizerWindow.Instance == null) {
                 EqualizerWindow eqwin = new EqualizerWindow (ServiceManager.Get<GtkElementsService> ().PrimaryWindow);
@@ -98,7 +97,7 @@
             } else {
                 EqualizerWindow.Instance.Present ();
             }
-        }*/
+        }
 
         private void OnFullScreen (object o, EventArgs args)
         {

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml	Thu Jun 19 17:02:07 2008
@@ -59,7 +59,7 @@
       <placeholder name="ViewMenuAdditions"/>
       <menuitem name="FullScreen" action="FullScreenAction"/>
       <separator/>
-      <!--<menuitem name="ShowEqualizer" action="ShowEqualizerAction"/>-->
+      <menuitem name="ShowEqualizer" action="ShowEqualizerAction"/>
     </menu>
 
     <menu name="PlaybackMenu" action="PlaybackMenuAction">



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