Mercurial > hg > xmms-sid
annotate src/xs_support.c @ 714:229fa2d043b9
Moved filter routines to xs_support.[ch].
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 09 Feb 2009 14:56:56 +0200 |
parents | 180d7a0250d8 |
children | 9321ffa2ea7e |
rev | line source |
---|---|
4 | 1 /* |
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) | |
3 | |
4 Miscellaneous support functions | |
5 | |
324 | 6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
422 | 7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP) |
4 | 8 |
9 This program is free software; you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
11 the Free Software Foundation; either version 2 of the License, or | |
12 (at your option) any later version. | |
13 | |
14 This program is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
412
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
19 You should have received a copy of the GNU General Public License along |
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
20 with this program; if not, write to the Free Software Foundation, Inc., |
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
4 | 22 */ |
49
3518ca5c8b0f
Support for compile-time big/little-endian optimizations in audio output
Matti Hamalainen <ccr@tnsp.org>
parents:
40
diff
changeset
|
23 #include "xs_support.h" |
224
df4cb5115322
Removed duplicate function, more portability cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
24 #include <ctype.h> |
202 | 25 |
226
858c09f59011
Moved some functions from xs_length.c here.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
26 |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
634
diff
changeset
|
27 guint16 xs_fread_be16(xs_file_t *f) |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
28 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
29 return (((guint16) xs_fgetc(f)) << 8) | ((guint16) xs_fgetc(f)); |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
30 } |
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
31 |
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
32 |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
634
diff
changeset
|
33 guint32 xs_fread_be32(xs_file_t *f) |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
34 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
35 return (((guint32) xs_fgetc(f)) << 24) | |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
36 (((guint32) xs_fgetc(f)) << 16) | |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
37 (((guint32) xs_fgetc(f)) << 8) | |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
38 ((guint32) xs_fgetc(f)); |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
39 } |
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
40 |
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
41 |
527
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
42 /* Load a file to a buffer, return 0 on success, negative value on error |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
43 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
634
diff
changeset
|
44 gint xs_fload_buffer(const gchar *filename, guint8 **buf, size_t *bufSize) |
527
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
45 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
46 xs_file_t *f; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
47 glong seekPos; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
48 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
49 /* Open file, get file size */ |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
50 if ((f = xs_fopen(filename, "rb")) == NULL) |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
51 return -1; |
527
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
52 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
53 xs_fseek(f, 0, SEEK_END); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
54 seekPos = xs_ftell(f); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
55 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
56 if (seekPos > 0) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
57 size_t readSize = seekPos; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
58 if (readSize >= *bufSize || *buf == NULL) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
59 /* Only re-allocate if the required size > current */ |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
60 if (*buf != NULL) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
61 g_free(*buf); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
62 *buf = NULL; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
63 } |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
64 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
65 *bufSize = seekPos; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
66 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
67 *buf = (guint8 *) g_malloc(*bufSize * sizeof(guint8)); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
68 if (*buf == NULL) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
69 xs_fclose(f); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
70 return -2; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
71 } |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
72 } |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
73 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
74 /* Read data */ |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
75 xs_fseek(f, 0, SEEK_SET); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
76 readSize = xs_fread(*buf, sizeof(guint8), *bufSize, f); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
77 xs_fclose(f); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
78 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
79 if (readSize != *bufSize) |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
80 return -3; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
81 else |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
82 return 0; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
83 } else { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
84 xs_fclose(f); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
85 return -4; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
86 } |
527
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
87 } |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
88 |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
89 |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
90 /* Copy a string |
4 | 91 */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
92 gchar *xs_strncpy(gchar *dest, const gchar *src, size_t n) |
4 | 93 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
94 const gchar *s; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
95 gchar *d; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
96 size_t i; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
97 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
98 /* Check the string pointers */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
99 if (!src || !dest) |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
100 return dest; |
4 | 101 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
102 /* Copy to the destination */ |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
103 i = n; |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
104 s = src; |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
105 d = dest; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
106 while (*s && (i > 0)) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
107 *(d++) = *(s++); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
108 i--; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
109 } |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
110 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
111 /* Fill rest of space with zeros */ |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
112 while (i > 0) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
113 *(d++) = 0; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
114 i--; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
115 } |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
116 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
117 /* Ensure that last is always zero */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
118 dest[n - 1] = 0; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
119 |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
120 return dest; |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
121 } |
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
122 |
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
123 |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
124 /* Copy a given string over in *result. |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
125 */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
126 gint xs_pstrcpy(gchar **result, const gchar *str) |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
127 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
128 /* Check the string pointers */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
129 if (!result || !str) |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
130 return -1; |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
131 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
132 /* Allocate memory for destination */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
133 if (*result) |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
134 g_free(*result); |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
135 *result = (gchar *) g_malloc(strlen(str) + 1); |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
136 if (!*result) |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
137 return -2; |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
138 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
139 /* Copy to the destination */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
140 strcpy(*result, str); |
4 | 141 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
142 return 0; |
4 | 143 } |
144 | |
145 | |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
146 /* Concatenates a given string into string pointed by *result. |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
147 */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
148 gint xs_pstrcat(gchar **result, const gchar *str) |
4 | 149 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
150 /* Check the string pointers */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
151 if (!result || !str) |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
152 return -1; |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
153 |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
154 if (*result != NULL) { |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
155 *result = (gchar *) g_realloc(*result, strlen(*result) + strlen(str) + 1); |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
156 if (*result == NULL) |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
157 return -1; |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
158 strcat(*result, str); |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
159 } else { |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
160 *result = (gchar *) g_malloc(strlen(str) + 1); |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
161 if (*result == NULL) |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
162 return -1; |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
163 strcpy(*result, str); |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
164 } |
4 | 165 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
166 return 0; |
4 | 167 } |
168 | |
169 | |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
170 /* Concatenate a given string up to given dest size or \n. |
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
171 * If size max is reached, change the end to "..." |
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
172 */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
173 void xs_pnstrcat(gchar *dest, size_t iSize, const gchar *str) |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
174 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
175 size_t i, n; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
176 const gchar *s; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
177 gchar *d; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
178 |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
179 d = dest; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
180 i = 0; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
181 while (*d && (i < iSize)) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
182 i++; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
183 d++; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
184 } |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
185 |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
186 s = str; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
187 while (*s && (*s != '\n') && (i < iSize)) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
188 *d = *s; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
189 d++; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
190 s++; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
191 i++; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
192 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
193 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
194 *d = 0; |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
195 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
196 if (i >= iSize) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
197 i--; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
198 d--; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
199 n = 3; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
200 while ((i > 0) && (n > 0)) { |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
201 *d = '.'; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
202 d--; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
203 i--; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
204 n--; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
205 } |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
206 } |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
207 } |
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
208 |
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
209 |
206
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
210 /* Locate character in string |
8b896d461fdb
Trivial fixes and added strncpy replacement.
Matti Hamalainen <ccr@tnsp.org>
parents:
202
diff
changeset
|
211 */ |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
212 gchar *xs_strrchr(gchar *str, const gchar ch) |
56
6a3ce7260ae1
Changed some standard functions to glib ones
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
213 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
214 gchar *lastPos = NULL; |
56
6a3ce7260ae1
Changed some standard functions to glib ones
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
215 |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
216 while (*str) { |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
217 if (*str == ch) |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
218 lastPos = str; |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
219 str++; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
220 } |
56
6a3ce7260ae1
Changed some standard functions to glib ones
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
221 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
222 return lastPos; |
56
6a3ce7260ae1
Changed some standard functions to glib ones
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
223 } |
6a3ce7260ae1
Changed some standard functions to glib ones
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
224 |
6a3ce7260ae1
Changed some standard functions to glib ones
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
225 |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
226 void xs_findnext(const gchar *str, size_t *pos) |
4 | 227 { |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
228 while (str[*pos] && isspace(str[*pos])) |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
229 (*pos)++; |
4 | 230 } |
231 | |
232 | |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
233 void xs_findeol(const gchar *str, size_t *pos) |
4 | 234 { |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
235 while (str[*pos] && (str[*pos] != '\n') && (str[*pos] != '\r')) |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
236 (*pos)++; |
4 | 237 } |
238 | |
239 | |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
240 void xs_findnum(const gchar *str, size_t *pos) |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
241 { |
663
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
242 while (str[*pos] && isdigit(str[*pos])) |
180d7a0250d8
More cosmetic variable name changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
243 (*pos)++; |
109
578b71b62eeb
Fileinfo now basically working, STIL COMMENT-fields are not yet parsed or shown.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
244 } |
214 | 245 |
714
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
246 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
247 /* Let's do some preprocessor magic :) */ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
248 #define XS_FVAR(T, P, K) g ## K ## int ## P *sp_ ## T ## P , *dp_ ## T ## P |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
249 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
250 #define XS_FILTER1(T, P, K, Q) \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
251 dataSize /= sizeof(g ## K ## int ## P); \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
252 sp_ ## T ## P = (g ## K ## int ## P *) srcBuf; \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
253 dp_ ## T ## P = (g ## K ## int ## P *) destBuf; \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
254 while (dataSize-- > 0) { \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
255 for (tmp = 0, i = 0; i < oversampleFactor; i++) \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
256 tmp += (gint32) ((gint ## P) (*(sp_ ## T ## P ++) Q)); \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
257 xs_filter_mbn = (tmp + xs_filter_mbn) / (oversampleFactor + 1); \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
258 *(dp_ ## T ## P ++) = ((g ## K ## int ## P) xs_filter_mbn) Q ; \ |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
259 } |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
260 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
261 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
262 static gint32 xs_filter_mbn = 0; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
263 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
264 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
265 gint xs_filter_rateconv(void *destBuf, void *srcBuf, const AFormat audioFormat, |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
266 const gint oversampleFactor, const gint bufSize) |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
267 { |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
268 static gint32 tmp; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
269 XS_FVAR(s, 8,); |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
270 XS_FVAR(u, 8, u); |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
271 XS_FVAR(s, 16,); |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
272 XS_FVAR(u, 16, u); |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
273 gint i; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
274 gint dataSize = bufSize; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
275 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
276 if (dataSize <= 0) |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
277 return dataSize; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
278 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
279 switch (audioFormat) { |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
280 case FMT_U8: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
281 XS_FILTER1(u, 8, u, ^0x80) |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
282 break; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
283 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
284 case FMT_S8: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
285 XS_FILTER1(s, 8,,) |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
286 break; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
287 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
288 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
289 case FMT_U16_BE: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
290 case FMT_U16_LE: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
291 case FMT_U16_NE: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
292 XS_FILTER1(u, 16, u, ^0x8000) |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
293 break; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
294 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
295 case FMT_S16_BE: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
296 case FMT_S16_LE: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
297 case FMT_S16_NE: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
298 XS_FILTER1(s, 16,,) |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
299 break; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
300 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
301 default: |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
302 return -1; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
303 } |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
304 |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
305 return 0; |
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
663
diff
changeset
|
306 } |