eb52d724d2
OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/MozillaThunderbird?expand=0&rev=88
92 lines
2.7 KiB
Diff
92 lines
2.7 KiB
Diff
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 <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
-/* 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;
|