annotate Plugins/Output/CoreAudio/convert.c @ 1637:5261e37b4d55 trunk

[svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
author nenolod
date Thu, 07 Sep 2006 11:32:59 -0700
parents
children 365a2b043447
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1637
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
1 /*
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
2 * Copyright (C) 2001 Haavard Kvaalen
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
3 *
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
7 * (at your option) any later version.
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
8 *
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
12 * GNU General Public License for more details.
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
13 *
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
17 */
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
18
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
19 #include "coreaudio.h"
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
20
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
21 void* osx_get_convert_buffer(size_t size)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
22 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
23 static size_t length;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
24 static void *buffer;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
25
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
26 if (size > 0 && size <= length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
27 return buffer;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
28
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
29 length = size;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
30 buffer = g_realloc(buffer, size);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
31 return buffer;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
32 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
33
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
34 static int convert_swap_endian(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
35 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
36 guint16 *ptr = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
37 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
38 for (i = 0; i < length; i += 2, ptr++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
39 *ptr = GUINT16_SWAP_LE_BE(*ptr);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
40
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
41 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
42 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
43
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
44 static int convert_swap_sign_and_endian_to_native(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
45 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
46 guint16 *ptr = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
47 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
48 for (i = 0; i < length; i += 2, ptr++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
49 *ptr = GUINT16_SWAP_LE_BE(*ptr) ^ 1 << 15;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
50
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
51 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
52 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
53
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
54 static int convert_swap_sign_and_endian_to_alien(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
55 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
56 guint16 *ptr = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
57 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
58 for (i = 0; i < length; i += 2, ptr++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
59 *ptr = GUINT16_SWAP_LE_BE(*ptr ^ 1 << 15);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
60
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
61 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
62 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
63
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
64 static int convert_swap_sign16(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
65 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
66 gint16 *ptr = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
67 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
68 for (i = 0; i < length; i += 2, ptr++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
69 *ptr ^= 1 << 15;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
70
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
71 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
72 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
73
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
74 static int convert_swap_sign8(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
75 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
76 gint8 *ptr = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
77 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
78 for (i = 0; i < length; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
79 *ptr++ ^= 1 << 7;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
80
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
81 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
82 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
83
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
84 static int convert_to_8_native_endian(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
85 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
86 gint8 *output = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
87 gint16 *input = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
88 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
89 for (i = 0; i < length / 2; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
90 *output++ = *input++ >> 8;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
91
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
92 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
93 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
94
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
95 static int convert_to_8_native_endian_swap_sign(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
96 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
97 gint8 *output = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
98 gint16 *input = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
99 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
100 for (i = 0; i < length / 2; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
101 *output++ = (*input++ >> 8) ^ (1 << 7);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
102
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
103 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
104 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
105
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
106
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
107 static int convert_to_8_alien_endian(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
108 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
109 gint8 *output = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
110 gint16 *input = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
111 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
112 for (i = 0; i < length / 2; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
113 *output++ = *input++ & 0xff;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
114
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
115 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
116 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
117
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
118 static int convert_to_8_alien_endian_swap_sign(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
119 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
120 gint8 *output = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
121 gint16 *input = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
122 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
123 for (i = 0; i < length / 2; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
124 *output++ = (*input++ & 0xff) ^ (1 << 7);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
125
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
126 return i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
127 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
128
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
129 static int convert_to_16_native_endian(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
130 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
131 guint8 *input = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
132 guint16 *output;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
133 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
134 *data = osx_get_convert_buffer(length * 2);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
135 output = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
136 for (i = 0; i < length; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
137 *output++ = *input++ << 8;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
138
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
139 return i * 2;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
140 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
141
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
142 static int convert_to_16_native_endian_swap_sign(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
143 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
144 guint8 *input = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
145 guint16 *output;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
146 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
147 *data = osx_get_convert_buffer(length * 2);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
148 output = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
149 for (i = 0; i < length; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
150 *output++ = (*input++ << 8) ^ (1 << 15);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
151
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
152 return i * 2;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
153 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
154
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
155
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
156 static int convert_to_16_alien_endian(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
157 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
158 guint8 *input = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
159 guint16 *output;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
160 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
161 *data = osx_get_convert_buffer(length * 2);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
162 output = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
163 for (i = 0; i < length; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
164 *output++ = *input++;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
165
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
166 return i * 2;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
167 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
168
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
169 static int convert_to_16_alien_endian_swap_sign(void **data, int length)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
170 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
171 guint8 *input = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
172 guint16 *output;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
173 int i;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
174 *data = osx_get_convert_buffer(length * 2);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
175 output = *data;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
176 for (i = 0; i < length; i++)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
177 *output++ = *input++ ^ (1 << 7);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
178
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
179 return i * 2;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
180 }
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
181
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
182 int (*osx_get_convert_func(int output, int input))(void **, int)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
183 {
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
184 if (output == input)
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
185 return NULL;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
186
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
187 printf("1\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
188
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
189 if ((output == FMT_U16_BE && input == FMT_U16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
190 (output == FMT_U16_LE && input == FMT_U16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
191 (output == FMT_S16_BE && input == FMT_S16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
192 (output == FMT_S16_LE && input == FMT_S16_BE))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
193 return convert_swap_endian;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
194
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
195 printf("2\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
196
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
197 if ((output == FMT_U16_BE && input == FMT_S16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
198 (output == FMT_U16_LE && input == FMT_S16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
199 (output == FMT_S16_BE && input == FMT_U16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
200 (output == FMT_S16_LE && input == FMT_U16_LE))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
201 return convert_swap_sign16;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
202
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
203 printf("3\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
204
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
205
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
206 if ((IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
207 ((output == FMT_U16_BE && input == FMT_S16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
208 (output == FMT_S16_BE && input == FMT_U16_LE))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
209 (!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
210 ((output == FMT_U16_LE && input == FMT_S16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
211 (output == FMT_S16_LE && input == FMT_U16_BE))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
212 return convert_swap_sign_and_endian_to_native;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
213
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
214 printf("4\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
215
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
216 if ((!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
217 ((output == FMT_U16_BE && input == FMT_S16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
218 (output == FMT_S16_BE && input == FMT_U16_LE))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
219 (IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
220 ((output == FMT_U16_LE && input == FMT_S16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
221 (output == FMT_S16_LE && input == FMT_U16_BE))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
222 return convert_swap_sign_and_endian_to_alien;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
223
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
224 printf("5\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
225
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
226 if ((IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
227 ((output == FMT_U8 && input == FMT_U16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
228 (output == FMT_S8 && input == FMT_S16_BE))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
229 (!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
230 ((output == FMT_U8 && input == FMT_U16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
231 (output == FMT_S8 && input == FMT_S16_LE))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
232 return convert_to_8_native_endian;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
233
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
234 printf("6\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
235
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
236 if ((IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
237 ((output == FMT_U8 && input == FMT_S16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
238 (output == FMT_S8 && input == FMT_U16_BE))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
239 (!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
240 ((output == FMT_U8 && input == FMT_S16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
241 (output == FMT_S8 && input == FMT_U16_LE))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
242 return convert_to_8_native_endian_swap_sign;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
243
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
244 printf("7\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
245
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
246 if ((!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
247 ((output == FMT_U8 && input == FMT_U16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
248 (output == FMT_S8 && input == FMT_S16_BE))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
249 (IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
250 ((output == FMT_U8 && input == FMT_U16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
251 (output == FMT_S8 && input == FMT_S16_LE))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
252 return convert_to_8_alien_endian;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
253
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
254 printf("8\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
255
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
256 if ((!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
257 ((output == FMT_U8 && input == FMT_S16_BE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
258 (output == FMT_S8 && input == FMT_U16_BE))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
259 (IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
260 ((output == FMT_U8 && input == FMT_S16_LE) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
261 (output == FMT_S8 && input == FMT_U16_LE))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
262 return convert_to_8_alien_endian_swap_sign;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
263
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
264 printf("9\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
265
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
266 if ((output == FMT_U8 && input == FMT_S8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
267 (output == FMT_S8 && input == FMT_U8))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
268 return convert_swap_sign8;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
269
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
270 printf("10\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
271
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
272 if ((IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
273 ((output == FMT_U16_BE && input == FMT_U8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
274 (output == FMT_S16_BE && input == FMT_S8))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
275 (!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
276 ((output == FMT_U16_LE && input == FMT_U8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
277 (output == FMT_S16_LE && input == FMT_S8))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
278 return convert_to_16_native_endian;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
279
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
280 printf("11\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
281
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
282 if ((IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
283 ((output == FMT_U16_BE && input == FMT_S8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
284 (output == FMT_S16_BE && input == FMT_U8))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
285 (!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
286 ((output == FMT_U16_LE && input == FMT_S8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
287 (output == FMT_S16_LE && input == FMT_U8))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
288 return convert_to_16_native_endian_swap_sign;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
289
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
290 printf("12\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
291
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
292 if ((!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
293 ((output == FMT_U16_BE && input == FMT_U8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
294 (output == FMT_S16_BE && input == FMT_S8))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
295 (IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
296 ((output == FMT_U16_LE && input == FMT_U8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
297 (output == FMT_S16_LE && input == FMT_S8))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
298 return convert_to_16_alien_endian;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
299
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
300 printf("14\n");
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
301
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
302 if ((!IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
303 ((output == FMT_U16_BE && input == FMT_S8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
304 (output == FMT_S16_BE && input == FMT_U8))) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
305 (IS_BIG_ENDIAN &&
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
306 ((output == FMT_U16_LE && input == FMT_S8) ||
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
307 (output == FMT_S16_LE && input == FMT_U8))))
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
308 return convert_to_16_alien_endian_swap_sign;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
309
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
310 g_warning("Translation needed, but not available.\n"
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
311 "Input: %d; Output %d.", input, output);
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
312 return NULL;
5261e37b4d55 [svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
nenolod
parents:
diff changeset
313 }