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