Skip to content

Instantly share code, notes, and snippets.

@darealshinji
Created October 25, 2014 20:39
Show Gist options
  • Save darealshinji/9c350a0fd9f16136b1f0 to your computer and use it in GitHub Desktop.
Save darealshinji/9c350a0fd9f16136b1f0 to your computer and use it in GitHub Desktop.
--- a/app/content/xul/mediacore/mediacoreEqualizer.xul
+++ b/app/content/xul/mediacore/mediacoreEqualizer.xul
@@ -159,7 +159,6 @@
<label value="0" id="eq-label-band9" class="sb-eq-label" />
</vbox>
</hbox>
- <xul:ng-eq-preset-list id="equalizer-pesets"/>
</vbox>
<script type="application/x-javascript"
--- a/app/content/bindings/bindings.css
+++ b/app/content/bindings/bindings.css
@@ -653,10 +653,6 @@
-moz-binding: url("chrome://songbird/content/bindings/eqBandSlider.xml#eq-band-slider") !important;
}
-ng-eq-preset-list {
- -moz-binding: url("chrome://songbird/content/bindings/eqPresetList.xml#eq-preset-list");
-}
-
/* properties formatter bindings */
sb-properties-formatter {
-moz-binding: url("chrome://songbird/content/bindings/propertiesMenuList.xml#propertiesFormatter");
--- a/build/tiers.mk
+++ b/build/tiers.mk
@@ -56,7 +56,6 @@
components/property \
components/library \
components/integration \
- components/equalizerpresets \
components/mediacore \
components/albumart \
components/dbengine \
@@ -81,7 +80,6 @@
components/property \
components/library \
components/integration \
- components/equalizerpresets \
components/mediacore \
components/albumart \
components/dbengine \
--- a/components/mediacore/base/public/sbIMediacoreMultibandEqualizer.idl
+++ b/components/mediacore/base/public/sbIMediacoreMultibandEqualizer.idl
@@ -80,13 +80,6 @@
*/
readonly attribute unsigned long bandCount;
/**
- * \brief The name of the current equalizer preset
- * \note If the current band values were not set through a preset this holds
- * an empty string.
- * \note Changing the name will apply the preset.
- */
- attribute AString currentPresetName;
- /**
* \brief Get a band.
*/
sbIMediacoreEqualizerBand getBand(in unsigned long aBandIndex);
--- a/components/mediacore/base/src/Makefile.in
+++ b/components/mediacore/base/src/Makefile.in
@@ -53,7 +53,6 @@
$(DEPTH)/components/mediacore/base/public \
$(DEPTH)/components/moz/prompter/public \
$(DEPTH)/components/property/public \
- $(DEPTH)/components/equalizerpresets/public \
$(topsrcdir)/components/include \
$(topsrcdir)/components/mediacore/base/src \
$(topsrcdir)/components/moz/strings/src \
--- a/components/mediacore/base/src/sbBaseMediacoreMultibandEqualizer.cpp
+++ b/components/mediacore/base/src/sbBaseMediacoreMultibandEqualizer.cpp
@@ -32,8 +32,6 @@
#include <nsIMutableArray.h>
#include <nsISimpleEnumerator.h>
-#include <nsIPrefBranch.h>
-#include <nsISupportsPrimitives.h>
#include <nsIPrefLocalizedString.h>
#include <nsComponentManagerUtils.h>
@@ -43,9 +41,6 @@
#include <prprf.h>
#include "sbMediacoreEqualizerBand.h"
-#include <sbProxiedComponentManager.h>
-#include <ngIEqualizerPresetProvider.h>
-#include <ngIEqualizerPreset.h>
/**
* To log this module, set the following environment variable:
@@ -97,11 +92,6 @@
return;
}
-#define SB_EQ_PRESET_PREF "songbird.eq.currentPreset"
-
-/*static*/ const nsEmbedString
-sbBaseMediacoreMultibandEqualizer::NO_PRESET = NS_LITERAL_STRING("");
-
/*static*/ const PRUint32
sbBaseMediacoreMultibandEqualizer::EQUALIZER_BAND_COUNT_DEFAULT = 10;
@@ -115,10 +105,6 @@
sbBaseMediacoreMultibandEqualizer::sbBaseMediacoreMultibandEqualizer()
: mMonitor(nsnull)
, mEqEnabled(PR_FALSE)
-, mCurrentPresetName(NO_PRESET)
-, mSettingPreset(false)
-, mPrefs(nsnull)
-, mPresets(nsnull)
{
TRACE(("sbBaseMediacoreMultibandEqualizer[0x%x] - Created", this));
}
@@ -189,25 +175,6 @@
nsresult rv = OnInitBaseMediacoreMultibandEqualizer();
NS_ENSURE_SUCCESS(rv, rv);
- mPrefs = do_ProxiedGetService("@mozilla.org/preferences-service;1", &rv);
- NS_ENSURE_SUCCESS (rv, rv);
- nsCOMPtr<nsIPrefLocalizedString> data;
- rv = mPrefs->GetComplexValue(SB_EQ_PRESET_PREF, NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(data));
- NS_ENSURE_SUCCESS(rv, rv);
- rv = data->GetData(getter_Copies(mCurrentPresetName));
- NS_ENSURE_SUCCESS(rv, rv);
-
- mPresets = do_ProxiedGetService("@getnightingale.com/equalizer-presets/manager;1", &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- PRBool hasPreset;
- rv = mPresets->HasPresetNamed(mCurrentPresetName, &hasPreset);
- NS_ENSURE_SUCCESS(rv, rv);
- if(!hasPreset) {
- rv = this->SetCurrentPresetName(NO_PRESET);
- NS_ENSURE_SUCCESS(rv, rv);
- }
-
return rv;
}
@@ -377,11 +344,6 @@
NS_ENSURE_SUCCESS(rv, rv);
}
- if(!mSettingPreset) {
- rv = this->SetCurrentPresetName(NO_PRESET);
- NS_ENSURE_SUCCESS(rv, rv);
- }
-
return NS_OK;
}
@@ -402,128 +364,6 @@
return NS_OK;
}
-/* attribute AString currentPresetName; */
-NS_IMETHODIMP
-sbBaseMediacoreMultibandEqualizer::GetCurrentPresetName(nsAString& aCurrentPresetName)
-{
- TRACE(("sbBaseMediacoreMultibandEqualizer[0x%x] - GetCurrentPresetName", this));
-
- NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
-
- nsAutoMonitor mon(mMonitor);
-
- aCurrentPresetName = mCurrentPresetName;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-sbBaseMediacoreMultibandEqualizer::SetCurrentPresetName(const nsAString& aCurrentPresetName)
-{
- TRACE(("sbBaseMediacoreMultibandEqualizer[0x%x] - SetCurrentPresetName", this));
-
- nsresult rv = NS_OK;
-
- NS_ENSURE_TRUE(mPrefs, NS_ERROR_NOT_INITIALIZED);
- NS_ENSURE_TRUE(mPresets, NS_ERROR_NOT_INITIALIZED);
-
- mSettingPreset = true;
-
- /* Not sure if this is needed and even works (->GetBands instatiates its own mon)
- NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
-
- nsAutoMonitor mon(mMonitor);*/
-
- if(mCurrentPresetName != aCurrentPresetName)
- {
- mCurrentPresetName = aCurrentPresetName;
-
- LOG(("Updating currentPreset pref"));
- nsCOMPtr<nsIPrefLocalizedString> data (do_CreateInstance("@mozilla.org/pref-localizedstring;1", &rv));
- NS_ENSURE_SUCCESS(rv, rv);
- rv = data->SetDataWithLength(aCurrentPresetName.Length(), aCurrentPresetName.BeginReading());
- NS_ENSURE_SUCCESS(rv, rv);
- rv = mPrefs->SetComplexValue(SB_EQ_PRESET_PREF, NS_GET_IID(nsIPrefLocalizedString), data);
- NS_ENSURE_SUCCESS(rv, rv);
- }
-
- if(aCurrentPresetName != NO_PRESET) {
- // Apply the preset
- PRBool presetExists;
- rv = mPresets->HasPresetNamed(aCurrentPresetName, &presetExists);
- NS_ENSURE_SUCCESS(rv, rv);
- LOG(("Preset exists: %i", presetExists));
-
- if(presetExists)
- {
- nsCOMPtr<nsISimpleEnumerator> bands = nsnull;
- rv = this->GetBands(getter_AddRefs(bands));
- NS_ENSURE_SUCCESS(rv, rv);
- NS_ENSURE_TRUE(bands, NS_ERROR_UNEXPECTED);
-
- nsCOMPtr<ngIEqualizerPreset> preset = nsnull;
- rv = mPresets->GetPresetByName(aCurrentPresetName, getter_AddRefs(preset));
- NS_ENSURE_SUCCESS(rv, rv);
- NS_ENSURE_TRUE(preset, NS_ERROR_UNEXPECTED);
- nsCOMPtr<nsIArray> valuesArray = nsnull;
- rv = preset->GetValues(getter_AddRefs(valuesArray));
- NS_ENSURE_SUCCESS(rv, rv);
- NS_ENSURE_TRUE(valuesArray, NS_ERROR_UNEXPECTED);
- LOG(("Got the two enumerators"));
- PRBool hasMoreBands = PR_FALSE;
-
- nsCOMPtr<nsISupports> element = nsnull;
- nsCOMPtr<nsISupports> value = nsnull;
-
- while(NS_SUCCEEDED(bands->HasMoreElements(&hasMoreBands)) &&
- hasMoreBands &&
- NS_SUCCEEDED(bands->GetNext(getter_AddRefs(element)))) {
- LOG(("Getting the info for a band"));
- nsCOMPtr<sbIMediacoreEqualizerBand> band(do_QueryInterface(element, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
- PRUint32 index;
- rv = band->GetIndex(&index);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsISupportsDouble> gain;
- rv = valuesArray->QueryElementAt(index, NS_GET_IID(nsISupportsDouble), getter_AddRefs(gain));
- NS_ENSURE_SUCCESS(rv, rv);
- LOG(("Extracting the GAIN value"));
- PRFloat64 gainValue;
- rv = gain->GetData(&gainValue);
- NS_ENSURE_SUCCESS(rv, rv);
- LOG(("Applying the GAIN value"));
- rv = band->SetGain(gainValue);
- NS_ENSURE_SUCCESS(rv, rv);
-
- LOG(("Applying the band"));
- rv = this->SetBand(band);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // This should possibly be done in front-end code for the separation.
- LOG(("Applying new GAIN value to the band slider"));
- char* gainString;
- rv = gain->ToString(&gainString);
- NS_ENSURE_SUCCESS(rv, rv);
- nsEmbedCString bandPrefName(NS_LITERAL_CSTRING("songbird.eq.band."));
- bandPrefName.AppendInt(index);
-
- LOG(("Band: %i, Gain: %s", index, gainString));
- rv = mPrefs->SetCharPref(bandPrefName.get(), gainString);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- }
- else {
- // Preset doesn't exist, set to no preset.
- return this->SetCurrentPresetName(NO_PRESET);
- }
- }
-
- mSettingPreset = false;
-
- return rv;
-}
-
/* sbIMediacoreEqualizerBand getBand (in unsigned long aBandIndex); */
NS_IMETHODIMP
sbBaseMediacoreMultibandEqualizer::GetBand(PRUint32 aBandIndex, sbIMediacoreEqualizerBand **_retval)
@@ -576,11 +416,6 @@
NS_ENSURE_SUCCESS(rv, rv);
}
- if(!mSettingPreset) {
- rv = this->SetCurrentPresetName(NO_PRESET);
- NS_ENSURE_SUCCESS(rv, rv);
- }
-
rv = EnsureBandIsCached(aBand);
NS_ENSURE_SUCCESS(rv, rv);
--- a/components/mediacore/base/src/sbBaseMediacoreMultibandEqualizer.h
+++ b/components/mediacore/base/src/sbBaseMediacoreMultibandEqualizer.h
@@ -38,10 +38,6 @@
#include <nsCOMPtr.h>
#include <nsHashKeys.h>
#include <nsInterfaceHashtable.h>
-#include <nsEmbedString.h>
-
-class nsIPrefBranch;
-class ngIEqualizerPresetCollection;
double
SB_ClampDouble(double aGain, double aMin, double aMax);
@@ -60,11 +56,6 @@
nsresult InitBaseMediacoreMultibandEqualizer();
/**
- * \brief Value of currentPResetName if the equalizer is not set by a preset.
- * This value is set as empty string ("").
- */
- static const nsEmbedString NO_PRESET;
- /**
* \brief Suggested default band count for the equalizer.
* This value is defined as 10.
*/
@@ -101,12 +92,6 @@
typedef nsInterfaceHashtable<nsUint32HashKey, sbIMediacoreEqualizerBand> eqbands_t;
eqbands_t mBands;
-
-private:
- nsEmbedString mCurrentPresetName;
- bool mSettingPreset;
- nsCOMPtr<nsIPrefBranch> mPrefs;
- nsCOMPtr<ngIEqualizerPresetCollection> mPresets;
};
#endif /* __SB_BASEMEDIACOREMULTIBANDEQUALIZER_H__ */
\ No newline at end of file
--- a/components/mediacore/gstreamer/src/Makefile.in
+++ b/components/mediacore/gstreamer/src/Makefile.in
@@ -80,7 +80,6 @@
$(DEPTH)/components/property/public \
$(topsrcdir)/components/property/src \
$(DEPTH)/components/job/public \
- $(DEPTH)/components/equalizerpresets/public \
$(topsrcdir)/components/moz/errorconsole/src \
$(MOZSDK_INCLUDE_DIR)/layout \
$(MOZSDK_INCLUDE_DIR)/gfx \
--- a/components/mediacore/manager/src/Makefile.in
+++ b/components/mediacore/manager/src/Makefile.in
@@ -59,7 +59,6 @@
$(topsrcdir)/components/moz/threads/src \
$(topsrcdir)/components/moz/xpcom/src \
$(DEPTH)/components/moz/windowwatcher/public \
- $(DEPTH)/components/equalizerpresets/public \
$(topsrcdir)/components/property/src \
$(MOZSDK_INCLUDE_DIR)/content \
$(MOZSDK_INCLUDE_DIR)/docshell \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment