alsa_stubs.c revision e8337e527775f93549a93be513bd5b4b9d658569
/** @file
*
* Stubs for libasound.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#define LOG_GROUP LOG_GROUP_DEV_AUDIO
#include <alsa/asoundlib.h>
#include "alsa_stubs.h"
#define VBOX_ALSA_LIB "libasound.so.2"
(pcm))
PROXY_STUB(snd_pcm_hw_params, int,
PROXY_STUB(snd_pcm_open, int,
(handler))
PROXY_STUB(snd_pcm_sw_params, int,
typedef struct
{
const char *name;
void (**fn)(void);
} SHARED_FUNC;
static SHARED_FUNC SharedFuncs[] =
{
};
/**
* Try to dynamically load the ALSA libraries. This function is not
* thread-safe, and should be called before attempting to use any of the
* ALSA functions.
*
* @returns iprt status code
*/
int audioLoadAlsaLib(void)
{
int rc = VINF_SUCCESS;
int i;
LogFlowFunc(("\n"));
/* If this is not NO then the function has obviously been called twice,
which is likely to be a bug. */
if (NO != isLibLoaded)
{
}
isLibLoaded = FAIL;
if (RT_FAILURE(rc))
{
return rc;
}
for (i=0; i<RT_ELEMENTS(SharedFuncs); i++)
{
if (RT_FAILURE(rc))
return rc;
}
isLibLoaded = YES;
return rc;
}