summaryrefslogtreecommitdiffstats
path: root/libao2/ao_arts.c
diff options
context:
space:
mode:
authorjkeil <jkeil@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-27 16:35:29 +0000
committerjkeil <jkeil@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-27 16:35:29 +0000
commit03e3deb95cfd7aaca0a91d2c5ad6a833e53a2b21 (patch)
tree7624e7818bac8f3cd29586478217f0014a5d1781 /libao2/ao_arts.c
parent2ae88126452c17a8add254c6d20fd1668e9510e8 (diff)
downloadmpv-03e3deb95cfd7aaca0a91d2c5ad6a833e53a2b21.tar.bz2
mpv-03e3deb95cfd7aaca0a91d2c5ad6a833e53a2b21.tar.xz
- 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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8577 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_arts.c')
-rw-r--r--libao2/ao_arts.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libao2/ao_arts.c b/libao2/ao_arts.c
index 9f012b551e..a6dca2f075 100644
--- a/libao2/ao_arts.c
+++ b/libao2/ao_arts.c
@@ -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 */
@@ -50,6 +50,24 @@ static int init(int rate_hz, int channels, int format, int flags)
}
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;
ao_data.samplerate = rate_hz;