[Mplayer-cvslog] CVS: main/libao2 ao_arts.c,1.3,1.4

Jürgen Keil CVS jkeil at mplayerhq.hu
Fri Dec 27 17:35:32 CET 2002


Update of /cvsroot/mplayer/main/libao2
In directory mail:/var/tmp.root/cvs-serv17976

Modified Files:
	ao_arts.c 
Log Message:
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
  broken)
- arts server always expects 16-bit sound in little endian byte order, even
  in the case the artsd server runs on a big endian machine.  Make sure that
  mplayer's audio filters convert the samples into one of the arts supported
  sound formats.


Index: ao_arts.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_arts.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ao_arts.c	6 Nov 2002 23:54:23 -0000	1.3
+++ ao_arts.c	27 Dec 2002 16:35:29 -0000	1.4
@@ -16,7 +16,7 @@
 #include "../config.h"
 #include "../mp_msg.h"
 
-#define OBTAIN_BITRATE(a) (((a != AFMT_U8) || (a != AFMT_S8)) ? 16 : 8)
+#define OBTAIN_BITRATE(a) (((a != AFMT_U8) && (a != AFMT_S8)) ? 16 : 8)
 
 /* Feel free to experiment with the following values: */
 #define ARTS_PACKETS 10 /* Number of audio packets */
@@ -49,6 +49,24 @@
 		return 0;
 	}
 	mp_msg(MSGT_AO, MSGL_INFO, "AO: [arts] Connected to sound server\n");
+
+	/*
+	 * arts supports 8bit unsigned and 16bit signed sample formats
+	 * (16bit apparently in little endian format, even in the case
+	 * when artsd runs on a big endian cpu).
+	 *
+	 * Unsupported formats are translated to one of these two formats
+	 * using mplayer's audio filters.
+	 */
+	switch (format) {
+	case AFMT_U8:
+	case AFMT_S8:
+	    format = AFMT_U8;
+	    break;
+	default:
+	    format = AFMT_S16_LE;    /* artsd always expects little endian?*/
+	    break;
+	}
 
 	ao_data.format = format;
 	ao_data.channels = channels;




More information about the MPlayer-cvslog mailing list