Mercurial > audlegacy
annotate src/audacious/xconvert.c @ 3979:67f01143e613
improve on-demand probing:
- playlist which contains subtunes is loaded properly.
- custom uri is handled properly.
- playlist_load_ins_file_tuple() has been rewritten. (necessary to subtune fix.)
- playlist_load_ins_file() became wrapper function of playlist_load_ins_file_tuple().
- __playlist_ins_with_info() has been removed.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Wed, 21 Nov 2007 00:46:54 +0900 |
parents | f1c756f39e6c |
children |
rev | line source |
---|---|
2431
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
1 /* Audacious |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
2 * Copyright (C) 2005-2007 Audacious team |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
3 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
4 * XMMS - Cross-platform multimedia player |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
5 * Copyright (C) 1998-2003 Peter Alm, Mikael Alm, Olle Hallnas, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
6 * Thomas Nilsson and 4Front Technologies |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
7 * Copyright (C) 1999-2003 Haavard Kvaalen |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
8 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
9 * This program is free software; you can redistribute it and/or modify |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
10 * it under the terms of the GNU General Public License as published by |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2431
diff
changeset
|
11 * the Free Software Foundation; under version 3 of the License. |
2431
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
12 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
17 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2431
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
20 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * Audacious or using our public API to be a derived work. |
2431
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
23 */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
24 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
25 #include "config.h" |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
26 #include <stdlib.h> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
27 #include <audacious/plugin.h> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
28 #include "xconvert.h" |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
29 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
30 #define IS_BIG_ENDIAN (G_BYTE_ORDER==G_BIG_ENDIAN) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
31 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
32 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
33 * buffer: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
34 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
35 * Contains data for conversion. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
36 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
37 * @buffer: A pointer to the memory being used in the conversion process. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
38 * @size: The size of the memory being referenced. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
39 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
40 struct buffer { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
41 void *buffer; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
42 int size; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
43 }; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
44 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
45 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
46 * xmms_convert_buffers: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
47 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
48 * Stores data for conversion. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
49 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
50 * @format_buffer: A buffer for converting formats. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
51 * @stereo_buffer: A buffer for downmixing or upmixing. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
52 * @freq_buffer: A buffer used for resampling. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
53 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
54 struct xmms_convert_buffers { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
55 struct buffer format_buffer, stereo_buffer, freq_buffer; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
56 }; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
57 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
58 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
59 * xmms_convert_buffers_new: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
60 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
61 * Factory for an #xmms_convert_buffers struct. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
62 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
63 * Return value: An #xmms_convert_buffers struct. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
64 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
65 struct xmms_convert_buffers * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
66 xmms_convert_buffers_new(void) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
67 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
68 return g_malloc0(sizeof(struct xmms_convert_buffers)); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
69 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
70 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
71 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
72 * convert_get_buffer: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
73 * @buffer: A buffer to resize. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
74 * @size: The new size for that buffer. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
75 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
76 * Resizes a conversion buffer. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
77 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
78 static void * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
79 convert_get_buffer(struct buffer *buffer, size_t size) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
80 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
81 if (size > 0 && size <= (size_t)buffer->size) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
82 return buffer->buffer; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
83 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
84 buffer->size = size; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
85 buffer->buffer = g_realloc(buffer->buffer, size); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
86 return buffer->buffer; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
87 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
88 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
89 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
90 * xmms_convert_buffers_free: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
91 * @buf: An xmms_convert_buffers structure to free. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
92 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
93 * Frees the actual buffers contained inside the buffer struct. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
94 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
95 void |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
96 xmms_convert_buffers_free(struct xmms_convert_buffers *buf) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
97 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
98 convert_get_buffer(&buf->format_buffer, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
99 convert_get_buffer(&buf->stereo_buffer, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
100 convert_get_buffer(&buf->freq_buffer, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
101 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
102 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
103 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
104 * xmms_convert_buffers_destroy: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
105 * @buf: An xmms_convert_buffers structure to destroy. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
106 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
107 * Destroys an xmms_convert_buffers structure. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
108 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
109 void |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
110 xmms_convert_buffers_destroy(struct xmms_convert_buffers *buf) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
111 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
112 if (!buf) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
113 return; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
114 xmms_convert_buffers_free(buf); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
115 g_free(buf); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
116 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
117 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
118 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
119 convert_swap_endian(struct xmms_convert_buffers *buf, void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
120 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
121 guint16 *ptr = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
122 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
123 for (i = 0; i < length; i += 2, ptr++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
124 *ptr = GUINT16_SWAP_LE_BE(*ptr); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
125 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
126 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
127 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
128 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
129 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
130 convert_swap_sign_and_endian_to_native(struct |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
131 xmms_convert_buffers |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
132 *buf, void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
133 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
134 guint16 *ptr = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
135 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
136 for (i = 0; i < length; i += 2, ptr++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
137 *ptr = GUINT16_SWAP_LE_BE(*ptr) ^ 1 << 15; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
138 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
139 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
140 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
141 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
142 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
143 convert_swap_sign_and_endian_to_alien(struct |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
144 xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
145 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
146 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
147 guint16 *ptr = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
148 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
149 for (i = 0; i < length; i += 2, ptr++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
150 *ptr = GUINT16_SWAP_LE_BE(*ptr ^ 1 << 15); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
151 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
152 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
153 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
154 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
155 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
156 convert_swap_sign16(struct xmms_convert_buffers *buf, void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
157 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
158 gint16 *ptr = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
159 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
160 for (i = 0; i < length; i += 2, ptr++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
161 *ptr ^= 1 << 15; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
162 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
163 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
164 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
165 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
166 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
167 convert_swap_sign8(struct xmms_convert_buffers *buf, void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
168 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
169 gint8 *ptr = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
170 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
171 for (i = 0; i < length; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
172 *ptr++ ^= 1 << 7; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
173 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
174 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
175 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
176 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
177 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
178 convert_to_8_native_endian(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
179 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
180 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
181 gint8 *output = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
182 gint16 *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
183 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
184 for (i = 0; i < length / 2; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
185 *output++ = *input++ >> 8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
186 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
187 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
188 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
189 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
190 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
191 convert_to_8_native_endian_swap_sign(struct xmms_convert_buffers |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
192 *buf, void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
193 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
194 gint8 *output = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
195 gint16 *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
196 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
197 for (i = 0; i < length / 2; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
198 *output++ = (*input++ >> 8) ^ (1 << 7); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
199 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
200 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
201 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
202 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
203 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
204 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
205 convert_to_8_alien_endian(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
206 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
207 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
208 gint8 *output = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
209 gint16 *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
210 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
211 for (i = 0; i < length / 2; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
212 *output++ = *input++ & 0xff; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
213 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
214 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
215 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
216 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
217 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
218 convert_to_8_alien_endian_swap_sign(struct xmms_convert_buffers |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
219 *buf, void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
220 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
221 gint8 *output = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
222 gint16 *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
223 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
224 for (i = 0; i < length / 2; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
225 *output++ = (*input++ & 0xff) ^ (1 << 7); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
226 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
227 return i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
228 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
229 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
230 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
231 convert_to_16_native_endian(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
232 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
233 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
234 guint8 *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
235 guint16 *output; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
236 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
237 *data = convert_get_buffer(&buf->format_buffer, length * 2); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
238 output = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
239 for (i = 0; i < length; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
240 *output++ = *input++ << 8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
241 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
242 return i * 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
243 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
244 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
245 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
246 convert_to_16_native_endian_swap_sign(struct |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
247 xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
248 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
249 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
250 guint8 *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
251 guint16 *output; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
252 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
253 *data = convert_get_buffer(&buf->format_buffer, length * 2); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
254 output = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
255 for (i = 0; i < length; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
256 *output++ = (*input++ << 8) ^ (1 << 15); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
257 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
258 return i * 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
259 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
260 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
261 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
262 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
263 convert_to_16_alien_endian(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
264 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
265 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
266 guint8 *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
267 guint16 *output; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
268 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
269 *data = convert_get_buffer(&buf->format_buffer, length * 2); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
270 output = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
271 for (i = 0; i < length; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
272 *output++ = *input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
273 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
274 return i * 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
275 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
276 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
277 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
278 convert_to_16_alien_endian_swap_sign(struct xmms_convert_buffers |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
279 *buf, void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
280 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
281 guint8 *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
282 guint16 *output; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
283 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
284 *data = convert_get_buffer(&buf->format_buffer, length * 2); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
285 output = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
286 for (i = 0; i < length; i++) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
287 *output++ = *input++ ^ (1 << 7); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
288 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
289 return i * 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
290 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
291 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
292 static AFormat |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
293 unnativize(AFormat fmt) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
294 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
295 if (fmt == FMT_S16_NE) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
296 if (IS_BIG_ENDIAN) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
297 return FMT_S16_BE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
298 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
299 return FMT_S16_LE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
300 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
301 if (fmt == FMT_U16_NE) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
302 if (IS_BIG_ENDIAN) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
303 return FMT_U16_BE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
304 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
305 return FMT_U16_LE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
306 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
307 return fmt; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
308 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
309 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
310 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
311 * xmms_convert_get_func: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
312 * @output: A format to output data as. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
313 * @input: The format of the inbound data. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
314 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
315 * Looks up the proper conversion method to use. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
316 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
317 * Return value: A function pointer to the desired conversion function. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
318 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
319 convert_func_t |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
320 xmms_convert_get_func(AFormat output, AFormat input) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
321 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
322 output = unnativize(output); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
323 input = unnativize(input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
324 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
325 if (output == input) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
326 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
327 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
328 if ((output == FMT_U16_BE && input == FMT_U16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
329 (output == FMT_U16_LE && input == FMT_U16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
330 (output == FMT_S16_BE && input == FMT_S16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
331 (output == FMT_S16_LE && input == FMT_S16_BE)) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
332 return convert_swap_endian; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
333 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
334 if ((output == FMT_U16_BE && input == FMT_S16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
335 (output == FMT_U16_LE && input == FMT_S16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
336 (output == FMT_S16_BE && input == FMT_U16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
337 (output == FMT_S16_LE && input == FMT_U16_LE)) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
338 return convert_swap_sign16; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
339 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
340 if ((IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
341 ((output == FMT_U16_BE && input == FMT_S16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
342 (output == FMT_S16_BE && input == FMT_U16_LE))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
343 (!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
344 ((output == FMT_U16_LE && input == FMT_S16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
345 (output == FMT_S16_LE && input == FMT_U16_BE)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
346 return convert_swap_sign_and_endian_to_native; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
347 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
348 if ((!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
349 ((output == FMT_U16_BE && input == FMT_S16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
350 (output == FMT_S16_BE && input == FMT_U16_LE))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
351 (IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
352 ((output == FMT_U16_LE && input == FMT_S16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
353 (output == FMT_S16_LE && input == FMT_U16_BE)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
354 return convert_swap_sign_and_endian_to_alien; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
355 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
356 if ((IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
357 ((output == FMT_U8 && input == FMT_U16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
358 (output == FMT_S8 && input == FMT_S16_BE))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
359 (!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
360 ((output == FMT_U8 && input == FMT_U16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
361 (output == FMT_S8 && input == FMT_S16_LE)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
362 return convert_to_8_native_endian; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
363 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
364 if ((IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
365 ((output == FMT_U8 && input == FMT_S16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
366 (output == FMT_S8 && input == FMT_U16_BE))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
367 (!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
368 ((output == FMT_U8 && input == FMT_S16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
369 (output == FMT_S8 && input == FMT_U16_LE)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
370 return convert_to_8_native_endian_swap_sign; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
371 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
372 if ((!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
373 ((output == FMT_U8 && input == FMT_U16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
374 (output == FMT_S8 && input == FMT_S16_BE))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
375 (IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
376 ((output == FMT_U8 && input == FMT_U16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
377 (output == FMT_S8 && input == FMT_S16_LE)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
378 return convert_to_8_alien_endian; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
379 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
380 if ((!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
381 ((output == FMT_U8 && input == FMT_S16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
382 (output == FMT_S8 && input == FMT_U16_BE))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
383 (IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
384 ((output == FMT_U8 && input == FMT_S16_LE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
385 (output == FMT_S8 && input == FMT_U16_LE)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
386 return convert_to_8_alien_endian_swap_sign; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
387 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
388 if ((output == FMT_U8 && input == FMT_S8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
389 (output == FMT_S8 && input == FMT_U8)) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
390 return convert_swap_sign8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
391 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
392 if ((IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
393 ((output == FMT_U16_BE && input == FMT_U8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
394 (output == FMT_S16_BE && input == FMT_S8))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
395 (!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
396 ((output == FMT_U16_LE && input == FMT_U8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
397 (output == FMT_S16_LE && input == FMT_S8)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
398 return convert_to_16_native_endian; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
399 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
400 if ((IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
401 ((output == FMT_U16_BE && input == FMT_S8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
402 (output == FMT_S16_BE && input == FMT_U8))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
403 (!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
404 ((output == FMT_U16_LE && input == FMT_S8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
405 (output == FMT_S16_LE && input == FMT_U8)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
406 return convert_to_16_native_endian_swap_sign; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
407 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
408 if ((!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
409 ((output == FMT_U16_BE && input == FMT_U8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
410 (output == FMT_S16_BE && input == FMT_S8))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
411 (IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
412 ((output == FMT_U16_LE && input == FMT_U8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
413 (output == FMT_S16_LE && input == FMT_S8)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
414 return convert_to_16_alien_endian; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
415 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
416 if ((!IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
417 ((output == FMT_U16_BE && input == FMT_S8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
418 (output == FMT_S16_BE && input == FMT_U8))) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
419 (IS_BIG_ENDIAN && |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
420 ((output == FMT_U16_LE && input == FMT_S8) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
421 (output == FMT_S16_LE && input == FMT_U8)))) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
422 return convert_to_16_alien_endian_swap_sign; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
423 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
424 g_warning("Translation needed, but not available.\n" |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
425 "Input: %d; Output %d.", input, output); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
426 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
427 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
428 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
429 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
430 convert_mono_to_stereo(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
431 void **data, int length, int b16) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
432 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
433 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
434 void *outbuf = convert_get_buffer(&buf->stereo_buffer, length * 2); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
435 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
436 if (b16) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
437 guint16 *output = outbuf, *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
438 for (i = 0; i < length / 2; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
439 *output++ = *input; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
440 *output++ = *input; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
441 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
442 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
443 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
444 else { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
445 guint8 *output = outbuf, *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
446 for (i = 0; i < length; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
447 *output++ = *input; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
448 *output++ = *input; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
449 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
450 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
451 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
452 *data = outbuf; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
453 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
454 return length * 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
455 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
456 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
457 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
458 convert_mono_to_stereo_8(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
459 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
460 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
461 return convert_mono_to_stereo(buf, data, length, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
462 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
463 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
464 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
465 convert_mono_to_stereo_16(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
466 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
467 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
468 return convert_mono_to_stereo(buf, data, length, TRUE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
469 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
470 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
471 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
472 convert_stereo_to_mono_u8(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
473 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
474 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
475 guint8 *output = *data, *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
476 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
477 for (i = 0; i < length / 2; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
478 guint16 tmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
479 tmp = *input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
480 tmp += *input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
481 *output++ = tmp / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
482 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
483 return length / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
484 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
485 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
486 convert_stereo_to_mono_s8(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
487 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
488 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
489 gint8 *output = *data, *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
490 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
491 for (i = 0; i < length / 2; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
492 gint16 tmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
493 tmp = *input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
494 tmp += *input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
495 *output++ = tmp / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
496 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
497 return length / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
498 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
499 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
500 convert_stereo_to_mono_u16le(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
501 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
502 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
503 guint16 *output = *data, *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
504 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
505 for (i = 0; i < length / 4; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
506 guint32 tmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
507 guint16 stmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
508 tmp = GUINT16_FROM_LE(*input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
509 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
510 tmp += GUINT16_FROM_LE(*input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
511 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
512 stmp = tmp / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
513 *output++ = GUINT16_TO_LE(stmp); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
514 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
515 return length / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
516 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
517 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
518 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
519 convert_stereo_to_mono_u16be(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
520 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
521 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
522 guint16 *output = *data, *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
523 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
524 for (i = 0; i < length / 4; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
525 guint32 tmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
526 guint16 stmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
527 tmp = GUINT16_FROM_BE(*input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
528 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
529 tmp += GUINT16_FROM_BE(*input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
530 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
531 stmp = tmp / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
532 *output++ = GUINT16_TO_BE(stmp); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
533 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
534 return length / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
535 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
536 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
537 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
538 convert_stereo_to_mono_s16le(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
539 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
540 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
541 gint16 *output = *data, *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
542 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
543 for (i = 0; i < length / 4; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
544 gint32 tmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
545 gint16 stmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
546 tmp = GINT16_FROM_LE(*input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
547 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
548 tmp += GINT16_FROM_LE(*input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
549 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
550 stmp = tmp / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
551 *output++ = GINT16_TO_LE(stmp); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
552 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
553 return length / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
554 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
555 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
556 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
557 convert_stereo_to_mono_s16be(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
558 void **data, int length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
559 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
560 gint16 *output = *data, *input = *data; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
561 int i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
562 for (i = 0; i < length / 4; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
563 gint32 tmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
564 gint16 stmp; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
565 tmp = GINT16_FROM_BE(*input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
566 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
567 tmp += GINT16_FROM_BE(*input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
568 input++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
569 stmp = tmp / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
570 *output++ = GINT16_TO_BE(stmp); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
571 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
572 return length / 2; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
573 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
574 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
575 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
576 * xmms_convert_get_channel_func: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
577 * @fmt: The format of the data. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
578 * @output: The number of channels to output as. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
579 * @input: The number of channels inbound. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
580 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
581 * Looks up the proper conversion method to use. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
582 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
583 * Return value: A function pointer to the desired conversion function. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
584 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
585 convert_channel_func_t |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
586 xmms_convert_get_channel_func(AFormat fmt, int output, int input) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
587 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
588 fmt = unnativize(fmt); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
589 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
590 if (output == input) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
591 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
592 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
593 if (input == 1 && output == 2) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
594 switch (fmt) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
595 case FMT_U8: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
596 case FMT_S8: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
597 return convert_mono_to_stereo_8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
598 case FMT_U16_LE: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
599 case FMT_U16_BE: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
600 case FMT_S16_LE: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
601 case FMT_S16_BE: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
602 return convert_mono_to_stereo_16; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
603 default: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
604 g_warning("Unknown format: %d" "No conversion available.", fmt); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
605 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
606 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
607 if (input == 2 && output == 1) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
608 switch (fmt) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
609 case FMT_U8: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
610 return convert_stereo_to_mono_u8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
611 case FMT_S8: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
612 return convert_stereo_to_mono_s8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
613 case FMT_U16_LE: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
614 return convert_stereo_to_mono_u16le; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
615 case FMT_U16_BE: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
616 return convert_stereo_to_mono_u16be; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
617 case FMT_S16_LE: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
618 return convert_stereo_to_mono_s16le; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
619 case FMT_S16_BE: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
620 return convert_stereo_to_mono_s16be; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
621 default: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
622 g_warning("Unknown format: %d. " |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
623 "No conversion available.", fmt); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
624 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
625 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
626 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
627 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
628 g_warning("Input has %d channels, soundcard uses %d channels\n" |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
629 "No conversion is available", input, output); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
630 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
631 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
632 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
633 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
634 #define RESAMPLE_STEREO(sample_type, bswap) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
635 const int shift = sizeof (sample_type); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
636 int i, in_samples, out_samples, x, delta; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
637 sample_type *inptr = *data, *outptr; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
638 guint nlen = (((length >> shift) * ofreq) / ifreq); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
639 void *nbuf; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
640 if (nlen == 0) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
641 return 0; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
642 nlen <<= shift; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
643 if (bswap) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
644 convert_swap_endian(NULL, data, length); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
645 nbuf = convert_get_buffer(&buf->freq_buffer, nlen); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
646 outptr = nbuf; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
647 in_samples = length >> shift; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
648 out_samples = nlen >> shift; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
649 delta = (in_samples << 12) / out_samples; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
650 for (x = 0, i = 0; i < out_samples; i++) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
651 { \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
652 int x1, frac; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
653 x1 = (x >> 12) << 12; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
654 frac = x - x1; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
655 *outptr++ = \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
656 ((inptr[(x1 >> 12) << 1] * \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
657 ((1<<12) - frac) + \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
658 inptr[((x1 >> 12) + 1) << 1] * \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
659 frac) >> 12); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
660 *outptr++ = \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
661 ((inptr[((x1 >> 12) << 1) + 1] * \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
662 ((1<<12) - frac) + \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
663 inptr[(((x1 >> 12) + 1) << 1) + 1] * \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
664 frac) >> 12); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
665 x += delta; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
666 } \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
667 if (bswap) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
668 convert_swap_endian(NULL, &nbuf, nlen); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
669 *data = nbuf; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
670 return nlen; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
671 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
672 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
673 #define RESAMPLE_MONO(sample_type, bswap) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
674 const int shift = sizeof (sample_type) - 1; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
675 int i, x, delta, in_samples, out_samples; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
676 sample_type *inptr = *data, *outptr; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
677 guint nlen = (((length >> shift) * ofreq) / ifreq); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
678 void *nbuf; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
679 if (nlen == 0) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
680 return 0; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
681 nlen <<= shift; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
682 if (bswap) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
683 convert_swap_endian(NULL, data, length); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
684 nbuf = convert_get_buffer(&buf->freq_buffer, nlen); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
685 outptr = nbuf; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
686 in_samples = length >> shift; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
687 out_samples = nlen >> shift; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
688 delta = ((length >> shift) << 12) / out_samples; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
689 for (x = 0, i = 0; i < out_samples; i++) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
690 { \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
691 int x1, frac; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
692 x1 = (x >> 12) << 12; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
693 frac = x - x1; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
694 *outptr++ = \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
695 ((inptr[x1 >> 12] * ((1<<12) - frac) + \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
696 inptr[(x1 >> 12) + 1] * frac) >> 12); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
697 x += delta; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
698 } \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
699 if (bswap) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
700 convert_swap_endian(NULL, &nbuf, nlen); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
701 *data = nbuf; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
702 return nlen; \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
703 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
704 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
705 convert_resample_stereo_s16ne(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
706 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
707 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
708 RESAMPLE_STEREO(gint16, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
709 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
710 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
711 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
712 convert_resample_stereo_s16ae(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
713 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
714 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
715 RESAMPLE_STEREO(gint16, TRUE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
716 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
717 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
718 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
719 convert_resample_stereo_u16ne(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
720 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
721 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
722 RESAMPLE_STEREO(guint16, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
723 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
724 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
725 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
726 convert_resample_stereo_u16ae(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
727 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
728 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
729 RESAMPLE_STEREO(guint16, TRUE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
730 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
731 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
732 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
733 convert_resample_mono_s16ne(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
734 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
735 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
736 RESAMPLE_MONO(gint16, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
737 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
738 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
739 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
740 convert_resample_mono_s16ae(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
741 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
742 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
743 RESAMPLE_MONO(gint16, TRUE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
744 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
745 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
746 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
747 convert_resample_mono_u16ne(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
748 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
749 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
750 RESAMPLE_MONO(guint16, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
751 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
752 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
753 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
754 convert_resample_mono_u16ae(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
755 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
756 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
757 RESAMPLE_MONO(guint16, TRUE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
758 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
759 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
760 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
761 convert_resample_stereo_u8(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
762 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
763 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
764 RESAMPLE_STEREO(guint8, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
765 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
766 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
767 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
768 convert_resample_mono_u8(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
769 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
770 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
771 RESAMPLE_MONO(guint8, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
772 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
773 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
774 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
775 convert_resample_stereo_s8(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
776 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
777 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
778 RESAMPLE_STEREO(gint8, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
779 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
780 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
781 static int |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
782 convert_resample_mono_s8(struct xmms_convert_buffers *buf, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
783 void **data, int length, int ifreq, int ofreq) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
784 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
785 RESAMPLE_MONO(gint8, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
786 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
787 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
788 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
789 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
790 * xmms_convert_get_frequency_func: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
791 * @fmt: The format of the data. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
792 * @channels: The number of channels inbound. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
793 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
794 * Looks up the proper conversion method to use. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
795 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
796 * Return value: A function pointer to the desired conversion function. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
797 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
798 convert_freq_func_t |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
799 xmms_convert_get_frequency_func(AFormat fmt, int channels) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
800 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
801 fmt = unnativize(fmt); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
802 g_message("fmt %d, channels: %d", fmt, channels); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
803 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
804 if (channels < 1 || channels > 2) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
805 g_warning("Unsupported number of channels: %d. " |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
806 "Resample function not available", channels); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
807 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
808 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
809 if ((IS_BIG_ENDIAN && fmt == FMT_U16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
810 (!IS_BIG_ENDIAN && fmt == FMT_U16_LE)) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
811 if (channels == 1) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
812 return convert_resample_mono_u16ne; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
813 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
814 return convert_resample_stereo_u16ne; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
815 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
816 if ((IS_BIG_ENDIAN && fmt == FMT_S16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
817 (!IS_BIG_ENDIAN && fmt == FMT_S16_LE)) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
818 if (channels == 1) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
819 return convert_resample_mono_s16ne; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
820 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
821 return convert_resample_stereo_s16ne; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
822 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
823 if ((!IS_BIG_ENDIAN && fmt == FMT_U16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
824 (IS_BIG_ENDIAN && fmt == FMT_U16_LE)) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
825 if (channels == 1) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
826 return convert_resample_mono_u16ae; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
827 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
828 return convert_resample_stereo_u16ae; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
829 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
830 if ((!IS_BIG_ENDIAN && fmt == FMT_S16_BE) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
831 (IS_BIG_ENDIAN && fmt == FMT_S16_LE)) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
832 if (channels == 1) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
833 return convert_resample_mono_s16ae; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
834 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
835 return convert_resample_stereo_s16ae; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
836 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
837 if (fmt == FMT_U8) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
838 if (channels == 1) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
839 return convert_resample_mono_u8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
840 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
841 return convert_resample_stereo_u8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
842 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
843 if (fmt == FMT_S8) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
844 if (channels == 1) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
845 return convert_resample_mono_s8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
846 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
847 return convert_resample_stereo_s8; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
848 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
849 g_warning("Resample function not available" "Format %d.", fmt); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
850 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
851 } |