Skip to content
Snippets Groups Projects
Commit 3978664e authored by Jack Moffitt's avatar Jack Moffitt
Browse files

plugins are allowed to use functions from libao, since they don't link with it

git-svn-id: http://svn.xiph.org/trunk/ao@1206 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 4dbd9af5
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,15 @@ ao_info_t ao_alsa_info =
"Otuputs to the Advanced Linux Sound Architecture."
};
static int _is_big_endian(void)
{
uint_16 pattern = 0xbabe;
unsigned char *bytewise = (unsigned char *)&pattern;
if (bytewise[0] == 0xba) return 1;
return 0;
}
void ao_alsa_parse_options(ao_alsa_internal_t *state, ao_option_t *options)
{
state->card = 0;
......@@ -87,7 +96,7 @@ ao_internal_t *plugin_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_opti
switch (bits) {
case 8 : param.format.format = SND_PCM_SFMT_S8;
break;
case 16 : param.format.format = ao_is_big_endian() ?
case 16 : param.format.format = _is_big_endian() ?
SND_PCM_SFMT_S16_BE : SND_PCM_SFMT_S16_LE;
break;
default : return NULL;
......
......@@ -55,6 +55,15 @@ typedef struct ao_oss_internal_s {
int fd;
} ao_oss_internal_t;
static int _is_big_endian(void)
{
uint_16 pattern = 0xbabe;
unsigned char *bytewise = (unsigned char *)&pattern;
if (bytewise[0] = 0xba) return 1;
return 0;
}
void ao_oss_parse_options(ao_oss_internal_t *state, ao_option_t *options)
{
state->dev = NULL;
......@@ -117,7 +126,7 @@ ao_internal_t *plugin_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_opti
{
case 8: tmp = AFMT_S8;
break;
case 16: tmp = ao_is_big_endian() ? AFMT_S16_BE : AFMT_S16_LE;
case 16: tmp = _is_big_endian() ? AFMT_S16_BE : AFMT_S16_LE;
break;
default:fprintf(stderr,"libao - Unsupported number of bits: %d.",
bits);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment