You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.7 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../xmms-jack/S16_LE.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
Of course 16 bit little endian data needs to be swapped on big endian CPUs ...
(The same is of course true for big endian data on little endian CPUs - but
for now this should be enough.)
- Rene Rebe <rene@exactcode.de>
--- xmms-jack/jack.c 2004-11-30 04:23:27.000000000 +0100
+++ xmms-jack-fixed/jack.c 2005-03-08 16:59:17.000000000 +0100
@@ -13,7 +13,7 @@
#include "jack.h"
#include "xconvert.h" /* xmms rate conversion header file */
-
+#include <byteswap.h>
/* set to 1 for verbose output */
#define VERBOSE_OUTPUT 0
@@ -437,6 +437,18 @@
/* loop until we have written all the data out to the jack device */
/* this is due to xmms' audio driver api */
char *buf = (char*)ptr;
+
+#ifdef __BIG_ENDIAN__
+ if (new_format == FMT_S16_LE) {
+ uint16_t* src = (uint16_t*) ptr;
+ uint16_t* end = (uint16_t*) (ptr + length);
+ while (src != end) {
+ *src = bswap_16(*src);
+ src++;
+ }
+ }
+#endif
+
while(length > 0)
{
TRACE("writing %d bytes\n", length);