mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 469635. Silence ALSA warnings when there is no sound device. r+sr=roc
--HG-- extra : rebase_source : 81cb6c89ffffd534a478151a7aa450c42b36a469
This commit is contained in:
parent
25641e6ca4
commit
8cf9286dfd
@ -100,6 +100,26 @@ static ca_context_destroy_fn ca_context_destroy;
|
||||
static ca_context_play_fn ca_context_play;
|
||||
static ca_context_change_props_fn ca_context_change_props;
|
||||
|
||||
/* we provide a blank error handler to silence ALSA's stderr
|
||||
messages on computers with no sound devices */
|
||||
typedef void (*snd_lib_error_handler_t) (const char* file,
|
||||
int line,
|
||||
const char* function,
|
||||
int err,
|
||||
const char* format,
|
||||
...);
|
||||
typedef int (*snd_lib_error_set_handler_fn) (snd_lib_error_handler_t handler);
|
||||
|
||||
static void
|
||||
quiet_error_handler(const char* file,
|
||||
int line,
|
||||
const char* function,
|
||||
int err,
|
||||
const char* format,
|
||||
...)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -166,6 +186,16 @@ nsSound::Init()
|
||||
}
|
||||
}
|
||||
|
||||
PRLibrary* libasound = PR_LoadLibrary("libasound.so.2");
|
||||
if (libasound) {
|
||||
snd_lib_error_set_handler_fn snd_lib_error_set_handler =
|
||||
(snd_lib_error_set_handler_fn) PR_FindFunctionSymbol(libasound, "snd_lib_error_set_handler");
|
||||
if (snd_lib_error_set_handler)
|
||||
snd_lib_error_set_handler(quiet_error_handler);
|
||||
|
||||
PR_UnloadLibrary(libasound);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user