Mercurial > audlegacy-plugins
annotate src/crossfade/format.c @ 3172:1b2350bdeaef
alsa-ng: Be less stupid if things don't open.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 15 May 2009 16:06:55 -0500 |
parents | a0ba6102131d |
children |
rev | line source |
---|---|
3059
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
1 /* |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
2 * XMMS Crossfade Plugin |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
3 * Copyright (C) 2000-2007 Peter Eisenlohr <peter@eisenlohr.org> |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
4 * |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
5 * based on the original OSS Output Plugin |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
6 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
7 * |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
11 * (at your option) any later version. |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
12 * |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
17 * |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
21 * USA. |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
22 */ |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
23 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
24 #ifdef HAVE_CONFIG_H |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
25 # include "config.h" |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
26 #endif |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
27 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
28 #include <string.h> |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
29 #include "format.h" |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
30 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
31 gboolean |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
32 setup_format(AFormat fmt, gint rate, gint nch, format_t * format) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
33 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
34 format->bps = 0; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
35 format->fmt = fmt; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
36 format->is_8bit = FALSE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
37 format->is_swapped = FALSE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
38 format->is_unsigned = FALSE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
39 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
40 /* check format */ |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
41 switch (fmt) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
42 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
43 case FMT_U8: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
44 format->is_8bit = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
45 format->is_unsigned = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
46 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
47 case FMT_S8: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
48 format->is_8bit = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
49 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
50 case FMT_U16_LE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
51 format->is_unsigned = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
52 #ifdef WORDS_BIGENDIAN |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
53 format->is_swapped = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
54 #endif |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
55 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
56 case FMT_U16_BE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
57 format->is_unsigned = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
58 #ifndef WORDS_BIGENDIAN |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
59 format->is_swapped = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
60 #endif |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
61 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
62 case FMT_U16_NE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
63 format->is_unsigned = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
64 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
65 case FMT_S16_LE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
66 #ifdef WORDS_BIGENDIAN |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
67 format->is_swapped = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
68 #endif |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
69 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
70 case FMT_S16_BE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
71 #ifndef WORDS_BIGENDIAN |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
72 format->is_swapped = TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
73 #endif |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
74 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
75 case FMT_S16_NE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
76 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
77 default: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
78 DEBUG(("[crossfade] setup_format: unknown format (%d)!\n", fmt)); |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
79 return -1; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
80 } |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
81 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
82 /* check rate */ |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
83 if ((rate < 1) || (rate > MAX_RATE)) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
84 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
85 DEBUG(("[crossfade] setup_format: illegal rate (%d)!\n", rate)); |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
86 return -1; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
87 } |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
88 format->rate = rate; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
89 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
90 /* check channels */ |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
91 switch (nch) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
92 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
93 case 1: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
94 case 2: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
95 format->nch = nch; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
96 break; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
97 default: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
98 DEBUG(("[crossfade] setup_format: illegal # of channels (%d)!\n", nch)); |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
99 return -1; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
100 } |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
101 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
102 /* calculate bps */ |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
103 format->bps = rate * nch; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
104 if (!format->is_8bit) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
105 format->bps *= 2; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
106 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
107 return 0; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
108 } |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
109 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
110 gboolean |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
111 format_match(AFormat fmt1, AFormat fmt2) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
112 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
113 if (fmt1 == fmt2) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
114 return TRUE; /* exact match */ |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
115 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
116 if ((fmt2 == FMT_U16_NE) || (fmt2 == FMT_S16_NE)) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
117 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
118 AFormat fmt = fmt1; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
119 fmt1 = fmt2; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
120 fmt2 = fmt; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
121 } |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
122 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
123 #ifdef WORDS_BIGENDIAN |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
124 if (((fmt1 == FMT_U16_NE) && (fmt2 == FMT_U16_BE)) || ((fmt1 == FMT_S16_NE) && (fmt2 == FMT_S16_BE))) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
125 return TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
126 #else |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
127 if (((fmt1 == FMT_U16_NE) && (fmt2 == FMT_U16_LE)) || ((fmt1 == FMT_S16_NE) && (fmt2 == FMT_S16_LE))) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
128 return TRUE; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
129 #endif |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
130 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
131 return FALSE; /* no match */ |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
132 } |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
133 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
134 gchar * |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
135 format_name(AFormat fmt) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
136 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
137 switch (fmt) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
138 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
139 case FMT_U8: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
140 return "FMT_U8"; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
141 case FMT_S8: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
142 return "FMT_S8"; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
143 case FMT_U16_LE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
144 return "FMT_U16_LE"; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
145 case FMT_U16_BE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
146 return "FMT_U16_BE"; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
147 case FMT_U16_NE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
148 return "FMT_U16_NE"; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
149 case FMT_S16_LE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
150 return "FMT_S16_LE"; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
151 case FMT_S16_BE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
152 return "FMT_S16_BE"; |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
153 case FMT_S16_NE: |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
154 return "FMT_S16_NE"; |
3065
a0ba6102131d
crossfade-ng: remove more cruft, kill some warnings.
William Pitcock <nenolod@atheme.org>
parents:
3059
diff
changeset
|
155 default: |
a0ba6102131d
crossfade-ng: remove more cruft, kill some warnings.
William Pitcock <nenolod@atheme.org>
parents:
3059
diff
changeset
|
156 break; |
3059
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
157 } |
3065
a0ba6102131d
crossfade-ng: remove more cruft, kill some warnings.
William Pitcock <nenolod@atheme.org>
parents:
3059
diff
changeset
|
158 return "<unsupported>"; |
3059
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
159 } |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
160 |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
161 void |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
162 format_copy(format_t * dest, format_t * src) |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
163 { |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
164 memcpy(dest, src, sizeof(format_t)); |
2e241e90494a
Import work in progress xmms-crossfade rewrite.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
165 } |