[xiph-cvs] cvs commit: ao/src/plugins/oss ao_oss.c

Jack Moffitt jack at xiph.org
Tue Jan 23 13:45:04 PST 2001



jack        01/01/23 13:45:04

  Modified:    src/plugins/alsa ao_alsa.c
               src/plugins/oss ao_oss.c
  Log:
  plugins are allowed to use functions from libao, since they don't link with it

Revision  Changes    Path
1.3       +10 -1     ao/src/plugins/alsa/ao_alsa.c

Index: ao_alsa.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/alsa/ao_alsa.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ao_alsa.c	2000/10/30 04:38:48	1.2
+++ ao_alsa.c	2001/01/23 21:45:03	1.3
@@ -53,6 +53,15 @@
         "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 @@
         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;

1.3       +10 -1     ao/src/plugins/oss/ao_oss.c

Index: ao_oss.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/oss/ao_oss.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ao_oss.c	2000/10/30 04:38:49	1.2
+++ ao_oss.c	2001/01/23 21:45:03	1.3
@@ -55,6 +55,15 @@
         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 @@
         {
         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);

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list