libesd fix (bmo#579877) mozilla-1.9.2
authorWolfgang Rosenauer <wr@rosenauer.org>
Wed, 28 Jul 2010 07:36:02 +0200
branchmozilla-1.9.2
changeset 112 22a2c93a47ee
parent 109 2bfb3c461caf
child 113 04527a174eec
libesd fix (bmo#579877)
mozilla-esd.patch
mozilla-xulrunner192/mozilla-esd.patch
mozilla-xulrunner192/mozilla-xulrunner192.spec
series
--- /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 <wr@rosenauer.org>
+# 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 <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;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-xulrunner192/mozilla-esd.patch	Wed Jul 28 07:36:02 2010 +0200
@@ -0,0 +1,1 @@
+../mozilla-esd.patch
\ No newline at end of file
--- a/mozilla-xulrunner192/mozilla-xulrunner192.spec	Wed Jul 28 06:57:39 2010 +0200
+++ b/mozilla-xulrunner192/mozilla-xulrunner192.spec	Wed Jul 28 07:36:02 2010 +0200
@@ -75,6 +75,7 @@
 Patch6:         mozilla-helper-app.patch
 Patch7:         mozilla-prefer_plugin_pref.patch
 Patch8:         mozilla-shared-nss-db.patch
+Patch9:         mozilla-esd.patch
 Patch10:        mozilla-kde.patch
 # PATCH-FEATURE-SLED FATE#302023, FATE#302024
 Patch11:        mozilla-gconf-backend.patch
@@ -223,6 +224,7 @@
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
+%patch9 -p1
 %if %suse_version >= 1110
 %patch10 -p1
 %endif
--- a/series	Wed Jul 28 06:57:39 2010 +0200
+++ b/series	Wed Jul 28 07:36:02 2010 +0200
@@ -12,6 +12,7 @@
 gecko-lockdown.patch
 toolkit-ui-lockdown.patch
 mozilla-ua-locale-pref.patch
+mozilla-esd.patch
 
 # Firefox patches
 firefox-libxul-sdk.patch