diff -r 2bfb3c461caf -r 22a2c93a47ee mozilla-esd.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mozilla-esd.patch Wed Jul 28 07:36:02 2010 +0200 @@ -0,0 +1,96 @@ +# HG changeset patch +# User Wolfgang Rosenauer +# Parent a93100d87cc9841c6e3e4b29a47bb7b91f23415f +Bug 579877 - sound output via libesd broken if no esound daemon running. r=karlt + +diff --git a/widget/src/gtk2/nsSound.cpp b/widget/src/gtk2/nsSound.cpp +--- a/widget/src/gtk2/nsSound.cpp ++++ b/widget/src/gtk2/nsSound.cpp +@@ -52,36 +52,31 @@ + #include "nsCOMPtr.h" + #include "nsAutoPtr.h" + #include "nsString.h" + + #include + #include + + #include +-/* used with esd_open_sound */ +-static int esdref = -1; + static PRLibrary *elib = nsnull; + static PRLibrary *libcanberra = nsnull; + static PRLibrary* libasound = nsnull; + + // the following from esd.h + + #define ESD_BITS8 (0x0000) + #define ESD_BITS16 (0x0001) + #define ESD_MONO (0x0010) + #define ESD_STEREO (0x0020) + #define ESD_STREAM (0x0000) + #define ESD_PLAY (0x1000) + + #define WAV_MIN_LENGTH 44 + +-typedef int (*EsdOpenSoundType)(const char *host); +-typedef int (*EsdCloseType)(int); +- + /* used to play the sounds from the find symbol call */ + typedef int (*EsdPlayStreamType) (int, int, const char *, const char *); + typedef int (*EsdAudioOpenType) (void); + typedef int (*EsdAudioWriteType) (const void *, int); + typedef void (*EsdAudioCloseType) (void); + + /* used to find and play common system event sounds. + this interfaces with libcanberra. +@@ -126,50 +121,30 @@ NS_IMPL_ISUPPORTS2(nsSound, nsISound, ns + //////////////////////////////////////////////////////////////////////// + nsSound::nsSound() + { + mInited = PR_FALSE; + } + + nsSound::~nsSound() + { +- if (esdref >= 0) { +- EsdCloseType EsdClose = (EsdCloseType) PR_FindFunctionSymbol(elib, "esd_close"); +- if (EsdClose) +- (*EsdClose)(esdref); +- esdref = -1; +- } + } + + NS_IMETHODIMP + nsSound::Init() + { + // This function is designed so that no library is compulsory, and + // one library missing doesn't cause the other(s) to not be used. + if (mInited) + return NS_OK; + + mInited = PR_TRUE; + + if (!elib) { + elib = PR_LoadLibrary("libesd.so.0"); +- if (elib) { +- EsdOpenSoundType EsdOpenSound = +- (EsdOpenSoundType) PR_FindFunctionSymbol(elib, "esd_open_sound"); +- if (!EsdOpenSound) { +- PR_UnloadLibrary(elib); +- elib = nsnull; +- } else { +- esdref = (*EsdOpenSound)("localhost"); +- if (esdref < 0) { +- PR_UnloadLibrary(elib); +- elib = nsnull; +- } +- } +- } + } + + if (!libasound) { + PRFuncPtr func = PR_FindFunctionSymbolAndLibrary("snd_lib_error_set_handler", + &libasound); + if (libasound) { + snd_lib_error_set_handler_fn snd_lib_error_set_handler = + (snd_lib_error_set_handler_fn) func;